mirror of
https://github.com/cc65/cc65.git
synced 2025-03-01 11:29:27 +00:00
moved cart header into seperate file, moved nmi stub into several file, tweaked linker config
This commit is contained in:
parent
1893e24da9
commit
c636675521
@ -8,23 +8,24 @@ SYMBOLS {
|
|||||||
MEMORY {
|
MEMORY {
|
||||||
# 0000-03ff is RAM
|
# 0000-03ff is RAM
|
||||||
# FIXME: what zp range can we actually use?
|
# FIXME: what zp range can we actually use?
|
||||||
ZP: start = $0080, size = $80;
|
ZP: start = $0020, size = $e0;
|
||||||
CPUSTACK: start = $0100, size =$100;
|
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
|
# 6000-e000 can be (Cartridge) ROM
|
||||||
# WARNING: fill value must be $00 else it will no more work
|
# 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;
|
#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;
|
#ROMFILL: start = $7000, size = $7000, fill = yes, fillval = $00, file = %O, define = yes;
|
||||||
# for images that have code >$6fff we must calculate the checksum!
|
# 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 {
|
SEGMENTS {
|
||||||
ZEROPAGE: load = ZP, type = zp, define = yes;
|
ZEROPAGE: load = ZP, type = zp, define = yes;
|
||||||
EXTZP: load = ZP, type = zp, define = yes, optional = yes;
|
EXTZP: load = ZP, type = zp, define = yes, optional = yes;
|
||||||
APPZP: 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;
|
INIT: load = ROM, type = ro, define = yes, optional = yes;
|
||||||
CODE: load = ROM, type = ro, define=yes;
|
CODE: load = ROM, type = ro, define=yes;
|
||||||
RODATA: load = ROM, type = ro, define=yes;
|
RODATA: load = ROM, type = ro, define=yes;
|
||||||
|
@ -1,33 +1,16 @@
|
|||||||
|
|
||||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
.export Start, _exit
|
||||||
|
|
||||||
.import initlib, donelib, callmain
|
.import initlib, donelib, callmain
|
||||||
.import push0, _main, zerobss, copydata
|
.import push0, _main, zerobss, copydata
|
||||||
|
|
||||||
.import IRQStub
|
|
||||||
|
|
||||||
; Linker generated symbols
|
; Linker generated symbols
|
||||||
.import __RAM_START__, __RAM_SIZE__
|
.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 "zeropage.inc"
|
||||||
.include "gamate.inc"
|
.include "gamate.inc"
|
||||||
|
|
||||||
.segment "STARTUP"
|
Start:
|
||||||
|
|
||||||
.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:
|
|
||||||
; setup the CPU and System-IRQ
|
; setup the CPU and System-IRQ
|
||||||
|
|
||||||
; Initialize CPU
|
; Initialize CPU
|
||||||
@ -67,12 +50,8 @@ _exit:
|
|||||||
jsr donelib ; Run module destructors
|
jsr donelib ; Run module destructors
|
||||||
|
|
||||||
; reset (start over)
|
; reset (start over)
|
||||||
jmp reset
|
jmp Start
|
||||||
|
|
||||||
.export initmainargs
|
.export initmainargs
|
||||||
initmainargs:
|
initmainargs:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
|
||||||
nmi:
|
|
||||||
rts
|
|
||||||
|
16
libsrc/gamate/header.s
Normal file
16
libsrc/gamate/header.s
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
; 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)
|
7
libsrc/gamate/nmi.s
Normal file
7
libsrc/gamate/nmi.s
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
;
|
||||||
|
; NMI handling (Gamate version)
|
||||||
|
;
|
||||||
|
.export NMIStub
|
||||||
|
|
||||||
|
NMIStub:
|
||||||
|
rts
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
; original audiotest.s by PeT (mess@utanet.at)
|
; original audiotest.s by PeT (mess@utanet.at)
|
||||||
|
|
||||||
.export _main
|
|
||||||
.include "gamate.inc"
|
.include "gamate.inc"
|
||||||
|
|
||||||
.zeropage
|
.zeropage
|
||||||
@ -29,17 +28,15 @@ psy: .byte 0
|
|||||||
xpos: .byte 0
|
xpos: .byte 0
|
||||||
ypos: .byte 0
|
ypos: .byte 0
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
chars:
|
chars: .incbin "cga2.chr"
|
||||||
.incbin "cga2.chr"
|
hex2asc: .byte "0123456789abcdef"
|
||||||
|
|
||||||
hex2asc: .byte "0123456789abcdef"
|
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
.export IRQStub
|
.export IRQStub, NMIStub
|
||||||
|
|
||||||
.proc nmi
|
.proc NMIStub
|
||||||
inc nmi_count
|
inc nmi_count
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
@ -50,8 +47,9 @@ hex2asc: .byte "0123456789abcdef"
|
|||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
|
.export Start
|
||||||
|
|
||||||
.proc _main
|
.proc Start
|
||||||
lda #>AUDIO_BASE
|
lda #>AUDIO_BASE
|
||||||
sta writeaddr+1
|
sta writeaddr+1
|
||||||
sta readaddr+1
|
sta readaddr+1
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
|
|
||||||
unsigned char y = 0;
|
unsigned char y = 0;
|
||||||
unsigned char x;
|
unsigned char x = 0;
|
||||||
unsigned short n;
|
unsigned short n;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@ -22,14 +22,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
n = clock();
|
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))) {
|
switch((*((unsigned char*)JOY_DATA))) {
|
||||||
case 0xff ^ JOY_DATA_UP:
|
case 0xff ^ JOY_DATA_UP:
|
||||||
++y;
|
++y; if (y == 0xc8) y = 0;
|
||||||
break;
|
break;
|
||||||
case 0xff ^ JOY_DATA_DOWN:
|
case 0xff ^ JOY_DATA_DOWN:
|
||||||
--y;
|
--y; if (y == 0xff) y = 0xc7;
|
||||||
break;
|
break;
|
||||||
case 0xff ^ JOY_DATA_LEFT:
|
case 0xff ^ JOY_DATA_LEFT:
|
||||||
++x;
|
++x;
|
||||||
@ -40,14 +40,12 @@ int main(int argc, char *argv[])
|
|||||||
case 0xff ^ JOY_DATA_FIRE_A:
|
case 0xff ^ JOY_DATA_FIRE_A:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (y == 0xff) y = 0xc7;
|
|
||||||
if (y == 0xc8) y = 0;
|
waitvblank();
|
||||||
|
|
||||||
(*((unsigned char*)LCD_XPOS)) = x;
|
(*((unsigned char*)LCD_XPOS)) = x;
|
||||||
(*((unsigned char*)LCD_YPOS)) = y;
|
(*((unsigned char*)LCD_YPOS)) = y;
|
||||||
|
|
||||||
waitvblank();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
; original lcdtest.s by PeT (mess@utanet.at)
|
; original lcdtest.s by PeT (mess@utanet.at)
|
||||||
|
|
||||||
.export _main
|
|
||||||
.include "gamate.inc"
|
.include "gamate.inc"
|
||||||
|
|
||||||
.zeropage
|
.zeropage
|
||||||
@ -32,15 +31,15 @@ xdesc: .byte "0123456789abcdefghijklmnopqrstuv", 0
|
|||||||
ydesc: .byte "0123456789ABCDEFGHIJKLMNOPQRSTUV", 0
|
ydesc: .byte "0123456789ABCDEFGHIJKLMNOPQRSTUV", 0
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
|
.export IRQStub, NMIStub
|
||||||
|
|
||||||
.proc nmi
|
|
||||||
|
.proc NMIStub
|
||||||
|
|
||||||
inc nmi_count
|
inc nmi_count
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.export IRQStub
|
|
||||||
|
|
||||||
.proc IRQStub
|
.proc IRQStub
|
||||||
|
|
||||||
inc irq_count
|
inc irq_count
|
||||||
@ -55,8 +54,9 @@ ydesc: .byte "0123456789ABCDEFGHIJKLMNOPQRSTUV", 0
|
|||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
|
.export Start
|
||||||
|
|
||||||
.proc _main
|
.proc Start
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta LCD_XPOS
|
sta LCD_XPOS
|
||||||
|
@ -13,6 +13,9 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
in = fopen(argv[1], "rb");
|
in = fopen(argv[1], "rb");
|
||||||
out = fopen(argv[2], "wb");
|
out = fopen(argv[2], "wb");
|
||||||
|
if (!in || !out) {
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
len = fread(buffer, 1, 512 * 1024, in);
|
len = fread(buffer, 1, 512 * 1024, in);
|
||||||
n = 0; for (i = 0x1000; i < 0x2000; i++) {
|
n = 0; for (i = 0x1000; i < 0x2000; i++) {
|
||||||
n += buffer[i];
|
n += buffer[i];
|
||||||
@ -22,4 +25,5 @@ int main(int argc, char *argv[]) {
|
|||||||
fwrite(buffer, 1, len, out);
|
fwrite(buffer, 1, len, out);
|
||||||
fclose(in);
|
fclose(in);
|
||||||
fclose(out);
|
fclose(out);
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user