Post Reply 
HP-71 Forth/Assembler ROM fix
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:

    TITLE LEX TEST
* ***********************************
* ENTRY POINTS
* ***********************************
=FNRTN1    EQU    #0F216

* ************************
* --LEX    header--
* ************************
    CON(2)    #5D        LEX ID
    CON(2)    #01        LOWEST TOKEN
    CON(2)    #04        HIGHEST    TOKEN
    CON(5)    0        NEXT LINKED LEX
    NIBHEX    F        NO SPEED TABLE
    CON(4)    (TxtbSt)+1-(*)    OFFSET TO TEXT TABLE
    CON(4)    0        OFFSET TO MESSAGE TABLE
    CON(5)    0        OFFSET TO POLL HANDLER
* ************************
* ------MAIN TABLE------
* ************************
    CON(3)    (ONEt)-(TxtbSt)
    REL(5)    ONEf
    NIBHEX    F        keyword is a BASIC function

    CON(3)    (TWOt)-(TxtbSt)
    REL(5)    TWOf
    NIBHEX    F        keyword is a BASIC function

    CON(3)    (THREEt)-(TxtbSt)
    REL(5)    THREEf
    NIBHEX    F        keyword is a BASIC function

    CON(3)    (FOURt)-(TxtbSt)
    REL(5)    FOURf
    NIBHEX    F        keyword is a BASIC function

* ************************
* ---Text table---
* ************************
TxtbSt

* names must be in alphabetical order

FOURt    CON(1)    (+)-(*)-2    cmdlen * 2 - 1
    NIBASC    \FOUR\
+    CON(2)    #04        TOKEN ID (entry in main table)

ONEt    CON(1)    (+)-(*)-2    cmdlen * 2 - 1
    NIBASC    \ONE\
+    CON(2)    #01        TOKEN ID

THREEt    CON(1)    (+)-(*)-2    cmdlen * 2 - 1
    NIBASC    \THREE\
+    CON(2)    #03        TOKEN ID

TWOt    CON(1)    (+)-(*)-2    cmdlen * 2 - 1
    NIBASC    \TWO\
+    CON(2)    #02        TOKEN ID

TxTbEn    NIBHEX    1FF        TEXT termination
*
********************************
* ONE entry
********************************

* IDS v1 7.5.1 Entry point
*    NIBHEX    8        bit parameter numeric
*    NIBHEX    4        bit parameter string
*    NIBHEX    2        bit parameter array
*
*    NIBHEX    C        3rd parameter numeric or string (if present)
*    NIBHEX    8        2nd parameter numeric
*    NIBHEX    4        1st parameter string
*    NIBHEX    23        argument count range (min=2,max=3)

    NIBHEX    00        argument count range (min=0,max=0)
ONEf    CON(3)    #024        NOP3 break for Emu71
        C=0     W               Clear all digits in register C.
        P=      14              Set the pointer register to the most-significant
        LCHEX   1               Load the most-significant digit in register C's
        GOVLNG  FNRTN1          Send the result back to the system.

********************************
* TWO entry
********************************
    NIBHEX    00        argument count range (min=0,max=0)
TWOf    CON(3)    #024        NOP3 break for Emu71
        C=0     W               Clear all digits in register C.
        P=      14              Set the pointer register to the most-significant
        LCHEX   2               Load the most-significant digit in register C's
        GOVLNG  FNRTN1          Send the result back to the system.

********************************
* THREE entry
********************************
    NIBHEX    00        argument count range (min=0,max=0)
THREEf    CON(3)    #024        NOP3 break for Emu71
        C=0     W               Clear all digits in register C.
        P=      14              Set the pointer register to the most-significant
        LCHEX   3               Load the most-significant digit in register C's
        GOVLNG  FNRTN1          Send the result back to the system.

********************************
* FOUR entry
********************************
    NIBHEX    00        argument count range (min=0,max=0)
FOURf    CON(3)    #024        NOP3 break for Emu71
        C=0     W               Clear all digits in register C.
        P=      14              Set the pointer register to the most-significant
        LCHEX   4               Load the most-significant digit in register C's
        GOVLNG  FNRTN1          Send the result back to the system.
    END

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.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP-71 Forth/Assembler ROM fix - Erwin - 11-24-2018, 09:24 PM
RE: HP-71 Forth/Assembler ROM fix - Erwin - 11-24-2018, 10:17 PM
RE: HP-71 Forth/Assembler ROM fix - Erwin - 11-25-2018, 06:12 PM
RE: HP-71 Forth/Assembler ROM fix - Christoph Giesselink - 11-26-2018 07:33 PM



User(s) browsing this thread: 1 Guest(s)