HP-71 Forth/Assembler ROM fix
|
12-02-2015, 08:02 AM
(This post was last modified: 12-02-2015 08:12 AM by J-F Garnier.)
Post: #1
|
|||
|
|||
HP-71 Forth/Assembler ROM fix
I published on my site a simple fix for the two major bugs of the assembler in the Forth ROM (buggy B=B+B A and D1=AS opcodes). I found this fix several years ago, but it now makes sense to publish it since the FRAM71 module now allows to load (and possibly modify) the hardwired part of the Forth/Assembler ROM.
http://www.jeffcalc.hp41.eu/emu71/bug71.html#forth A couple of simple POKE may implement the fix, after loading the regular ROM: POKE "E76A8","4" ! instead of "5" POKE "E76C4","9" ! instead of "8" Note that the ROM checksum is unchanged by this fix. I let the FRAM71 experts devise the exact patch loading procedure :-) J-F |
|||
12-02-2015, 05:58 PM
Post: #2
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
I patched HRDFORTH.BIN prior to loading it into Emu71. Seems to work, no slight-of-FRAM magic necessary. Am I missing something?
Dave |
|||
12-02-2015, 08:01 PM
(This post was last modified: 12-02-2015 09:17 PM by J-F Garnier.)
Post: #3
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(12-02-2015 05:58 PM)Dave Frederickson Wrote: I patched HRDFORTH.BIN prior to loading it into Emu71.Easy... Quote:Seems to work, Here is a short test assembly code to check the bugs and the fix: Code:
With a genuine Forth/assembler ROM, the result is Code:
With the fix, the two errors disappear. |
|||
12-02-2015, 08:44 PM
Post: #4
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix | |||
12-03-2015, 01:35 AM
Post: #5
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(12-02-2015 05:58 PM)Dave Frederickson Wrote: I patched HRDFORTH.BIN prior to loading it into Emu71. Seems to work, no slight-of-FRAM magic necessary. Am I missing something? For a real 71B w/FRAM71, you need to do this: Load the HC ROM image into first F_Block Change jumpers to move this to E0000 Use the POKE statements JFG provided, or maybe easier with the RAM editor Issue FRAM71 config to reconfigure E0000 as ROM Voila... I found a file from John Baker from around 1986 with 5 patches to the FORTH Assembler that fix these fundamental code-generation bugs, plus some other bugs in how the assembler works (e.g. with more than 100 symbols, the assembler listing will not be generated properly if not in DECIMAL mode, and other similarly obscure stuff). I can post it if anyone is interested. Back then, patching the assembler was done by adding complex RAM-based patches to the FORTHRAM file, but now that we can patch the HC ROM image, it may be feasible to generate simple patches like these for all 5 issues. --Bob Prosperi |
|||
12-03-2015, 05:10 PM
(This post was last modified: 12-03-2015 08:11 PM by Dave Frederickson.)
Post: #6
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
I've updated the FRAM71 Tool Kit to include a FORTH HC ROM loader, F2R2, that includes the two patches above.
F2R2 Code: 0010 DIM A$[64] Dave Edit: Fixed bug in code per below post. |
|||
12-03-2015, 06:09 PM
(This post was last modified: 12-03-2015 06:10 PM by Sylvain Cote.)
Post: #7
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(12-03-2015 05:10 PM)Dave Frederickson Wrote: ... Dave, I will not work, because you are targeting the page E instead of the page 3. Here is the corrected code ... 0130 POKE "376A8","4" 0140 POKE "376C4","9" Sylvain |
|||
12-03-2015, 06:40 PM
(This post was last modified: 12-04-2015 02:56 AM by Dave Frederickson.)
Post: #8
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(12-03-2015 06:09 PM)Sylvain Cote Wrote: I will not work, because you are targeting the page E instead of the page 3. Hi Sylvain, Thanks for that "expert" catch. The Tool Kit has been updated. Dave Edit: (12-03-2015 01:35 AM)rprosperi Wrote: I found a file from John Baker from around 1986 with 5 patches to the FORTH Assembler that fix these fundamental code-generation bugs, plus some other bugs in how the assembler works (e.g. with more than 100 symbols, the assembler listing will not be generated properly if not in DECIMAL mode, and other similarly obscure stuff). I can post it if anyone is interested. Someone already did! FIX5A |
|||
11-24-2018, 09:24 PM
Post: #9
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(12-03-2015 06:40 PM)Dave Frederickson Wrote:(12-03-2015 06:09 PM)Sylvain Cote Wrote: I will not work, because you are targeting the page E instead of the page 3. Hi, a question on the experts. I have the FRAM71 kit and installed all (for me - like i described in a post of mine) necessary programs. What about those above FIX5A fixes? How to implement them with the Forth/assembler in the FRAM71? best regards Erwin |
|||
11-24-2018, 09:49 PM
Post: #10
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(11-24-2018 09:24 PM)Erwin Wrote: Hi, a question on the experts. I have the FRAM71 kit and installed all (for me - like i described in a post of mine) necessary programs. What about those above FIX5A fixes? How to implement them with the Forth/assembler in the FRAM71? The fixes to the assembler only change the FORTHRAM file, so there is no need to worry about if you have the FORTH/Assembler in ROM or FRAM71. The assembler, written in FORTH, had 'hooks' built-in to allow later patches to replace an opcode, or even much more as John Baker's 5th patch proves, into the RAM file. If you want to implement all the changes, you simply load the patch file (" FIX5A" LOADF) into a blank FORTHRAM file, and then make that your new starting place to build your own stuff on top of. But note a couple important things: 1. The 'revised' assembler is now invoked via " MYSOURCE" SASM, so that you can still invoke the original using " MYSOURCE" ASSEMBLE. 2. The new assembler discards some of the built-in pseudo-ops that control the assembly type (e.g. for LEX file header, keyword tables, etc.), requiring you to manually craft (the normally auto-generated content with) CON(i) N, NIBASC 'chars' or NIBHEX N pseudo-ops with the proper bytes, for the header, LEXID, etc. So, while this does give you much more fine-tuned control, I'd suggest deferring jumping to that version until you've used the basic stuff for a while. --Bob Prosperi |
|||
11-24-2018, 10:17 PM
Post: #11
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(11-24-2018 09:49 PM)rprosperi Wrote:(11-24-2018 09:24 PM)Erwin Wrote: Hi, a question on the experts. I have the FRAM71 kit and installed all (for me - like i described in a post of mine) necessary programs. What about those above FIX5A fixes? How to implement them with the Forth/assembler in the FRAM71? Great - thanks for your fast response :-) very helpful kind regards Erwin |
|||
11-25-2018, 03:03 AM
Post: #12
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
As Bob noted, the F/A's assembler is written FORTH, but there are other 71B assemblers.
Of note is Joachim Siebold's ASM71 cross assembler for the 71B. https://github.com/bug400/asm71 I suspect that Joachim's assembler includes all the bug fixes. Dave |
|||
11-25-2018, 03:45 AM
Post: #13
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
I also found a version of the F/A ROM assembler fixes that takes care of 4 out of 5 of the bugs, but does not make the drastic changes that the FIX5A version does.
Here is a version that circulated in a file called ASMFIX4 Code: HEX It also has the virtue of being understandable without requiring encyclopedic knowledge of how the assembler itself works. Just use " ASMFIX4" LOADF into a new/empty FORTHRAM file and it will fix all the bugs any reasonable person is likely to encounter, and all the changes are 'invisible' in the sense that you can fully use the assembler as documented, with all specified features working as documented. It basically just fixes the real bugs. --Bob Prosperi |
|||
11-25-2018, 06:12 PM
Post: #14
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(11-25-2018 03:45 AM)rprosperi Wrote: I also found a version of the F/A ROM assembler fixes that takes care of 4 out of 5 of the bugs, but does not make the drastic changes that the FIX5A version does. Hi, fine that's an easy way :-) thanks for sharing |
|||
11-25-2018, 09:02 PM
(This post was last modified: 11-25-2018 09:06 PM by J-F Garnier.)
Post: #15
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
Let me add another small bug in the Forth Assembler, that has been recently reported to me by an eminent member of this community :-)
The Forth Assembler generates null-bytes at the end of some lines in the assembly listing (the file or device specified by the LISTING variable). Null bytes have generally no effect on printers, but emu71/Dos and the ILper printer show null bytes as star '*' characters (for a good reason), and can make the listing file quite obscure. The effect can be noticed when the listing file is the Emu71 display, or the ILPer printer window, or a HP71 file that is later printed to Emu71 or ILPer by PLIST. When using Emu71 or ILPer, a workaround is to use a HP71 file as the listing destination, and then use LIST (and not PLIST) to list or print it. Note also that null-bytes are also generated if the listing file is the DOSLINK device, but just editing the PC file with notepad (for windows systems) replaces the null bytes by space characters. J-F |
|||
11-26-2018, 07:33 PM
Post: #16
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
Does it still make sense to use the HP-71 Forth/Assembler ROM for new projects?
No doubt, it will be complicated to translate any Forth programs into another programming language. It also will be a little bit difficult to replace the Assembler Macros to make LEX programming more easily? So is ASM71 the right way? I think not. Some years ago I began writing some very easy test programs to check the behavior of the HP-IL ROM on requests over the HP-IL mailbox. The first steps I made with HP-71 Forth/Assembler, but entering the code with an HP-71 editor is IMHO horrible. So my development process was writing the source code on the PC as ASCII file, convert the file into a TEXT1 file to transfer it with DOSLINK to the HP-71 and then compile it with the Forth/Assembler ROM. For me is ASM71 another brick in the wall of Star Assembler, AREUH, CLASS, GNU-Tools, ... All common, these are Saturn assemblers from a time HP hasn't published his own development tools. So my reference is the HPTools assembler package v3.0.9. With this assembler I wrote my HP48 SysRPL and Assembler programs, was able to do the same thing with the HP49G, could compile the Aplet/eLesson framework files for the HP38G/HP39G. Back to the roots I used HPTools v3 to write the HP28C ROM upload program with the opcode restrictions of the 1LK7 CPU. Finally I created with the help of the HP-71 JPC ROM and other sources a small framework for compiling LEX files on the PC: Code:
Something heard about the MASD syntax? It's easily spoken a macro language extension for writing assembler programs more structural. It became important, when HP introduced the HP49G and some sample programs especially for this calculator used this syntax. HPTools v3 supports this also. For me, one compiler fits all in the Saturn CPU world. |
|||
11-26-2018, 10:48 PM
Post: #17
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(11-26-2018 07:33 PM)Christoph Giesselink Wrote: So my reference is the HPTools assembler package v3.0.9. With this assembler I wrote my HP48 SysRPL and Assembler programs, was able to do the same thing with the HP49G, could compile the Aplet/eLesson framework files for the HP38G/HP39G. Back to the roots I used HPTools v3 to write the HP28C ROM upload program with the opcode restrictions of the 1LK7 CPU. Thanks Christoph, for your comments and especially for sharing the LEX file template; this is extremely similar to the style proposed by John Baker back when he was busily writing almost everything for the 71B. For simple/small LEX files, the macro pseudo-ops in the F/A ROM assembler work fine, but I can understand your goal of wanting to use a single tool suite for all the Saturn targets! Do you know where the HPTools pkg v3.0.9 is available to download? I naturally thought it may be on hpcalc.org, but the latest version I see there is v3.0.8 (awfully close of course, but no doubt 3.0.9 was released for a reason....) --Bob Prosperi |
|||
11-26-2018, 11:19 PM
Post: #18
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(11-26-2018 10:48 PM)rprosperi Wrote: Do you know where the HPTools pkg v3.0.9 is available to download? I suspect v3.0.9 is for Mac. http://www.hpmuseum.org/forum/thread-799...l#pid70084 |
|||
11-26-2018, 11:40 PM
Post: #19
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(11-26-2018 11:19 PM)Dave Frederickson Wrote: I suspect v3.0.9 is for Mac. He may have the Mac version too, but I know Christoph doesn't build on a Mac so it appears he has both Win & Mac (and maybe Linux too). --Bob Prosperi |
|||
11-27-2018, 09:23 PM
Post: #20
|
|||
|
|||
RE: HP-71 Forth/Assembler ROM fix
(11-26-2018 10:48 PM)rprosperi Wrote: Do you know where the HPTools pkg v3.0.9 is available to download? I naturally thought it may be on hpcalc.org, but the latest version I see there is v3.0.8 (awfully close of course, but no doubt 3.0.9 was released for a reason....) I build my Windows version in 2008/2010 from the 3.0.9 SVN sources at bubblestuff.com dated Apr. 29th, 2011, which base on the sources from 2008 for the MAC. In the SVN sources from 2011 is a patch for SLOAD I made 2010. SLOAD calculated a wrong HP-71 checksum, when the checksum is on an odd address. The bubblestuff repository is not accessable any more, wether the public or the developer access. Official 3.0.9 change log: 3.0.9: Thanks to William Graves - Project File for MS Studio 2008 - Fixed signed/unsigned mismatches in sload |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)