From e191b3a85b451f739ae4497cdca58b56da1f91ec Mon Sep 17 00:00:00 2001 From: Honza Slesinger Date: Mon, 25 Mar 2024 18:00:17 +0100 Subject: [PATCH] make it buildable in KickAss 5x --- Makefile | 10 +- bootstrap.asm | 64 ++++++++--- kernal128.asm | 222 +++++++++++++++++++++++++++++---------- kernal64.asm | 170 +++++++++++++++++++++++------- loader.asm | 2 +- server128.asm | 216 ++++++++++++++++++++++++++++--------- server64.asm | 173 ++++++++++++++++++++++-------- server.h => server_h.asm | 35 +++--- 8 files changed, 660 insertions(+), 232 deletions(-) rename server.h => server_h.asm (93%) diff --git a/Makefile b/Makefile index 22b3fa4..33e81ac 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -PREFIX=/usr +PREFIX=/usr/local SYSCONFDIR=/etc -KASM?=kasm3 +KASM?=java -jar /home/honza/projects/c64/pc-tools/kickass/KickAss.jar MINGW32?=i686-w64-mingw32 MINGW32-GCC=$(MINGW32)-gcc @@ -120,7 +120,7 @@ inpout32.dll: tools/make-server: tools/make-server.c $(CC) $(CFLAGS) -o tools/make-server tools/make-server.c -server64.c: tools/make-server server.h server64.asm loader.asm +server64.c: tools/make-server server_h.asm server64.asm loader.asm $(KASM) :target=c64 :pc=257 -o base server64.asm # 257 = 0101 $(KASM) :target=c64 :pc=513 -o high server64.asm # 513 = 0201 $(KASM) :target=c64 :pc=258 -o low server64.asm # 258 = 0102 @@ -129,7 +129,7 @@ server64.c: tools/make-server server.h server64.asm loader.asm tools/make-server c64 base low high loader > server64.c rm -v base low high loader -server128.c: tools/make-server server.h server128.asm loader.asm +server128.c: tools/make-server server_h.asm server128.asm loader.asm $(KASM) :target=c128 :pc=257 -o base server128.asm # 257 = 0101 $(KASM) :target=c128 :pc=513 -o high server128.asm # 513 = 0201 $(KASM) :target=c128 :pc=258 -o low server128.asm # 258 = 0102 @@ -156,7 +156,7 @@ kernal128.c: tools/make-kernal tools/make-kernal.c kernal128.asm tools/make-bootstrap: tools/make-bootstrap.c $(CC) $(CFLAGS) -o tools/make-bootstrap tools/make-bootstrap.c -bootstrap-c64.txt: tools/make-bootstrap bootstrap.asm server.h +bootstrap-c64.txt: tools/make-bootstrap bootstrap.asm server_h.asm $(KASM) :target=c64 -o bootstrap-c64.prg bootstrap.asm && \ tools/make-bootstrap c64 bootstrap-c64.prg > bootstrap-c64.txt diff --git a/bootstrap.asm b/bootstrap.asm index 912aff9..cd76bf2 100644 --- a/bootstrap.asm +++ b/bootstrap.asm @@ -1,4 +1,4 @@ -.import source "server.h" +.import source "server_h.asm" .if(target == "c64") { .pc = $3000 @@ -14,10 +14,22 @@ jmp main //------------------------------------------------------------------------------ -read: { :read() rts } -write: { :write() rts } -ack: { :ack() rts } -wait: { :wait() rts } +read: { + :read() + rts +} +write: { + :write() + rts +} +ack: { + :ack() + rts +} +wait: { + :wait() + rts +} //------------------------------------------------------------------------------ @@ -59,14 +71,26 @@ load: { lda $dd01 sta (start),y jsr ack - :next() + inc start + bne !check+ + inc start+1 + +!check: + lda start+1 + cmp end+1 + bne !loop- + + lda start + cmp end + bne !loop- -done: lda end - sta bend - lda end+1 - sta bend+1 +done: + lda end + sta bend + lda end+1 + sta bend+1 - lda #$1b + lda #$1b sta $d011 rts } @@ -74,12 +98,18 @@ done: lda end //------------------------------------------------------------------------------ readHeader: { - jsr read stx mem - jsr read stx bank - jsr read stx start - jsr read stx start+1 - jsr read stx end - jsr read stx end+1 + jsr read + stx mem + jsr read + stx bank + jsr read + stx start + jsr read + stx start+1 + jsr read + stx end + jsr read + stx end+1 rts } diff --git a/kernal128.asm b/kernal128.asm index f32f016..9781c3d 100644 --- a/kernal128.asm +++ b/kernal128.asm @@ -2,7 +2,7 @@ .pc = $e000 -.import source "server.h" +.import source "server_h.asm" //------------------------------------------------------------------------------ @@ -26,7 +26,8 @@ eof: .pc = $f6cc tapeIODisabledMessage: { -.text "TAPE IO DISABLE" .byte $c4 +.text "TAPE IO DISABLE" +.byte $c4 eof: } @@ -113,7 +114,18 @@ near: ldy #$00 lda $dd01 sta (start),y :ack() - :next() + inc start + bne !check+ + inc start+1 + +!check: + lda start+1 + cmp end+1 + bne !loop- + + lda start + cmp end + bne !loop- jmp done far: :checkIO() @@ -142,7 +154,18 @@ save: { near: ldy #$00 !loop: lda (start),y :write() - :next() + inc start + bne !check+ + inc start+1 + +!check: + lda start+1 + cmp end+1 + bne !loop- + + lda start + cmp end + bne !loop- jmp done far: :checkIO() @@ -161,19 +184,25 @@ eof: //------------------------------------------------------------------------------ poke: { - jsr read stx mem - jsr read stx bank - jsr read stx start - jsr read stx start+1 + jsr read + stx mem + jsr read + stx bank + jsr read + stx start + jsr read + stx start+1 :wait() - lda $dd01 pha + lda $dd01 + pha :ack() :checkBank() near: ldy #$00 - pla sta (start),y + pla + sta (start),y jmp done far: ldy #$00 @@ -181,7 +210,8 @@ far: ldy #$00 sta stashptr ldx mem - pla jsr stash + pla + jsr stash done: jmp irq.done eof: @@ -190,10 +220,14 @@ eof: //------------------------------------------------------------------------------ peek: { - jsr read stx mem - jsr read stx bank - jsr read stx start - jsr read stx start+1 + jsr read + stx mem + jsr read + stx bank + jsr read + stx start + jsr read + stx start+1 :output() @@ -221,24 +255,36 @@ eof: //------------------------------------------------------------------------------ jump: { - jsr read stx mem - jsr read stx bank + jsr read + stx mem + jsr read + stx bank - ldx #$ff txs // reset stack pointer + ldx #$ff + txs // reset stack pointer - lda #>repl pha // make sure the code jumped to can rts to basic - lda #[repl + pha // make sure the code jumped to can rts to basic + lda #[return pha - lda #return + pha + lda #repl pha // make sure the code jumped to can rts to basic - lda #[repl + pha // make sure the code jumped to can rts to basic + lda #[return pha - lda #return + pha + lda #repl pha // make sure the code jumped to can rts to basic - lda #[repl + pha // make sure the code jumped to can rts to basic + lda #[return pha - lda #return + pha + lda #repl pha // make sure the code jumped to can rts to basic - lda #[repl + pha // make sure the code jumped to can rts to basic + lda #[return pha - lda #return + pha + lda #