mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-24 22:31:38 +00:00
Minor improvements for Intel 8080 and ZX Spectrum
This commit is contained in:
parent
998902acf6
commit
2ef79d6894
@ -30,9 +30,19 @@ You can also define feature values using the `-D` command line option.
|
||||
|
||||
### Built-in features
|
||||
|
||||
* `ARCH_6502` – 1 if compiling for 6502, 0 otherwise
|
||||
* `ARCH_6502` – 1 if compiling for 6502, 0 otherwise
|
||||
|
||||
* `ARCH_Z80` – 1 if compiling for Z80, 0 otherwise
|
||||
* `CPUFEATURE_65C02` – 1 if compiling for 65C02-compatible processor, 0 otherwise
|
||||
|
||||
* `CPUFEATURE_65CE02` – 1 if compiling for 65CE02-compatible processor, 0 otherwise
|
||||
|
||||
* `ARCH_I80` – 1 if compiling for Intel 8080-like processor, 0 otherwise
|
||||
|
||||
* `CPUFEATURE_8080` – 1 if compiling for Intel 8080-compatible processor, 0 otherwise
|
||||
|
||||
* `CPUFEATURE_GAMEBOY` – 1 if compiling for Sharp LR35902-compatible processor, 0 otherwise
|
||||
|
||||
* `CPUFEATURE_Z80` – 1 if compiling for Z80-compatible processor, 0 otherwise
|
||||
|
||||
### Commonly used features
|
||||
|
||||
|
@ -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,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,4 +1,3 @@
|
||||
;DON'T USE THIS
|
||||
;a single-load ZX Spectrum 48k program
|
||||
[compilation]
|
||||
arch=z80
|
||||
|
29
include/zxspectrum_8080.ini
Normal file
29
include/zxspectrum_8080.ini
Normal 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
|
||||
|
||||
|
@ -238,10 +238,14 @@ object Platform {
|
||||
def builtInCpuFeatures(cpu: Cpu.Value): Map[String, Long] = {
|
||||
Map[String, Long](
|
||||
"ARCH_6502" -> toLong(CpuFamily.forType(cpu) == CpuFamily.M6502),
|
||||
"CPUFEATURE_65C02" -> toLong(Cpu.defaultFlags(cpu).contains(CompilationFlag.EmitCmosOpcodes)),
|
||||
"CPUFEATURE_65CE02" -> toLong(Cpu.defaultFlags(cpu).contains(CompilationFlag.Emit65CE02Opcodes)),
|
||||
"ARCH_I80" -> toLong(CpuFamily.forType(cpu) == CpuFamily.I80),
|
||||
"ARCH_Z80" -> toLong(cpu == Cpu.Z80 || cpu == Cpu.EZ80),
|
||||
"CPUFEATURE_Z80" -> toLong(Cpu.defaultFlags(cpu).contains(CompilationFlag.EmitZ80Opcodes)),
|
||||
"CPUFEATURE_8080" -> toLong(Cpu.defaultFlags(cpu).contains(CompilationFlag.EmitIntel8080Opcodes)),
|
||||
"CPUFEATURE_GAMEBOY" -> toLong(Cpu.defaultFlags(cpu).contains(CompilationFlag.EmitSharpOpcodes)),
|
||||
"ARCH_X86" -> toLong(CpuFamily.forType(cpu) == CpuFamily.I86),
|
||||
"ARCH_6500" -> toLong(CpuFamily.forType(cpu) == CpuFamily.M6800),
|
||||
"ARCH_6800" -> toLong(CpuFamily.forType(cpu) == CpuFamily.M6800),
|
||||
"ARCH_ARM" -> toLong(CpuFamily.forType(cpu) == CpuFamily.ARM),
|
||||
"ARCH_68K" -> toLong(CpuFamily.forType(cpu) == CpuFamily.M68K),
|
||||
"HAS_HARDWARE_MULTIPLY" -> (cpu match {
|
||||
|
Loading…
x
Reference in New Issue
Block a user