1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-27 19:30:04 +00:00
millfork/include/m6809/stdlib_6809.mfk

58 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

// 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
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
}
2020-07-31 11:27:17 +00:00
asm byte hi_nibble_to_hex(byte register(b) value) {
LSRB
LSRB
LSRB
LSRB
? JMP lo_nibble_to_hex
}
2020-07-31 11:27:17 +00:00
asm byte lo_nibble_to_hex(byte register(b) value) {
! ANDB #$F
ADDB #$30
CMPB #$3A
2020-07-31 11:27:17 +00:00
BCS _lo_nibble_to_hex_lbl
ADDB #$7 // carry is set
_lo_nibble_to_hex_lbl:
? RTS
}
macro asm void panic() {
? JSR _panic
2020-07-31 14:07:39 +00:00
}
noinline asm word call(word register(x) routine) {
JMP ,X
}