123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- modemenu:
- ;Set the font to the pixel-aligned font
- ld a,2
- ld (textmode),a
- ld hl,modemenu_header+5
- ld de,mode_menu_header_RAM+5
- ld bc,6
- ld a,c
- ld (font_height),a
- lddr
- ld (menutopinit),bc
- ld (menudefault),bc
- ld hl,menu_header_getter
- ld (menu_header_get),hl
- ex de,hl
- inc hl
- ld bc,$120D
- ld de,$3B27
- ld ix,modemenu_getselect
- call menuroutine
- xor a
- ld (textmode),a
- ret
- mode_menu_header_getter:
- or a
- jr z,$+4
- xor a
- ret
- ld hl,mode_menu_header_RAM
- or h
- ret
- modemenu_getselect:
- jr nc,modemenu_opt
- ; If the user pressed [Enter], then we need to re-enter!
- ld a,(k_save)
- sub 9
- ret nz
- call +_
- jp menu_render
- _:
- ld a,(menucur)
- dec a
- jp z,toggle_token_hook
- ld a,(flags+appLwrCaseFlag)
- xor 1<<lwrCaseActive
- ld (flags+appLwrCaseFlag),a
- ret
- modemenu_opt:
- ld a,c
- cp 2
- ccf
- ret c
- dec a
- jr nz,+_
- ld hl,s_Token_Hook
- ld de,mode_menu_scrap
- ld bc,11
- ldir
- bit tokenHookActive,(iy+hookflags3)
- jr z,s_onoff
- ;verify it is the same page as Grammer
- ld hl,(tokenHookPtr+2)
- in a,(6)
- cp l
- ld hl,s_Off
- jr nz,$+5
- ld hl,s_On
- call mov4
- ld hl,mode_menu_scrap
- or a
- ret
- _:
- ld hl,s_Lowercase
- ld de,mode_menu_scrap
- ld bc,10
- ldir
- bit lwrCaseActive,(iy+appLwrCaseFlag)
- s_onoff:
- ; z means OFF, nz means ON
- ld hl,s_On
- jr nz,$+5
- ld hl,s_Off
- call mov4
- ld hl,mode_menu_scrap
- ret
- toggle_token_hook:
- ;Gotta toggle the token hook
- ;Point to the page and load the token hook page in A
- ld hl,tokenHookPtr+2
- in a,(6)
- ;If token hook is inactive, we need to set it to Grammer's
- bit tokenHookActive,(iy+hookflags3)
- jr z,tokenhook_on
- ;The token hook is active.
- ;If it is Grammer's, need to reset
- cp (hl)
- jr z,resetTokenHook
- tokenhook_on:
- ;Now we have to actually set the hook
- ;We'll do it manually, I still have flashbacks to thepenguin77's April Fools Joke of 2011
- ;HL already points to where the page should be written, and A is the page
- ld (hl),a
- ld hl,TokenHook
- ld (tokenHookPtr),hl
- set tokenHookActive,(iy+hookflags3)
- ;now reset the tokenhook opt-out
- call p1_FindGVarData
- or a
- ret nz
- res tokenhook_optout,(hl)
- ret
- resetTokenHook:
- res tokenHookActive,(iy+hookflags3)
- ;now set the tokenhook opt-out
- call p1_FindGVarData
- or a
- ret nz
- set tokenhook_optout,(hl)
- ret
- modemenu_header:
- .db "MODES",0
- s_Lowercase:
- .db "LOWERCASE",$29,0
- s_Token_Hook:
- .db "TOKEN",$29,"HOOK",$29,0
- s_On:
- .db "ON",0
- s_Off:
- .db "OFF",0
|