1
0
mirror of https://github.com/KarolS/millfork.git synced 2026-04-19 10:42:10 +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
+3 -9
View File
@@ -7,9 +7,7 @@ import stdio
void putstr(pointer str, byte len) {
asm {
? LD HL,(str)
? LD D, H
? LD E, L
? LD DE,(str)
? LD A,(len)
? LD B, 0
? LD C, A
@@ -20,12 +18,8 @@ void putstr(pointer str, byte len) {
void putstrz(pointer str) {
word length = strzlen(str)
asm {
? LD HL,(str)
? LD D, H
? LD E, L
? LD HL,(length)
? LD B, H
? LD C, L
? LD DE,(str)
? LD BC,(length)
CALL 8252
}
}
+2 -2
View File
@@ -2,8 +2,8 @@
#if ARCH_6502
import stdlib_6502
#elseif ARCH_Z80
import stdlib_z80
#elseif ARCH_I80
import stdlib_i80
#else
#warn Unsupported architecture
#endif
@@ -1,7 +1,7 @@
// target-independent things
#if not(ARCH_Z80)
#warn stdlib_z80 module should be only used on 6502-compatible targets
#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) {
@@ -21,10 +21,14 @@ macro asm void enable_irq() {
}
asm byte hi_nibble_to_hex(byte a) {
SRL A
SRL A
SRL A
SRL A
#if CPUFEATURE_GAMEBOY
SWAP A
#else
RR A
RR A
RR A
RR A
#endif
JP lo_nibble_to_hex
}
@@ -32,7 +36,11 @@ 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
@@ -41,5 +49,3 @@ _lo_nibble_to_hex_lbl:
macro asm void panic() {
CALL _panic
}
array __constant8 = [8]
-1
View File
@@ -1,4 +1,3 @@
;DON'T USE THIS
;a single-load ZX Spectrum 48k program
[compilation]
arch=z80
+29
View File
@@ -0,0 +1,29 @@
;a single-load ZX Spectrum 48k program
;using just the Intel 8080 instruction set
[compilation]
arch=i8080
encoding=sinclair
modules=default_panic,zxspectrum,stdlib
[allocation]
segments=default,slowram
segment_default_start=$8000
segment_default_datastart=after_code
segment_default_end=$ffff
segment_slowram_start=$5ccb
segment_slowram_end=$7fff
[define]
ZX_SPECTRUM=1
WIDESCREEN=0
KEYBOARD=1
; TODO: ?
JOYSTICKS=1
HAS_BITMAP_MODE=1
[output]
style=single
format=tap
extension=tap