1
0
mirror of https://github.com/KarolS/millfork.git synced 2026-04-20 18:16:35 +00:00

Minor improvements for Intel 8080 and ZX Spectrum

This commit is contained in:
Karol Stasiak
2018-07-30 18:16:50 +02:00
parent 998902acf6
commit 2ef79d6894
7 changed files with 66 additions and 24 deletions
+51
View File
@@ -0,0 +1,51 @@
// target-independent things
#if not(ARCH_I80)
#warn stdlib_i80 module should be only used on Intel 8080-like targets
#endif
macro asm void poke(word const addr, byte a) {
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 a) {
#if CPUFEATURE_GAMEBOY
SWAP A
#else
RR A
RR A
RR A
RR A
#endif
JP lo_nibble_to_hex
}
asm byte lo_nibble_to_hex(byte a) {
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
}