Author Topic: Axe Parser  (Read 553812 times)

0 Members and 5 Guests are viewing this topic.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Parser
« Reply #2115 on: January 09, 2012, 03:41:10 pm »
Awesome ;D Where do you put the replacement token in the Axiom?




Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #2116 on: January 09, 2012, 03:44:43 pm »
Currently, I'm putting cached Axiom token replacements in appBackUpScreen, because I know that the OS will not touch this. Except for when you run an app, as the name suggests, but at that point you've exited the program editor. I still need to ask thepenguin77 if zStart wants this area of RAM when editing programs, in which case I should probably find another spot.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Parser
« Reply #2117 on: January 09, 2012, 03:47:12 pm »
I meant how would you define a replacement token when you're writing an Axiom that should have one?




Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #2118 on: January 09, 2012, 03:57:18 pm »
Oh sorry, I misread your post. :)

Basically, your standard Axiom looks like this:


.dw $C0DE
;Axiom commands go here
.dw 0


If you don't want any token replacements, you don't have to change a thing. This keeps backwards compatibility, which is always nice.
If you want token replacements, the layout extends to something like this:


.dw $C0DE
;Axiom commands go here
.dw 0
.dw $C0DE
.dw Tokens_End-Tokens
Tokens:
;For as many token replacements as you want:
.db HookLowByte, HookHighByte, StringLength, "String"
.db HookLowByte, HookHighByte, StringLength, "String"
Tokens_End:


HookLowByte and HookHighByte are different from the usual token values. To figure them out, I use a mix of this in combination with this. And StringLength is the length of the replacement ASCII string, which should not include a null terminator.



EDIT: Here's an example, taken from the Axiom I showed in the screenshot. It replaces GridOn with GrayOn, X₃ᴛ with Buf1, and Y₃ᴛ with Buf2.


.dw $C0DE
;Axiom commands go here
.dw 0
.dw $C0DE
.dw Tokens_End-Tokens
Tokens:
.dw 10*2+$0384
.db 6,"GrayOn"
.dw 14*2+$0220
.db 4,"Buf1"
.dw 15*2+$0220
.db 4,"Buf2"
Tokens_End:
« Last Edit: January 09, 2012, 04:01:46 pm by Runer112 »

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Axe Parser
« Reply #2119 on: January 09, 2012, 04:02:52 pm »
I'm a little lost ...

If I try it right now, this will not work because I need an additional code which you made, right ?

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #2120 on: January 09, 2012, 04:09:00 pm »
Axe doesn't have this functionality yet, which is why I spent the time to make a prototype version that does. ;) I haven't released it anywhere, since I think Quigibo would rather I give it to him and let him possibly tinker with it a bit and then release it officially. And existing Axioms don't have any token replacement data, so even with this new system, they will act just like they do currently. Only Axioms designed with this new system in mind will have token replacements. However, it is possible to tack on token replacement data to old Axioms if you properly resize the appvar and add in token replacement data.
« Last Edit: January 09, 2012, 04:15:34 pm by Runer112 »

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Parser
« Reply #2121 on: January 09, 2012, 06:36:33 pm »
Sounds really, really cool. I hope this gets implemented!
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #2122 on: January 10, 2012, 03:24:22 am »
Very cool!  I'd like to see that code, how you accomplished it.  And I don't mind if you show off the code here, I'm always willing to share code.  The only reason I haven't open-sourced Axe is simply because of standardization.  If other people were to modify and release the parser you could start seeing programs that each need a special version to compile and it can get annoying, these versions wouldn't get official updates either without a very active developer.  By keeping it closed, I can ensure reverse and forward-compatibility in a simple single version.  If you want to know how any chuck of the code looks though, I can always share.

Some things I'm particularly curious about:
- How do you know if the program has just been opened using only the token hook?  Would this process work during an instant scroll as well?  Even in DCS?
- What do you do (or prefer me to do) when there are more replacements than can fit in the buffer?  Especially with long names, it could only hold 80 or so max.
- Are you sure this doesn't slow down the scrolling too much with all these replacements?
- The token numbers are difficult for developers to type in manually, any ideas of how I could generate a list of equates?

Unrelated, but the other thing I realized a while ago is that its too difficult for Applications to use the framework.  All the absolute labels are in the $4000 range, and since an app is running here, I would have to generate an entirely new copy of the pseudo-lookup-table in order to change these addresses to the $8000 range.  And since space is a problem, I doubt I will be able to do that.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #2123 on: January 10, 2012, 03:41:19 am »
Code vomit:

Code: [Select]
.nolist
#include "ti83plus.inc"
.list

#define p_GetArc $55E7
#define p_ReadArcApp $5658
#define p_CopyArc $568D

#define TokenHook_Temp appBackUpScreen-2
#define AxiomTokens appBackUpScreen

.org $71E0

TokenHook_NotAxe:
ld bc,('A'<<8)+(StrPROGRAM&$FF)
TokenHook_CheckIfChanged:
ld de,textShadow
ld a,(de)
xor b
ret nz
push hl
ld h,StrPROGRAM>>8
ld l,c
B_CALL(_Mov7B)
B_CALL(_saveShadow)
B_CALL(_rstrShadow)
pop hl
xor a
ret

TokenHook:
.db $83
ld a,(cxCurApp)
cp kPrgmEd
ret nz
ld bc,(EditTop)
ld a,(bc)
cp tDecPt
jr nz,TokenHook_NotAxe
TokenHook_MaybeAxe:
inc bc
ld a,(bc)
cp tDecPt
jr z,TokenHook_IsAxe
sub tA
cp tTheta-tA+1
jr nc,TokenHook_NotAxe
TokenHook_IsAxe:
push hl
push de
ld bc,('P'<<8)+(StrAXESRC&$FF)
call TokenHook_CheckIfChanged
call z,TokenHook_AxiomSearch
pop de
ld hl,AxeTokens
ld b,0
jr TokenHook_CompareLoop_Start
TokenHook_CompareLoop:
cp e
inc hl
jr z,TokenHook_LowByteMatch
TokenHook_NoMatch:
inc hl
ld c,(hl)
inc c
add hl,bc
TokenHook_CompareLoop_Start:
ld a,(hl)
or a
jr nz,TokenHook_CompareLoop
TokenHook_DoneNoMatch:
add hl,hl
ld hl,AxiomTokens
jr nc,TokenHook_CompareLoop_Start
pop hl
ret
TokenHook_LowByteMatch:
ld a,(hl)
cp d
jr nz,TokenHook_NoMatch
TokenHook_Match:
ld de,localTokStr
push de
ld c,17
ldir
pop hl
pop bc
ret

TokenHook_AxiomSearch:
ld hl,AxiomTokens
B_CALL(_BufClr)
ld hl,-768
ld (TokenHook_Temp),hl
ld de,(editTop)
push de
ld hl,(editCursor)
push hl
push de
B_CALL(_BufToBtm)
ld hl,(editCursor)
pop de
or a
sbc hl,de
inc hl
ld b,h
ld c,l
ex de,hl
call TokenHook_AxiomSearch_Loop
TokenHook_AxiomSearch_Done:
pop hl
ld (editTop),hl
B_CALL(_BufToTop)
pop hl
ld (editTop),hl
ret

TokenHook_AxiomSearch_CheckHeader:
call ReadArc
inc de
add a,c
ld bc,$C0DE
sbc hl,bc
ld c,a
ret z
pop bc
TokenHook_AxiomSearch_Loop__:
pop bc
TokenHook_AxiomSearch_Loop_:
pop hl
TokenHook_AxiomSearch_Loop:
ld a,tAsmComp
cpir
ret po
push hl
dec hl
dec hl
ld a,(hl)
cp t2ByteTok
jr nz,TokenHook_AxiomSearch_Loop_
TokenHook_AxiomSearch_Backtrack:
dec hl
ld a,(hl)
cp tSpace
jr z,TokenHook_AxiomSearch_Backtrack
sub tColon
cp tEnter-tColon+1
jr nc,TokenHook_AxiomSearch_Loop_
TokenHook_AxiomSearch_FindAxiom:
pop hl
push hl
push bc
dec hl
rst 20h
ld hl,OP1
ld d,AppVarObj
ld (hl),d
call p_GetArc+1
jr c,TokenHook_AxiomSearch_Loop__
TokenHook_AxiomSearch_FoundAxiom:
ex de,hl
ld c,b
call TokenHook_AxiomSearch_CheckHeader
ld b,32+1
TokenHook_AxiomSearch_ScanAxiom:
call ReadArc
inc de
ld a,h
or l
jr z,TokenHook_AxiomSearch_EndOfAxiom
add hl,de
ld de,5
add hl,de
ex de,hl
djnz TokenHook_AxiomSearch_ScanAxiom
TokenHook_AxiomSearch_EndOfAxiom:
call TokenHook_AxiomSearch_CheckHeader
call ReadArc
inc de
ld a,c
ld b,h
ld c,l
ld hl,(TokenHook_Temp)
add hl,bc
jr c,TokenHook_AxiomSearch_Loop__
ld (TokenHook_Temp),hl
sbc hl,bc
push bc
ld bc,appBackUpScreen+768
add hl,bc
pop bc
ex de,hl
call p_CopyArc+5
jr TokenHook_AxiomSearch_Loop__

ReadArc:
ex de,hl
xor a
cp c
jr z,ReadArc_RAM
push bc
push hl
call p_ReadArcApp+11
pop de
inc de
pop bc
ret
ReadArc_RAM:
ld e,(hl)
inc hl
ld d,(hl)
ex de,hl
ret

AxeTokens:
.db $F4,$03,5,"Copy("
.db $FE,$03,5,"Exch("
.db $0E,$04,5,"Freq("
.db $66,$01,5,"Buff("
.db $62,$01,5,"sign{"
.db $06,$00,5,Lconvert,"Char"
.db $08,$04,4,Lconvert,"Hex"
.db $02,$04,5,"Data("
.db $4E,$01,7,"Bitmap("
.db $02,$00,4,Lconvert,"Tok"
.db $80,$04,7,"#Axiom("
.db $04,$04,5,"Rect("
.db $06,$04,6,"RectI("
.db $58,$02,3,LrecurV,"ar"
.db $5A,$02,4,"app",LrecurV
.db $5C,$02,3,"grp"
.db $F6,$01,4,"port"
.db $52,$01,5,"Text "
.db $D8,$01,8,"Pt-Mask("
.db $DA,$01,7,"pt-Get("
.db $D0,$01,3,"Get"
.db $14,$04,5,"rotC("
.db $16,$04,6,"rotCC("
.db $18,$04,6,"flipV("
.db $1A,$04,6,"flipH("
.db $C8,$03,7,"inData("
.db $B8,$01,5,"input"
.db $74,$01,6,"float{"
.db $72,$01,4,"nib{"
.db $F6,$03,9,"#Realloc("
.db $68,$01,6,"#Icon("
.db $80,$01,2,Llambda,"("
.db $38,$03,5,"Load("
.db $3A,$03,5,"Next("
.db $14,$03,7,"Render("
.db $3C,$03,6,"DrawL("
.db $3E,$03,6,"DrawR("
.db $16,$03,6,"DrawS("
.db $82,$03,6,"Print("
.db $44,$03,3,"Up("
.db $46,$03,5,"Down("
.db $5C,$03,5,"Left("
.db $40,$03,6,"Right("
.db $42,$03,4,"New("
.db $5E,$03,7,"Delete("
.db 0

StrPROGRAM:
.db "PROGRAM"
StrAXESRC:
.db "AXE SRC"
#if (StrPROGRAM>>8) != (StrAXESRC>>8)
.error "StrPROGRAM and StrAXESRC must have the same MSB"
#endif


Answers to your questions:
  • This is probably the trickiest, hackiest thing I had to do. And it turns out that the way I did it doesn't actually work with DoorsCS, but not because of its instant scroll. In the screenshot, I demonstrate changing the title of the program editor to "AXE SRC" when an Axe program is detected. However, this is more of an accident than a feature. To determine if the program editor was just opened and the file needs to be scanned for Axioms, I check if the program has a valid Axe header and (textShadow) equals 'P'. Whenever this is true, I change the title string so this condition does not occur again, scan for Axioms, and then continue the hook as usual. So this does work with instant scrolling, but it doesn't work with DoorsCS, only because it removes the top row of the program editor. It might be possible to use another RAM area that is written to upon opening a program for editing and thereafter not read or written to, which would allow for Axiom tokens to work in DoorsCS (Axe tokens still work fine), but I couldn't think of any.
  • When token replacements no longer fit, I just ignore them. But frankly, most Axioms only have a couple of commands so I'm not too worried about anyone going over the limit.
  • When no Axioms are detected, only a trivial amount of cycles for checking Axiom tokens is added to the token comparing stage. Scrolling in an Axe program with less than a dozen of so Axiom token replacements will actually be faster because I optimized the comparison loop. ;)
  • I didn't find it too difficult to make my own token hook comparison values. As long as the programmer has access to resources like this and this, it shouldn't be too difficult to calculate them.


EDIT: Oh, and if you plan on using this, it's probably a good idea to move TokenHook_Temp and AxiomTokens, since I recently figured out that zStart uses appBackUpScreen, and I know a lot of Axe users use zStart. statVars seems like a good alternative.

EDIT 2: Now that I think about it, I think I realized the much simpler way to determine if the program editor was just opened... If the saved previous value of cxCurApp isn't equal to kPrgmEd, set it to kPrgmEd, scan for Axioms, and then resume the token hook as usual.

EDIT 3: I knew this would happen, as soon as I release my code I think of improvements and bugs. Anyways, I forgot to make this properly find Axioms with names of less than 8 characters. Maybe later I'll just post a new version with all these edits taken into account.
« Last Edit: January 10, 2012, 05:19:18 am by Runer112 »

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #2124 on: January 10, 2012, 08:23:47 pm »
Sorry for the double post, but technically, this is a project update!


I fixed everything that I knew was bad about the previous version of the token hook that I posted. The updated hook is now:
  • DoorsCS compatible!
  • zStart compatible!
  • Compatible with any Axiom name length!
  • Faster!
  • Smaller!
  • And stronger, too!

Code: [Select]
.nolist
#include "ti83plus.inc"
.list

#define cxPrevApp cxPrev+cxCurApp-cxMain

#define p_GetArc $55E7
#define p_ReadArcApp $5658
#define p_CopyArc $568D

#define TokenHook_Temp appRawKeyHandle
#define AxiomTokens statVars
#define AxiomTokens_End curGStyle

.org $71E0


TokenHook:
.db $83
ld a,(cxCurApp)
cp kPrgmEd
ret nz
ld bc,(EditTop)
ld a,(bc)
cp tDecPt
ret nz
inc bc
ld a,(bc)
cp tDecPt
jr z,TokenHook_IsAxe
sub tA
cp tTheta-tA+1
ret nc
TokenHook_IsAxe:
push hl
ld hl,cxPrevApp
ld a,kPrgmEd
cp (hl)
jr z,TokenHook_SkipAxiomSearch
TokenHook_AxiomSearch:
ld (hl),a
push de
ld hl,AxiomTokens
ld (iy+statFlags),h
B_CALL(_BufClr)
ld hl,AxiomTokens-AxiomTokens_End
ld (TokenHook_Temp),hl
B_CALL(_IsAtTop)
push de
push hl
B_CALL(_BufToBtm)
B_CALL(_IsAtTop)
sbc hl,de
ld b,h
ld c,l
ex de,hl
call TokenHook_AxiomSearch_Loop
pop hl
ld (editTop),hl
B_CALL(_BufToTop)
pop hl
ld (editTop),hl
pop de
TokenHook_SkipAxiomSearch:
ld hl,AxeTokens
ld b,0
jr TokenHook_CompareLoop_Start
TokenHook_CompareLoop:
cp e
inc hl
jr z,TokenHook_LowByteMatch
TokenHook_NoMatch:
inc hl
ld c,(hl)
inc c
add hl,bc
TokenHook_CompareLoop_Start:
ld a,(hl)
or a
jr nz,TokenHook_CompareLoop
TokenHook_DoneNoMatch:
add hl,hl
ld hl,AxiomTokens
jr nc,TokenHook_CompareLoop_Start
pop hl
ret
TokenHook_LowByteMatch:
ld a,(hl)
cp d
jr nz,TokenHook_NoMatch
TokenHook_Match:
ld de,localTokStr
push de
ld c,17
ldir
pop hl
pop bc
ret


TokenHook_AxiomSearch_CheckHeader:
call ReadArc
inc de
add a,c
ld bc,$C0DE
sbc hl,bc
ld c,a
ret z
pop bc
TokenHook_AxiomSearch_Loop__:
pop bc
TokenHook_AxiomSearch_Loop_:
pop hl
TokenHook_AxiomSearch_Loop:
ld a,tAsmComp
cpir
ret po
push hl
dec hl
dec hl
ld a,(hl)
cp t2ByteTok
jr nz,TokenHook_AxiomSearch_Loop_
TokenHook_AxiomSearch_Backtrack:
dec hl
ld a,(hl)
cp tSpace
jr z,TokenHook_AxiomSearch_Backtrack
sub tColon
cp tEnter-tColon+1
jr nc,TokenHook_AxiomSearch_Loop_
TokenHook_AxiomSearch_FindAxiom:
pop hl
push hl
push bc
dec hl
rst 20h
ld hl,OP1
ld (hl),AppVarObj
ld a,tRParen
ld bc,10
cpir
dec hl
ld (hl),b
ld l,OP1&$FF
call p_GetArc+1
jr c,TokenHook_AxiomSearch_Loop__
TokenHook_AxiomSearch_FoundAxiom:
ex de,hl
ld c,b
call TokenHook_AxiomSearch_CheckHeader
ld b,32+1
TokenHook_AxiomSearch_ScanAxiom:
call ReadArc
inc de
ld a,h
or l
jr z,TokenHook_AxiomSearch_EndOfAxiom
add hl,de
ld de,5
add hl,de
ex de,hl
djnz TokenHook_AxiomSearch_ScanAxiom
TokenHook_AxiomSearch_EndOfAxiom:
call TokenHook_AxiomSearch_CheckHeader
call ReadArc
inc de
ld a,c
ld b,h
ld c,l
ld hl,(TokenHook_Temp)
add hl,bc
jr c,TokenHook_AxiomSearch_Loop__
ld (TokenHook_Temp),hl
sbc hl,bc
push bc
ld bc,curGStyle
add hl,bc
pop bc
ex de,hl
call p_CopyArc+5
jr TokenHook_AxiomSearch_Loop__


ReadArc:
ex de,hl
xor a
cp c
jr z,ReadArc_RAM
push bc
push hl
call p_ReadArcApp+11
pop de
inc de
pop bc
ret
ReadArc_RAM:
ld e,(hl)
inc hl
ld d,(hl)
ex de,hl
ret


AxeTokens:
.db $F4,$03,5,"Copy("
.db $FE,$03,5,"Exch("
.db $0E,$04,5,"Freq("
.db $66,$01,5,"Buff("
.db $62,$01,5,"sign{"
.db $06,$00,5,Lconvert,"Char"
.db $08,$04,4,Lconvert,"Hex"
.db $02,$04,5,"Data("
.db $4E,$01,7,"Bitmap("
.db $02,$00,4,Lconvert,"Tok"
.db $80,$04,7,"#Axiom("
.db $04,$04,5,"Rect("
.db $06,$04,6,"RectI("
.db $58,$02,3,LrecurV,"ar"
.db $5A,$02,4,"app",LrecurV
.db $5C,$02,3,"grp"
.db $F6,$01,4,"port"
.db $52,$01,5,"Text "
.db $D8,$01,8,"Pt-Mask("
.db $DA,$01,7,"pt-Get("
.db $D0,$01,3,"Get"
.db $14,$04,5,"rotC("
.db $16,$04,6,"rotCC("
.db $18,$04,6,"flipV("
.db $1A,$04,6,"flipH("
.db $C8,$03,7,"inData("
.db $B8,$01,5,"input"
.db $74,$01,6,"float{"
.db $72,$01,4,"nib{"
.db $F6,$03,9,"#Realloc("
.db $68,$01,6,"#Icon("
.db $80,$01,2,Llambda,"("
.db $38,$03,5,"Load("
.db $3A,$03,5,"Next("
.db $14,$03,7,"Render("
.db $3C,$03,6,"DrawL("
.db $3E,$03,6,"DrawR("
.db $16,$03,6,"DrawS("
.db $82,$03,6,"Print("
.db $44,$03,3,"Up("
.db $46,$03,5,"Down("
.db $5C,$03,5,"Left("
.db $40,$03,6,"Right("
.db $42,$03,4,"New("
.db $5E,$03,7,"Delete("
.db 0

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Axe Parser
« Reply #2125 on: January 10, 2012, 10:35:53 pm »
Wow, Runer, that is incredible.  I'm very impressed with all you did there, and quite glad you made it compatible with everything.  Thank you!

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Parser
« Reply #2126 on: January 10, 2012, 11:27:09 pm »
* Freyaday bows to the glory of the Runer
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: Axe Parser
« Reply #2127 on: January 11, 2012, 01:08:51 pm »
* kindermoumoute is amazed by these codes.
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Axe Parser
« Reply #2128 on: January 12, 2012, 10:48:28 am »
Once again, great work Runer! :thumbsup:
« Last Edit: January 12, 2012, 10:48:46 am by Art_of_camelot »

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #2129 on: January 12, 2012, 03:17:16 pm »
I just realized that the token hook has a very minor bug in it. I was relying on the indicator $00 to signal that there are no more tokens to be compared, but I seemed to forget that a couple of tokens actually have $00 as the low byte of the compare value. I suggest fixing this by making $FF signal the end of token comparisons, as this is an odd number and is thus not a valid low byte for the compare value. Fixing the code itself for this change is actually quite easy, and will only cost 1 byte and 4 cycles. Add an inc e before the comparison loop and change or a at the end of the comparison loop to inc a.

EDIT: Let me think this through a bit, this makes my Axiom token replacement cache generator less optimized...
« Last Edit: January 12, 2012, 03:25:01 pm by Runer112 »