2. It may be of any size, limited only by the size of memory used.
3. RAM $ 100- $ 1FF can be used for the program.
Here is a diagram of the first version.
What do you think, about this ?
Code: Select all
TSX
LSR $107,X
ROR $106,X
Code: Select all
ISR: PHA ; (Later you may need to push Y also, with PHY, if the
PHX ; ISR uses Y anywhere. NMOS will have to go through A.)
TSX
LDA 103,X ; Get the stacked staus, and
AND #$10 ; see if the B bit is set (meaning a BRK instruction
BNE break ; caused the interrupt. If B bit is set, branch.
<service hardware interrupt>
PLX
PLA
RTI
;-------------
break: LDA 104,X ; The return addr is at 104,X and 105,X, and the
SEC ; signature byte is at the addr they point to, minus 1.
SBC #1 ; Use SBC here, not DEA, because we want the C flag.
STA temp ; Do low byte first (temp is in ZP),
LDA 105,X ; then high byte.
BCS brk1 ; If decrementing the low byte did a borrow,
DEA ; then decrement the high byte too.
brk1: STA temp+1
LDA (temp) ; Read the signature byte
. ; which will determine the next actions.
.
.
Code: Select all
JSR PRIMM
.BYTE "This will be printed!", $00