mirror of
https://github.com/mi57730/a2d.git
synced 2025-02-21 23:29:00 +00:00
Prevent crashes in Calculator/Eyes DA using ROM FP routines
During calls, MGTK uses the top half of the zero page to hold the active grafport and local variables. It normally saves/restores the ZP on each call so that the application's ZP state is preserved. Per docs, the ZP1 call with param $00 can be used to disable this; MGTK will write its state to the ZP and assume the ZP is not touched until a subsequent ZP1 call with param $80, allowing higher performance. DeskTop would normally run in this state ($00), except when DAs were invoked since they could use ROM routines (etc) and expect the top half of the ZP to be preserved during MGTK calls. But it did this with a toggle ($00, $80, run the DA, then $00 again). Confusingly, the Calc (and Eyes, c/o copy/pasta) DA would also attempt to get to a normal state when running ($80, run, $00). In rev 30532c31 I disabled DeskTop's toggling around DAs to fix an issue in the Sort Directory DA (see #119), which might have changed the overall behavior. The result is that on the IIc+ (and possibly other hardware, but not Virtual II or Laser 128EX) the Calc and Eyes DAs would crash. This change disables use of the ZP1 by DeskTop and the DAs. This will likely impair performance somewhat due to the save/restore overhead on each call, but at least this gets us to a "known good state". Fixes #157, #158
This commit is contained in:
parent
9e7fcdf9ea
commit
46e413f3f1
@ -666,7 +666,6 @@ window_title:
|
||||
init: sta ALTZPON
|
||||
lda LCBANK1
|
||||
lda LCBANK1
|
||||
MGTK_CALL MGTK::SetZP1, preserve_zp_params
|
||||
MGTK_CALL MGTK::OpenWindow, winfo
|
||||
MGTK_CALL MGTK::InitPort, grafport
|
||||
MGTK_CALL MGTK::SetPort, grafport
|
||||
@ -696,8 +695,9 @@ loop: lda adjust_txtptr_copied-1,x
|
||||
bne loop
|
||||
.endproc
|
||||
|
||||
lda #0 ; Turn off errors
|
||||
sta ERRFLG
|
||||
lda #0
|
||||
sta ERRFLG ; Turn off errors
|
||||
sta SHIFT_SIGN_EXT ; Zero before using FP ops
|
||||
|
||||
copy16 #error_hook, COUT_HOOK ; set up FP error handler
|
||||
|
||||
@ -772,7 +772,6 @@ ignore_click:
|
||||
exit: MGTK_CALL MGTK::CloseWindow, closewindow_params
|
||||
DESKTOP_CALL DT_REDRAW_ICONS
|
||||
lda ROMIN2
|
||||
MGTK_CALL MGTK::SetZP1, overwrite_zp_params
|
||||
|
||||
.proc do_close
|
||||
;; Copy following routine to ZP and invoke it
|
||||
|
@ -187,8 +187,6 @@ grow_box_bitmap:
|
||||
lda LCBANK1
|
||||
lda LCBANK1
|
||||
|
||||
;; Don't let MGTK smash zero page
|
||||
MGTK_CALL MGTK::SetZP1, preserve_zp_params
|
||||
lda #0
|
||||
sta SHIFT_SIGN_EXT ; Must zero before using FP ops
|
||||
|
||||
@ -214,7 +212,6 @@ grow_box_bitmap:
|
||||
.proc exit
|
||||
MGTK_CALL MGTK::CloseWindow, winfo
|
||||
DESKTOP_CALL DT_REDRAW_ICONS
|
||||
MGTK_CALL MGTK::SetZP1, overwrite_zp_params
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
@ -1559,10 +1559,7 @@ nope: dex
|
||||
;; Invoke it
|
||||
jsr set_pointer_cursor
|
||||
jsr reset_grafport3
|
||||
;; MGTK_RELAY_CALL MGTK::SetZP1, zp_use_flag0
|
||||
;; MGTK_RELAY_CALL MGTK::SetZP1, zp_use_flag1
|
||||
jsr DA_LOAD_ADDRESS
|
||||
;; MGTK_RELAY_CALL MGTK::SetZP1, zp_use_flag0
|
||||
lda #0
|
||||
sta running_da_flag
|
||||
|
||||
@ -15542,7 +15539,6 @@ end:
|
||||
MGTK_RELAY_CALL MGTK::StartDeskTop, startdesktop_params
|
||||
jsr desktop_main::set_mono_mode
|
||||
MGTK_RELAY_CALL MGTK::SetMenu, splash_menu
|
||||
MGTK_RELAY_CALL MGTK::SetZP1, zp_use_flag0
|
||||
MGTK_RELAY_CALL MGTK::SetCursor, watch_cursor
|
||||
MGTK_RELAY_CALL MGTK::ShowCursor
|
||||
;; fall through
|
||||
|
Loading…
x
Reference in New Issue
Block a user