1
0
mirror of https://github.com/cc65/cc65.git synced 2026-03-10 17:21:49 +00:00

initial (identical) minimal "library" for assembly support for c65 and mega65. taken from #1792

This commit is contained in:
mrdudz
2025-06-22 21:09:40 +02:00
parent 6d7f37c4f2
commit 715d9c00a2
4 changed files with 96 additions and 0 deletions

32
libsrc/c65/exehdr.s Normal file
View File

@@ -0,0 +1,32 @@
;
; Ullrich von Bassewitz, 2010-11-14
;
; This module supplies a small BASIC stub program that jumps to the machine
; language code that follows it using SYS.
;
; The following symbol is used by linker config to force the module
; to get included into the output file
.export __EXEHDR__: absolute = 1
.segment "EXEHDR"
.addr Next
.word .version ; Line number
.byte $fe, $02, "0:" ; BANK 0
.byte $9e ; SYS
; .byte <(((Start / 10000) .mod 10) + '0')
.byte <(((Start / 1000) .mod 10) + '0')
.byte <(((Start / 100) .mod 10) + '0')
.byte <(((Start / 10) .mod 10) + '0')
.byte <(((Start / 1) .mod 10) + '0')
.byte $00 ; End of BASIC line
Next: .word 0 ; BASIC end marker
Start:
; If the start address is larger than 4 digits, the header generated above
; will not contain the highest digit. Instead of wasting one more digit that
; is almost never used, check it at link time and generate an error so the
; user knows something is wrong.
.assert (Start < 10000), error, "Start address too large for generated BASIC stub"

16
libsrc/c65/loadaddr.s Normal file
View File

@@ -0,0 +1,16 @@
;
; Ullrich von Bassewitz, 2010-11-13
;
; This module supplies the load address that is expected by Commodore
; machines in the first two bytes of an excutable disk file.
;
; The following symbol is used by linker config to force the module
; to get included into the output file
.export __LOADADDR__: absolute = 1
.segment "LOADADDR"
.addr *+2

32
libsrc/mega65/exehdr.s Normal file
View File

@@ -0,0 +1,32 @@
;
; Ullrich von Bassewitz, 2010-11-14
;
; This module supplies a small BASIC stub program that jumps to the machine
; language code that follows it using SYS.
;
; The following symbol is used by linker config to force the module
; to get included into the output file
.export __EXEHDR__: absolute = 1
.segment "EXEHDR"
.addr Next
.word .version ; Line number
.byte $fe, $02, "0:" ; BANK 0
.byte $9e ; SYS
; .byte <(((Start / 10000) .mod 10) + '0')
.byte <(((Start / 1000) .mod 10) + '0')
.byte <(((Start / 100) .mod 10) + '0')
.byte <(((Start / 10) .mod 10) + '0')
.byte <(((Start / 1) .mod 10) + '0')
.byte $00 ; End of BASIC line
Next: .word 0 ; BASIC end marker
Start:
; If the start address is larger than 4 digits, the header generated above
; will not contain the highest digit. Instead of wasting one more digit that
; is almost never used, check it at link time and generate an error so the
; user knows something is wrong.
.assert (Start < 10000), error, "Start address too large for generated BASIC stub"

16
libsrc/mega65/loadaddr.s Normal file
View File

@@ -0,0 +1,16 @@
;
; Ullrich von Bassewitz, 2010-11-13
;
; This module supplies the load address that is expected by Commodore
; machines in the first two bytes of an excutable disk file.
;
; The following symbol is used by linker config to force the module
; to get included into the output file
.export __LOADADDR__: absolute = 1
.segment "LOADADDR"
.addr *+2