2017-12-06 23:23:30 +00:00
|
|
|
// target-independent things
|
|
|
|
|
|
|
|
word nmi_routine_addr @$FFFA
|
|
|
|
word reset_routine_addr @$FFFC
|
|
|
|
word irq_routine_addr @$FFFE
|
|
|
|
|
2018-02-01 21:39:38 +00:00
|
|
|
macro asm void poke(word const addr, byte a) {
|
2017-12-06 23:23:30 +00:00
|
|
|
STA addr
|
|
|
|
}
|
|
|
|
|
2018-02-01 21:39:38 +00:00
|
|
|
macro asm byte peek(word const addr) {
|
2018-01-31 23:22:53 +00:00
|
|
|
?LDA addr
|
2017-12-06 23:23:30 +00:00
|
|
|
}
|
|
|
|
|
2018-02-01 21:39:38 +00:00
|
|
|
macro asm void disable_irq() {
|
2017-12-06 23:23:30 +00:00
|
|
|
SEI
|
|
|
|
}
|
|
|
|
|
2018-02-01 21:39:38 +00:00
|
|
|
macro asm void enable_irq() {
|
2017-12-06 23:23:30 +00:00
|
|
|
CLI
|
|
|
|
}
|
|
|
|
|
2018-01-08 00:17:25 +00:00
|
|
|
asm byte hi_nibble_to_hex(byte a) {
|
|
|
|
LSR
|
|
|
|
LSR
|
|
|
|
LSR
|
|
|
|
LSR
|
|
|
|
JMP lo_nibble_to_hex
|
|
|
|
}
|
|
|
|
|
|
|
|
asm byte lo_nibble_to_hex(byte a) {
|
|
|
|
AND #$F
|
|
|
|
CLC
|
|
|
|
ADC #$30
|
|
|
|
CMP #$3A
|
|
|
|
BCC _lo_nibble_to_hex_lbl
|
|
|
|
ADC #$6 // carry is set
|
|
|
|
_lo_nibble_to_hex_lbl:
|
|
|
|
RTS
|
|
|
|
}
|
|
|
|
|
2018-02-01 21:39:38 +00:00
|
|
|
macro asm void panic() {
|
2018-01-08 00:17:25 +00:00
|
|
|
JSR _panic
|
2018-01-31 21:26:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
array __constant8 = [8]
|