From 40516e077e7e30097d57bd2475838e8b37d52884 Mon Sep 17 00:00:00 2001 From: Will Scullin Date: Thu, 8 Oct 2020 19:23:01 -0700 Subject: [PATCH] automaton --- .editorconfig | 4 ++++ apple1js.html | 1 + asm/cell.s | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ tapes/cell.js | 30 +++++++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 asm/cell.s create mode 100644 tapes/cell.js diff --git a/.editorconfig b/.editorconfig index 011b4cc..eff4970 100644 --- a/.editorconfig +++ b/.editorconfig @@ -19,3 +19,7 @@ trim_trailing_whitespace = true [Makefile] indent_style = tab indent_size = 8 + +[*.s] +indent_style = tab +indent_size = 8 diff --git a/apple1js.html b/apple1js.html index 6534a42..88ac55c 100644 --- a/apple1js.html +++ b/apple1js.html @@ -40,6 +40,7 @@ var tapes = {}; + diff --git a/asm/cell.s b/asm/cell.s new file mode 100644 index 0000000..019fca0 --- /dev/null +++ b/asm/cell.s @@ -0,0 +1,66 @@ +; +; Apple 1 Cellular Automaton +; https://mathworld.wolfram.com/CellularAutomaton.html +; By Will Scullin +; + ORG $300 + +ECHO EQU $FFEF +CR EQU $8D + +; Load Rule $5A = 90 +START LDA #$5A + LDX #0 +RULELOOP LSR A + TAY + LDA #$00 + ROR A + STA RULES,X + TYA + INX + CPX #$08 + BNE RULELOOP +; Print Row +OUT LDA #CR + JSR ECHO + LDX #$00 +OUTLOOP LDA CELLS,X + BMI SOLID + LDA #' ' + BPL OUT +SOLID LDA #'X' +OUT JSR ECHO + INX + CPX #$27 + BCC OUTLOOP +; Update Row + LDA CELLS + ASL A + LDA #$00 + ROL A + LDX #$FF +UPDATELOOP INX + TAY + LDA CELLS+1,X + ASL + TYA + ROL A + TAY + LDA RULE,Y + STA CELLS,X + TYA + AND #$03 + CPX #$27 + BCC UPDATELOOP + BCS OUT +; Workspace +CELLS DB $00,$00,$00,$00,$00,$00,$00,$00, + DB $00,$00,$00,$00,$00,$00,$00,$00, + DB $00,$00,$00,$80,$00,$00,$00,$00, + DB $00,$00,$00,$00,$00,$00,$00,$00, + DB $00,$00,$00,$00,$00,$00,$00,$00 + +RULE DB $00,$00,$00,$00,$00,$00,$00,$00 + +000 +001 diff --git a/tapes/cell.js b/tapes/cell.js new file mode 100644 index 0000000..6ac32a1 --- /dev/null +++ b/tapes/cell.js @@ -0,0 +1,30 @@ +// Cellular Automaton +// https://mathworld.wolfram.com/CellularAutomaton.html +// By Will Scullin + + +/* +C100R +300.36FR +300R +*/ + +tapes['Cellular Automaton'] = { + script: 'C100R\n0300.036FR\n300R\n', + tracks: [[ // 300.036F + 0xa9, 0x5a, 0xa2, 0x00, 0x4a, 0xa8, 0xa9, 0x00, + 0x6a, 0x9d, 0x75, 0x03, 0x98, 0xe8, 0xe0, 0x08, + 0xd0, 0xf2, 0xa9, 0x8d, 0x20, 0xef, 0xff, 0xa2, + 0x00, 0xbd, 0x4d, 0x03, 0x30, 0x04, 0xa9, 0x20, + 0x10, 0x02, 0xa9, 0x58, 0x20, 0xef, 0xff, 0xe8, + 0xe0, 0x27, 0x90, 0xed, 0xad, 0x4d, 0x03, 0x0a, + 0xa9, 0x00, 0x2a, 0xa2, 0xff, 0xe8, 0xa8, 0xbd, + 0x4e, 0x03, 0x0a, 0x98, 0x2a, 0xa8, 0xb9, 0x75, + 0x03, 0x9d, 0x4d, 0x03, 0x98, 0x29, 0x03, 0xe0, + 0x27, 0x90, 0xea, 0xb0, 0xb3, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]] +};