smartport call

This commit is contained in:
Joshua Bell 2018-02-16 17:17:54 -08:00
parent 9b721cfb33
commit 2a1c7fb7f9

View File

@ -6505,49 +6505,55 @@ L45A9: .byte $00,$00,$00,$00,$00,$00,$00,$00
;; Possibly SmartPort STATUS call to determine ejectability ??? ;; Possibly SmartPort STATUS call to determine ejectability ???
.proc L45B2 .proc L45B2
ptr := $6
ldx L4597 ldx L4597
beq L45C6 beq done
stx L45A0 stx L45A0
L45BA: lda L4597,x : lda L4597,x
jsr L45C7 jsr L45C7
sta L45A0,x sta L45A0,x
dex dex
bne L45BA bne :-
L45C6: rts done: rts
L45C7: sta L4637 L45C7: sta unit_num
txa txa
pha pha
tya tya
pha pha
;; Compute driver address ($BFds for Slot s Drive d)
ldx #$11 ldx #$11
lda L4637 lda unit_num
and #$80 and #$80 ; high bit is drive (0=D1, 1=D2)
beq L45D9 beq L45D9
ldx #$21 ldx #$21
L45D9: stx L45EC L45D9: stx bf_lo ; D1=$11, D2=$21
lda L4637 lda unit_num
and #$70 and #$70
lsr a lsr a
lsr a lsr a
lsr a lsr a
clc clc
adc L45EC adc bf_lo
sta L45EC sta bf_lo
L45EC := *+1 bf_lo := *+1
lda $BF00 ; self-modified lda $BF00 ; self-modified to $BFds
sta $06+1 sta ptr+1
lda #0 lda #0 ; Bug: assumes driver is at $XX00 ???
sta $06 sta ptr ; Bug: Should check driver is $Cn before continuing
ldy #7 ldy #7
lda ($06),y lda (ptr),y ; $Cn07 == 0 for SmartPort
bne L4627 bne notsp
;; Locate SmartPort entry point: $Cn00 + ($CnFF) + 3
ldy #$FF ldy #$FF
lda ($06),y lda (ptr),y
clc clc
adc #$03 adc #3
sta $06 sta ptr
lda L4637 lda unit_num
pha pha
rol a rol a
pla pla
@ -6560,36 +6566,44 @@ L45D9: stx L45EC
plp plp
adc #1 adc #1
sta L463A sta status_params_unit_num
jsr L4634 ;; Execute SmartPort call
.byte 0 ; ??? jsr call
.addr L4639 .byte 0 ; STATUS
.addr status_params
lda L463E lda status_buffer
and #$10 and #$10 ; general status byte, $10 = disk in drive
beq L4627 beq notsp
lda #$FF lda #$FF
bne L4629 bne finish
L4627: lda #$00
L4629: sta L4638 notsp: lda #0 ; not SmartPort
finish: sta result
pla pla
tay tay
pla pla
tax tax
return L4638 return result
L4634: jmp ($06) call: jmp (ptr)
L4637: .byte 0 unit_num:
L4638: .byte 0 .byte 0
result: .byte 0
;; params for call ;; params for call
L4639: .byte 3 .proc status_params
L463A: .byte 1 param_count: .byte 3
.addr L463E unit_num: .byte 1
.byte 0 list_ptr: .addr status_buffer
L463E: .res 16, 0 status_code: .byte 0
.endproc
status_params_unit_num := status_params::unit_num
status_buffer: .res 16, 0
.endproc .endproc
;;; ================================================== ;;; ==================================================