include 'include/ez80.inc'
include 'include/tiformat.inc'
include 'include/ti84pceg.inc'
format ti executable 'RUNSHELL'
hook_reloc_addr := ti.pixelShadow2
ld hl,hook ; copy hook to temp location
ld de,hook_reloc_addr
push de
ld bc,lengthof hook_code
ldir
pop hl
jp ti.SetGetKeyHook
hook:
db hook_code
virtual at hook_reloc_addr
hook_start:
db $83
cp a,ti.kPrgm ; check if [prgm] pressed
ret nz
ld a,ti.cxCmd
call ti.NewContext0 ; switch to homescreen
call ti.BufClear ; clear input buffer
ld de,(ti.t2ByteTok shl 8) or ti.tasm
call ti.BufInsert
ret z
ld hl,prgm_name
ld b,prgm_name.len
.insert:
push bc
push hl
ld de,0
ld e,(hl)
call ti.BufInsert ; insert program name
pop hl
pop bc
ret z
inc hl
djnz .insert
ld a,ti.kEnter
jp ti.JForceCmd ; press enter
prgm_name:
db ti.tProg,'VYSION'
.len := $-prgm_name
load hook_code: $-hook_start from hook_start
end virtual