src/asm/6502/macroInt.s
raw| 1 | macroState=$50 ; pointer to state |
| 2 | macroAddr=$52 ; pointer to address |
| 3 | |
| 4 | ; macro state takes 4 bytes |
| 5 | ; macroPos bits: |
| 6 | ; 7: had |
| 7 | ; 6: will |
| 8 | |
| 9 | ; x: macro |
| 10 | macroIntRun: |
| 11 | lda macroAddr,x |
| 12 | ora macroAddr+1,x |
| 13 | beq :+ |
| 14 | |
| 15 | ; do macro |
| 16 | : rts |
| 17 | |
| 18 | ; set the macro address, then call |
| 19 | ; x: macro |
| 20 | macroIntInit: |
| 21 | lda #0 |
| 22 | sta macroState,x |
| 23 | sta macroPos,x |
| 24 | txa |
| 25 | rol |
| 26 | tax |
| 27 | lda macroAddr,x |
| 28 | ora macroAddr+1,x |
| 29 | beq :+ |
| 30 | lda #$40 |
| 31 | sta macroState,x |
| 32 | : rts |