mirror of
https://github.com/mgcaret/davex-mg-utils.git
synced 2025-01-02 14:29:19 +00:00
fastchip program now working
This commit is contained in:
parent
0f0c7d2c56
commit
9d87982ce6
94
fastchip.s
94
fastchip.s
@ -5,15 +5,17 @@
|
|||||||
;
|
;
|
||||||
; options:
|
; options:
|
||||||
; -l List speeds and exit
|
; -l List speeds and exit
|
||||||
; -e <num> Enable FastChip, 1 = on, 0 = off (sync)
|
|
||||||
; -s <num> Set speed, 0-40, see -l for list of speed values
|
; -s <num> Set speed, 0-40, see -l for list of speed values
|
||||||
|
; Setting speed to 0 (off) causes a reboot.
|
||||||
; -p <str> Set slot speeds, slot numbers in str are set to fast, rest slow
|
; -p <str> Set slot speeds, slot numbers in str are set to fast, rest slow
|
||||||
; To set all slow, use -p 0. Will not set Disk IIs to fast.
|
; To set all slow, use -p 0. Will not set Disk IIs to fast.
|
||||||
; -a <num> Set audio (speaker) delay, 0-4 (Off/Fast/Normal/Music/Hifi)
|
; -a <num> Set audio (speaker) delay, 0-4 (Off/Fast/Normal/Music/Hifi)
|
||||||
; -j <num> Set joystick delay, 0-2 (Off/Short/Long)
|
; -j <num> Set joystick delay, 0-2 (Off/Short/Long)
|
||||||
; -b <num> Set backlight, 0-5 (Off/Fade/Speed/R/G/B)
|
; -b <num> Set backlight, 0-5 (Off/Fade/Speed/R/G/B)
|
||||||
|
; -y Answer reboot y/n questions with yes
|
||||||
;
|
;
|
||||||
; Invalid values are silently ignored.
|
; Invalid values are silently ignored. Settings that will cause a reboot
|
||||||
|
; will be confirmed unless -y is given.
|
||||||
;
|
;
|
||||||
; No options: List current settings
|
; No options: List current settings
|
||||||
; %hend
|
; %hend
|
||||||
@ -55,12 +57,12 @@ prbyte = $fdda
|
|||||||
DX_info $01,$12,dx_cc_iie_or_iigs,$00
|
DX_info $01,$12,dx_cc_iie_or_iigs,$00
|
||||||
DX_ptab
|
DX_ptab
|
||||||
DX_parm 'l',t_nil ; list speeds
|
DX_parm 'l',t_nil ; list speeds
|
||||||
DX_parm 'e',t_int1 ; enable/disable
|
|
||||||
DX_parm 's',t_int1 ; speed
|
DX_parm 's',t_int1 ; speed
|
||||||
DX_parm 'p',t_string ; slot speeds
|
DX_parm 'p',t_string ; slot speeds
|
||||||
DX_parm 'a',t_int1 ; speaker delay
|
DX_parm 'a',t_int1 ; speaker delay
|
||||||
DX_parm 'j',t_int1 ; joystick delay
|
DX_parm 'j',t_int1 ; joystick delay
|
||||||
DX_parm 'b',t_int1 ; backlight
|
DX_parm 'b',t_int1 ; backlight
|
||||||
|
DX_parm 'y',t_nil ; force yes
|
||||||
DX_end_ptab
|
DX_end_ptab
|
||||||
DX_desc "Control FastChip //e."
|
DX_desc "Control FastChip //e."
|
||||||
DX_main
|
DX_main
|
||||||
@ -92,7 +94,7 @@ exiterr: lda #$ff
|
|||||||
jsr xmess
|
jsr xmess
|
||||||
asc_hi "No FastChip detected!"
|
asc_hi "No FastChip detected!"
|
||||||
.byte $8d,$00
|
.byte $8d,$00
|
||||||
; jmp exiterr ; comment out for basic emulator testing
|
jmp exiterr ; comment out for basic emulator testing
|
||||||
doit: lda #$00
|
doit: lda #$00
|
||||||
sta showall
|
sta showall
|
||||||
jsr try_all
|
jsr try_all
|
||||||
@ -106,7 +108,7 @@ doit: lda #$00
|
|||||||
php
|
php
|
||||||
sei
|
sei
|
||||||
jsr fcunlock
|
jsr fcunlock
|
||||||
jsr try_state
|
sta fcenable
|
||||||
jsr try_speed
|
jsr try_speed
|
||||||
jsr try_slots
|
jsr try_slots
|
||||||
jsr try_speaker
|
jsr try_speaker
|
||||||
@ -117,36 +119,27 @@ doit: lda #$00
|
|||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc try_state
|
|
||||||
lda #'e'|$80
|
|
||||||
jsr xgetparm_ch
|
|
||||||
bcs done
|
|
||||||
cpy #$02 ; too big?
|
|
||||||
bcs done
|
|
||||||
cpy #$01
|
|
||||||
bne :+ ; want disable
|
|
||||||
lda #$01
|
|
||||||
sta fcenable ; enable
|
|
||||||
bne diddone
|
|
||||||
: lda #$01 ; anything but $a6 or $6a
|
|
||||||
sta fcbase ; disable
|
|
||||||
diddone: jsr show_state
|
|
||||||
inc showall
|
|
||||||
done: rts
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
.proc try_speed
|
.proc try_speed
|
||||||
lda #'s'|$80
|
lda #'s'|$80
|
||||||
jsr xgetparm_ch
|
jsr xgetparm_ch
|
||||||
bcs done
|
bcs done
|
||||||
|
cpy #0
|
||||||
|
beq disable
|
||||||
cpy #41 ; too big?
|
cpy #41 ; too big?
|
||||||
bcs done
|
bcs done
|
||||||
lda #CFG_SPEED
|
doset: lda #CFG_SPEED
|
||||||
sta fcregnum ; config reg
|
sta fcregnum ; config reg
|
||||||
sty fcregval ; value
|
sty fcregval ; value
|
||||||
jsr show_speed
|
noset: jsr show_speed
|
||||||
inc showall
|
inc showall
|
||||||
done: rts
|
done: rts
|
||||||
|
disable: lda #'y'|$80
|
||||||
|
jsr xgetparm_ch
|
||||||
|
bcc :+
|
||||||
|
jsr ask_reboot
|
||||||
|
beq noset
|
||||||
|
: ldy #0
|
||||||
|
beq doset
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc try_slots
|
.proc try_slots
|
||||||
@ -245,10 +238,15 @@ done: rts
|
|||||||
|
|
||||||
; Show all current settings
|
; Show all current settings
|
||||||
.proc show_all
|
.proc show_all
|
||||||
|
jsr xmess
|
||||||
|
asc_hi "FastChip //e"
|
||||||
|
.byte $8d
|
||||||
|
asc_hi "------------"
|
||||||
|
.byte $8d,$00
|
||||||
php
|
php
|
||||||
sei
|
sei
|
||||||
jsr fcunlock
|
jsr fcunlock
|
||||||
jsr show_state
|
sta fcenable
|
||||||
jsr show_speed
|
jsr show_speed
|
||||||
jsr show_slots
|
jsr show_slots
|
||||||
jsr show_speaker
|
jsr show_speaker
|
||||||
@ -261,20 +259,6 @@ done: rts
|
|||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc show_state
|
|
||||||
jsr xmess
|
|
||||||
asc_hi "FastChip: "
|
|
||||||
.byte $00
|
|
||||||
lda fcenable
|
|
||||||
rol
|
|
||||||
rol
|
|
||||||
and #$01
|
|
||||||
jsr pr_onoff
|
|
||||||
lda #$8d
|
|
||||||
jsr cout
|
|
||||||
rts
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
.proc show_speed
|
.proc show_speed
|
||||||
jsr xmess
|
jsr xmess
|
||||||
asc_hi "Speed: "
|
asc_hi "Speed: "
|
||||||
@ -489,10 +473,8 @@ lp: jsr cout ; myidx reloaded at end of loop
|
|||||||
.proc fcdetect
|
.proc fcdetect
|
||||||
php
|
php
|
||||||
sei
|
sei
|
||||||
jsr fcunlock
|
jsr fcunlock ; unlock
|
||||||
lda fcenable ; current state
|
sta fcenable ; enable FC registers
|
||||||
php ; save it (S flag)
|
|
||||||
sta fcenable ; enable FC
|
|
||||||
lda fcenable ; now see if it's there
|
lda fcenable ; now see if it's there
|
||||||
bpl notfound ; bit 7 set if present and enabled
|
bpl notfound ; bit 7 set if present and enabled
|
||||||
ldy fcspeed ; speed reg
|
ldy fcspeed ; speed reg
|
||||||
@ -508,16 +490,11 @@ lp: jsr cout ; myidx reloaded at end of loop
|
|||||||
cpy fcregval ; config register data, saved speed
|
cpy fcregval ; config register data, saved speed
|
||||||
bne notfound ; no match, no fastchip
|
bne notfound ; no match, no fastchip
|
||||||
; at this point we have a high degree of confidence that FC is there
|
; at this point we have a high degree of confidence that FC is there
|
||||||
plp ; get initial state
|
jsr fclock ; lock it back up
|
||||||
bpl setslow ; was it disabled?
|
|
||||||
bmi found
|
|
||||||
setslow: sta fcbase ; a=0 from above; disable it
|
|
||||||
found: jsr fclock ; lock it back up
|
|
||||||
plp ; restore IRQs
|
plp ; restore IRQs
|
||||||
clc ; indicate found
|
clc ; indicate found
|
||||||
rts
|
rts
|
||||||
notfound: plp ; clean stack
|
notfound: plp ; restore IRQs
|
||||||
plp ; restore IRQs
|
|
||||||
sec ; indicate not found
|
sec ; indicate not found
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
@ -618,6 +595,21 @@ spdtab: .byte 0,0,0,2,0,3
|
|||||||
.byte 12,5,16,6
|
.byte 12,5,16,6
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
.proc ask_reboot
|
||||||
|
lda #$01
|
||||||
|
jsr xredirect
|
||||||
|
jsr xmess
|
||||||
|
asc_hi "Apply setting and reboot"
|
||||||
|
.byte $00
|
||||||
|
lda #'n'|$80
|
||||||
|
jsr xyesno2
|
||||||
|
php
|
||||||
|
lda #$ff
|
||||||
|
jsr xredirect
|
||||||
|
plp ; restore z flag
|
||||||
|
rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
.proc pr_err
|
.proc pr_err
|
||||||
jsr xmess
|
jsr xmess
|
||||||
asc_hi "Err!"
|
asc_hi "Err!"
|
||||||
|
Loading…
Reference in New Issue
Block a user