CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 113 users online: 1 member, 78 guests and 34 bots.
Members: Spyro543.
Bots: VoilaBot (4), Spinn3r (1), Magpie Crawler (3), VoilaBot (5), Googlebot (20), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
Author Message
SirCmpwn


Coding Knight


Joined: 06 Feb 2010
Posts: 1477
Location: Colorado Springs

Posted: 10 Jan 2011 12:21:24 am    Post subject: Parser Hook Problems

Hello,
I've been pulling my hair out over this, but I can't seem to figure it out. For some reason, when the parser hook fires for me, the value in BC is always the same, and doesn't represent the token being parsed. Does anyone know why this might be happening?
_________________
Drew "Sir Cmpwn" DeVault
Back to top
_player1537


Guru-in-Training


Joined: 25 Nov 2009
Posts: 2958

Posted: 10 Jan 2011 12:22:23 am    Post subject:

I believe op1 or one of the other's holds the actual token.
_________________
http://tanner.myserverathome.com
Back to top
SirCmpwn


Coding Knight


Joined: 06 Feb 2010
Posts: 1477
Location: Colorado Springs

Posted: 10 Jan 2011 12:23:19 am    Post subject:

Naw, that is always the same as well. And it isn't OP1.
_________________
Drew "Sir Cmpwn" DeVault
Back to top
_player1537


Guru-in-Training


Joined: 25 Nov 2009
Posts: 2958

Posted: 10 Jan 2011 12:24:01 am    Post subject:

http://wikiti.brandonw.net/index.php?title=83Plus:Hooks:9BAC

ParseVar, BegPC, curPC, endPC?
_________________
http://tanner.myserverathome.com
Back to top
SirCmpwn


Coding Knight


Joined: 06 Feb 2010
Posts: 1477
Location: Colorado Springs

Posted: 10 Jan 2011 12:25:04 am    Post subject:

I'm only handling states 1-3, in which case B should contain the token.
_________________
Drew "Sir Cmpwn" DeVault
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55742
Location: Earth, Sol, Milky Way

Posted: 10 Jan 2011 12:38:14 am    Post subject:

The ParserHook will fire several times. Are you checking all the times it fires?
_________________


Back to top
SirCmpwn


Coding Knight


Joined: 06 Feb 2010
Posts: 1477
Location: Colorado Springs

Posted: 10 Jan 2011 12:44:29 am    Post subject:

Yeah. The code is something like this:

Code:
or a
ret z ; Return on state 0
[Display BC's value in hex]
cp a
ret


This crashes for anything other than state 0.
_________________
Drew "Sir Cmpwn" DeVault
Back to top
_player1537


Guru-in-Training


Joined: 25 Nov 2009
Posts: 2958

Posted: 10 Jan 2011 12:46:13 am    Post subject:

Are you sure whatever it is you are displaying BC with isn't screwing up something you need? Like one of the pointers or something?
_________________
http://tanner.myserverathome.com
Back to top
SirCmpwn


Coding Knight


Joined: 06 Feb 2010
Posts: 1477
Location: Colorado Springs

Posted: 10 Jan 2011 12:47:50 am    Post subject:

I'm sure. When I remove that code, it still crashes.
_________________
Drew "Sir Cmpwn" DeVault
Back to top
_player1537


Guru-in-Training


Joined: 25 Nov 2009
Posts: 2958

Posted: 10 Jan 2011 12:49:37 am    Post subject:

You return Z every time with that code, is that right? "Return Z to run the standard function." (WikiTI)


Code:
cp 1
jr nz,ReturnZ
<display BC>
xor a
inc a
ret
ReturnZ:
xor a
ret

_________________
http://tanner.myserverathome.com


Last edited by _player1537 on 10 Jan 2011 12:50:34 am; edited 1 time in total
Back to top
SirCmpwn


Coding Knight


Joined: 06 Feb 2010
Posts: 1477
Location: Colorado Springs

Posted: 10 Jan 2011 12:49:59 am    Post subject:

That is correct. Right now, I just want to get through it without crashing.

This is my current code:

Code:
cp 1
jr z, $+2
cp a
ret
[Display BC's hex value]
cp a
ret

_________________
Drew "Sir Cmpwn" DeVault
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55742
Location: Earth, Sol, Milky Way

Posted: 10 Jan 2011 01:10:45 am    Post subject:

jr z, $+2 jumps to the cp a, I believe.
_________________


Back to top
SirCmpwn


Coding Knight


Joined: 06 Feb 2010
Posts: 1477
Location: Colorado Springs

Posted: 10 Jan 2011 01:12:05 am    Post subject:

It's not really that, I changed it for readability. There's really a label there.
_________________
Drew "Sir Cmpwn" DeVault
Back to top
_player1537


Guru-in-Training


Joined: 25 Nov 2009
Posts: 2958

Posted: 10 Jan 2011 01:13:48 am    Post subject:

Nope, it doesn't. BrandonW and I worked that out one HCWP, it jumps from the end of instruction. So the literal "jr" followed by a literal 0 will continue execution normally. Err, kinda like what we are talking about :/
_________________
http://tanner.myserverathome.com
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55742
Location: Earth, Sol, Milky Way

Posted: 10 Jan 2011 01:13:55 am    Post subject:

Aren't you using a proper debugging and breakpoints to avoid having to display bc?
_________________


Back to top
SirCmpwn


Coding Knight


Joined: 06 Feb 2010
Posts: 1477
Location: Colorado Springs

Posted: 10 Jan 2011 01:14:41 am    Post subject:

KermMartian, this is technically hybrid Axe/Asm.
_________________
Drew "Sir Cmpwn" DeVault
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55742
Location: Earth, Sol, Milky Way

Posted: 10 Jan 2011 01:16:32 am    Post subject:

SirCmpwn wrote:
KermMartian, this is technically hybrid Axe/Asm.
And that somehow precludes you from using an emulator with a debugger to set breakpoints on your ParserHook...?
_________________


Back to top
SirCmpwn


Coding Knight


Joined: 06 Feb 2010
Posts: 1477
Location: Colorado Springs

Posted: 10 Jan 2011 01:18:08 am    Post subject:

My hook works fine for non-class 1 events. But on class 1 events, I get ERR:Argument when exiting with Z reset. With Z set, it works, but still executes the token.
I use the following on my exits, straight from Omnicalc:
-With Parser
xor a
ret
-Without Parser
xor a
inc a
ret
_________________
Drew "Sir Cmpwn" DeVault
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.035865 seconds.