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

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Forth bugs and fixes
PostPosted: Tue Jul 02, 2019 7:35 pm 
Offline

Joined: Fri May 05, 2017 9:27 pm
Posts: 858
I'd like to start this thread off with a bug and fix for an old favorite, Blazin' Forth.
The C64 has a vector for the system IRQ at address $314-$315 so software can "patch in" it's own IRQ.
Blazin' Forth uses this for sound and music words. It saves the old address in a variable named SYSIRQ. The new IRQ performs an indirect jump to the old IRQ through SYSIRQ. Blazin' Forth, like any decent ITC Forth for the C64, checks if the code field of a new name will cross a page boundary. If it will, the dictionary is padded with one byte prior to creating the header. Scott Ballantyne included the source for the system loader so someone could modify it ( after making a backup ), forget THRU, and reload the system.
Although no word will have a code field that crosses a page boundary, it is possible for part of the parameter field to cross a page boundary. In an ITC Forth, this is harmless unless the parameter field is used for an indirect jump address.
This is where the bug comes in. If the system is altered and rebuilt, there is a possibility that the one cell parameter field of SYSIRQ will cross a page boundary.
For the bug fix there is a word in Blazin' Forth, " , that will create a counted string in the PAD. It can be used to avoid this bug.
Replace
Code:
HEX
VARIABLE SYSIRQ

with this
Code:
HEX
// BUG FIX
" SYSIRQ" C@ HERE + 1+
2+ 2+         // SIZE OF LINK
              // & CODE FIELDS
0FF AND 0FF = // WILL PFA BE ON
              // PAGE BOUNDARY?
ABS ALLOT     // IF SO BUMP IT PAST
VARIABLE SYSIRQ

Note that VIEW? , the variable that determines if a view field is created, is off during the loading of the system.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 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: