Z1 support

This commit is contained in:
Peter Ferrie 2018-03-21 12:39:23 -07:00
parent 132ece1b82
commit c63826bbfa
5 changed files with 590 additions and 4 deletions

View File

@ -62,19 +62,21 @@ quit jsr $bf00
bne quit
;select interpreter by auxtype
;3, 4, 5, "$55" (special case)
;1, 3, 4, 5, "$55" (special case)
lda c4_parms+5
cmp #1
beq +
cmp #3
bcc quit
cmp #$55
beq +
beq ++
cmp #6
bcs quit
dec filename
+ dec filename
ora #$30
sta version
+
++
;get volume name

Binary file not shown.

Binary file not shown.

582
src/onbeyond/z1/z1.s Normal file
View File

@ -0,0 +1,582 @@
;license:MIT
;(c) 2017-2018 by qkumba
!cpu 6502
!to "build/ONBEYONDZ1",plain
*=$3000
!macro version {!scrxor $80, "1/180221"}
;user-defined options
verbose_info = 0 ;set to 1 to enable display of memory usage
gamename=$2940
savename=$2980
scrpname=$29C0
;unpacker variables, no need to change these
src = $0
dst = $2
ecx = $4
last = $6
tmp = $8
- jsr $bf00
op_c7
!byte $c7
!word c7_parms
ldx $200
bne +
lda $bf30
sta c5_parms+1
jsr $bf00
!byte $c5
!word c5_parms
ldx $201
inx
txa
and #$0f
sta $200
lda #$2f
sta $201
dec op_c7
bne -
+
ldy $2006
lda #'1'
sta gamename,y
lda #'Z'
sta gamename-1,y
lda #'V'
sta savename+1,y
lda #'A'
sta savename,y
lda #'S'
sta savename-1,y
lda #'G'
sta scrpname+1,y
lda #'O'
sta scrpname,y
lda #'L'
sta scrpname-1,y
dey
dey
- lda $2006,y
sta gamename,y
sta savename,y
sta scrpname,y
dey
bpl -
inc savename
inc scrpname
lda $306
eor $305
eor $304
eor $303
eor $302
eor $301
eor $300
eor #$a5
beq +
ldx #0
stx $303 ;no script
stx $304
dex
stx $302 ;no load
+
jsr $fe93
jsr $fc58
lda #$17
sta $25
lda #0
sta $24
sta $57b
jsr $fc22
ldy #0
beq +
- jsr $fdf0
iny
+ lda brandtext,y
bne -
lda #>pakoff
sta src + 1
lda #<pakoff
sta src
lda #8
sta dst + 1
lda #0
sta dst
jsr unpack
;copy new RWTS and interpreter support routines
ldy #0
- lda unrelochdd, y
sta $2800, y
iny
bne -
ldy #<(hddcodeend - $2800)
- lda unrelochdd + $ff, y
sta $28ff, y
dey
bne -
sty $1e37
sty $1e5d
lda #$28
sta $1e38
sta $1e5e
lda $303
beq +
lda #<print
sta $1c3f
lda #>print
sta $1c40
lda #<printer
sta $1d94
lda #>printer
sta $1d95
lda $304
beq +
lda #<callbackprn1
sta $1d7c
lda #>callbackprn1
sta $1d7d
+
ldx $302
inx
beq +
lda $1d7c
sta loadcall1+1
lda $1d7d
sta loadcall2+1
lda #<callback1
sta $1d7c
lda #>callback1
sta $1d7d
+
lda #<savefile
sta $2069
lda #>savefile
sta $206a
lda #<loadfile
sta $2102
lda #>loadfile
sta $2103
lda #<closefile
sta $20ea
sta $20f0
sta $2196
sta $219c
lda #>closefile
sta $20eb
sta $20f1
sta $2197
sta $219d
lda #<quit
sta $1bc0
lda #>quit
sta $1bc1
jsr closefile
lda #$60
sta $7c ;!
jmp $800
brandtext
!scrxor $80, "ON BEYOND Z-MACHINE! REVISION "
+version
!byte 0
c7_parms
!byte 1
!word $200
c5_parms
!byte 2
!byte 0
!word $201
unrelochdd
!pseudopc $2800 {
clc
adc #$c9
sta pro_op
lda #0
sta ce_parms+2
lda $e2
sta ce_parms+3
lda $e3
sta ce_parms+4
lda $e5
sta ca_parms+3
- jsr $bf00
!byte $ce ;seek
!word ce_parms
bcc +
jsr $bf00
!byte $d0 ;set EOF
!word ce_parms
bcc -
+
jsr $bf00
pro_op
!byte $ca ;read file
!word ca_parms
bcs quit
rts
printer
ldx $ed
lda #$8d
sta $200,x
inx
stx cb_parms+4
lda #<scrpname
sta c8_parms+1
ldx #(<gamename xor <scrpname)
jsr closefile1
jsr $bf00
!byte $d1
!word ce_parms
jsr $bf00
!byte $ce
!word ce_parms
jsr $bf00
!byte $cb
!word cb_parms
bcc closefile
quit
jsr xclose
jsr $bf00
!byte $65
!word quit_parms
savefile
jsr $bf00
!byte $c0
!word c0_parms
loadfile
lda #$ff
sta $e2
sta $e3
closefile
ldx #(<gamename xor <savename)
closefile1
jsr xclose
jsr xopen
txa
eor c8_parms+1
sta c8_parms+1
rts
callback1
ldx #$ff
- inx
lda xrestore,x
sta $200,x
jsr $fded
cmp #$8d
bne -
loadcall1
ldy #$6f
sty $1d7c
loadcall2
ldy #$fd
sty $1d7d
rts
xrestore
!byte $d2,$c5,$d3,$d4,$cf,$d2,$c5,$8d
callbackprn1
ldx #$ff
- inx
lda xscript,x
sta $200,x
jsr $fded
cmp #$8d
bne -
ldy #$6f
sty $1d7c
ldy #$fd
sty $1d7d
rts
xscript
!byte $d3,$c3,$d2,$c9,$d0,$d4,$8d
print
jsr $bf00
!byte $c1
!word c1_parms
lda #<scrpname
sta c0_parms+1
jsr $bf00
!byte $c0
!word c0_parms
lda #<printer
sta $1c3f
lda #>printer
sta $1c40
lda #<savename
sta c0_parms+1
rts
xclose
jsr $bf00
!byte $cc
!word cc_parms
rts
xopen
jsr $bf00
!byte $c8
!word c8_parms
lda c8_parms+5
sta ce_parms+1
sta ca_parms+1
sta cb_parms+1
rts
c8_parms
!byte 3
!word gamename
!word $2400
!byte 0
c0_parms
!byte 7
!word savename
!byte %11000011
!byte 04
!word 0
cc_parms
!byte 1
!word 0
!word 0
ce_parms
!byte 2
!byte 0
!byte 0
!byte 0
!byte 0
ca_parms
!byte 4
!byte $ff
!word $2900
!word $100
!word $ffff
c1_parms
!byte 1
!word scrpname
cb_parms
quit_parms
!byte 4
!byte $ff
!word $200
!word $00ff
!word $ffff
hddcodeend
}
unpack ;unpacker entrypoint
lda #0
sta last
sta ecx+1
literal
jsr getput
ldy #2
nexttag
jsr getbit
bcc literal
jsr getbit
bcc codepair
jsr getbit
bcs onebyte
jsr getsrc
lsr
beq donedepacking
ldx #0
stx ecx
rol ecx
stx last+1
tax
bne domatch_with_2inc
getbit
asl last
bne .stillbitsleft
jsr getsrc
sec
rol
sta last
.stillbitsleft
donedepacking
rts
onebyte
ldy #0
sty tmp+1
iny
sty ecx
iny
lda #$10
.getmorebits
pha
jsr getbit
pla
rol
bcc .getmorebits
bne domatch
jsr putdst
linktag
bne nexttag
codepair
jsr getgamma
- jsr dececx
dey
bne -
tay
beq +
normalcodepair
dey
sty last+1
jsr getsrc
tax
!byte $a9
+ iny
jsr getgamma
cpy #$7d
bcs domatch_with_2inc
cpy #5
bcs domatch_with_inc
txa
bmi domatch_new_lastpos
tya
bne domatch_new_lastpos
domatch_with_2inc
clc
!byte $24
set_carry
sec
domatch_with_inc
inc ecx
bne test_carry
inc ecx+1
test_carry
bcc set_carry
domatch_new_lastpos
domatch_lastpos
ldy #1
lda last+1
sta tmp+1
txa
domatch
sta tmp
lda src+1
pha
lda src
pha
lda dst
sec
sbc tmp
sta src
lda dst+1
sbc tmp+1
sta src+1
;;access1
;; sta $c003
- jsr getput
jsr dececx
ora ecx+1
bne -
;; sta $c002
pla
sta src
pla
sta src+1
bne linktag
getgamma
lda #1
sta ecx
.getgammaloop
jsr getbit
rol ecx
rol ecx+1
jsr getbit
bcs .getgammaloop
rts
dececx
lda ecx
bne +
dec ecx+1
+ dec ecx
lda ecx
rts
getput
jsr getsrc
putdst
sty tmp
ldy #0
sta (dst), y
inc dst
bne +
inc dst+1
bne +
getsrc
sty tmp
ldy #0
lda (src), y
inc src
bne +
inc src+1
+ ldy tmp
rts
pakoff
!bin "src/onbeyond/z1/0800-21ff.pak"
!byte $D3,$C1,$CE,$A0,$C9,$CE,$C3,$AE

View File

@ -12,6 +12,7 @@ if "%1" equ "asm" (
acme -r build\grue.system.lst src\grue.system.s
acme -r build\pitchdark.lst src\pitchdark.a
acme -r build\onbeyond.system.lst src\onbeyond\onbeyond.system.s
acme -r build\z1.lst src\onbeyond\z1\z1.s
acme -r build\z3.lst src\onbeyond\z3\z3.s
acme -r build\z4.lst src\onbeyond\z4\z4.s
acme -r build\z5.lst src\onbeyond\z5\z5.s
@ -32,6 +33,7 @@ cadius ADDFILE "build\%DISK%" "/PITCH.DARK/" "build\PITCH.DARK"
cadius ADDFILE "build\%DISK%" "/PITCH.DARK/" "build\ONBEYOND.SYSTEM"
cadius CREATEFOLDER "build\%DISK%" "/PITCH.DARK/LIB/"
cadius ADDFILE "build\%DISK%" "/PITCH.DARK/LIB/" "build\WEEGUI"
cadius ADDFILE "build\%DISK%" "/PITCH.DARK/LIB/" "build\ONBEYONDZ1"
cadius ADDFILE "build\%DISK%" "/PITCH.DARK/LIB/" "build\ONBEYONDZ3"
cadius ADDFILE "build\%DISK%" "/PITCH.DARK/LIB/" "build\ONBEYONDZ4"
cadius ADDFILE "build\%DISK%" "/PITCH.DARK/LIB/" "build\ONBEYONDZ5"