MEMORY {
# 0000-03ff is RAM
# FIXME: what zp range can we actually use?
- ZP: start = $0080, size = $80;
+ ZP: start = $0020, size = $e0;
CPUSTACK: start = $0100, size =$100;
- RAM: start = $0200, size = $180, define = yes;
+ RAM: start = $0200, size = $200 - __STACKSIZE__, define = yes;
+ CARTHEADER: file = %O, define = yes, start = %S, size = $0029;
# 6000-e000 can be (Cartridge) ROM
# WARNING: fill value must be $00 else it will no more work
#ROM: start = $6000, size = $1000, fill = yes, fillval = $00, file = %O, define = yes;
#ROMFILL: start = $7000, size = $7000, fill = yes, fillval = $00, file = %O, define = yes;
# for images that have code >$6fff we must calculate the checksum!
- ROM: start = $6000, size = $8000, fill = yes, fillval = $00, file = %O, define = yes;
+ ROM: start = $6000 + $29, size = $8000 - $29, fill = yes, fillval = $00, file = %O, define = yes;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp, define = yes;
EXTZP: load = ZP, type = zp, define = yes, optional = yes;
APPZP: load = ZP, type = zp, define = yes, optional = yes;
- STARTUP: load = ROM, type = ro, define=yes;
+ STARTUP: load = CARTHEADER, type = ro, define=yes;
INIT: load = ROM, type = ro, define = yes, optional = yes;
CODE: load = ROM, type = ro, define=yes;
RODATA: load = ROM, type = ro, define=yes;
- .export __STARTUP__ : absolute = 1 ; Mark as startup
+ .export Start, _exit
.import initlib, donelib, callmain
.import push0, _main, zerobss, copydata
- .import IRQStub
-
; Linker generated symbols
.import __RAM_START__, __RAM_SIZE__
- .import __ROM_START__, __ROM_SIZE__
- .import __STARTUP_LOAD__,__STARTUP_RUN__, __STARTUP_SIZE__
- .import __CODE_LOAD__,__CODE_RUN__, __CODE_SIZE__
- .import __RODATA_LOAD__,__RODATA_RUN__, __RODATA_SIZE__
.include "zeropage.inc"
.include "gamate.inc"
- .segment "STARTUP"
-
- .word 0 ; +00 checksum from 7000-7fff (simple 8bit adds)
- .byte 1, 0, 1 ; +02 flags
- .byte "COPYRIGHT BIT CORPORATION", 0, $ff ; +05 copyright
- ; system vectors
- jmp reset ; +20 reset entry
- jmp nmi ; +23 nmi entry
- jmp IRQStub ; +26 irq entry (135 hz)
-
-;-------------------------------------------------------------------------------
-reset:
+Start:
; setup the CPU and System-IRQ
; Initialize CPU
jsr donelib ; Run module destructors
; reset (start over)
- jmp reset
+ jmp Start
.export initmainargs
initmainargs:
rts
-
-;-------------------------------------------------------------------------------
-nmi:
- rts
--- /dev/null
+ ; The following symbol is used by linker config to force the module
+ ; to get included into the output file
+ .export __STARTUP__: absolute = 1
+
+ .import Start, IRQStub, NMIStub
+
+
+ .segment "STARTUP"
+
+ .word 0 ; +00 checksum from 7000-7fff (simple 8bit adds)
+ .byte 1, 0, 1 ; +02 flags
+ .byte "COPYRIGHT BIT CORPORATION", 0, $ff ; +05 copyright
+ ; system vectors
+ jmp Start ; +20 reset entry
+ jmp NMIStub ; +23 nmi entry
+ jmp IRQStub ; +26 irq entry (135 hz)
--- /dev/null
+;
+; NMI handling (Gamate version)
+;
+ .export NMIStub
+
+NMIStub:
+ rts
\ No newline at end of file
; original audiotest.s by PeT (mess@utanet.at)
- .export _main
.include "gamate.inc"
.zeropage
xpos: .byte 0
ypos: .byte 0
-.code
+ .code
-chars:
- .incbin "cga2.chr"
-
-hex2asc: .byte "0123456789abcdef"
+chars: .incbin "cga2.chr"
+hex2asc: .byte "0123456789abcdef"
;-------------------------------------------------------------------------------
- .export IRQStub
+ .export IRQStub, NMIStub
-.proc nmi
+.proc NMIStub
inc nmi_count
rts
.endproc
.endproc
;-------------------------------------------------------------------------------
+ .export Start
-.proc _main
+.proc Start
lda #>AUDIO_BASE
sta writeaddr+1
sta readaddr+1
#include <conio.h>
unsigned char y = 0;
-unsigned char x;
+unsigned char x = 0;
unsigned short n;
int main(int argc, char *argv[])
n = clock();
- gotoxy(0,2);cprintf("%04x %02x %02x", n, x, y);
+ gotoxy(0,2);cprintf("%04x %02x %02x %02x", n, x, y, *((unsigned char*)JOY_DATA));
switch((*((unsigned char*)JOY_DATA))) {
case 0xff ^ JOY_DATA_UP:
- ++y;
+ ++y; if (y == 0xc8) y = 0;
break;
case 0xff ^ JOY_DATA_DOWN:
- --y;
+ --y; if (y == 0xff) y = 0xc7;
break;
case 0xff ^ JOY_DATA_LEFT:
++x;
case 0xff ^ JOY_DATA_FIRE_A:
break;
}
- if (y == 0xff) y = 0xc7;
- if (y == 0xc8) y = 0;
+
+ waitvblank();
(*((unsigned char*)LCD_XPOS)) = x;
(*((unsigned char*)LCD_YPOS)) = y;
- waitvblank();
-
}
return 0;
; original lcdtest.s by PeT (mess@utanet.at)
- .export _main
.include "gamate.inc"
.zeropage
ydesc: .byte "0123456789ABCDEFGHIJKLMNOPQRSTUV", 0
;-------------------------------------------------------------------------------
+ .export IRQStub, NMIStub
-.proc nmi
+
+.proc NMIStub
inc nmi_count
rts
.endproc
- .export IRQStub
-
.proc IRQStub
inc irq_count
.endproc
;-------------------------------------------------------------------------------
+ .export Start
-.proc _main
+.proc Start
lda #0
sta LCD_XPOS
}
in = fopen(argv[1], "rb");
out = fopen(argv[2], "wb");
+ if (!in || !out) {
+ exit(-1);
+ }
len = fread(buffer, 1, 512 * 1024, in);
n = 0; for (i = 0x1000; i < 0x2000; i++) {
n += buffer[i];
fwrite(buffer, 1, len, out);
fclose(in);
fclose(out);
+ return (0);
}