Checkpoint comments.

This commit is contained in:
Christopher RYU 2023-10-03 18:46:43 +09:00
parent 8c405d173c
commit 9852fbd564
1 changed files with 80 additions and 60 deletions

View File

@ -3,9 +3,16 @@
; Input file: bitsy.bye
; Page: 1
OPEN_BUFFER := $0280
L2000 := $2000
L1400 := $1400
PRODOS_MLI := $BF00
DEVNUM := $BF30
BITMAP := $BF58
DRVSM2 := $C082
INIT := $FB2F
BASCALC := $FBC1
BELL1 := $FBDD
@ -24,7 +31,7 @@ NEWVIDEO := $C029
.org $1000
cld
lda $C082
lda DRVSM2 ; turn all drive phases off
cli
sta CLR80VID
sta CLR80COL
@ -35,26 +42,27 @@ NEWVIDEO := $C029
jsr HOME
ldx #$DF
lda #$CF
L101E: sta $BE79,x
lda L1270,x
sta $7A,x
L101E: sta BITMAP-$df,x ; $BF58, aka BITMAP
lda L135F -$df,x ; $134F
sta $7A,x ; $0159
lda #$00
txs
inx
bne L101E
.byte $C2
.byte $02
beq L1034 ; f0 04
inx ; e8
stx NEWVIDEO
L1034: inc $BF6F
ldx #$57
L1039: lda L12FF,x
.setcpu "65816" ; this is a NOP on 65x02
rep #$02 ; reset processor status bits
.setcpu "6502"
beq L1034 ; branch-always on 6502
inx ; only //gs
stx NEWVIDEO ; only //gs
L1034: inc BITMAP+$17 ; bitmap of low 48k of memory
ldx #(L1356-L12FE-1) ; $57
L1039: lda L12FE+1,x ; $1356
bmi L1045
jsr BASCALC
jsr BASCALC ; row in a -> screen address in ($28)
ldy L1300,x
.byte $2C ; mask next ...
L1045: sta ($28),y
L1045: sta ($28),y ; store directly to $(SCREEN) from BASCALC
dey
dex
bne L1039
@ -62,24 +70,27 @@ L104B: sta $0480,y
sta ($28),y
dey
bpl L104B
lda $BF30
lsr a
lsr a
lsr a
; done drawing screen
lda DEVNUM ; get current active slot (DSSS/0000)
lsr a ; for 7, that's 0111/0000
lsr a
lsr a ; now 0000/1110
tax
inx
cmp #$10
cmp #$10 ; legit slot?
bcc L1060
L105F: dex
L1060: jsr L1254
L1060: jsr OPEN_PREFIX
beq L105F
L1065: lda #$14
sta $7B
sta $59
ldy #$00
L1065: lda #>L1400
sta $7A+1
sta $58+1
ldy #<L1400
sty $7A
sty $58
jsr L1294
jsr OPEN_FILE
cpy #$4C
beq L107B
jsr BELL1
@ -173,9 +184,11 @@ L1120: inx
cpx #$14
bcc L10AC
stx $29
jsr RDKEY
cmp #$8D
jsr RDKEY ; get keypress
cmp #$8D ; CR?
bne L11A8
; try to load and execute the selected file
jsr PRODOS_MLI ; SET_PREFIX
.byte $c6
.word L12FD
@ -192,14 +205,14 @@ L113F: stx $7B
sta ($5C),y
inc $74
dey
jsr L1294
jsr OPEN_FILE
dey
bmi L1164
ldx L10B9+1
lda #$C3
sta $0305,x
ldy #$FF
L115C: jsr L1294
L115C: jsr OPEN_FILE
dec $74
dey
bpl L11A2
@ -208,7 +221,7 @@ L1166: lda ($5C),y
sta $2006,y
dey
bpl L1166
L116E: jsr HOME
EXEC_FILE: jsr HOME
jmp L2000
L1174: tay
@ -216,7 +229,7 @@ L1174: tay
sta $57
tax
L117A: lda ($5C),y
sta $0280,x
sta OPEN_BUFFER,x
dex
dey
bpl L117A
@ -224,11 +237,12 @@ L117A: lda ($5C),y
lda #$AF
sta $0281,x
bcs L11A5
jsr L1294
jsr OPEN_FILE
tya
beq L116E
beq EXEC_FILE
L1191: jsr BELL1
L1194: ldy $57
BROWSER_BACK: ldy $57
L1196: lda ($73),y
dey
beq L11A2
@ -240,7 +254,7 @@ L11A2: jsr BELL1
L11A5: jmp L1065
L11A8: ldx $5E
cmp #$95
cmp #$95 ; right-arrow?
bne L11E5
L11AE: inx
ldy #$10
@ -271,16 +285,16 @@ L11D4: eor #$F8
bne L11E0
bcs L11E0
dex
L11E0: jsr L1254
L11E0: jsr OPEN_PREFIX
bpl L11A5
L11E5: cmp #$9B
beq L1194
cmp #$C1
bcs L1221
adc #$48
L11E5: cmp #$9B ; ESC?
beq BROWSER_BACK
cmp #$C1 ; A?
bcs L1221 ; branch if less than or equal to ...
adc #$48 ; carry clear, so assume this is minimum $FA
cmp #$F9
bcs L11D4
sbc #$CF
bcs L11D4 ; if we are <= $F9, go to L11D4
sbc #$CF ; now minimum $2c - "+"
beq L1201
tay
dey
@ -337,7 +351,8 @@ L124A: dex
lda #$14
sta $5D
bne L1235
L1254: txa
OPEN_PREFIX: txa
and #$0F
sta $56
lsr a
@ -374,18 +389,18 @@ L127C: ldy #$AF
dey
rts
L1294: lda $57
sta $0280
OPEN_FILE: lda $57
sta OPEN_BUFFER
jsr PRODOS_MLI ; open
.byte $c8
.word $0072
bcs L12F3
bcs BB_EXIT
lda $77
sta $79
sty $7D
lda #$2B
ldx #$0D
.byte $2C ; mask next
.byte $2C ; mask next
L12AC: lda #$27
dex
bne L12B5
@ -396,9 +411,9 @@ L12B5: sta $7C
.byte $ca
.word $0078
iny
beq L12F3
beq BB_EXIT
lsr $7E
beq L12F3
beq BB_EXIT
tay
lda ($7A),y
and #$8F
@ -426,15 +441,18 @@ L12DC: tya
bcc L12AC
inc $7B
bne L12AC
L12F3: tay
jsr PRODOS_MLI
BB_EXIT: tay
jsr PRODOS_MLI ; close all open files
.byte $cc
.word L12FB
.word CLOSE_ALL
rts
L12FB: .byte $01, $00
L12FD: .word $8001
L12FF: .byte $02
; ProDOS MLI call parameters here
CLOSE_ALL: .byte 1, 0 ; one parameter, no reference, so close all
L12FD: .byte 1
L12FE: .word OPEN_BUFFER
L1300: .byte $ad, $16, $29
scrcode "BITSY BYE"
.byte $05, $24
@ -447,12 +465,14 @@ L1300: .byte $ad, $16, $29
scrcode "RETURN:SELECT"
.byte $17, $0d
scrcode "ESC:BACK"
.byte $17, $18
.byte $17
L134F: .byte $18 ; $18 is L134F
scrcode "TAB,#:NEW VOL"
.byte $17, $28
scrcode "S6,D1:"
.byte $00, $06
scrcode "/BASIS.SYSTEM"
L135F: scrcode "S6,D1:"
.byte $00
L1356: .byte $06
L135q: scrcode "/BASIS.SYSTEM"
.byte $02, $00, $81, $02, $03, $80, $02, $00, $0b, $00
L136E: .byte $04, $FA, $06, $fc, $04