mirror of
https://github.com/a2-4am/passport.git
synced 2025-03-10 20:30:21 +00:00
some formatting changes
This commit is contained in:
parent
b5db14e87a
commit
c40a85b140
@ -36,6 +36,8 @@ VPOS = $25
|
||||
|
||||
; Standard addresses
|
||||
PRODOSMLI= $BF00
|
||||
KEY = $C000
|
||||
STROBE = $C010
|
||||
TEXT = $FB2F
|
||||
HOME = $FC58
|
||||
WAIT = $FCA8
|
||||
|
@ -1,16 +1,13 @@
|
||||
!zone {
|
||||
EnterCFFAIfAvailable
|
||||
ldy #$04
|
||||
- lda $C7F6, y
|
||||
cmp CFFASignature, y
|
||||
cmp @CFFASignature, y
|
||||
sec
|
||||
bne +
|
||||
dey
|
||||
bpl -
|
||||
jsr $C730
|
||||
clc
|
||||
+
|
||||
rts
|
||||
CFFASignature
|
||||
+ rts
|
||||
@CFFASignature
|
||||
!byte $43,$46,$33,$4B,$31
|
||||
}
|
||||
|
@ -189,7 +189,6 @@ all_done_set
|
||||
; $cmp2 zero page clobbered
|
||||
; stack set to first instruction after string
|
||||
;-------------------------------
|
||||
!zone {
|
||||
compare
|
||||
clc
|
||||
adc #BASEPAGE
|
||||
@ -211,17 +210,17 @@ CompareMemory
|
||||
pha
|
||||
lda tmp
|
||||
pha
|
||||
.cmp
|
||||
@cmp
|
||||
lda (cmp2),y
|
||||
dey
|
||||
bmi .success
|
||||
bmi @success
|
||||
cmp (cmp1),y
|
||||
beq .cmp
|
||||
beq @cmp
|
||||
cmp #WILDCARD
|
||||
beq .cmp
|
||||
beq @cmp
|
||||
sec
|
||||
!byte $24 ; hide CLC
|
||||
.success clc
|
||||
@success clc
|
||||
php
|
||||
lda cmp1+1
|
||||
sec
|
||||
@ -229,4 +228,3 @@ CompareMemory
|
||||
ldx cmp1
|
||||
plp
|
||||
rts
|
||||
}
|
||||
|
17
src/keys.a
17
src/keys.a
@ -1,22 +1,15 @@
|
||||
KEY = $C000
|
||||
STROBE = $C010
|
||||
|
||||
!zone {
|
||||
WaitForKey
|
||||
bit STROBE
|
||||
.k lda KEY
|
||||
bpl .k
|
||||
- lda KEY
|
||||
bpl -
|
||||
bit STROBE
|
||||
cmp #"*"
|
||||
bne .noast
|
||||
bne +
|
||||
jsr TEXT
|
||||
lda #s_reset
|
||||
jsr PrintByID
|
||||
jmp $FF59
|
||||
.noast
|
||||
cmp #$E1
|
||||
+ cmp #$E1
|
||||
bcc +
|
||||
and #$DF ; force uppercase
|
||||
+
|
||||
rts
|
||||
}
|
||||
+ rts
|
||||
|
33
src/modify.a
33
src/modify.a
@ -15,7 +15,6 @@
|
||||
; oVerflow bit clear
|
||||
; all other flags clobbered
|
||||
;-------------------------------
|
||||
!zone {
|
||||
modify
|
||||
sta gDisplayBytes
|
||||
clc
|
||||
@ -31,49 +30,43 @@ modify
|
||||
tya
|
||||
clc
|
||||
adc modsrc
|
||||
bcc .noinc
|
||||
bcc +
|
||||
inx
|
||||
.noinc
|
||||
sta tmp
|
||||
+ sta tmp
|
||||
txa
|
||||
pha
|
||||
lda tmp
|
||||
pha
|
||||
sty modtmp
|
||||
bit gMode
|
||||
bpl .exitnomod ; verify mode -> no modify
|
||||
bvc .exitnomod ; demuffin mode -> no modify
|
||||
bpl @exitnomod ; verify mode -> no modify
|
||||
lda #s_modify
|
||||
jsr PrintByID
|
||||
ldy #0
|
||||
.dest
|
||||
lda (moddest),y
|
||||
- lda (moddest), y
|
||||
jsr PrintByte
|
||||
iny
|
||||
cpy modtmp
|
||||
bne .dest
|
||||
bne -
|
||||
lda #s_modifyto
|
||||
jsr PrintByID
|
||||
ldy #0
|
||||
.src
|
||||
iny
|
||||
lda (modsrc),y
|
||||
- iny
|
||||
lda (modsrc), y
|
||||
jsr PrintByte
|
||||
cpy modtmp
|
||||
bne .src
|
||||
bne -
|
||||
lda #$8D
|
||||
jsr PrintA
|
||||
bvc +
|
||||
.mod
|
||||
sta (moddest),y
|
||||
+ lda (modsrc),y
|
||||
- sta (moddest), y
|
||||
+ lda (modsrc), y
|
||||
dey
|
||||
bpl .mod
|
||||
.exit
|
||||
bpl -
|
||||
@exit
|
||||
inc gPatchCount
|
||||
.exitnomod
|
||||
@exitnomod
|
||||
lda gDisplayBytes
|
||||
ldx moddest
|
||||
clv
|
||||
rts
|
||||
}
|
||||
|
29
src/prefs.a
29
src/prefs.a
@ -51,51 +51,48 @@ SavePrefs
|
||||
; C clear if all prefs were valid
|
||||
; A,X clobbered
|
||||
;-------------------------------
|
||||
!zone {
|
||||
ValidatePrefs
|
||||
ldx #$00
|
||||
lda PREFSVER
|
||||
cmp #CURRENTVER
|
||||
beq .checkslot
|
||||
beq @checkslot
|
||||
lda #CURRENTVER
|
||||
sta PREFSVER
|
||||
lda #$FF
|
||||
sta SLOT
|
||||
sta DRIVE
|
||||
inx
|
||||
.checkslot
|
||||
@checkslot
|
||||
lda SLOT
|
||||
sec
|
||||
sbc #$30
|
||||
beq .badslot
|
||||
beq @badslot
|
||||
cmp #$08
|
||||
bcc .checkdrive
|
||||
.badslot
|
||||
bcc @checkdrive
|
||||
@badslot
|
||||
lda #DEFSLOT
|
||||
sta SLOT
|
||||
inx
|
||||
.checkdrive
|
||||
@checkdrive
|
||||
lda DRIVE
|
||||
sec
|
||||
sbc #$30
|
||||
beq .baddrive
|
||||
beq @baddrive
|
||||
cmp #$03
|
||||
bcc .checks6d1
|
||||
.baddrive
|
||||
bcc @checks6d1
|
||||
@baddrive
|
||||
lda #DEFDRIVE
|
||||
sta DRIVE
|
||||
inx
|
||||
.checks6d1
|
||||
@checks6d1
|
||||
lda SLOT
|
||||
cmp #$36
|
||||
bne .done
|
||||
bne @done
|
||||
lda DRIVE
|
||||
cmp #$31
|
||||
bne .done
|
||||
bne @done
|
||||
lda #$32
|
||||
sta DRIVE
|
||||
inx
|
||||
.done
|
||||
cpx #$01 ; set carry if anything changed
|
||||
@done cpx #$01 ; set carry if anything changed
|
||||
rts
|
||||
}
|
||||
|
99
src/print.a
99
src/print.a
@ -10,57 +10,56 @@ kForceLower !byte $FF ; AND mask for lowercase letters
|
||||
; out: X register preserved, others clobbered
|
||||
; all flags clobbered
|
||||
;-------------------------------
|
||||
!zone {
|
||||
PrintByID
|
||||
stx .x+1
|
||||
ldy #0 ; substitution mode flag
|
||||
tax
|
||||
lda StringTableLow,x
|
||||
sta .print+1
|
||||
sta @print+1
|
||||
lda StringTableHigh,x
|
||||
sta .print+2
|
||||
.print
|
||||
sta @print+2
|
||||
@print
|
||||
lda $FFFF ; modified at runtime
|
||||
beq .done
|
||||
cpy #0 ; are we in substitution mode or include mdoe?
|
||||
bmi .include ; yes, include mode
|
||||
beq .nosub ; no -> branch
|
||||
beq @nosub ; no -> branch
|
||||
ldy #0
|
||||
cmp #"t" ; "%t" = current track
|
||||
bne .sub1
|
||||
bne @sub1
|
||||
lda gTrack
|
||||
bpl .printbyte ; unconditional branch
|
||||
.sub1
|
||||
bpl @printbyte ; unconditional branch
|
||||
@sub1
|
||||
cmp #"s" ; "%s" = current sector
|
||||
bne .sub2
|
||||
bne @sub2
|
||||
lda gSector
|
||||
bpl .printbyte ; unconditional branch
|
||||
.sub2
|
||||
bpl @printbyte ; unconditional branch
|
||||
@sub2
|
||||
cmp #"S" ; write slot
|
||||
bne .sub3
|
||||
bne @sub3
|
||||
lda SLOT
|
||||
bne .printsd ; unconditional branch
|
||||
.sub3
|
||||
bne @printsd ; unconditional branch
|
||||
@sub3
|
||||
cmp #"D" ; write drive
|
||||
bne .sub4
|
||||
bne @sub4
|
||||
lda DRIVE
|
||||
.printsd
|
||||
@printsd
|
||||
ora #$80
|
||||
jsr PrintA
|
||||
bvc .next ; unconditional branch
|
||||
.sub4
|
||||
@sub4
|
||||
cmp #"0" ; "%0" through "%9"
|
||||
bcc .nosub
|
||||
bcc @nosub
|
||||
cmp #":"
|
||||
bcs .nosub
|
||||
bcs @nosub
|
||||
sec
|
||||
sbc #"0"
|
||||
tax
|
||||
lda gDisplayBytes,x
|
||||
.printbyte
|
||||
@printbyte
|
||||
jsr PrintByte
|
||||
bvc .next ; unconditional branch
|
||||
.nosub
|
||||
@nosub
|
||||
cmp #"%"
|
||||
bne .stillnosub
|
||||
iny ; Y=#$01 (substitution mode, next character will be interpreted)
|
||||
@ -71,31 +70,31 @@ PrintByID
|
||||
dey ; Y=#$FF (include mode, next character will be interpreted)
|
||||
bne .next ; unconditional branch
|
||||
+ cmp #$E1
|
||||
bcc .noforce
|
||||
bcc @noforce
|
||||
and kForceLower
|
||||
.noforce
|
||||
@noforce
|
||||
jsr COUT
|
||||
.next
|
||||
inc .print+1
|
||||
bne .print
|
||||
inc .print+2
|
||||
bne .print ; unconditional branch
|
||||
inc @print+1
|
||||
bne @print
|
||||
inc @print+2
|
||||
bne @print ; unconditional branch
|
||||
.done
|
||||
.x ldx #$FD ; SMC
|
||||
rts
|
||||
.include
|
||||
sta .a+1
|
||||
lda .print+1
|
||||
lda @print+1
|
||||
pha
|
||||
lda .print+2
|
||||
lda @print+2
|
||||
pha
|
||||
ldx .x+1
|
||||
.a lda #$FD ; SMC
|
||||
jsr PrintByID
|
||||
pla
|
||||
sta .print+2
|
||||
sta @print+2
|
||||
pla
|
||||
sta .print+1
|
||||
sta @print+1
|
||||
ldy #0
|
||||
beq .next ; unconditional branch
|
||||
|
||||
@ -110,9 +109,9 @@ PrintByID
|
||||
; @tmpy clobbered
|
||||
;-------------------------------
|
||||
PrintByte
|
||||
jsr .saveAXY
|
||||
jsr SaveAXY
|
||||
jsr PRBYTE
|
||||
jmp .loadAXY
|
||||
jmp LoadAXY
|
||||
|
||||
;-------------------------------
|
||||
; PrintA
|
||||
@ -125,17 +124,18 @@ PrintByte
|
||||
; @tmpy clobbered
|
||||
;-------------------------------
|
||||
PrintA
|
||||
jsr .saveAXY
|
||||
jsr SaveAXY
|
||||
jsr COUT
|
||||
; /!\ execution falls through here
|
||||
|
||||
.loadAXY
|
||||
LoadAXY
|
||||
lda tmpa
|
||||
ldx tmpx
|
||||
ldy tmpy
|
||||
clv
|
||||
rts
|
||||
|
||||
.saveAXY
|
||||
SaveAXY
|
||||
sta tmpa
|
||||
stx tmpx
|
||||
sty tmpy
|
||||
@ -153,34 +153,33 @@ ClearScreen
|
||||
.begin
|
||||
ldx #$04
|
||||
stx counter
|
||||
stx .loop+2
|
||||
stx .change+2
|
||||
stx @loop+2
|
||||
stx @change+2
|
||||
ldy #$00
|
||||
sty flag
|
||||
.loop
|
||||
@loop
|
||||
ldx $FF00,y ; modified at runtime
|
||||
cpx #$A0
|
||||
beq .nochange
|
||||
bcs .down
|
||||
beq @nochange
|
||||
bcs @down
|
||||
inx
|
||||
bne .change
|
||||
.down
|
||||
bne @change
|
||||
@down
|
||||
dex
|
||||
.change
|
||||
@change
|
||||
txa
|
||||
sta $FF00,y ; modified at runtime
|
||||
sta flag
|
||||
.nochange
|
||||
@nochange
|
||||
iny
|
||||
bne .loop
|
||||
inc .loop+2
|
||||
inc .change+2
|
||||
bne @loop
|
||||
inc @loop+2
|
||||
inc @change+2
|
||||
dec counter
|
||||
bne .loop
|
||||
bne @loop
|
||||
lda #$01
|
||||
jsr WAIT
|
||||
lda flag
|
||||
bne .begin
|
||||
.home
|
||||
jmp HOME
|
||||
}
|
||||
|
77
src/rwts.a
77
src/rwts.a
@ -1,3 +1,16 @@
|
||||
gTrack !byte $00
|
||||
gSector !byte $00
|
||||
|
||||
gRWTSParams
|
||||
!byte $01,$60,$01,$00
|
||||
_track !byte $00
|
||||
_sector !byte $00
|
||||
!word dct
|
||||
gAddress !word $1F00
|
||||
!byte $00,$00
|
||||
gCommand !byte $01,$00,$FE,$60,$01,$00,$00
|
||||
dct !byte $00,$01,$EF,$D8,$00
|
||||
|
||||
;-------------------------------
|
||||
; ReadSector
|
||||
; high-level function to read a single sector.
|
||||
@ -32,16 +45,14 @@ ReadSector
|
||||
|
||||
lda gIsProtDOS
|
||||
beq _protread
|
||||
|
||||
setuprwts
|
||||
@go
|
||||
ldy #<gRWTSParams
|
||||
lda #>gRWTSParams
|
||||
jsr jCallRWTS
|
||||
bcc endread
|
||||
bcc +
|
||||
lda gOnAClearDayYouCanReadForever
|
||||
beq setuprwts
|
||||
endread
|
||||
rts
|
||||
beq @go
|
||||
+ rts
|
||||
|
||||
;
|
||||
; "Protected.DOS" has enough differences that we just
|
||||
@ -51,35 +62,31 @@ endread
|
||||
; nibble is stored in zp$4E and varies based on track
|
||||
; and sector.
|
||||
;
|
||||
!zone {
|
||||
_protread
|
||||
lda gTrack ; T02,S05+ use "protected" mode
|
||||
cmp #$03 ; (altered data prologue and
|
||||
bcs .protected ; nibble translate table)
|
||||
bcs @protected ; nibble translate table)
|
||||
cmp #$02 ; T00,S00 - T02,S04 use
|
||||
bcc .standard ; "standard" mode
|
||||
bcc @standard ; "standard" mode
|
||||
lda gSector
|
||||
cmp #$05
|
||||
bcs .protected
|
||||
.standard
|
||||
bcs @protected
|
||||
@standard
|
||||
lda #$9B
|
||||
sta $BF2C
|
||||
bne .go ; unconditional branch
|
||||
.protected
|
||||
bne @go ; unconditional branch
|
||||
@protected
|
||||
lda #$B5
|
||||
sta $4E
|
||||
lda #$D5
|
||||
sta $BF2C ; execution falls through here
|
||||
.go
|
||||
lda #<gRWTSParams
|
||||
@go lda #<gRWTSParams
|
||||
ldy #>gRWTSParams
|
||||
jsr $BA00 ; note non-standard entry point
|
||||
bcc endprotread
|
||||
bcc +
|
||||
lda gOnAClearDayYouCanReadForever
|
||||
beq .go
|
||||
endprotread
|
||||
rts
|
||||
}
|
||||
beq @go
|
||||
+ rts
|
||||
|
||||
;-------------------------------
|
||||
; PreReadSector
|
||||
@ -125,9 +132,9 @@ IgnoreAddressChecksum
|
||||
; in: A = new track
|
||||
;-------------------------------
|
||||
ChangeTrack
|
||||
sta .new+1
|
||||
sta @new+1
|
||||
jsr WriteTrack
|
||||
.new lda #$d1 ; modified at runtime
|
||||
@new lda #$d1 ; modified at runtime
|
||||
|
||||
; note: execution falls through here
|
||||
|
||||
@ -194,39 +201,25 @@ WriteTrackNA ; entry point used by Special Delivery trac
|
||||
|
||||
;-------------------------------
|
||||
; FatalWriteError
|
||||
; in: A has MLI code (from WriteTrackFirstPass or WriteTrackSecondPass)
|
||||
; in: A has MLI error code
|
||||
; out: does not return, exits via TheEnd
|
||||
;-------------------------------
|
||||
FatalWriteError
|
||||
sta gDisplayBytes ; for use in error messages, if any
|
||||
sta gDisplayBytes
|
||||
tax
|
||||
lda #s_writeioerr
|
||||
cpx #MLI_IOERR
|
||||
beq .printerr
|
||||
beq @print
|
||||
lda #s_writenodev
|
||||
cpx #MLI_NODEV
|
||||
beq .printerr
|
||||
beq @print
|
||||
lda #s_writeprot
|
||||
cpx #MLI_WRITEPROT
|
||||
beq .printerr
|
||||
beq @print
|
||||
lda #s_othermli
|
||||
.printerr
|
||||
pha
|
||||
@print pha
|
||||
lda #s_writeerr
|
||||
jsr PrintByID
|
||||
pla
|
||||
jsr PrintByID
|
||||
jmp TheEnd
|
||||
|
||||
gTrack !byte $00
|
||||
gSector !byte $00
|
||||
|
||||
gRWTSParams ; used to read each sector
|
||||
!byte $01,$60,$01,$00
|
||||
_track !byte $00
|
||||
_sector !byte $00
|
||||
!word dct
|
||||
gAddress !word $1F00
|
||||
!byte $00,$00
|
||||
gCommand !byte $01,$00,$FE,$60,$01,$00,$00
|
||||
dct !byte $00,$01,$EF,$D8,$00
|
||||
|
@ -35,28 +35,26 @@ kSectorResetAdaptiveRWTS = $C0 ; will accept any epilogue on next sector,
|
||||
kSectorIgnoreAddressChecksum = $C1 ; will ignore address field checksum
|
||||
kSectorCustomDOS32B4BB = $C2 ; DOS 3.2 / JMP B4BB RWTS swapper
|
||||
;-------------------------------
|
||||
!zone {
|
||||
InitSectorMapWithIgnore
|
||||
lda #kSectorOptional
|
||||
!byte $2C
|
||||
InitSectorMap
|
||||
lda #kSectorRequired
|
||||
ldx #<sectormap
|
||||
stx .B+1
|
||||
stx @B+1
|
||||
ldx #>sectormap
|
||||
stx .B+2
|
||||
stx @B+2
|
||||
ldx #$22
|
||||
.A ldy #$0F
|
||||
.B sta $FFFF
|
||||
inc .B+1
|
||||
@A ldy #$0F
|
||||
@B sta $FFFF
|
||||
inc @B+1
|
||||
bne +
|
||||
inc .B+2
|
||||
inc @B+2
|
||||
+ dey
|
||||
bpl .B
|
||||
bpl @B
|
||||
dex
|
||||
bpl .A
|
||||
bpl @A
|
||||
rts
|
||||
}
|
||||
|
||||
sectormap
|
||||
T00S00
|
||||
|
Loading…
x
Reference in New Issue
Block a user