aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile4
-rw-r--r--src/aexec.s (renamed from src/aexec.dasm)38
-rw-r--r--src/loadxex.s3
3 files changed, 21 insertions, 24 deletions
diff --git a/src/Makefile b/src/Makefile
index ba72f9f..5efd335 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -45,8 +45,8 @@ loadmenu.xex: loadxex.s
loadmkau.xex: loadxex.s
cl65 -t none -o loadmkau.xex loadxex.s
-aexec.xex: aexec.dasm
- dasm aexec.dasm -f3 -oaexec.xex
+aexec.xex: aexec.s
+ cl65 -t none -o aexec.xex aexec.s
test: disk
atariserver fujitest.atr
diff --git a/src/aexec.dasm b/src/aexec.s
index 9338c4c..27e8909 100644
--- a/src/aexec.dasm
+++ b/src/aexec.s
@@ -4,9 +4,10 @@
; Return value: 0 for success, nonzero on error, never returns if exe has
; a run address.
-; TODO: learn ca65 syntax better, port this to ca65
+; This is for the Atari, but it gets built with "-t none" to
+; avoid ld65 adding the C runtime startup code. Also, there is
+; NO run address in this file.
-; Usage: build with "dasm aexec.dasm -f3 -oaexec.xex"
; "Link" to your program with "cat aexec.xex yourprog.xex > newprog.xex"
; int __fastcall__ (*atari_exec_p)(char *) = (int __fastcall__ (*)(char *))0x600;
@@ -30,20 +31,19 @@
; the caller...
- processor 6502
- include "equates.inc"
+ .include "atari.inc"
tmp = $d4 ; aka FR0
loadaddr = $d6
main = $0600
- org main-6
- word $FFFF
- word main
- word endmain-1
+ .org main-6
+ .word $FFFF
+ .word main
+ .word endmain-1
- org main
+ .org main
pha
txa
pha
@@ -96,7 +96,7 @@ fndone:
fail:
lda #$48
sta 710
-hang bne hang
+hang: bne hang
readheader:
; read 2 bytes into local buffer
@@ -155,7 +155,7 @@ noinc:
sta INITAD+1
beq readheader ; branch always
-do_init
+do_init:
jmp (INITAD)
close_file:
@@ -171,7 +171,7 @@ close_file:
; If there was no run address, we were probably loading an R: driver, so
; our caller is safe to return to
-norun
+norun:
lda #0 ; return 0
tax
rts
@@ -185,22 +185,18 @@ read2bytes:
sta ICBAH+$10
sta ICBLH+$10
read_segment:
- lda #C_GETCHR
+ lda #GETCHR
sta ICCOM+$10
ldx #$10
jmp CIOV
-do_run
+do_run:
jmp (RUNAD)
-fclose
- lda #C_CLOSE
+fclose:
+ lda #CLOSE
sta ICCOM+$10
ldx #$10
jmp CIOV
-endmain
-
-; word RUNAD
-; word RUNAD+1
-; word main
+endmain:
diff --git a/src/loadxex.s b/src/loadxex.s
index 7008f75..bf0f3c6 100644
--- a/src/loadxex.s
+++ b/src/loadxex.s
@@ -5,7 +5,8 @@
; I'd have to make AUTORUN.SYS a copy of FUJIMENU.COM with
; the serial driver prepended.
-RUNAD = $02e0
+ .include "atari.inc"
+
atari_exec = $0600
main = $2e00 ; same place as cc65