* Changed the way that Atmos programs are started.
- Put a BASIC-language stub at the beginning. - Removed the Autostart flag. Those changes make it easy to give command-line arguments to a program. * Made the Atmos configure file accept a special symbol definition on ld65's command line. We can use "__RAMEND__" to increase the amount of RAM that's available to programs.
This commit is contained in:
24
libsrc/atmos/bashdr.s
Normal file
24
libsrc/atmos/bashdr.s
Normal file
@@ -0,0 +1,24 @@
|
||||
;
|
||||
; 2010-11-14, Ullrich von Bassewitz
|
||||
; 2014-09-06, Greg King
|
||||
;
|
||||
; This module supplies a small BASIC stub program that uses CALL
|
||||
; to jump to the machine-language code that follows it.
|
||||
;
|
||||
|
||||
; The following symbol is used by the linker config. file
|
||||
; to force this module to be included into the output file.
|
||||
.export __BASHDR__:abs = 1
|
||||
|
||||
|
||||
.segment "BASHDR"
|
||||
|
||||
.addr Next
|
||||
.word .version ; Line number
|
||||
.byte $BF,'#' ; CALL token, mark number as hexadecimal
|
||||
.byte <(Start >> 8 ) + '0' + (Start >> 8 > $09) * $07
|
||||
.byte <(Start >> 4 & $0F) + '0' + (Start >> 4 & $0F > $09) * $07
|
||||
.byte <(Start & $0F) + '0' + (Start & $0F > $09) * $07
|
||||
.byte $00 ; End of BASIC line
|
||||
Next: .addr $0000 ; BASIC program end marker
|
||||
Start:
|
||||
@@ -2,39 +2,18 @@
|
||||
; Startup code for cc65 (Oric version)
|
||||
;
|
||||
; By Debrune J<>r<EFBFBD>me <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org>
|
||||
; 2014-08-22, Greg King
|
||||
; 2014-11-09, Greg King
|
||||
;
|
||||
|
||||
.export _exit
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
.import initlib, donelib
|
||||
.import callmain, zerobss
|
||||
.import __RAM_START__, __RAM_SIZE__
|
||||
.import __ZPSAVE_LOAD__, __STACKSIZE__
|
||||
.import __RAM_START__, __RAM_SIZE__, __STACKSIZE__
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "atmos.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Oric tape header
|
||||
|
||||
.segment "TAPEHDR"
|
||||
|
||||
.byte $16, $16, $16 ; Sync bytes
|
||||
.byte $24 ; End of header marker
|
||||
|
||||
.byte $00 ; $2B0
|
||||
.byte $00 ; $2AF
|
||||
.byte $80 ; $2AE Machine code flag
|
||||
.byte $C7 ; $2AD Autoload flag
|
||||
.dbyt __ZPSAVE_LOAD__ - 1 ; $2AB
|
||||
.dbyt __RAM_START__ ; $2A9
|
||||
.byte $00 ; $2A8
|
||||
.byte ((.VERSION >> 8) & $0F) + '0'
|
||||
.byte ((.VERSION >> 4) & $0F) + '0'
|
||||
.byte (.VERSION & $0F) + '0'
|
||||
.byte $00 ; Zero terminated compiler version
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Place the startup code in a special segment.
|
||||
|
||||
@@ -79,7 +58,7 @@ L1: lda sp,x
|
||||
|
||||
; Call the module destructors. This is also the exit() entry.
|
||||
|
||||
_exit: jsr donelib ; Run module destructors
|
||||
_exit: jsr donelib
|
||||
|
||||
; Restore the system stuff.
|
||||
|
||||
@@ -104,7 +83,15 @@ L2: lda zpsave,x
|
||||
|
||||
.segment "ZPSAVE"
|
||||
|
||||
zpsave: .res zpspace
|
||||
zpsave:
|
||||
|
||||
; This padding is needed by a bug in the ROM.
|
||||
; (The CLOAD command starts BASIC's variables table on top of the last byte
|
||||
; that was loaded [instead of at the next address].)
|
||||
|
||||
.byte 0
|
||||
|
||||
.res zpspace - 1
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
|
||||
30
libsrc/atmos/tapehdr.s
Normal file
30
libsrc/atmos/tapehdr.s
Normal file
@@ -0,0 +1,30 @@
|
||||
;
|
||||
; Based on code by Debrune J<>r<EFBFBD>me <jede@oric.org>
|
||||
; 2013-08-15, Greg King
|
||||
;
|
||||
|
||||
; The following symbol is used by the linker config. file
|
||||
; to force this module to be included into the output file.
|
||||
.export __TAPEHDR__:abs = 1
|
||||
|
||||
.import __BASHDR_LOAD__, __ZPSAVE_LOAD__, __AUTORUN__, __PROGFLAG__
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Oric cassette-tape header
|
||||
|
||||
.segment "TAPEHDR"
|
||||
|
||||
.byte $16, $16, $16 ; Sync bytes
|
||||
.byte $24 ; Beginning-of-header marker
|
||||
|
||||
.byte $00 ; $2B0
|
||||
.byte $00 ; $2AF
|
||||
.byte <__PROGFLAG__ ; $2AE Language flag ($00=BASIC, $80=machine code)
|
||||
.byte <__AUTORUN__ ; $2AD Auto-run flag ($C7=run, $00=only load)
|
||||
.dbyt __ZPSAVE_LOAD__ ; $2AB Address of end of file
|
||||
.dbyt __BASHDR_LOAD__ ; $2A9 Address of start of file
|
||||
.byte $00 ; $2A8
|
||||
|
||||
; File name (a maximum of 17 characters), zero-terminated
|
||||
.asciiz .sprintf("%u", .time)
|
||||
Reference in New Issue
Block a user