1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-25 06:29:17 +00:00
millfork/include/stdlib_i80.mfk

61 lines
905 B
Plaintext
Raw Normal View History

// target-independent things
#if not(ARCH_I80)
#warn stdlib_i80 module should be only used on Intel 8080-like targets
#endif
2018-08-03 11:23:37 +00:00
#pragma zilog_syntax
2018-09-28 21:45:26 +00:00
import i80_math
macro asm void poke(word const addr, byte register(a) value) {
! LD (addr), A
}
macro asm byte peek(word const addr) {
! LD A, (addr)
}
macro asm void disable_irq() {
DI
}
macro asm void enable_irq() {
EI
}
asm byte hi_nibble_to_hex(byte register(a) value) {
#if CPUFEATURE_GAMEBOY
SWAP A
#else
2018-08-01 08:16:20 +00:00
RRA
RRA
RRA
RRA
#endif
2018-08-01 08:16:20 +00:00
? JP lo_nibble_to_hex
}
asm byte lo_nibble_to_hex(byte register(a) value) {
AND $F
ADD A,$30
CP $3A
#if CPUFEATURE_GAMEBOY | CPUFEATURE_Z80
JR C,_lo_nibble_to_hex_lbl
#else
JP C,_lo_nibble_to_hex_lbl
#endif
ADD A,$7
_lo_nibble_to_hex_lbl:
RET
}
macro asm void panic() {
? CALL _panic
}
2019-07-26 22:58:10 +00:00
noinline asm word call(word de) {
PUSH DE
RET
}