mirror of
https://github.com/whscullin/apple1js.git
synced 2024-11-22 04:33:34 +00:00
automaton
This commit is contained in:
parent
09e1781cac
commit
40516e077e
@ -19,3 +19,7 @@ trim_trailing_whitespace = true
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
|
||||
[*.s]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
|
@ -40,6 +40,7 @@ var tapes = {};
|
||||
<script type="text/javascript" src="tapes/applesoft.js"></script>
|
||||
<script type="text/javascript" src="tapes/basic.js"></script>
|
||||
<script type="text/javascript" src="tapes/blackjack.js"></script>
|
||||
<script type="text/javascript" src="tapes/cell.js"></script>
|
||||
<script type="text/javascript" src="tapes/checkers.js"></script>
|
||||
<script type="text/javascript" src="tapes/codebreaker.js"></script>
|
||||
<script type="text/javascript" src="tapes/hamurabi.js"></script>
|
||||
|
66
asm/cell.s
Normal file
66
asm/cell.s
Normal file
@ -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
|
30
tapes/cell.js
Normal file
30
tapes/cell.js
Normal file
@ -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
|
||||
]]
|
||||
};
|
Loading…
Reference in New Issue
Block a user