(06-15-2015 06:17 AM)jsi Wrote: Hello all,
I'd like to point to asm71, a cross assembler to create LEX or BIN files for the
HP-71B.
The first version was created in 1986 in Turbo Pascal. With minor changes it compiles well with the Free Pascal compiler.
Not another assembler yet...
I understand why in the 80'ties and early 90'ties different mnemonics were created and used for writing Saturn assembler code. HP hasn't published his HP-Tools and later only his Mess-Dos version of the Saturn Assembler, version 1.56, 12/20/89.
So each community build their own tools:
Class Mnemonics or also called Alonzo mnemonics (Alonzo Gariepy)
- CLASS and CLDIS Clarke assembler and disassembler, written 1991 by Lutz Vieweg.
- STAR, the Saturn Macro Assembler, Copyright (C) 1990, 1991 Jan Brittenson.
HP Mnemonics
- ASM71 (Linux, Mac, Win32)
- Areuh for building JPC Rom (PPC Paris Rom)
- SASM Ver. 1.56, 12/20/89
- GNU HP Tools 2.1
- HP Tools 3.0.8 (FreeBSD, Linux, Win32)
- HP Tools 3.0.9 (Win32, Mac)
But in 1998 with the source code release of the HP Tools 3.0 (3.0.2) everything changed IMHO. Now a reference implementation for all Saturn CPU's was available and it later was expanded with the Saturn+ opcodes (switch -P 3) and MASD instruction set. Furthermore SASM can produce raw code suppressing the object files header or code for a separate linker process. I personally use the separate linker process to link with the compiled entry point table of the calculator. Entry point table files are available for many HP Saturn based calculators, also for the HP71. Finally the HP Tools v3.0.8 binaries were published for FreeBSD, Linux and Win32 and v3.0.9 for Mac.
The last point is, when you want to use the symbolic names in the Emu28/Emu42/Emu48 and Emu71/Win emulator code debugger or the RPL Object Viewer you need the entry point table in HP Tools 3.0 object file format.
The advantage of ASM71 I see is, it can use the simplified LEX table macros introduced by the Forth/Assembler module and the integrated creation of the LIF header for LEX and BIN files.
For the HP Tools SASM assembler you need an asm file template for configuring the LEX tables and a program to add the LIF header like JFG's alifhdr program. So for me one Saturn compiler, the HP Tools 3.0.9 fits all.
Here's my LEX template for the HP Tools SASM package:
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
And this my batch file RPL71.BAT to assemble a single source file:
Code:
@echo off
if not exist %1.a goto quit
sasm -e -N -P 1 -a %1.lst %1.a
echo LL %1.lr > %1.m
echo SUPPRESS XR SU >> %1.m
echo SE %SASM_LIB%\HP71EP.o >> %1.m
echo RE %1.o >> %1.m
sload -H -o %1 %1.m
type %1.lr
alifhdr %1 %1.dat
:quit
The resulting dat file is then transferred over the DOSLINK device to a real HP71 or Emu71/Win with the help of a small BASIC program running on the HP71.