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