2020-04-27 10:40:49 +00:00
|
|
|
// target-independent things
|
|
|
|
|
|
|
|
#if not(ARCH_6809)
|
|
|
|
#warn stdlib_6809 module should be only used on 6809-compatible targets
|
|
|
|
#endif
|
|
|
|
|
2020-06-04 15:07:19 +00:00
|
|
|
import m6809/m6809_math
|
|
|
|
|
2020-04-27 10:40:49 +00:00
|
|
|
word nmi_routine_addr @$FFFC
|
|
|
|
word reset_routine_addr @$FFFE
|
|
|
|
word irq_routine_addr @$FFF8
|
|
|
|
word swi_routine_addr @$FFFA
|
|
|
|
word firq_routine_addr @$FFF6
|
|
|
|
word swi2_routine_addr @$FFF4
|
|
|
|
word swi3_routine_addr @$FFF2
|
|
|
|
|
|
|
|
macro asm void poke(word const addr, byte register(b) value) {
|
|
|
|
! STB addr
|
|
|
|
}
|
|
|
|
|
|
|
|
macro asm byte peek(word const addr) {
|
|
|
|
! LDB addr
|
|
|
|
}
|
|
|
|
|
|
|
|
macro asm void disable_irq() {
|
|
|
|
ORCC #$30
|
|
|
|
}
|
|
|
|
|
|
|
|
macro asm void enable_irq() {
|
|
|
|
ANDCC #$CF
|
|
|
|
}
|
|
|
|
|
|
|
|
asm byte hi_nibble_to_hex(byte register(a) value) {
|
|
|
|
LSRB
|
|
|
|
LSRB
|
|
|
|
LSRB
|
|
|
|
LSRB
|
|
|
|
? JMP lo_nibble_to_hex
|
|
|
|
}
|
|
|
|
|
|
|
|
asm byte lo_nibble_to_hex(byte register(a) value) {
|
|
|
|
! ANDB #$F
|
|
|
|
ADDB #$30
|
|
|
|
CMPB #$3A
|
|
|
|
BCC _lo_nibble_to_hex_lbl
|
|
|
|
ADDB #$7 // carry is set
|
|
|
|
_lo_nibble_to_hex_lbl:
|
|
|
|
? RTS
|
|
|
|
}
|
|
|
|
|
|
|
|
macro asm void panic() {
|
|
|
|
? JSR _panic
|
|
|
|
}
|