6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed May 15, 2024 1:59 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Feb 04, 2020 11:56 pm 
Offline

Joined: Tue Feb 04, 2020 4:56 pm
Posts: 1
Is it possible to compile a new NEXT in the dictionary that will replace the built in word in Fig Forth? I wrote a replacement to test and it will call my NEXT only once after I load the block it's in but reverts to the original NEXT afterwards.


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 05, 2020 12:11 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
One way to replace it is to have it in RAM so you overwrite the first three bytes to hold a jump instruction to your new NEXT routine, since all primitives are already assembled with JMP NEXT at the end. I do a related thing in my '816 Forth in that it's an indirect jump, and the intermediate address holds the address of the NEXT you want to execute. The reason for this is to jump immediately into Forth interrupt service when appropriate (and that version of NEXT is actually shorter and faster than the standard NEXT!), or you could have other versions of NEXT for things like instruction trace, single-stepping, etc., although I have not implemented the latter two. Most of the time, this indirect variable will just hold the address of the normal NEXT to jump to.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 05, 2020 1:46 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1929
Location: Sacramento, CA, USA
I think that you would have to replace every JMP NEXT (about 18 of them) in the source with JMP MYNEXT ... or just poke MYNEXT into the space originally occupied by NEXT.

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


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 post attachments in this forum

Search for:
Jump to: