HP 71B FORTH/Assembler ROM
|
09-02-2022, 03:59 AM
Post: #1
|
|||
|
|||
HP 71B FORTH/Assembler ROM
Hi everyone,
I made a video about the HP71B FORTH/Assembler ROM. It was interesting to delve into the history of FORTH and also think about how FORTH relates to RPL. Also a shout out to Mark Fleming and his excellent MultiMod ROM emulator for allowing me to load the ROM on my 71B. https://www.youtube.com/watch?v=0gjdUPmw...torCulture Antony. Antony Kuzmicich - Melbourne, Australia. https://youtube.com/CalculatorCulture |
|||
09-02-2022, 09:16 AM
(This post was last modified: 09-02-2022 09:57 AM by KimH.)
Post: #2
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
Hi Antony,
I saw your video while having my "Morning Brew" and liked it very much - thanks a lot for doing this. I have the ROM, but have never really "played" with it. It appears more complicated than I'd thought. first - you trigger my curiosity with your "structure" of the NQueens program and I learn a lot more from examples such as yours. The "Manual" does not have a single example "to learn from". Do you have a suggestion/source on how one can get more examples like what you did here. Is there a good paper/book/page to go look at? Second - Can you maybe share the link to the ANSI Doc you show 2:22 - I can't seem to find anything looking like what you show here. And keep those short "Culture" stories coming, they are fun to watch KimH |
|||
09-02-2022, 11:39 AM
(This post was last modified: 09-02-2022 11:48 AM by Sylvain Cote.)
Post: #3
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM | |||
09-02-2022, 12:09 PM
Post: #4
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
There is also "Starting Forth" by Brodie. IT appears to be online now:
https://www.forth.com/starting-forth/ |
|||
09-02-2022, 12:18 PM
Post: #5
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
(09-02-2022 12:09 PM)KeithB Wrote: There is also "Starting Forth" by Brodie. IT appears to be online now: 1 + This is literally THE standard to learn Forth, and an easy read. 71B Forth is a bit different, but it will be a while before you get to these areas, the key thing to keep in mind is the 71B operates on 4-bit nybbles rather than 8-bit bytes. Forth is MUCH faster then BASIC for most tasks, but file-handing is more flexible in BASIC, so it's fortunate HP provided the BASICX/FORTHX etc. keywords that make it simple for programs in each language to easily access advantages in the other. --Bob Prosperi |
|||
09-02-2022, 02:44 PM
Post: #6
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
The granddaddy of all FORTH related books, "Threaded Interpretive Languages, Their Design and Implementation" can also be found online. Not really a FORTH tutorial, the book describes in detail how a TIL works using Z80 code to build the threaded variations.
https://archive.org/details/R.G.Loeliger...eBooks1981 Note that this link is broken when used because the "1981" at the end gets translated to an escape sequence - click on it then edit the resulting URL to remove the junk at the end and replace with "1981" as required. You can also copy and paste the link to a new page and edit accordingly. I regretfully have to join the "chip shortage club" with Tony (teenix) as the PIC processor used by the MultiMod is not available until May of next year. Assuming they don't sell out immediately! There are some chips offered on The Bay for $8 to $15 each, but who knows what you're buying AND shipping is $10 or more. ~Mark Remember kids, "In a democracy, you get the government you deserve." |
|||
09-02-2022, 06:52 PM
Post: #7
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
(09-02-2022 02:44 PM)mfleming Wrote: The granddaddy of all FORTH related books, "Threaded Interpretive Languages, Their Design and Implementation... Thanks Mark, looked all around for this some years ago, glad to have a copy of it. --Bob Prosperi |
|||
09-02-2022, 07:06 PM
Post: #8
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
After teaching 20 years (under)graduates on programming language design and implementation, I find that most introductory texts on FORTH are useless, lacking aim, i.e. not focussing on practical examples to learn the important "FORTH patterns" of programming (see e.g. https://www.youtube.com/watch?v=mvrE2ZGe-rs to understand). I've seen the same problems with Lisp and Prolog. It is remarkable how many folks hate these languages, likely because the books, (online) tutorials etc. are useless, not focussing on what matters most.
(09-02-2022 12:09 PM)KeithB Wrote: There is also "Starting Forth" by Brodie. IT appears to be online now: Sorry I have to say this, but Brodie's intro to FORTH is too simplistic and off-putting to folks who already have a rudimentary understanding of programming. Just get your hands dirty working through FORTH examples. Mistakes can hurt (more) with FORTH. So you will never forget! PS. just humbly mention, not want to hijack this thread: I (re)wrote the FORTH500 system, with a basic intro to FORTH and programming examples. FORTH500 is FORTH Standard compliant, to which the HP-71B is quite close actually. - Rob "I count on old friends to remain rational" |
|||
09-02-2022, 07:32 PM
(This post was last modified: 09-02-2022 07:36 PM by Garth Wilson.)
Post: #9
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
(09-02-2022 09:16 AM)KimH Wrote: The "Manual" does not have a single example "to learn from". Do you have a suggestion/source on how one can get more examples like what you did here. Is there a good paper/book/page to go look at? This was a slight difficulty I ran into when I got into Forth in 1990, which was on the 71. KeithB linked to the excellent "Starting Forth" book above, on Forth, Inc.'s own website, a version with a few modernizations over the original but keeps the original beloved cartoons. KeithB, BTW, was the one who originally made me aware of Forth, and got me interested in looking into it. The book more or less assumed you had something to practice on, while the Forth ROM's manual assumed you were already familiar with Forth and just needed to know a few particulars about the 71's unusual implementation with 20-bit cells and 4-bit data at each address; so they were kind of left pointing at each other. I did eventually get going though. The 71's Forth seems to be Forth-79, although I'm not intimately acquainted with all the differences between Forth-79 and Forth-83 which I later got a lot more experience on with the 6502, or the differences between Forth-79 and the earlier fig-Forth. The 71's implementation was pretty inefficient; but since it's Forth, it of course allowed me to make a lot of improvements, including speeding up existing Forth words. In the extreme case, which I think was CHR$, I was able to make it 14 times as fast, without even resorting to assembly language. Last year, I saw an interview with Leo Brodie, the author of Starting Forth, and of the sequel, "Thinking Forth" which is almost more about programming philosophy but shows how to do all kind of unexpected things in Forth. (It has a lot of power that does not immediately meet the eye, and which even the intermediate user won't yet be aware of.) Brodie still looks a lot like his picture on the back of the paper book—just add a few years—and is still very sharp, humorous, and good-natured. He drew the cartoons for the book himself. (09-02-2022 07:06 PM)robve Wrote: Mistakes can hurt (more) with FORTH. I have to disagree; but I do seem to have an RPN brain, and Forth came much more naturally to me than algebraic languages, and it's easier for me to write without mistakes in Forth. http://WilsonMinesCo.com (Lots of HP-41 links at the bottom of the links page, at http://wilsonminesco.com/links.html#hp41 ) |
|||
09-02-2022, 08:42 PM
(This post was last modified: 09-02-2022 08:45 PM by robve.)
Post: #10
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
(09-02-2022 07:32 PM)Garth Wilson Wrote:(09-02-2022 07:06 PM)robve Wrote: Mistakes can hurt (more) with FORTH. Sure sure... you must be right. Nobody accidentally switches the arguments to a store like so VAR 2 ! in Forth :-) Not as bad to make mistakes as in assembly or with pointers in C that are notorious for vulnerabilities in production software. But Forth sure hurts when making even minor mistakes, like this one that can destroy the dictionary. Not to mention that some Forth implementations don't have stack overflow protection and no dictionary overflow protection. Caveat emptor, com Forth? - Rob "I count on old friends to remain rational" |
|||
09-02-2022, 09:48 PM
(This post was last modified: 09-02-2022 09:48 PM by Garth Wilson.)
Post: #11
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
(09-02-2022 08:42 PM)robve Wrote: [quote='Garth Wilson' pid='163672' dateline='1662147142'] I've never seen a need for it, even though Forth is the main HLL I use. I never have any problem with these. I cannot latch onto C though. I've been through the standard K&R book on it, and one on "C For Dummies" or some such title, and I'm done trying. My brain doesn't work that way. http://WilsonMinesCo.com (Lots of HP-41 links at the bottom of the links page, at http://wilsonminesco.com/links.html#hp41 ) |
|||
09-02-2022, 10:50 PM
Post: #12
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
Religious debates about language preferences and skills will always ensue in threads like this, and like true religious debates, everyone is of course right. And wrong. And well, will continue to pray in the same places.
Regarding Forth on the 71B, as you are exploring and learning it, you will encounter Memory Lost far more often than when attempting similar things in BASIC, so one modern approach which makes this a lot less painful is to use Christoph Giesselink's EMU71/Win (https://hp.giesselink.com/emu71.htm) which lets you save your state just before trying something new, and then when seeing the Memory Lost, you simply reload your state file and 10 seconds later, you're back where you were just before that fateful step. Before long you learn to check it twice and fairly soon, are a lot more careful. It's really only noticeable because 71B BASIC is soo protective, and you have to work pretty hard to hurt yourself, and so become a tad spoiled and relatively careless when using it. But everyone should try Forth, and it's really easy on a 71B; it will be a very new experience for most people, even seasoned programmers. Most 71 users love it. --Bob Prosperi |
|||
09-03-2022, 12:06 AM
Post: #13
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM | |||
09-03-2022, 12:11 AM
Post: #14
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
(09-02-2022 10:50 PM)rprosperi Wrote: Religious debates about language preferences and skills will always ensue in threads like this, and like true religious debates, everyone is of course right. And wrong. And well, will continue to pray in the same places. Yes, I agree with everything you've said. But the funny thing is, we both like Forth. No religious wars here I think it should be fine to point out some (maybe inconvenient) facts I've observed when working with students and professionals. Students sure have strong opinions about programming languages. But I don't, see (1) below. People sometimes get upset whenever mentioning just one tiny little thing that is demonstrably problematic with a programming language. Instead, one should know the strengths and weaknesses and pick the programming language that best suits the project goal to complete. It helps when programming languages are easier to pick up, but Forth tutorials are generally questionable, many are useless unless you're a total noob not knowing what a stack is. Forth is great, but has some weaknesses (no worries, I won't sum these up here.) 1) footnote: because I enjoy(ed) teaching the subject (as well as many other, actually more theoretical subjects in CS), and enjoyed programming even more: (MS) Basic (80s), Fortran (80s+90s), Pascal (80s), Modula-3 (90s), Prolog (80s-present), C (80s-present), C++ (90s-present), Java (occasionally), Python (for hobby), Forth (for hobby), Lisp/Scheme (for hobby), Miranda/Haskell (90s mostly), Lua (2010s-present), Javascript (2010s-present only if I have to), Z80/6502/68000/SCxxxx assembly (80s-present). When combined, I wrote >2M of lines of code myself, since the 80s (I can provide links to prove). But that's not the point. - Rob "I count on old friends to remain rational" |
|||
09-03-2022, 12:25 AM
(This post was last modified: 09-03-2022 01:30 AM by robve.)
Post: #15
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
(09-03-2022 12:06 AM)Thomas Klemm Wrote:(09-02-2022 11:39 AM)Sylvain Cote Wrote: Forth links ... Sorry to say, but yet again, a very bad set of Forth examples masquerading as a Forth tutorial "for beginners" (the link on the bottom of that page). Even the font and typesetting of the code is bad. At least use spacing between words and definitions. Add comments in the right margin next to the code to explain what the code does. It's 2020 now, not the 80s. But even the 80s did a better job. I mean, look at Jupiter ACE Forth which has lots of programs and examples. For example: http://www.jupiter-ace.co.uk/listing_YC_...83_82.html More here: http://www.jupiter-ace.co.uk/software_in...aglistings (well, in some cases the web site totally screws up the background GIF, but ignore that, just copy-paste the text...). EDIT: The Jupiter ACE Forth manual is one of the better Forth books I've seen. It's a Forth-79 dialect (close to Forth-83): http://www.jupiter-ace.co.uk/usermanual....ce_manuals I did not know until I searched this online again today, but apparently a hardcopy of the "Jupiter ACE manual - 40th anniversary edition" is on sale on Amazon, if anyone is interested. - Rob "I count on old friends to remain rational" |
|||
09-03-2022, 01:40 AM
Post: #16
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
(09-03-2022 12:11 AM)robve Wrote: Instead, one should know the strengths and weaknesses and pick the programming language that best suits the project goal to complete and the way one's brain works. The programming language that's best for one person won't necessarily be what's best for the next, even tackling the same project and goals, and having the same background and education. Quote:Regarding Forth on the 71B, as you are exploring and learning it, you will encounter Memory Lost far more often Well, it has been a long time since I started into Forth, which was on the 71; but I already was familiar with stacks from the 41 and microprocessor work, and I don't recall ever having a crash in Forth on the 71. I did in BASIC with a particular bug in TRANSFORM though, and it was so bad I couldn't even bring it back with INIT:3. http://WilsonMinesCo.com (Lots of HP-41 links at the bottom of the links page, at http://wilsonminesco.com/links.html#hp41 ) |
|||
09-03-2022, 02:23 AM
Post: #17
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
(09-03-2022 01:40 AM)Garth Wilson Wrote:Quote:Regarding Forth on the 71B, as you are exploring and learning it, you will encounter Memory Lost far more often Duly noted. The HP-71B FORTH/Assembler ROM manual has lots of warnings (emphasis is mine) about memory lost and system reset issues, which aren't reassuring: FORTH is similar to assembly language in its lack of user protection. In most cases FORTH will attempt to perform the specified operation, even if the operation will cause a Memory Lost condition. For instance, it is easy to write a FORTH loop that pushes a value onto the data stack 1,000,000 times. Execution of this loop will overwrite the user dictionary, the FORTH system variables, and the BASIC O/S variables. Eventually the machine will be too confused to continue and will perform a cold start. In other cases you might need to perform an INIT 3 to recover normal HP-71 operation. Because of the complete access to the HP-71 memory space provided by FORTH, it is quite possible for a FORTH program to store inappropriate data into HP-71 operating system RAM. In many cases, this will cause a memory lost condition. Following a memory loss, the HP-71 will return to the BASIC environment. Subroutine Return Stack. Return addresses are stored on an eight-level LIFO hardware stack. Subroutine call and return instructions automatically push and pop addresses on this stack. If a ninth address is pushed onto the stack, the oldest address will be lost and will be replaced by zero when it is eventually popped from the stack. Because the memory-reset code of the operating system resides at address 00000, excessive nesting of subroutine calls will cause a memory reset. Anyway, still a great machine and ROM to learn Forth - Rob "I count on old friends to remain rational" |
|||
09-03-2022, 12:57 PM
Post: #18
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
(09-03-2022 01:40 AM)Garth Wilson Wrote: Well, it has been a long time since I started into Forth, which was on the 71; but I already was familiar with stacks from the 41 and microprocessor work, and I don't recall ever having a crash in Forth on the 71. I did in BASIC with a particular bug in TRANSFORM though, and it was so bad I couldn't even bring it back with INIT:3. There's always one in every crowd, and in this case a very lucky one! I suspect you may have experienced this in the beginning, but it's been so long it feels like it didn't happen. The important thing is you kept going and before too long you were replacing many of the ROM words with your own. In fact, as you've mentioned the revised chr$ word, can you share it, it'll be interesting to see some string handling improvements. Thanks Garth. --Bob Prosperi |
|||
09-07-2022, 02:57 AM
Post: #19
|
|||
|
|||
RE: HP 71B FORTH/Assembler ROM
(09-03-2022 12:57 PM)rprosperi Wrote: as you've mentioned the revised chr$ word, can you share it. It'll be interesting to see some string-handling improvements. I haven't forgotten, but I'm looking over my tons of notes. Since this has come up a few times over the years I've been on this forum, I should prepare a web page on it and post it on my site. http://WilsonMinesCo.com (Lots of HP-41 links at the bottom of the links page, at http://wilsonminesco.com/links.html#hp41 ) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)