Browse Source

Tokenhook now defaults to ON, using appv GVarData for opt-out flag

Zeda Thomas 4 years ago
parent
commit
cc48da335d
8 changed files with 65 additions and 14 deletions
  1. 2 0
      docs/grammer2.5.inc
  2. 5 0
      src/01.z80
  3. 11 1
      src/grammer.z80
  4. 2 0
      src/grammer2.5.inc
  5. 0 13
      src/main.z80
  6. 12 0
      src/modemenu.z80
  7. 10 0
      src/ramcode.z80
  8. 23 0
      src/startmenu.z80

+ 2 - 0
docs/grammer2.5.inc

@@ -121,6 +121,8 @@ parserHookActive  = 1		;1 = parser hook active
 appLwrCaseFlag    = 24h
 lwrCaseActive     = 3
 
+;This is used in gvardata
+tokenhook_optout  = 0
 ;===============================================================================
 
 

+ 5 - 0
src/01.z80

@@ -95,6 +95,11 @@ menu_code_start:
 #include "subroutines/heapsort.z80"
 #include "subroutines/zcomp.z80"
 
+p1_FindGVarData:
+  ld hl,FindGVarData
+  ld (prev_page_call_address),hl
+  jp prev_page_call
+
 p1_PutTokenText:
   ld bc,PutTokenText
   ld (prev_page_call_address),bc

+ 11 - 1
src/grammer.z80

@@ -4089,9 +4089,18 @@ FindGVarData:
   ld hl,GVarData
   rst rMov9ToOP1
   bcall(_ChkFindSym)
-  ret nc
+  ld a,b
+  jr nc,GetVarInfoVarFound
   ld hl,3
   bcall(_CreateAppVar)
+  ld hl,4
+  add hl,de
+  xor a
+  ld (hl),a
+  dec hl
+  ld (hl),a
+  dec hl
+  ld (hl),a
   ret
 GetVarName:
   call ParseFullArg
@@ -4494,6 +4503,7 @@ BufferToLCD:
 #include "subroutines/chardim.z80"
 #include "subroutines/ConvOP1.z80"
 #include "parserinterrupt.z80"
+#include "startmenu.z80"
 #include "err.z80"
 #include "commandtable.z80"
 

+ 2 - 0
src/grammer2.5.inc

@@ -121,6 +121,8 @@ parserHookActive  = 1		;1 = parser hook active
 appLwrCaseFlag    = 24h
 lwrCaseActive     = 3
 
+;This is used in gvardata
+tokenhook_optout  = 0
 ;===============================================================================
 
 

+ 0 - 13
src/main.z80

@@ -9,16 +9,3 @@ _:
 	bcall(_clrTxtShd)
   bcall(_saveCmdShadow)
   bcall(_JForceCmdNoChar)
-StartMenu:
-  ld bc,0
-  ld (TempWord3),a
-  ld (TempWord4),bc
-  ld (TempWord5),hl
-  call FindGVarData
-  ld a,b \ or a
-  jr nz,+_
-_:
-  in a,(6)
-  ld hl,GrammerHook
-  bcall(_SetParserHook)
-#include "startmenu.z80"

+ 12 - 0
src/modemenu.z80

@@ -119,9 +119,21 @@ tokenhook_on:
   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
 
 

+ 10 - 0
src/ramcode.z80

@@ -1,4 +1,14 @@
 RAMCodeStart:
+_:
+readbyte = -_-RAMCodeStart+ramCode
+  ld c,6
+  in b,(c)
+  out (6),a
+  ld d,(hl)
+  inc l
+  call z,IncHLMem1
+  out (c),b
+  ret
 
 _:
 IncHLMem1 = -_-RAMCodeStart+ramCode

+ 23 - 0
src/startmenu.z80

@@ -1,3 +1,26 @@
+setup_parserhook:
+  call SetUpData
+  call FindGVarData
+  call readbyte
+  ;D is the flags
+  bit tokenhook_optout,d
+  call z,p0_tokenhook_on
+  in a,(6)
+  ld hl,GrammerHook
+  bcall(_SetParserHook)
+  ret
+p0_tokenhook_on:
+  ld hl,tokenhook_on
+  ld (next_page_call_address),hl
+  ld hl,tokenHookPtr+2
+  dec b
+  ld a,b
+  jp next_page_call
+
+
+
+StartMenu:
+  call setup_parserhook
 startmenu__:
 ;need to add in the options at the bottom
 ;add title at the top