mirror of
https://github.com/KarolS/millfork.git
synced 2026-04-22 00:17:03 +00:00
Preprocessor. Z80 improvements. Library improvements.
This commit is contained in:
+8
-1
@@ -1,6 +1,6 @@
|
||||
[compilation]
|
||||
arch=strict
|
||||
modules=a8_kernel,default_panic
|
||||
modules=a8_kernel,default_panic,stdlib
|
||||
encoding=atascii
|
||||
|
||||
[allocation]
|
||||
@@ -10,6 +10,13 @@ segment_default_start=$2000
|
||||
; TODO
|
||||
segment_default_end=$3fff
|
||||
|
||||
[define]
|
||||
ATARI_8=1
|
||||
WIDESCREEN=1
|
||||
KEYBOARD=1
|
||||
JOYSTICKS=2
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
;TODO
|
||||
style=single
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
|
||||
#if not(ATARI_8)
|
||||
#warn a8_kernel module should be used only on Atari computer-compatible targets
|
||||
#endif
|
||||
|
||||
asm void putchar(byte a) {
|
||||
tax
|
||||
lda $347
|
||||
|
||||
+9
-1
@@ -1,7 +1,7 @@
|
||||
[compilation]
|
||||
arch=strict
|
||||
encoding=apple2
|
||||
modules=apple2_kernel,default_panic
|
||||
modules=apple2_kernel,default_panic,stdlib
|
||||
|
||||
|
||||
[allocation]
|
||||
@@ -10,6 +10,14 @@ zp_pointers=6,8,$EB,$ED,$FA,$FC
|
||||
segment_default_start=$0C00
|
||||
segment_default_end=$95FF
|
||||
|
||||
[define]
|
||||
APPLE_2=1
|
||||
WIDESCREEN=0
|
||||
KEYBOARD=1
|
||||
; TODO: ?
|
||||
JOYSTICKS=0
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
;TODO
|
||||
style=single
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
|
||||
#if not(APPLE_2)
|
||||
#warn apple2_kernel module should be used only on Apple II-compatible targets
|
||||
#endif
|
||||
|
||||
array hires_page_1 [$2000] @$2000
|
||||
array hires_page_2 [$2000] @$4000
|
||||
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
|
||||
#if not(BBC_MICRO)
|
||||
#warn bbc_hardware module should be used only on BBC Micro-compatible targets
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
|
||||
#if not(BBC_MICRO)
|
||||
#warn bbc_kernal module should be used only on BBC Micro-compatible targets
|
||||
#endif
|
||||
|
||||
// OSASCI. Write a character (to screen) from A plus LF if (A)=&0D
|
||||
// Input: A = Byte to write.
|
||||
asm void putchar(byte a) @$FFE3 extern
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
; "strict" guarantees compatibility with Rockwell CPU's in some later Model B's
|
||||
arch=strict
|
||||
encoding=bbc
|
||||
modules=bbc_kernal,bbc_hardware,default_panic
|
||||
modules=bbc_kernal,bbc_hardware,default_panic,stdlib
|
||||
|
||||
|
||||
[allocation]
|
||||
@@ -13,6 +13,14 @@ segment_default_start=$0E00
|
||||
; The following is for Model B; for Model A, consider changing it to $31FF
|
||||
segment_default_end=$71FF
|
||||
|
||||
[define]
|
||||
BBC_MICRO=1
|
||||
WIDESCREEN=1
|
||||
KEYBOARD=1
|
||||
; TODO: ?
|
||||
JOYSTICKS=1
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=allocated
|
||||
|
||||
+11
-1
@@ -2,7 +2,7 @@
|
||||
arch=nmos
|
||||
encoding=petscii
|
||||
screen_encoding=petscr
|
||||
modules=c128_hardware,loader_1c01,c128_kernal,default_panic
|
||||
modules=c128_hardware,loader_1c01,c128_kernal,default_panic,stdlib
|
||||
|
||||
|
||||
[allocation]
|
||||
@@ -11,6 +11,16 @@ zp_pointers=$FB,$FD,$43,$45,$47,$4B,$F7,$F9,$9E,$9B,$3D
|
||||
segment_default_start=$1C0D
|
||||
segment_default_end=$FEFF
|
||||
|
||||
[define]
|
||||
CBM=1
|
||||
CBM_128=1
|
||||
CBM_64=1
|
||||
MOS_6510=1
|
||||
WIDESCREEN=1
|
||||
KEYBOARD=1
|
||||
JOYSTICKS=2
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=startaddr,allocated
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
|
||||
#if not(CBM_128)
|
||||
#warn c128_hardware module should be only used on C128-compatible targets
|
||||
#endif
|
||||
|
||||
import c64_vic
|
||||
import c64_sid
|
||||
import c64_cia
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
// Routines from Commodore 128 KERNAL ROM
|
||||
|
||||
#if not(CBM_128)
|
||||
#warn c128_kernal module should be only used on C128-compatible targets
|
||||
#endif
|
||||
|
||||
// CHROUT. Write byte to default output. (If not screen, must call OPEN and CHKOUT beforehands.)
|
||||
// Input: A = Byte to write.
|
||||
asm void putchar(byte a) @$FFD2 extern
|
||||
+11
-2
@@ -1,7 +1,12 @@
|
||||
// mouse driver for Commodore 1531 mouse on Commodore 64
|
||||
|
||||
#if not(CBM_64) || not(WIDESCREEN)
|
||||
#warn c1531 module should be only used on C64-compatible targets
|
||||
#endif
|
||||
|
||||
import mouse
|
||||
import c64_hardware
|
||||
import stdlib
|
||||
|
||||
sbyte _c1531_calculate_delta (byte old, byte new) {
|
||||
byte mouse_delta
|
||||
@@ -53,8 +58,12 @@ byte _c1531_handle_y() {
|
||||
}
|
||||
|
||||
void c1531_mouse () {
|
||||
|
||||
cia1_pra = ($3f & cia1_pra) | $40
|
||||
_c1531_handle_x()
|
||||
_c1531_handle_y()
|
||||
}
|
||||
byte value
|
||||
poke($dc03, 0)
|
||||
value = peek($dc01)
|
||||
mouse_rbm = (value & 1) ^ 1
|
||||
if value & 16 == 0 { mouse_lbm = 1 } else { mouse_lbm = 0}
|
||||
}
|
||||
|
||||
+9
-1
@@ -2,7 +2,7 @@
|
||||
arch=nmos
|
||||
encoding=petscii
|
||||
screen_encoding=petscr
|
||||
modules=loader_1001,c264_kernal,c264_hardware,default_panic
|
||||
modules=loader_1001,c264_kernal,c264_hardware,default_panic,stdlib
|
||||
|
||||
|
||||
[allocation]
|
||||
@@ -11,6 +11,14 @@ zp_pointers=$C1,$C3,$FB,$FD,$39,$3B,$3D,$43,$4B
|
||||
segment_default_start=$100D
|
||||
segment_default_end=$3FFF
|
||||
|
||||
[define]
|
||||
CBM=1
|
||||
CBM_264=1
|
||||
WIDESCREEN=1
|
||||
KEYBOARD=1
|
||||
JOYSTICKS=2
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=startaddr,allocated
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
#if not(CBM_264)
|
||||
#warn c264_hardware module should be only used on C264-compatible targets
|
||||
#endif
|
||||
|
||||
import c264_ted
|
||||
@@ -1,4 +1,7 @@
|
||||
// Routines from C16 and Plus/4 KERNAL ROM
|
||||
#if not(CBM_264)
|
||||
#warn c264_kernal module should be only used on C264-compatible targets
|
||||
#endif
|
||||
|
||||
// CHROUT. Write byte to default output. (If not screen, must call OPEN and CHKOUT beforehands.)
|
||||
// Input: A = Byte to write.
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#if not(CBM_264)
|
||||
#warn c264_ted module should be only used on C264-compatible targets
|
||||
#endif
|
||||
|
||||
const byte black = 0
|
||||
const byte white = $71
|
||||
|
||||
@@ -21,6 +21,14 @@ segment_default_codeend=$9fff
|
||||
segment_default_datastart=after_code
|
||||
segment_default_end=$cfff
|
||||
|
||||
[define]
|
||||
CBM=1
|
||||
CBM_64=1
|
||||
MOS_6510=1
|
||||
WIDESCREEN=1
|
||||
KEYBOARD=1
|
||||
JOYSTICKS=2
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
; how the banks are laid out in the output files; so far, there is no bank support in the compiler yet
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
// Routines from C64 BASIC ROM
|
||||
|
||||
#if not(CBM_64)
|
||||
#warn c64_basic module should be only used on C64-compatible targets
|
||||
#endif
|
||||
|
||||
import c64_kernal
|
||||
|
||||
// print a 16-bit number on the standard output
|
||||
|
||||
+5
-1
@@ -1,5 +1,9 @@
|
||||
// Hardware addresses for C64
|
||||
|
||||
#if not(CBM_64)
|
||||
#warn c64_cia module should be only used on C64-compatible targets
|
||||
#endif
|
||||
|
||||
// CIA1
|
||||
byte cia1_pra @$DC00
|
||||
byte cia1_prb @$DC01
|
||||
@@ -37,4 +41,4 @@ macro void vic_bank_8000() {
|
||||
macro void vic_bank_C000() {
|
||||
cia2_ddra = 3
|
||||
cia2_pra = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#if not(CBM_64)
|
||||
#warn c64_hardware module should be only used on C64-compatible targets
|
||||
#endif
|
||||
|
||||
import c64_vic
|
||||
import c64_sid
|
||||
import c64_cia
|
||||
@@ -38,4 +42,4 @@ macro void c64_ram_charset_kernal() {
|
||||
macro void c64_ram_charset_basic() {
|
||||
cpu6510_ddr = 7
|
||||
cpu6510_port = 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,4 +29,4 @@ asm clear_carry load(byte a, word yx) @$FFD5 extern
|
||||
// Output: Carry: 0 = No errors, 1 = Error; A = KERNAL error code (if Carry = 1).
|
||||
asm clear_carry save(byte a, word yx) @$FFD5 extern
|
||||
|
||||
word irq_pointer @$314
|
||||
word irq_pointer @$314
|
||||
|
||||
@@ -23,4 +23,4 @@ void _panic() {
|
||||
STA $D020
|
||||
}
|
||||
while(true){}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,15 @@ segment_default_start=$80D
|
||||
segment_default_codeend=$9fff
|
||||
segment_default_end=$cfff
|
||||
|
||||
[define]
|
||||
CBM=1
|
||||
CBM_64=1
|
||||
MOS_6510=1
|
||||
WIDESCREEN=1
|
||||
KEYBOARD=1
|
||||
JOYSTICKS=2
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=startaddr,allocated
|
||||
|
||||
@@ -16,6 +16,15 @@ segment_default_start=$80D
|
||||
segment_default_codeend=$9fff
|
||||
segment_default_end=$cfff
|
||||
|
||||
[define]
|
||||
CBM=1
|
||||
CBM_64=1
|
||||
MOS_6510=1
|
||||
WIDESCREEN=1
|
||||
KEYBOARD=1
|
||||
JOYSTICKS=2
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=startaddr,allocated
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
// Hardware addresses for C64
|
||||
|
||||
#if not(CBM_64)
|
||||
#warn c64_sid module should be only used on C64-compatible targets
|
||||
#endif
|
||||
|
||||
// SID
|
||||
|
||||
word sid_v1_freq @$D400
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
// Hardware addresses for C64
|
||||
|
||||
#if not(CBM_64)
|
||||
#warn c64_vic module should be only used on C64-compatible targets
|
||||
#endif
|
||||
|
||||
|
||||
// VIC-II
|
||||
byte vic_spr0_x @$D000
|
||||
byte vic_spr0_y @$D001
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#if not(MOS_6510) && not(CBM_64)
|
||||
#warn cpu6510 module should be only used on 6510-compatible targets
|
||||
#endif
|
||||
|
||||
byte cpu6510_ddr @0
|
||||
byte cpu6510_port @1
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#if not(CBM)
|
||||
#warn loader_0401 module should be only used on Commodore targets
|
||||
#endif
|
||||
|
||||
array _basic_loader @$401 = [
|
||||
$0b,
|
||||
4,
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#if not(CBM)
|
||||
#warn loader_0801 module should be only used on Commodore targets
|
||||
#endif
|
||||
|
||||
array _basic_loader @$801 = [
|
||||
$0b,
|
||||
$08,
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#if not(CBM)
|
||||
#warn loader_0801_16bit module should be only used on Commodore targets
|
||||
#endif
|
||||
|
||||
array _basic_loader @$801 = [
|
||||
$0b,
|
||||
$08,
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#if not(CBM)
|
||||
#warn loader_1001 module should be only used on Commodore targets
|
||||
#endif
|
||||
|
||||
array _basic_loader @$1001 = [
|
||||
$0b,
|
||||
$10,
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#if not(CBM)
|
||||
#warn loader_1201 module should be only used on Commodore targets
|
||||
#endif
|
||||
|
||||
array _basic_loader @$1201 = [
|
||||
$0b,
|
||||
$12,
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#if not(CBM)
|
||||
#warn loader_1c01 module should be only used on Commodore targets
|
||||
#endif
|
||||
|
||||
array _basic_loader @$1C01 = [
|
||||
$0b,
|
||||
$1C,
|
||||
|
||||
+9
-1
@@ -4,7 +4,7 @@
|
||||
arch=nmos
|
||||
encoding=petscii
|
||||
screen_encoding=petscr
|
||||
modules=lunix
|
||||
modules=lunix,stdlib
|
||||
lunix=true
|
||||
|
||||
|
||||
@@ -17,6 +17,14 @@ segment_default_codeend=$8fff
|
||||
segment_default_datastart=after_code
|
||||
segment_default_end=$8fff
|
||||
|
||||
[define]
|
||||
LUNIX=1
|
||||
CBM_64=1
|
||||
WIDESCREEN=1
|
||||
KEYBOARD=1
|
||||
; TODO: ?
|
||||
JOYSTICKS=2
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
style=lunix
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#if not(LUNIX)
|
||||
#warn lunix module should be only used on Lunix targets
|
||||
#endif
|
||||
|
||||
const word lkf_jumptab = $200
|
||||
|
||||
byte relocation_offset @$1001
|
||||
|
||||
+9
-1
@@ -1,8 +1,16 @@
|
||||
// Generic module for mouse support
|
||||
// Resolutions up to 512x256 are supported
|
||||
|
||||
import x_coord
|
||||
|
||||
// Mouse X coordinate
|
||||
word mouse_x
|
||||
x_coord mouse_x
|
||||
|
||||
// Mouse Y coordinate
|
||||
byte mouse_y
|
||||
|
||||
// Left mouse button pressed
|
||||
byte mouse_lbm
|
||||
|
||||
// Right mouse button pressed
|
||||
byte mouse_rbm
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#if not(NES)
|
||||
#warn nes_hardware module should be only used on NES/Famicom targets
|
||||
#endif
|
||||
|
||||
byte ppu_ctrl @$2000
|
||||
byte ppu_mask @$2001
|
||||
byte ppu_status @$2002
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
[compilation]
|
||||
arch=ricoh
|
||||
modules=nes_hardware,nes_routines,default_panic,nes_mmc4
|
||||
modules=nes_hardware,nes_routines,default_panic,nes_mmc4,stdlib
|
||||
ro_arrays=true
|
||||
|
||||
[allocation]
|
||||
@@ -55,6 +55,13 @@ segment_chrrom0_end=$ffff
|
||||
segment_chrrom1_start=$0000
|
||||
segment_chrrom1_end=$ffff
|
||||
|
||||
[define]
|
||||
NES=1
|
||||
WIDESCREEN=0
|
||||
KEYBOARD=0
|
||||
JOYSTICKS=2
|
||||
HAS_BITMAP_MODE=0
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=$4E,$45,$53,$1A, 8,16,$A0,8, 0,0,$07,0, 2,0,0,0, prgrom0:$8000:$bfff,prgrom1:$8000:$bfff,prgrom2:$8000:$bfff,prgrom3:$8000:$bfff,prgrom4:$8000:$bfff,prgrom5:$8000:$bfff,prgrom6:$8000:$bfff,prgrom7:$c000:$ffff,chrrom0:$0000:$ffff,chrrom1:$0000:$ffff
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#if not(NES)
|
||||
#warn nes_mmc4 module should be only used on NES/Famicom targets
|
||||
#endif
|
||||
|
||||
asm inline void set_prg_bank(byte a) {
|
||||
STA $A000
|
||||
? RTS
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#if not(NES)
|
||||
#warn nes_routines module should be only used on NES/Famicom targets
|
||||
#endif
|
||||
|
||||
|
||||
asm void on_reset() {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
[compilation]
|
||||
arch=ricoh
|
||||
modules=nes_hardware,nes_routines,default_panic
|
||||
modules=nes_hardware,nes_routines,default_panic,stdlib
|
||||
ro_arrays=true
|
||||
|
||||
[allocation]
|
||||
@@ -24,6 +24,13 @@ segment_prgrom_end=$ffff
|
||||
segment_chrrom_start=$0000
|
||||
segment_chrrom_end=$1fff
|
||||
|
||||
[define]
|
||||
NES=1
|
||||
WIDESCREEN=0
|
||||
KEYBOARD=0
|
||||
JOYSTICKS=2
|
||||
HAS_BITMAP_MODE=0
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=$4E,$45,$53,$1A, 2,1,0,0, 0,0,0,0, 0,0,0,0, prgrom:$8000:$ffff, chrrom:$0000:$1fff
|
||||
|
||||
+9
-1
@@ -3,7 +3,7 @@
|
||||
[compilation]
|
||||
arch=z80
|
||||
encoding=jisx
|
||||
modules=default_panic
|
||||
modules=default_panic,stdlib
|
||||
|
||||
[allocation]
|
||||
; TODO: find a more optimal start address
|
||||
@@ -12,6 +12,14 @@ segment_default_codeend=$bfff
|
||||
segment_default_datastart=after_code
|
||||
segment_default_end=$efff
|
||||
|
||||
[define]
|
||||
NEC_PC_88=1
|
||||
WIDESCREEN=1
|
||||
KEYBOARD=1
|
||||
; TODO:
|
||||
JOYSTICKS=1
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=d88
|
||||
|
||||
@@ -9,6 +9,14 @@ zp_pointers=$C1,$C3,$FB,$FD,$39,$3B,$3D,$43,$4B
|
||||
segment_default_start=$40D
|
||||
segment_default_end=$FFF
|
||||
|
||||
[define]
|
||||
CBM=1
|
||||
CBM_PET=1
|
||||
WIDESCREEN=0
|
||||
KEYBOARD=1
|
||||
JOYSTICKS=0
|
||||
HAS_BITMAP_MODE=0
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=startaddr,allocated
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
// Routines from Commodore PET KERNAL ROM
|
||||
|
||||
#if not(CBM_PET)
|
||||
#warn pet_kernal module should be only used on PET targets
|
||||
#endif
|
||||
|
||||
// CHROUT. Write byte to default output. (If not screen, must call OPEN and CHKOUT beforehands.)
|
||||
// Input: A = Byte to write.
|
||||
asm void putchar(byte a) @$FFD2 extern
|
||||
+9
-1
@@ -2,7 +2,7 @@
|
||||
arch=nmos
|
||||
encoding=petscii
|
||||
screen_encoding=petscr
|
||||
modules=loader_1001,c264_kernal,c264_hardware,default_panic
|
||||
modules=loader_1001,c264_kernal,c264_hardware,default_panic,stdlib
|
||||
|
||||
|
||||
[allocation]
|
||||
@@ -11,6 +11,14 @@ zp_pointers=$C1,$C3,$FB,$FD,$39,$3B,$3D,$43,$4B
|
||||
segment_default_start=$100D
|
||||
segment_default_end=$3FFF
|
||||
|
||||
[define]
|
||||
CBM=1
|
||||
CBM_264=1
|
||||
WIDESCREEN=1
|
||||
KEYBOARD=1
|
||||
JOYSTICKS=2
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
style=per_bank
|
||||
format=startaddr,allocated
|
||||
|
||||
+10
-9
@@ -1,5 +1,13 @@
|
||||
// target-independent standard I/O routines
|
||||
|
||||
import string
|
||||
#if ZX_SPECTRUM
|
||||
import stdio_zxspectrum
|
||||
#endif
|
||||
|
||||
|
||||
#if not(ZX_SPECTRUM)
|
||||
|
||||
void putstr(pointer str, byte len) {
|
||||
byte index
|
||||
index = 0
|
||||
@@ -8,7 +16,6 @@ void putstr(pointer str, byte len) {
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
|
||||
void putstrz(pointer str) {
|
||||
byte index
|
||||
index = 0
|
||||
@@ -18,11 +25,5 @@ void putstrz(pointer str) {
|
||||
}
|
||||
}
|
||||
|
||||
byte strzlen(pointer str) {
|
||||
byte index
|
||||
index = 0
|
||||
while str[index] != 0 {
|
||||
index += 1
|
||||
}
|
||||
return index
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
#if not(ZX_SPECTRUM)
|
||||
#warn stdio_zxspectrum module should be only used on ZX Spectrum-compatible targets
|
||||
#endif
|
||||
|
||||
import stdio
|
||||
|
||||
void putstr(pointer str, byte len) {
|
||||
asm {
|
||||
? LD HL,(str)
|
||||
? LD D, H
|
||||
? LD E, L
|
||||
? LD A,(len)
|
||||
? LD B, 0
|
||||
? LD C, A
|
||||
CALL 8252
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
CALL 8252
|
||||
}
|
||||
}
|
||||
+7
-44
@@ -1,46 +1,9 @@
|
||||
// target-independent things
|
||||
|
||||
word nmi_routine_addr @$FFFA
|
||||
word reset_routine_addr @$FFFC
|
||||
word irq_routine_addr @$FFFE
|
||||
|
||||
macro asm void poke(word const addr, byte a) {
|
||||
STA addr
|
||||
}
|
||||
|
||||
macro asm byte peek(word const addr) {
|
||||
?LDA addr
|
||||
}
|
||||
|
||||
macro asm void disable_irq() {
|
||||
SEI
|
||||
}
|
||||
|
||||
macro asm void enable_irq() {
|
||||
CLI
|
||||
}
|
||||
|
||||
asm byte hi_nibble_to_hex(byte a) {
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
JMP lo_nibble_to_hex
|
||||
}
|
||||
|
||||
asm byte lo_nibble_to_hex(byte a) {
|
||||
AND #$F
|
||||
CLC
|
||||
ADC #$30
|
||||
CMP #$3A
|
||||
BCC _lo_nibble_to_hex_lbl
|
||||
ADC #$6 // carry is set
|
||||
_lo_nibble_to_hex_lbl:
|
||||
RTS
|
||||
}
|
||||
|
||||
macro asm void panic() {
|
||||
JSR _panic
|
||||
}
|
||||
|
||||
array __constant8 = [8]
|
||||
#if ARCH_6502
|
||||
import stdlib_6502
|
||||
#elseif ARCH_Z80
|
||||
import stdlib_z80
|
||||
#else
|
||||
#warn Unsupported architecture
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
// target-independent things
|
||||
|
||||
#if not(ARCH_6502)
|
||||
#warn stdlib_6502 module should be only used on 6502-compatible targets
|
||||
#endif
|
||||
|
||||
word nmi_routine_addr @$FFFA
|
||||
word reset_routine_addr @$FFFC
|
||||
word irq_routine_addr @$FFFE
|
||||
|
||||
macro asm void poke(word const addr, byte a) {
|
||||
STA addr
|
||||
}
|
||||
|
||||
macro asm byte peek(word const addr) {
|
||||
LDA addr
|
||||
}
|
||||
|
||||
macro asm void disable_irq() {
|
||||
SEI
|
||||
}
|
||||
|
||||
macro asm void enable_irq() {
|
||||
CLI
|
||||
}
|
||||
|
||||
asm byte hi_nibble_to_hex(byte a) {
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
JMP lo_nibble_to_hex
|
||||
}
|
||||
|
||||
asm byte lo_nibble_to_hex(byte a) {
|
||||
AND #$F
|
||||
CLC
|
||||
ADC #$30
|
||||
CMP #$3A
|
||||
BCC _lo_nibble_to_hex_lbl
|
||||
ADC #$6 // carry is set
|
||||
_lo_nibble_to_hex_lbl:
|
||||
RTS
|
||||
}
|
||||
|
||||
macro asm void panic() {
|
||||
JSR _panic
|
||||
}
|
||||
|
||||
array __constant8 = [8]
|
||||
@@ -0,0 +1,45 @@
|
||||
// target-independent things
|
||||
|
||||
#if not(ARCH_Z80)
|
||||
#warn stdlib_z80 module should be only used on 6502-compatible 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) {
|
||||
SRL A
|
||||
SRL A
|
||||
SRL A
|
||||
SRL A
|
||||
JP lo_nibble_to_hex
|
||||
}
|
||||
|
||||
asm byte lo_nibble_to_hex(byte a) {
|
||||
AND $F
|
||||
ADD A,$30
|
||||
CP $3A
|
||||
JR C,_lo_nibble_to_hex_lbl
|
||||
ADD A,$6 // carry is set
|
||||
_lo_nibble_to_hex_lbl:
|
||||
RET
|
||||
}
|
||||
|
||||
macro asm void panic() {
|
||||
CALL _panic
|
||||
}
|
||||
|
||||
array __constant8 = [8]
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
byte strzlen(pointer str) {
|
||||
byte index
|
||||
index = 0
|
||||
while str[index] != 0 {
|
||||
index += 1
|
||||
}
|
||||
return index
|
||||
}
|
||||
+8
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
[compilation]
|
||||
arch=nmos
|
||||
modules=vcs_hardware,default_panic
|
||||
modules=vcs_hardware,default_panic,stdlib
|
||||
ro_arrays=true
|
||||
; use -fzp-register to override this:
|
||||
zeropage_register=false
|
||||
@@ -21,6 +21,13 @@ segment_default_end=$ef
|
||||
segment_prgrom_start=$f000
|
||||
segment_prgrom_end=$ffff
|
||||
|
||||
[define]
|
||||
ATARI_2600=1
|
||||
WIDESCREEN=0
|
||||
KEYBOARD=0
|
||||
JOYSTICKS=2
|
||||
HAS_BITMAP_MODE=0
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=prgrom:$f000:$ffff
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
|
||||
#if not(ATARI_2600)
|
||||
#warn vcs_hardware module should be only used on Atari 2600-compatible targets
|
||||
#endif
|
||||
|
||||
byte VSYNC @$00
|
||||
byte VBLANK @$01
|
||||
byte WSYNC @$02
|
||||
|
||||
+9
-1
@@ -2,7 +2,7 @@
|
||||
arch=nmos
|
||||
encoding=petscii
|
||||
screen_encoding=petscr
|
||||
modules=loader_1001,vic20_kernal,default_panic
|
||||
modules=loader_1001,vic20_kernal,default_panic,stdlib
|
||||
|
||||
|
||||
[allocation]
|
||||
@@ -11,6 +11,14 @@ zp_pointers=$C1,$C3,$FB,$FD,$39,$3B,$3D,$43,$4B
|
||||
segment_default_start=$100D
|
||||
segment_default_end=$1CFF
|
||||
|
||||
[define]
|
||||
CBM=1
|
||||
CBM_VIC=1
|
||||
WIDESCREEN=0
|
||||
KEYBOARD=1
|
||||
JOYSTICKS=1
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=startaddr,allocated
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
arch=nmos
|
||||
encoding=petscii
|
||||
screen_encoding=petscr
|
||||
modules=loader_0401,vic20_kernal,default_panic
|
||||
modules=loader_0401,vic20_kernal,default_panic,stdlib
|
||||
|
||||
|
||||
[allocation]
|
||||
@@ -11,6 +11,14 @@ zp_pointers=$C1,$C3,$FB,$FD,$39,$3B,$3D,$43,$4B
|
||||
segment_default_start=$40D
|
||||
segment_default_end=$1CFF
|
||||
|
||||
[define]
|
||||
CBM=1
|
||||
CBM_VIC=1
|
||||
WIDESCREEN=0
|
||||
KEYBOARD=1
|
||||
JOYSTICKS=1
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=startaddr,allocated
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
arch=nmos
|
||||
encoding=petscii
|
||||
screen_encoding=petscr
|
||||
modules=loader_1201,vic20_kernal,default_panic
|
||||
modules=loader_1201,vic20_kernal,default_panic,stdlib
|
||||
|
||||
|
||||
[allocation]
|
||||
@@ -11,6 +11,14 @@ zp_pointers=$C1,$C3,$FB,$FD,$39,$3B,$3D,$43,$4B
|
||||
segment_default_start=$120D
|
||||
segment_default_end=$1FFF
|
||||
|
||||
[define]
|
||||
CBM=1
|
||||
CBM_VIC=1
|
||||
WIDESCREEN=0
|
||||
KEYBOARD=1
|
||||
JOYSTICKS=1
|
||||
HAS_BITMAP_MODE=1
|
||||
|
||||
[output]
|
||||
style=single
|
||||
format=startaddr,allocated
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
// Routines from C16 and Plus/4 KERNAL ROM
|
||||
|
||||
#if not(CBM_VIC)
|
||||
#warn vic20_kernal module should be only used on VIC-20 targets
|
||||
#endif
|
||||
|
||||
// CHROUT. Write byte to default output. (If not screen, must call OPEN and CHKOUT beforehands.)
|
||||
// Input: A = Byte to write.
|
||||
asm void putchar(byte a) @$FFD2 extern
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
#if WIDESCREEN
|
||||
alias x_coord = word
|
||||
#else
|
||||
alias x_coord = byte
|
||||
#endif
|
||||
@@ -1,4 +1,8 @@
|
||||
|
||||
#if not(ARCH_6502)
|
||||
#warn zp_reg module should be used only on 6502-compatible targets
|
||||
#endif
|
||||
|
||||
inline asm byte __mul_u8u8u8() {
|
||||
? LDA #0
|
||||
? JMP __mul_u8u8u8_start
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[compilation]
|
||||
arch=z80
|
||||
encoding=bbc
|
||||
modules=default_panic,zxspectrum
|
||||
modules=default_panic,zxspectrum,stdlib
|
||||
|
||||
[allocation]
|
||||
segments=default,slowram
|
||||
@@ -13,6 +13,14 @@ 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
|
||||
|
||||
@@ -1,4 +1,23 @@
|
||||
|
||||
#if not(ZX_SPECTRUM)
|
||||
#warn zxspectrum module should be only used on ZX Spectrum-compatible targets
|
||||
#endif
|
||||
|
||||
inline asm void putchar(byte a) {
|
||||
rst $10
|
||||
? ret
|
||||
}
|
||||
|
||||
inline asm void set_border(byte a) {
|
||||
out (254),a
|
||||
? ret
|
||||
}
|
||||
|
||||
const byte black = 0
|
||||
const byte blue = 1
|
||||
const byte red = 2
|
||||
const byte purple = 3
|
||||
const byte green = 4
|
||||
const byte cyan = 5
|
||||
const byte yellow = 6
|
||||
const byte white = 7
|
||||
|
||||
Reference in New Issue
Block a user