New machine language port
|
12-21-2019, 01:17 AM
Post: #1
|
|||
|
|||
New machine language port
Hello all,
I am porting a machine language program written for the HP-48 to the HP50g, and I encounter some problems with this. The mnemonics below are not recognized by MASD. Are there replacement mnemonics for this? This list is not the program itself, but the mnemonics from the program parts, with which I have problems, and are in a random order. Who can help me with this? Sincerely, Karel. D1=A D1=D1+ 5 DSRB.F A C=C-CON A,5 B=C A C=R3 B=B+A A C=C+A A C=C+CON A,16 D0=C A=A&C A A=C A A=R4 D0=A A=A+C A D=C A B=A A CD0EX A=DAT0 S I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
12-21-2019, 03:22 AM
(This post was last modified: 12-21-2019 04:57 AM by Joe Horn.)
Post: #2
|
|||
|
|||
RE: New machine language port
If you're compiling using the 50g's built-in assembler, then you have a setting wrong somewhere*, or a syntax error (e.g. a missing final "@"), because the mnemonics you listed are valid in the 50g.
On the other hand, if you're using a non-HP assembler, you might need an HP<>AG translation table, such as the following: http://holyjoe.net/hp/ROSETTA.TXT For example, if you look up the D1=A mnemonic, you'll see that it's a valid HP mnemonic, whose AG equivalent is MOVE.A A,D1. Explanations are at the top of the file. * EDIT: One setting which makes a difference is flag -92: Set means "MASD SysRPL mode" and clear means "MASD asm mode". EDIT 2: ASM assembles the following (useless Code object) correctly in SysRPL mode (when flag -92 is set): "CODE D1=A ENDCODE @" ASM assembles the the following into the same (useless) Code object when flag -92 is clear (asm mode): "D1=A @" Do not run that Code object; it's just an example of using one of the opcodes you listed. <0|ɸ|0> -Joe- |
|||
12-22-2019, 03:14 AM
Post: #3
|
|||
|
|||
RE: New machine language port
> If you're compiling using the 50g's built-in assembler, then you have a setting > wrong somewhere*, or a syntax error (e.g. a missing final "@"), because the > > mnemonics you listed are valid in the 50g.
Which setting would that be, I do not know where to change those. > or example, if you look up the D1=A mnemonic, you'll see that it's a valid HP > mnemonic. Yes, I have seen that, but I do not know how it is possible that I get those errors. > * EDIT: One setting which makes a difference is flag -92: Set means "MASD > SysRPL mode" and clear means "MASD asm mode". Flag -92 is set, because I program always in sys-rpl. Assembly is something I hope to learn someday, but is difficult yet, despite the documentation I have. > EDIT 2: ASM assembles the following (useless Code object) correctly in SysRPL > mode (when flag -92 is set): > "CODE > D1=A > ENDCODE > @" Most of the code is placed in "CODE" and "ENDCODE" statements, so that should not be a problem. However, the errors are incomprehensive to me. I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
12-22-2019, 05:25 AM
Post: #4
|
|||
|
|||
RE: New machine language port
Aha... I think I detect the problem here. Are you trying to use those mnemonics in System RPL mode, outside of a CODE / ENDCODE block? If so, that's the problem. None of the mnemonics you listed are System RPL commands. They are Saturn assembly language mnemonics which only makes sense inside the source code of a Code object. In brief, System RPL is a different language than Saturn Assembly Language. You *can* create a single System RPL program object which contains both SRPL code and Saturn code, but to do that you must enclose all Saturn code inside a CODE / ENDCODE bloack in the System RPL source code.
If the above does not describe your problem, then please post the shortest source code you've had trouble with, and share exactly how you tried to assemble it, and exactly what the result was. That would help us figure out what's causing the errors you're seeing. <0|ɸ|0> -Joe- |
|||
12-22-2019, 09:15 PM
Post: #5
|
|||
|
|||
RE: New machine language port
Dear Mr. Horn,
Below you will find one of the smallest programs in the package to be ported. In total, the package covers more than 20 kB of source code, most of which in assembly. Both marked "D1=A" instructions produce an "Invalid Field" error message. Note that the last "D1=A" mnemonic gives no error message. All this is a mystery to me. Maybe this is clear to you, and you can help me solve this problem. I hope to hear from you soon. Sincerely, Karel. :: CODE GOSBVL =SAVPTR A=DAT1 A AD1EX D1=D1+ 10 CD1EX R4=C D1=A <----- error! D1=D1+ 5 A=DAT1 A AD1EX D1=D1+ 5 C=DAT1 A A=R4 D1=A <----- error! C=0 S C=C-1 S *LBCB5E A=DAT1 B A=A+1 B GOC LBCB7D D1=D1+ 2 DAT1=C S D1=D1+ 16 AD1EX A=A+C A D1=A <----- no error! GOTO LBCB5E *LBCB7D A=0 A A=A-1 A GOVLNG =PUSH#ALOOP ENDCODE ; @ I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
12-22-2019, 11:31 PM
Post: #6
|
|||
|
|||
RE: New machine language port
Just guessing here, but:
Both errors directly follow references to "R4", which seems is not a coincidence... Perhaps you need to specify the field specifier of A, as in: D1=A A --Bob Prosperi |
|||
12-23-2019, 12:12 AM
(This post was last modified: 12-23-2019 12:13 AM by Joe Horn.)
Post: #7
|
|||
|
|||
RE: New machine language port
(12-22-2019 11:31 PM)rprosperi Wrote: Just guessing here, but: Almost correct, but the required field is W, not A. Change every R4=C to R4=C W and change every A=R4 to A=R4 W and so on. When the W field is the only one valid for a command, the syntax should allow it to be omitted, but apparently in this case you have to specify it. Silly assembler! Two lessons learned here: (1) When the error message is "Invalid Field", look for a bad or missing field specifier. (2) Very often the error pointer will be pointing at the line after where the error actually happened. Hope that helps! <0|ɸ|0> -Joe- |
|||
12-23-2019, 02:56 AM
Post: #8
|
|||
|
|||
RE: New machine language port
(12-23-2019 12:12 AM)Joe Horn Wrote: Almost correct, but... I consider that a satisfying near-victory for Saturn Assembler knowledge. At least some of it stuck, somehow... --Bob Prosperi |
|||
12-23-2019, 07:35 AM
(This post was last modified: 12-23-2019 07:37 AM by Joe Horn.)
Post: #9
|
|||
|
|||
RE: New machine language port
(12-23-2019 12:12 AM)Joe Horn Wrote: When the W field is the only one valid for a command, the syntax should allow it to be omitted, but apparently in this case you have to specify it. Silly assembler! Update: I just checked the 50g AUR, and the "RReg" commands (e.g. R0=A W) have been extended (in the Saturn simulator used by the 50g) to allow more fields than just W. Since other fields can be used now (e.g. R0=A X), the source code must specify the desired field. The W field cannot be assumed like it was on the HP 48. So there's Lesson #3 to be learned here too: Check the 50g AUR (beginning on page 6-19) for the Saturn Assembly Language used in the HP 50g. It is much richer than the HP 48 Saturn Assembly Language. <0|ɸ|0> -Joe- |
|||
12-24-2019, 12:30 AM
Post: #10
|
|||
|
|||
RE: New machine language port
Hi guys,
That worked! The HP50g AUR that I have only handles user RPL, so which AUR are we talking about? And if another AUR already exists, how can I obtain it? Here is another mnemonic that causes the following error message: "Invalid Field", 'DSRB.F A'. This mnemonic is preceded by this: 'SB=0'. Does the same apply here as for the earlier 'D1=A'? Sincerely, Karel. I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
12-24-2019, 02:31 AM
Post: #11
|
|||
|
|||
RE: New machine language port | |||
12-24-2019, 03:00 AM
Post: #12
|
|||
|
|||
RE: New machine language port
(12-24-2019 12:30 AM)cahlucas Wrote: ... Here is another mnemonic that causes the following error message: "Invalid Field", 'DSRB.F A'. This mnemonic is preceded by this: 'SB=0'. Does the same apply here as for the earlier 'D1=A'? This time the invalid field is actually where it says it is. The "f" in the syntax "DSRB.f" stands for "field". Replace that "f" with whatever field you want. For example, if you want to execute DSRB on the A field, the syntax is "DSRB.A" or "DSRB A" (not "DSRB.F A"). <0|ɸ|0> -Joe- |
|||
12-24-2019, 04:52 PM
Post: #13
|
|||
|
|||
RE: New machine language port
(12-24-2019 02:31 AM)Gene Wrote: HP-50G AUR Dear Mr. Gene, This is essentially the same AUR that I have at home in printed form. It contains absolutely nothing that relates to machine language. This means that Mr. J.Horn meant a very different AUR. However, I do not know which one, and would like to know that, and also where I can get it. Sincerely, Karel. I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
12-24-2019, 06:10 PM
Post: #14
|
|||
|
|||
RE: New machine language port
(12-24-2019 04:52 PM)cahlucas Wrote:(12-24-2019 02:31 AM)Gene Wrote: HP-50G AUR Try again. We have the same version. As I replied above, the Saturn Assembly Language section begins on page 6-19. That's "page six dash nineteen", not "pages six through 19". You PDF viewer might also call it "page 517". After reading that section, be sure to read all of Chapter 6. Hope that helps! <0|ɸ|0> -Joe- |
|||
12-24-2019, 06:12 PM
Post: #15
|
|||
|
|||
RE: New machine language port
(12-24-2019 04:52 PM)cahlucas Wrote:(12-24-2019 02:31 AM)Gene Wrote: HP-50G AUR I just downloaded it and found the section at page 6-19 onward to which Joe refers. The section is called "Saturn ASM mode". It is there. Jake |
|||
12-24-2019, 10:51 PM
Post: #16
|
|||
|
|||
RE: New machine language port
(12-24-2019 03:00 AM)Joe Horn Wrote:(12-24-2019 12:30 AM)cahlucas Wrote: ... Here is another mnemonic that causes the following error message: "Invalid Field", 'DSRB.F A'. This mnemonic is preceded by this: 'SB=0'. Does the same apply here as for the earlier 'D1=A'? Dear Mr. Horn, That also worked! That is, I can compile the program. Below is another program with the errors that the assembler returned. I have already improved some mnemonics, but there are still statements that cause problems, see below. Hopefully you can help me with this too. Merry Christmas! Sincerely, Karel. :: CODE GOSBVL =SAVPTR SETHEX P= 0 A=DAT1 A AD1EX D1=D1+ 5 C=DAT1 A R0=C W D1=A D1=D1+ 5 A=DAT1 A AD1EX D1=D1+ 10 CD1EX R3=C W D1=A D1=D1+ 5 C=DAT1 A CD0EX D0=D0+ 5 C=DAT0 A R2=C W D1=D1+ 5 C=DAT1 A CD0EX D0=D0+ 5 C=DAT0 A C=C-CON A,5 <----- Bad Expression! R1=C W B=C A D0=D0+ 5 CD0EX C=C+B A C=C-1 A C=C-1 A R4=C W C=R3 W D0=C B=0 A *LBCF90 A=DAT0 B A=A+1 B GOC LBCFC1 D0=D0+ 2 A=DAT0 S A=A+1 S GONC LBCFAF A=R1 W B=B+A A B=B+1 A B=B+1 A *LBCFAF D0=D0+ 16 CD0EX A=R2 W C=C+A A D0=C GOTO LBCF90 *LBCFC1 C=B A C=C+CON A,16 <----- Invalid Field! GOSBVL =GETTEMP AD0EX D0=A C=C-CON A,5 <----- Bad Expression! D0=D0+ 5 DAT0=C A D0=A LC(5) =DOCSTR <----- Bad Expression! DAT0=C A GOSBVL =GPPushA GOSBVL =SAVPTR A=A+CON A,10 <----- Invalid Field! D1=A LC(2) #2B <----- Bad Expression! DAT1=C B D1=D1+ 2 C=R3 W D0=C ST=0 2 *LBD019 A=DAT0 B A=A+1 B GONC LBD046 ?ST=1 2 GOYES LBD035 LC(2) #30 DAT1=C B D1=D1+ 2 GOTO LBD038 *LBD035 D1=D1- 2 *LBD038 LC(2) #20 DAT1=C B GOVLNG =GETPTRLOOP *LBD046 D0=D0+ 2 A=DAT0 S A=A+1 S GOC LBD065 *LBD053 D0=D0+ 16 CD0EX A=R2 W C=C+A A D0=C GOTO LBD019 *LBD065 D0=D0+ 1 A=DAT0 A C=R0 W A=A+C A ?A#0 A GOYES LBD07E D0=D0- 1 GOTO LBD053 *LBD07E D0=D0+ 5 A=DAT0 A C=A A D=C A D0=D0+ 5 C=DAT0 A A=-A-1 A B=A A A=A!C A B=B&C A B=-B-1 A A=A&B A D0=D0+ 5 CD0EX RSTK=C C=R4 W D0=C C=R1 W B=C A BSRB A ST=1 1 *LBD0BB ?B#0 A GOYES LBD0EB ?ST=0 1 GOYES LBD0CF LC(2) #31 DAT1=C B D1=D1+ 2 *LBD0CF GOSUB LBD12F LC(2) #2B <----- Bad Expression! DAT1=C B D1=D1+ 2 C=RSTK A=R2 W C=C+A A D0=C GOTO LBD019 *LBD0EB SB=0 DSRB A ?SB=0 GOYES LBD104 C=DAT0 B ASRB A GOTO LBD11D *LBD104 ASRB A ?SB=0 GOYES LBD126 C=DAT0 B C=C+CON A,16 <----- Invalid Field! C=C+CON A,16 <----- Invalid Field! *LBD11D DAT1=C B D1=D1+ 2 ST=0 1 *LBD126 D0=D0- 2 B=B-1 A GOTO LBD0BB *LBD12F CD1EX RSTK=C C=C-CON A,2 <----- Bad Expression! D0=C D1=C LC(2) #2B <----- Bad Expression! *LBD144 A=DAT0 B ?C=A B GOYES LBD153 D0=D0- 2 GOTO LBD144 *LBD153 D0=D0+ 2 *LBD156 AD0EX D0=A CD1EX D1=C ?C<=A A GOYES LBD17D A=DAT0 B C=DAT1 B DAT0=C B DAT1=A B D0=D0+ 2 D1=D1- 2 GOTO LBD156 *LBD17D C=RSTK D1=C ST=1 2 RTN ENDCODE DUP $ " " ONE POS$ #1- TWO SWAP SUB$ ; @ I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
12-24-2019, 11:15 PM
Post: #17
|
|||
|
|||
RE: New machine language port
(12-24-2019 10:51 PM)cahlucas Wrote: ... there are still statements that cause problems, see below. Hopefully you can help me with this too. Interesting... there seem to be many subtle differences between the old HP 48 assembler tools and the 50g's assembler. I hope the following suggestions work for you. C=C-CON A,5 <----- Bad Expression! Try C=C-5.A (I don't think the 50g allows the old "CON" syntax.) C=C+CON A,16 <----- Invalid Field! Try C=C+16.A C=C-CON A,5 <----- Bad Expression! see above LC(5) =DOCSTR <----- Bad Expression! Try LC(5) DOCSTR (Omit the leading = sign) A=A+CON A,10 <----- Invalid Field! Try A=A+10.A LC(2) #2B <----- Bad Expression! Try LC 2B (see LC syntax on page 6-23 of the AUR) C=C+CON A,16 <----- Invalid Field! see above C=C-CON A,2 <----- Bad Expression! Try C=C-2.A LC(2) #2B <----- Bad Expression! see above If any of the above don't work, please let us know. <0|ɸ|0> -Joe- |
|||
12-24-2019, 11:25 PM
Post: #18
|
|||
|
|||
RE: New machine language port
(12-24-2019 06:12 PM)Jake Schwartz Wrote:(12-24-2019 04:52 PM)cahlucas Wrote: Dear Mr. Gene, Dear Mr. Schwartz, I just checked, and you are right. And when I saw it, I remembered that I had indeed seen it before, but I use the AUR so little because I always program in sys-RPL that I had completely forgotten it was there. Thank you and happy Christmas! Sincerely, Karel. I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
12-24-2019, 11:30 PM
Post: #19
|
|||
|
|||
RE: New machine language port
(12-24-2019 06:10 PM)Joe Horn Wrote:(12-24-2019 04:52 PM)cahlucas Wrote: Dear Mr. Gene, Dear Mr. Horn, Yes, your right. I have checked and it is indeed there. Thank you! Sincerely, Karel. I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
12-27-2019, 12:19 AM
Post: #20
|
|||
|
|||
RE: New machine language port
(12-24-2019 11:15 PM)Joe Horn Wrote: If any of the above don't work, please let us know. Dear Mr. Horn, I can compile everything, except for a part of the program. And strangely enough, it is a sys-rpl statement, the 'MDIMS' command, which can be found on page 90 of the book "An Introduction to HP 48 System RPL and Assembly Language Programming" by James Donnelly, March 1, 2009. It gives a "Can't Find" error message. It is in a part of the program outside the 'CODE' and 'ENDCODE' statements, in a part with only sys-rpl. So apparently this is a valid instruction that is not recognized. Hopefully this can be solved. Sincerely, Karel. I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)