launch.z80 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ; This program launches Grammer2.
  2. ; If the input is a string, this assumes it is the name of the program to execute.
  3. ; Otherwise, this starts an in-line parser.
  4. #include "grammer2.5.inc"
  5. _FindApp = 4C4Eh
  6. .db $BB,$6D
  7. .org $9D95
  8. ; move the app name into OP1
  9. ld hl,app_name
  10. rst rMov9ToOP1
  11. bcall(_FindApp) ; locate the app
  12. ret c ; exit if it isn't found
  13. ; Now A is the page that the app is on, but we need to save the current page so
  14. ; that we can restore it later.
  15. ld b,a ; save A
  16. in a,(6) ; Get the current page
  17. ld (page_restore),a ; save it to our restore location (self-modifying code)
  18. ld a,b ; get the app's page in A again
  19. out (6),a ; write the app's page
  20. ; Grammer already contains a routine to parse Ans and execute code accordingly,
  21. ; so all we need to do is call ProgramAccessStart
  22. call ProgramAccessStart
  23. ;restore the page
  24. .db $3E ;start of `ld a,*`
  25. page_restore:
  26. .db 0 ;dummy value, this gets overwritten
  27. out (6),a
  28. ret
  29. app_name:
  30. .db $14,"Grammer",0