disasm wip

This commit is contained in:
Joshua Bell 2020-10-02 21:02:13 -07:00
parent 2304490978
commit 93ae124043

View File

@ -21,6 +21,8 @@
kRemoveWriteProtect = 11 kRemoveWriteProtect = 11
.endenum .endenum
kErrDiskWriteProtected = $2B
;;; Zero Page Locations ;;; Zero Page Locations
mach_type := $07 ; 0 = IIc, 1 = II+/IIe mach_type := $07 ; 0 = IIc, 1 = II+/IIe
@ -134,25 +136,25 @@ init_80_col:
;; End signature is two adjacent $FFs ;; End signature is two adjacent $FFs
loop: loop:
read_msb := * + 2
L2072 := * + 2
lda L239E,y lda L239E,y
cmp #$FF cmp #$FF
bne L207E bne :+
L2079 := * + 2 check_msb := * + 2 ; check for second $FF
ldx L239E+1,y ldx L239E+1,y
cpx #$FF cpx #$FF
beq L208F beq L208F ; done!
L207E: :
L2080 := * + 2
write_msb := * + 2
sta L1000,y sta L1000,y
iny iny
bne loop bne loop
inc L2072 inc read_msb
inc L2079 inc check_msb
inc L2080 inc write_msb
bne loop ; always bne loop ; always
.endproc .endproc
@ -171,7 +173,7 @@ L2099 := * + 1
lda $1204 lda $1204
lsr a lsr a
sta year sta year
jsr convert_to_bcd jsr ConvertToBCD
sta bcd_year sta bcd_year
;; -------------------------------------------------- ;; --------------------------------------------------
@ -312,12 +314,14 @@ install_clock:
sta $1204 sta $1204
L2176: lda $1204 L2176: lda $1204
lsr a lsr a
cmp #$56 cmp #(kDefaultYear .mod 100)
bcc L218C bcc L218C
;; Two byte compare
lda DATELO lda DATELO
cmp $1203 cmp file_info_params + $A ; mod_date
lda DATELO+1 lda DATELO+1
sbc $1204 sbc file_info_params + $A + 1 ; mod_date + 1
bcs L21DF bcs L21DF
L218C: bit KBDSTRB L218C: bit KBDSTRB
@ -329,7 +333,7 @@ L218C: bit KBDSTRB
;; -------------------------------------------------- ;; --------------------------------------------------
;; Show current year prompt ;; Show current year prompt
.scope .scope
show_year_prompt: retry:
ldy #MessageCode::kCurrentYear ldy #MessageCode::kCurrentYear
jsr ShowMessage jsr ShowMessage
@ -351,26 +355,26 @@ show_year_prompt:
ldy #MessageCode::kCurrentYear ldy #MessageCode::kCurrentYear
jsr ShowMessage jsr ShowMessage
jsr GetDigitKey ; Decade jsr GetDigitKey ; Decade
asl a asl a ; move tens digit to high nibble
asl a asl a
asl a asl a
asl a asl a
sta bcd_year sta bcd_year
jsr GetDigitKey ; Year jsr GetDigitKey ; Year
and #$0F and #$0F ; mask ones digit
ora bcd_year ora bcd_year
sta bcd_year sta bcd_year
jmp show_year_prompt jmp retry
.endscope .endscope
;; -------------------------------------------------- ;; --------------------------------------------------
;; Current year is okay ;; Current year is okay
year_ok: year_ok:
lda $1204 lda $1204
jsr year_from_bcd jsr YearFromBCD
jsr InvokeDriver jsr InvokeDriver
jsr L111A jsr WriteFileInfo
L21DF: lda RWRAM1 ; Driver lives in LC Bank 1 L21DF: lda RWRAM1 ; Driver lives in LC Bank 1
lda RWRAM1 ; so bank that in lda RWRAM1 ; so bank that in
@ -406,7 +410,7 @@ install_ptr := * + 1
;;; Output: year ;;; Output: year
;;; $06 is trashed ;;; $06 is trashed
.proc year_from_bcd .proc YearFromBCD
lda bcd_year lda bcd_year
pha pha
lsr a lsr a
@ -433,7 +437,7 @@ install_ptr := * + 1
;;; Output: A = BCD number ;;; Output: A = BCD number
;;; $06 is trashed ;;; $06 is trashed
.proc convert_to_bcd .proc ConvertToBCD
ldx #$FF ldx #$FF
: inx : inx
sec sec
@ -889,30 +893,40 @@ done: rts
.endproc .endproc
;;; ------------------------------------------------------------ ;;; ------------------------------------------------------------
;;; Write current date/time to a file.
L111A: lda #$07 ; SET_FILE_INFO count .proc WriteFileInfo
retry:
lda #7 ; SET_FILE_INFO count
sta file_info_params sta file_info_params
ldy #$03
L1121: lda DATELO,y ;; Fill params with current date/time.
sta $1203,y ldy #3
: lda DATELO,y
sta file_info_params + $A,y ; mod_date
dey dey
bpl L1121 bpl :-
lda #OPC_RTS
lda #OPC_RTS ; Temporarily disable driver
sta DATETIME sta DATETIME
PRODOS_CALL MLI_SET_FILE_INFO, file_info_params PRODOS_CALL MLI_SET_FILE_INFO, file_info_params
bne :+ bne :+
lda #OPC_JMP_abs ; Re-enable driver
lda #OPC_JMP_abs
sta DATETIME sta DATETIME
rts rts
: cmp #$2B ;; Error; maybe retry?
bne ShowDiskErrorAndChain
: cmp #kErrDiskWriteProtected
bne ShowDiskErrorAndChain ; Failed
;; Write protected - show error and retry
ldy #MessageCode::kRemoveWriteProtect ldy #MessageCode::kRemoveWriteProtect
jsr ShowMessage jsr ShowMessage
jsr L11C3 jsr Bell
jsr RDKEY jsr RDKEY
jmp L111A jmp retry
.endproc
;;; ------------------------------------------------------------ ;;; ------------------------------------------------------------
@ -975,7 +989,7 @@ L119F: PRODOS_CALL MLI_READ_BLOCK, read_block_params
.proc ShowMessageAndMaybeChain .proc ShowMessageAndMaybeChain
sty msg_num sty msg_num
jsr ShowMessage jsr ShowMessage
jsr L11C3 jsr Bell
lda msg_num lda msg_num
cmp #MessageCode::kNoClock cmp #MessageCode::kNoClock
bne loop bne loop
@ -987,18 +1001,25 @@ loop: jmp loop ; Infinite loop!
.endproc .endproc
;;; ------------------------------------------------------------ ;;; ------------------------------------------------------------
;;; Make a tone (from ProDOS Technical Reference Manual)
;;; $0C is trashed
L11C3: lda #$20 .proc Bell
sta $0C
L11C7: lda #$02 length := $0C
lda #$20 ; duration of tone
sta length
bell1: lda #$2 ; short delay...click
jsr WAIT jsr WAIT
sta SPKR sta SPKR
lda #$24 lda #$24 ; long delay...click ($20 in TRM)
jsr WAIT jsr WAIT
sta SPKR sta SPKR
dec $0C dec length
bne L11C7 bne bell1 ; repeat length times
rts rts
.endproc
;;; ------------------------------------------------------------ ;;; ------------------------------------------------------------
;;; MLI call params ;;; MLI call params