Advertisement
Guest User

Untitled

a guest
Jan 4th, 2021
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. public _InstallStartHook
  2. public _ClearStartHook
  3.  
  4. include 'include/ez80.inc'
  5. include 'include/tiformat.inc'
  6. include 'include/ti84pceg.inc'
  7.  
  8. _hook_start_addr:
  9. virtual at ti.appData
  10. _hook_start:
  11. db $83
  12. ;ld (ti.plotSScreen),a
  13. cp ti.kPrgm ; was Prgms pressed?
  14. ret nz
  15. ld a, ti.cxCmd
  16. call ti.NewContext ; just attempt a cleanup now
  17. call ti.CursorOff
  18. call ti.RunIndicOff
  19. ;check if there's enough memory
  20. ld hl,9
  21. call ti.EnoughMem
  22. jq c,NotEnoughMemory
  23. ;delete the entry program
  24. ld hl,Prog_Name
  25. ;ld de,ti.OP1
  26. ;ld bc,3 ; type (1) + name (1) + zero (1)
  27. ;ldir
  28. call ti.Mov9ToOP1
  29. call ti.ChkFindSym
  30. ;ret c
  31. call ti.DelVarArc
  32. ;create the new program
  33. ld hl,Prog_Name
  34. call ti.Mov9ToOP1
  35. ld hl,9 ;the data is 9 bytes long
  36. ld a, ti.ProgObj
  37. call ti.CreateVar
  38. ;write the stuff to it
  39. inc de
  40. inc de
  41. ld hl, Prog_Data
  42. ld bc, Prog_Data_End - Prog_Data
  43. ldir
  44. ld a, ti.kEnter
  45. call ti.JForceCmd
  46. ret
  47. NotEnoughMemory:
  48. ld hl, String_Mem
  49. call ti.PutS
  50. ret
  51. NotInEditor:
  52. ld hl, String_Editor
  53. call ti.PutS
  54. ret
  55. Prog_Name:
  56. db ti.ProgObj, "#", 0
  57. Prog_Data:
  58. db $bb, $6a, ti.tProg, "VYSION"
  59. Prog_Data_End:
  60. String_Mem:
  61. db "Not enough memory...", 0
  62. String_Editor:
  63. db "Not in editor...", 0
  64. load code: $-_hook_start from _hook_start
  65. end virtual
  66. db code
  67.  
  68.  
  69. _InstallStartHook:
  70. ld iy, ti.flags
  71. ld hl,_hook_start_addr
  72. ld de,ti.appData
  73. ld bc,lengthof code
  74. ldir
  75. ld hl,ti.appData
  76. ;jp ti.plotSScreen
  77. call ti.SetGetKeyHook
  78. set 0, (iy + ti.hookflags1)
  79. set 5, (iy + ti.hookflags1)
  80. ;call ti.ClrScrn
  81. ;call ti.HomeUp
  82. ;ld hl, String_Success
  83. ;call ti.PutS
  84. ;.getkey:
  85. ;wait for a keypress
  86. ;call ti.GetCSC
  87. ;or a,a
  88. ;jr z,.getkey
  89. ret
  90. ;String_Success:
  91. ;db "Successfully installed.", 0
  92.  
  93. _ClearStartHook:
  94. ;all of this is probably unnecessary
  95. ld iy, ti.flags
  96. call ti.ClrGetKeyHook
  97. call ti.ClrRawKeyHook
  98. res 0, (iy + ti.hookflags1)
  99. res 5, (iy + ti.hookflags1)
  100. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement