diff --git a/src/cesium.8xp b/src/cesium.8xp index 6db4421..210eec1 100644 Binary files a/src/cesium.8xp and b/src/cesium.8xp differ diff --git a/src/data/textFrench.asm b/src/data/textFrench.asm index 8f8e81e..cd145f5 100644 --- a/src/data/textFrench.asm +++ b/src/data/textFrench.asm @@ -14,8 +14,8 @@ AutoBackupStr: .db "Sauver la RAM avant de lancer des prgms",0 ListAppsStr: .db "les applications Flash",0 -RunOnBootStr: - .db "Lancer Cesium au d",$82,"marrage",0 +ShortcutsStr: + .db "Activer les raccourcis clavier",0 ErrorStr: .db "ERREUR : Version",0 LibStr: diff --git a/src/routines/common.asm b/src/routines/common.asm index 8e65ee6..402866e 100755 --- a/src/routines/common.asm +++ b/src/routines/common.asm @@ -105,6 +105,20 @@ FindAppStart: CesiumAppName: .db "Cesium",0 +SetKeyHookPtr: + call FindAppStart + ld bc,0-CesiumStart + add hl,bc + push hl + ld bc,GetKeyHook + add hl,bc + ld (rawKeyHookPtr),hl + ld a,(shortcutKeys) + or a,a + call nz,_SetRawKeyHook + pop hl + ret + DeletePgrmFromUserMem: ld de,(asm_prgm_size) ; load total program totalPrgmSize or a,a diff --git a/src/routines/exit.asm b/src/routines/exit.asm index 112d0cd..1c16c17 100755 --- a/src/routines/exit.asm +++ b/src/routines/exit.asm @@ -11,6 +11,10 @@ FullExit: ld a,(AutoBackup) or a,a call nz,ClearOldBackup + call SetKeyHookPtr + ld hl,appdata + ld bc,200 + call _MemClear ld hl,WipeSafeRam_Start ld de,WipeSafeRam ld bc,WipeSafeRam_End-WipeSafeRam_Start diff --git a/src/routines/hooks.asm b/src/routines/hooks.asm index b422ecd..6865bc8 100755 --- a/src/routines/hooks.asm +++ b/src/routines/hooks.asm @@ -20,7 +20,10 @@ StopEverything: GetKeyHook: add a,e cp a,kPrgm - ret nz + jr z,StartCesium + ret + +StartCesium: di ld hl,$f0202c ld (hl),l @@ -31,7 +34,14 @@ GetKeyHook: ld (menuCurrent),a res curAble, (iy + curFlags) call _CloseEditEqu - ld hl,OP1 ; execute app + ld de,(asm_prgm_size) ; load total program size + or a,a + sbc hl,hl + ld (asm_prgm_size),hl ; delete whatever current program was there (in case someone uses getkey in a program) + ld hl,userMem + call _DelMem + ld hl,OP1 ; execute app + push hl ld (hl),'C' inc hl ld (hl),'e' @@ -45,22 +55,11 @@ GetKeyHook: ld (hl),'m' inc hl ld (hl),0 - ld hl,OP1 - push hl - ld de,(asm_prgm_size) ; load total program prgmSize - or a,a - sbc hl,hl - ld (asm_prgm_size),hl ; delete whatever current program was there - ld hl,userMem - call _DelMem ; HL->place to delete, DE=amount to delete - ld hl,$100 - call _EnoughMem pop hl - jp c, _ErrMemory call _FindAppStart ; This locates the start of executable code for an app ld a,E_Validation jp c,_JError ; If we can't find it, that's a problem (throw a validation error) - push hl ; push location of start of app + push hl call _ReloadAppEntryVecs call _RunIndicOff call _AppSetup @@ -68,34 +67,14 @@ GetKeyHook: set 6,(iy+$28) res 0,(iy+$2C) ; set some app flags set appAllowContext,(iy+APIFlg) ; turn on apps - ld hl,$D1787C ; copy to ram data location - ld bc,$FFF - call _MemClear ; zero out the ram data section pop hl ; hl -> start of app - push hl ; de -> start of code for app - ld bc,$100 ; bypass header information - add hl,bc - ex de,hl - ld hl,$18 ; find the start of the data to copy to ram - add hl,de - ld hl,(hl) - call __icmpzero ; initialize the bss if it exists - jr z,+_ - push hl - pop bc - ld hl,$15 - add hl,de - ld hl,(hl) - add hl,de - ld de,$D1787C ; copy it in - ldir -_: pop hl ; hl -> start of app ld bc,$100 ; bypass some header info add hl,bc push hl - pop de ld bc,$12 ; offset add hl,bc ld hl,(hl) - add hl,de + pop bc + add hl,bc + xor a,a jp (hl) diff --git a/src/routines/main.asm b/src/routines/main.asm index 468a6d1..fe31b8e 100755 --- a/src/routines/main.asm +++ b/src/routines/main.asm @@ -1,6 +1,13 @@ CESIUM_OS_BEGIN: - push af + cp a,$aa + jr z,LoadSettings + xor a,a + sbc hl,hl + ld (currSelAbs),hl + ld (scrollamt),hl + ld (currSel),a ; op1 holds the name of this program + LoadSettings: ld hl,settingsAppVar call _Mov9ToOP1 @@ -24,9 +31,7 @@ LoadSettings: ld de,TmpSettings ldir ; copy the temporary settings to the lower stack - call FindAppStart - ld bc,0-CesiumStart - add hl,bc + call SetKeyHookPtr push hl ld bc,ParserHook add hl,bc @@ -54,15 +59,6 @@ LoadSettings: ld bc,ErrCatchBASIC add hl,bc ld (BASICERROR_HANDLER+1),hl - pop af - cp a,$AA - jr z,RELOADED_FROM_PRGM - xor a,a - sbc hl,hl - ld (currSelAbs),hl - ld (scrollamt),hl - ld (currSel),a ; op1 holds the name of this program -RELOADED_FROM_PRGM: res onInterrupt,(iy+OnFlags) ; this bit of stuff just enables the [on] key call ClearScreens call _GetBatteryStatus ;> 75%=4 ;50%-75%=3 ;25%-50%=2 ;5%-25%=1 ;< 5%=0 diff --git a/src/routines/reloader.asm b/src/routines/reloader.asm deleted file mode 100755 index e69de29..0000000 diff --git a/src/routines/settings.asm b/src/routines/settings.asm index dab1e85..c5cfad2 100755 --- a/src/routines/settings.asm +++ b/src/routines/settings.asm @@ -1,5 +1,5 @@ CreateDefaultSettings: - ld hl,10 + ld hl,12 call _EnoughMem jp c,FullExit ld hl,10