35 Commits c336c2b4d6 ... d7d68b8e0d

Author SHA1 Message Date
  Zeda Thomas d7d68b8e0d forgot this define for the float routines :x 4 years ago
  Zeda Thomas 98076df6da Advancing the version to 2.51.0.0 4 years ago
  Zeda Thomas d22ca74c55 updating the readme 4 years ago
  Zeda Thomas cc48da335d Tokenhook now defaults to ON, using appv GVarData for opt-out flag 4 years ago
  Zeda Thomas 0703e9537f further subdivision of the tokenhook LUT to speed up search 4 years ago
  Zeda Thomas c57f1be288 fixed issues with build script 4 years ago
  Zeda Thomas 89bf3c83b9 Merge pull request #49 from NonstickAtom785/master 4 years ago
  Zeda Thomas c3bcb94b56 fixed some issues, renamed some 4 years ago
  NonstickAtom785 7f28cd0541 fixes error? 4 years ago
  NonstickAtom785 b0c6d2d244 Commented Length 4 years ago
  NonstickAtom785 d7e83c0f1d Update tokenhook.z80 4 years ago
  NonstickAtom785 d4875ce11e Fixed the issue on my side... 4 years ago
  NonstickAtom785 debbf20d8e Fixed name length for setI 4 years ago
  NonstickAtom785 16d87b23d0 Update tokenhook.z80 4 years ago
  NonstickAtom785 1c6508376c Update tokenhook.z80 4 years ago
  Zeda Thomas e8e5a4dcbd fixed tokenhook bug, modified proposed token replacements. 4 years ago
  NonstickAtom785 72560e2cc1 Added a bunch of Data 4 years ago
  NonstickAtom785 7aa4f2c6d1 Update tokenhook.z80 4 years ago
  NonstickAtom785 25264239c0 Added Search, ins, del, & inStr 4 years ago
  NonstickAtom785 6273c6f3f4 Update tokenhook.z80 4 years ago
  NonstickAtom785 b32df31339 Update tokenhook.z80 4 years ago
  NonstickAtom785 1898f10d9d Merge pull request #6 from Zeda/master 4 years ago
  Zeda Thomas 92349f7118 fixed small font and omnicalc font text to allow archived font data #14 4 years ago
  Zeda Thomas 731ba78290 Merge branch 'master' of https://github.com/Zeda/Grammer2 4 years ago
  Zeda Thomas 2ebd3d6960 fixed Get( to now return the starting data address of archived vars 4 years ago
  Zeda Thomas 5da51926e2 Merge pull request #48 from NonstickAtom785/master 4 years ago
  NonstickAtom785 861d7262be Merge pull request #5 from Zeda/master 4 years ago
  NonstickAtom785 75fffdd856 Added /bin to ignore list 4 years ago
  NonstickAtom785 6238a24be1 Added bin folder creation 4 years ago
  NonstickAtom785 874ec863d4 Update .gitmodules 4 years ago
  NonstickAtom785 e066f16821 Update .gitmodules 4 years ago
  NonstickAtom785 ab1390cbcc Update .gitmodules 4 years ago
  NonstickAtom785 507e36d290 Advance Version 4 years ago
  NonstickAtom785 e111904c2a Advance version 4 years ago
  NonstickAtom785 cfc9b39d02 Merge pull request #3 from Zeda/master 4 years ago
15 changed files with 194 additions and 97 deletions
  1. 1 0
      .gitignore
  2. 3 1
      compile
  3. 1 0
      compile.bat
  4. 2 0
      docs/grammer2.5.inc
  5. 16 18
      docs/readme.md
  6. 5 0
      src/01.z80
  7. 22 22
      src/gfx/text.z80
  8. 30 7
      src/grammer.z80
  9. 2 0
      src/grammer2.5.inc
  10. 1 1
      src/grammerdata.z80
  11. 0 13
      src/main.z80
  12. 12 0
      src/modemenu.z80
  13. 10 0
      src/ramcode.z80
  14. 23 0
      src/startmenu.z80
  15. 66 35
      src/tokenhook.z80

+ 1 - 0
.gitignore

@@ -3,6 +3,7 @@
 /readme
 /examples
 /localdocs
+/bin
 todo.*
 *.zip
 *.8*

+ 3 - 1
compile

@@ -1,5 +1,7 @@
 #!/bin/bash
 
+mkdir -p bin
+
 cd src
 
 echo -e "\e[1m\e[37mGenerating grammer2.5.inc\e[0m"
@@ -13,7 +15,7 @@ echo -e "\e[1m\e[37mAssembling App\e[0m"
 spasm grammer.z80 ../bin/grammer.8xk -I ../z80float/single
 
 # Check for an experimental package
-if [ ! -f "experimental/experimental.z80" ];then
+if [ ! -f "../bin/EXPRMNTL.8xv" ];then
   echo -e "\e[1m\e[37mAssembling Experimental Package\e[0m"
   spasm experimental/experimental.z80 ../bin/EXPRMNTL.8xv -I single
 fi

+ 1 - 0
compile.bat

@@ -3,6 +3,7 @@
 
 if exist spasm.exe (
   echo "Starting Compile..."
+  md bin
 ) else (
   echo "Opening readme..."
   start "" https://github.com/Zeda/Grammer2/blob/master/Readme.md

+ 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
 ;===============================================================================
 
 

+ 16 - 18
docs/readme.md

@@ -1,21 +1,19 @@
-<style>
-a{
-  text-decoration: none;
-  font-weight: bold;
-  border-bottom: 1px dotted gray;
-  color: black;
-}
-</style>
+<!--
+If you see this, you are probably viewing it as plaintext, and that should be
+fine, but it looks prettier when it is rendered as Markdown.
+You can see this document here:
 
-An HTML version of this file is in the `readme` folder :)
+    https://github.com/Zeda/Grammer2/blob/master/docs/readme.md
+
+-->
 
 # Commands and Tutorial
 ```
 Author........Zeda Thomas
 [email protected]
 Project.......Grammer
-Version.......2.50.7.1    (I will probably forget to change this :( )
-Last Update...7 November 2019
+Version.......2.51.0.0    (I will probably forget to change this :( )
+Last Update...15 February 2020
 Language......English
 Programming...Assembly
 Size..........2-Page app
@@ -602,17 +600,17 @@ Here is an error handler example
 
 | Name         | Description |
 |:------------ |:------- |
-| R▶Pr(        | This will clear the particle buffer.
-| R▶Pθ(        | This will recalculate the particle positions and draw them. If you want to change the particle buffer, just add a pointer argument. `Get("EBUF→A:R▶Pθ(A-2`
-| P▶Rx(        | This will add a particle to the buffer. Just use the pixel coordinate position. For example: `P▶Rx(2,2`
-| P▶Ry(        | This will change the particle effect. `0` is normal sand, `1` is boiling, `2` lets you put in a basic custom rule set. If you want it to check Down, then Left/Right, then Up, use the following pattern: `0000 1000 0110 0001`<sub>2</sub>. That makes it first check down, and if it cannot go down, it then checks left or right, and if it cannot go left or right, it tests up. In decimal, that is 2145, so you would do: `P▶Ry(2,2145`. To make things easier, though, you can just use a string. This will achieve the same effect: `P▶Ry(2,"D,LR,U`. **Note** that you do need the actual string, not a pointer.
-|  P▶Rx('      | This will convert a rectangular region of the screen to particles. The inputs are `P▶Rx('Y,X,Height,Width`. This scans the area for pixels that are turned on and adds them to the current particle buffer.
+| clrPart <sub>R►Pr(</sub>        | This will clear the particle buffer.
+| runPart <sub>R►PΘ(</sub>        | This will recalculate the particle positions and draw them. If you want to change the particle buffer, just add a pointer argument. `Get("EBUF→A:R▶Pθ(A-2`
+| addPart <sub>P►Rx(</sub>        | This will add a particle to the buffer. Just use the pixel coordinate position. For example: `P▶Rx(2,2`
+| partType <sub>P▶Ry(</sub>       | This will change the particle effect. `0` is normal sand, `1` is boiling, `2` lets you put in a basic custom rule set. If you want it to check Down, then Left/Right, then Up, use the following pattern: `0000 1000 0110 0001`<sub>2</sub>. That makes it first check down, and if it cannot go down, it then checks left or right, and if it cannot go left or right, it tests up. In decimal, that is 2145, so you would do: `P▶Ry(2,2145`. To make things easier, though, you can just use a string. This will achieve the same effect: `P▶Ry(2,"D,LR,U`. **Note** that you do need the actual string, not a pointer.
+| addPart(' <sub>P►Rx('</sub>     | This will convert a rectangular region of the screen to particles. The inputs are `P▶Rx('Y,X,Height,Width`. This scans the area for pixels that are turned on and adds them to the current particle buffer.
 
 ## Miscellaneous
 
 | Name         | Description |
 |:------------ |:------- |
-| ▶DMS         | Found in the angle menu, this is the "module" token. Modules allow you to extend Grammer's functionality. Grammer comes with a default module which must be included to use some functions (like the `Menu` command). Currently, you can have up to five other modules. For example, if you have a module packaged as an appvar called `MyModule`: `"5MyModule→▶DMS`. In order to execute a function `MyFunc(` from one of the modules, use : `▶DMSMyFunc`. If you have the token hook enabled (from Grammer's main menu), it looks a little cleaner: `"5MyModule→$` and `$MyFunc`, respectively.
+| $ <sub>▶DMS</sub> | Found in the angle menu, this is the "module" token. Modules allow you to extend Grammer's functionality. Grammer comes with a default module which must be included to use some functions (like the `Menu` command). Currently, you can have up to five other modules. For example, if you have a module packaged as an appvar called `MyModule`: `"5MyModule→▶DMS`. In order to execute a function `MyFunc(` from one of the modules, use : `▶DMSMyFunc`. If you have the token hook enabled (from Grammer's main menu), it looks a little cleaner: `"5MyModule→$` and `$MyFunc`, respectively.
 | conj(        | **Warning:** I have no knowledge of musical jargon, so excuse my mistakes. This is a sound command with three inputs. The syntax is `conj(Note,Octave,Duration`. Notes are: 0=C, 1=C#, 2=D, 3=D#, 4=E, 5=F, 6=F#, 7=G, 8=G#, 9=A, 10=A#, 11=B. Octave is 0 to 6. Duration is in 64th notes. So for example, a 32nd dot note uses 3/64th time. Duration is thus 3.
 | conj('       | This sound routine has two different functions `conj('Duration,'Period` or `conj('Duration,DataLoc,Size`. This reads data for the period directly to save time (intead of converting numbers on the fly). Size is the size of the data in words, not bytes.
 
@@ -644,7 +642,7 @@ arrays and matrices. First, here are the commands you have to work with:
 | Unarchive    | Use this like `Archive`, except this unarchives the var
 | Delvar       | Use this like `Archive`, except this will delete a var
 | sub(         | Use this to remove data from a variable. the syntax is: `sub(#ofBytes,Offset,"Varname`. For example, to delete the first 4 bytes of program Alpha: `sub(4,0,"EAlpha`.
-| augment(     | This is used to insert data into a var. The syntax is: `augment(#ofbytes,Offset,"VarName`. For example, to insert 4 bytes at the beginning of appvar `Hello`: `augment(4,0,"UHello`.
+| ins <sub>augment</sub>     | This is used to insert data into a var. The syntax is: `augment(#ofbytes,Offset,"VarName`. For example, to insert 4 bytes at the beginning of appvar `Hello`: `augment(4,0,"UHello`.
 
 Display the first 4 bytes of prgmPROG  using `IS>(`
 ```

+ 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

+ 22 - 22
src/gfx/text.z80

@@ -101,14 +101,15 @@ _:
   add hl,bc
   add hl,bc
   adc hl,bc
+  ld a,(font_ptr_page)
   jp p,+_
-  ld a,h
-  add a,-$40
-  ld h,a
+  or a
+  jr z,+_
+  set 6,h
+  res 7,h
+  inc a
 _:
-  ld a,(font_ptr_page)
   ld bc,3
-  adc a,b
   ld de,$8005
   call readarc
   pop bc
@@ -194,29 +195,27 @@ OmniCalcFont:
   add hl,bc
   ld bc,(FontPointer)
   adc hl,bc
+  ld a,(font_ptr_page)
   jp p,+_
-  ld a,h
-  add a,-$40
-  ld h,a
+  or a
+  jr z,+_
+  set 6,h
+  res 7,h
+  inc a
 _:
-  ld a,(font_ptr_page)
   ld bc,7
-  adc a,b
   ld de,$8005
   call readarc
-  ld de,$8005
-  ld b,7
+  ld hl,0706h
+  ld b,h
 _:
-  ld a,(hl)
+  dec e
+  ld a,(de)
   rlca
   rlca
   rlca
   ld (de),a
-  inc e
-  inc hl
   djnz -_
-  ld de,$8005
-  ld hl,0706h
   jr VputSCStepIn
 VPutSC:
 ;Inputs:
@@ -227,14 +226,15 @@ VPutSC:
   add hl,bc
   add hl,bc
   adc hl,bc ;*3
+  ld a,(font_ptr_page)
   jp p,+_
-  ld a,h
-  add a,-$40
-  ld h,a
+  or a
+  jr z,+_
+  set 6,h
+  res 7,h
+  inc a
 _:
-  ld a,(font_ptr_page)
   ld bc,3
-  adc a,b
   ld de,$8005+6
   call readarc
   ld hl,$8005+6

+ 30 - 7
src/grammer.z80

@@ -35,6 +35,7 @@
 ;#define include_interrupt
 #define INCLUDE_GRAMPKG
 #define INDEX_VFONT      ;Allows faster font access for key portions of the font
+#define char_TI_TOK
 
 .org $4000
 .db $80,$0F, 0,0,0,0
@@ -2783,12 +2784,23 @@ GetToken:
   bcall(_ChkFindSym)
 VarTokenStepIn:
   jp c,return_BC_0
-  inc de
-  inc de
-  ld c,a
-  ld (ThetaPrimeVar),bc
-  ld b,d
-  ld c,e
+  ex de,hl
+  ld a,b
+  or a
+  jr z,+_
+  ld b,0
+  add hl,bc
+  ld c,10
+  adc hl,bc
+  jp p,+_
+  ld h,$40
+  inc a
+_:
+  ld (ThetaPrimeVar),a
+  inc hl
+  inc hl
+  ld b,h
+  ld c,l
   ret
 RepeatToken:
   push hl
@@ -3868,6 +3880,7 @@ _:
   pop hl
 
 ConvRStr_Float:
+
   ;HL points to the string
   dec hl
   ld a,(hl)
@@ -4078,9 +4091,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
@@ -4483,6 +4505,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
 ;===============================================================================
 
 

+ 1 - 1
src/grammerdata.z80

@@ -4,7 +4,7 @@ sinTable:
 .db 91,93,95,97,99,101,103,105,106,108,110,111,113,114,116,117
 .db 118,119,121,122,122,123,124,125,126,126,127,127,127,128,128,128
 StrVersion:
- .db "Grammer v2.50.9.6",0
+ .db "Grammer v2.51.0.0",0
 FrequencyLUT:
 .dw 2508,2367,2234,2109,1990,1879,1773,1674,1580,1491,1407,1328
 .dw 1254,1184,1117,1054,995,939,887,837,790,746,704,664

+ 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

+ 66 - 35
src/tokenhook.z80

@@ -18,15 +18,21 @@ TokenHook:
   ld a,3Eh
   cp (hl)
   jr nz,tokenhook_pop1exit
-  ld b,0
-  dec d
-  inc d
+  xor a
+  ld b,a
+  or d
   ld hl,TokenTable_0
   jr z,TokenSearchLoop
   ld hl,TokenTable_1
+  dec a
+  jr z,TokenSearchLoop
+  ld hl,TokenTable_2
 TokenSearchLoop:
-  ld a,e
-  cp (hl)
+  ld a,(hl)
+  and $FE
+;  ld a,e
+;  cp (hl)
+  cp e
   inc hl
   jr z,ChkByte2
 NotTokenMatch:
@@ -56,36 +62,61 @@ NoChange:
 TokenTable:
 TokenTable_0:
 ; .db $02,0,7,"module."
- .db $02,0,1,$F2    ;$
- .db $04,0,6,$05,"Float"
- .db $06,0,8,5,"lFactor"
- .db $28,0,7,"Insert("
- .db $36,0,7,"ClrPart"
- .db $38,0,7,"RunPart"
- .db $3A,0,8,"AddPart("
- .db $3C,0,9,"PartType("
- .db $44,0,5,"Misc("
- .db $58,0,1,5Fh
- .db $BE,0,5,"call "
- .db 0
+ .db $02,0,1,$F2           ;►DMS (turns into "$")
+ .db $04,0,6,$05,"Float"   ;►Dec
+ .db $06,0,8,5,"lFactor"   ;►Frac
+ .db $28,0,4,"ins "        ;augment(
+ .db $32,0,4,"max "        ;max(
+ .db $34,0,4,"min "        ;min(
+ .db $36,0,7,"clrPart"     ;R►Pr
+ .db $38,0,7,"runPart"     ;R►PΘ
+ .db $3A,0,8,"addPart "    ;P►Rx
+ .db $3C,0,9,"partType "   ;P►Ry
+ .db $44,0,5,"misc "       ;solve(
+ .db $58,0,1,5Fh           ;i (turns into "_")
+ .db $BE,0,5,"call "       ;prgm
+ .db $E6,0,5,"Mode "       ;Fix
+ .db $EC,0,9,"setUpInt "   ;Func
+ .db $EE,0,8,"StackOp "    ;Param
+ .db 0                     ;End of Table 0
 
 TokenTable_1:
- .db $38,1,5,"Rect("
- .db $3C,1,5,"Tile("
- .db $3E,1,7,"Sprite("
- .db $40,1,8,"TileMap("
- .db $48,1,9,"Contrast("
- .db $4E,1,9,"ShiftBuf("
- .db $62,1,7,"WriteB("
- .db $70,1,4,"Inv("
- .db $72,1,7,"WriteW("
-; .db $7E,1,2,"2^"
- .db $A6,1,4,"For "
- .db $B4,1,7,"GetInc("
- .db $B6,1,7,"GetDec("
- .db $BC,1,7,"SetBuf("
- .db $C0,1,8,"SetFont("
- .db $CE,1,8,"MakeVar("
- .db $D0,1,8,"FindVar("
- .db $72,4,4,"gbuf"
+ .db $26,1,5,"Text "       ;Text(
+ .db $38,1,5,"Rect "       ;Line(
+ .db $3C,1,5,"Tile "       ;Pt-On(
+ .db $3E,1,7,"Sprite "     ;Pt-Off(
+ .db $40,1,8,"TileMap "    ;Pt-Change(
+ .db $48,1,9,"Contrast "   ;Shade(
+ .db $4E,1,9,"shiftBuf "   ;Tangent(
+ .db $62,1,7,"WriteB "     ;int(
+ .db $70,1,4,"Inv "        ;not(
+ .db $72,1,7,"WriteW "     ;iPart(
+ .db $7C,1,4,"jmp "        ;ln(
+; .db $7E,1,2,"2^"         ;e^(
+ .db $A6,1,4,"For "        ;For(
+; .db $AA,1,6,"retPnt"      ;Return
+ .db $B4,1,7,"GetInc "     ;IS>(
+ .db $B6,1,7,"GetDec "     ;DS<(
+ .db $BC,1,7,"setBuf "     ;Disp
+ .db $BE,1,7,"DispBuf"     ;DispGraph
+ .db $C0,1,8,"setFont "    ;Output(
+ .db $CE,1,8,"MakeVar "    ;Send(
+ .db $D0,1,8,"FindVar "    ;Get(
  .db 0
+
+TokenTable_2:
+ .db $B4,3,6,"Local "      ;►Nom(
+ .db $BE,3,8,"randInt "    ;randInt(
+ .db $C2,3,4,"del "        ;sub(
+ .db $C8,3,6,"inStr "      ;inString(
+ .db $F4,3,5,"Play "       ;conj(
+ .db $FE,3,5,"eval "       ;expr(
+ .db $01,4,7,"Search "     ;length(   ;use 01 instead of 00 (00 indicates the end of the table)
+ .db $40,4,7,"StackE "     ;Pmt_End
+ .db $42,4,7,"StackS "     ;Pmt_Bgn
+ .db $72,4,4,"gbuf"        ;G-T
+ .db $7A,4,5,"Arch "       ;Archive
+ .db $7C,4,7,"UnArch "     ;UnArchive
+ .db $7E,4,4,"Asm "        ;Asm(
+ .db $82,4,7,"AsmHex "     ;AsmPrgm
+ .db 0                     ;End of Table 1