Post Reply 
LBL and END handling on the PX41CX and in PX41CX_Interface.xls
11-12-2024, 07:45 AM (This post was last modified: 11-20-2024 06:55 AM by krischik.)
Post: #1
LBL and END handling on the PX41CX and in PX41CX_Interface.xls
Hello @agarza and @Pierre

I created a little test program mostly consisting of LBL statements and dumped it from my PX41CX. The program decodes on dm41.swissmicros like this:


Code:

PX41
08 4b000000000000 00000000000000 00000000001000 00000000000000 
0c 0000000000618e 1a70016919c18e 0000002c048000 00000000007000 
18c 00000000000000 00000000000000 09000000cc0020 542d2d3785ca01 
190 c801f800544553 54455354203630 543539c601f700 c401f600544553 
194 f5005445535437 0054455336c201 00544536c001f4 f2005435cc00f3 
198 02f2005a34cc00 cf6332cf6633cc 54455354300131 c000f8004c424c 
A: 09999999999000  B: 0000002c0480fd  C: 000000002c00fd
S: 00101010000000
M: 000018a5ff83d3  N: 00000000000000  G: 20
EOF

Code:
STACK = 0 0 0 0 0
; ALPHA = '                        '
; SIZE =  100
; A: 09999999999000  B: 0000002c0480fd  C: 000000002c00fd
; S: 00101010000000
; M: 000018a5ff83d3  N: 00000000000000  G: 20
; PRG = 19B .. 18E
LBL 'LBLTEST'       ; C000F8004C424C54455354
STO 00              ; 30
LBL 00              ; 01
STO 01              ; 31
LBL 99              ; CF63
STO 02              ; 32
LBL A               ; CF66
STO 03              ; 33
LBL 'Z'             ; CC02F2005A
STO 04              ; 34
LBL 'T'             ; CC00F20054
STO 05              ; 35
LBL 'TE'            ; CC00F3005445
STO 06              ; 36
LBL 'TES'           ; C001F400544553
STO 06              ; 36
LBL 'TEST'          ; C201F50054455354
STO 07              ; 37
LBL 'TEST5'         ; C401F6005445535435
STO 09              ; 39
LBL 'TEST 6'        ; C601F700544553542036
STO 00              ; 30
LBL 'TEST--7'       ; C801F800544553542D2D37
RTN                 ; 85
END                 ; CA0109
GLOBAL              ; CC
RCL 00              ; 20
END

I now have two Problems:

  1. I can't send the progam back to my PX-41CX. It just doesn't read.
  2. it won't decode properly with with PX41CX_Interface.xls.


I already analysed the the Visual Basic and noted a few bugs in the handling of LBL and END which I corrected in my own decoder (line 414 .. 424).

Why analysing I noticed that both LBL and END start with hex C followed by various status flags – which may or may not be hex 0 — which makes decoding them almost heuristic. This is pretty error prone. So I wonder if Receive has a problem in that area as well.

What I find especially interesting is the „0=compiled or 1=not compiled“ flag for the END command which I found in the hp41cx-prog-handbook.pdf. Does anybody know what precisely is compiled.

Regards

Martin

https://uiq3.sf.net/rpn-45/
Developer RPN-45, FX-602P Simulator, FX-603P Simulator
HP16C, HP35s, HP-Prime, FX-602P, FX-603P, PC-1403



Visit this user's website Find all posts by this user
Quote this message in a reply
11-12-2024, 03:54 PM
Post: #2
Something strange with register handling as well
I have another problematic one. If you load this test program and pack with GTO.. the program disappears.

Code:
PX41
08 4b000000000000 000000003e3c58 0000000000c000 00000000000000 
0c 00000000004193 1a70016919c193 0000002c048000 0000000005101b 
190 00000000000000 00000000000000 00000000000000 18ce9985c8082d 
194 989591169017ce 119a929b939814 968e978f9a109b 958a2b960c970d 
198 85928693879489 93029403950491 54455354309201 c000f800524547 
A: 09999999999000  B: 0000002c0480fd  C: 000000002c00fd
S: 00000010000000
M: 000018a5ff83d3  N: 00000000000000  G: 00
EOF

PS: I'm a computer scientist with focus test engineering. I do strange stuff programers hate me for.

https://uiq3.sf.net/rpn-45/
Developer RPN-45, FX-602P Simulator, FX-603P Simulator
HP16C, HP35s, HP-Prime, FX-602P, FX-603P, PC-1403



Visit this user's website Find all posts by this user
Quote this message in a reply
11-12-2024, 04:33 PM (This post was last modified: 11-12-2024 04:38 PM by Sylvain Cote.)
Post: #3
RE: LBL and END handling on the PX41CX and in PX41CX_Interface.xls
(11-12-2024 07:45 AM)krischik Wrote:  What I find especially interesting is the „0=compiled or 1=not compiled“ flag for the END command which I found in the hp41cx-prog-handbook.pdf. Does anybody know what precisely is compiled.
The compiled bit was supposed to reflect that all GTO/XEQ offset within a program has been calculated and stored into their respective GTO/XEQ.

In reality, AFAIK the END compile bit is always set to 0, even when none/some/all GTO/XEQ offset has been calculated and stored within them.

edit: I just tested the above statement with the ZENROM RAMED function and I can confirm the (reality) behavior on a 41CLv5.

Sylvain Côté
Find all posts by this user
Quote this message in a reply
11-12-2024, 05:02 PM
Post: #4
RE: LBL and END handling on the PX41CX and in PX41CX_Interface.xls
(11-12-2024 04:33 PM)Sylvain Cote Wrote:  
(11-12-2024 07:45 AM)krischik Wrote:  What I find especially interesting is the „0=compiled or 1=not compiled“ flag for the END command which I found in the hp41cx-prog-handbook.pdf. Does anybody know what precisely is compiled.
The compiled bit was supposed to reflect that all GTO/XEQ offset within a program has been calculated and stored into their respective GTO/XEQ.

That is what I suspected. Thanks for confirming. In PX41CX_Interface.xls Pierre relies on those values to be 0 which of course doesn't work in all conditions. And since I copied his code I ran into all sorts of trouble.

Regards
Martin

https://uiq3.sf.net/rpn-45/
Developer RPN-45, FX-602P Simulator, FX-603P Simulator
HP16C, HP35s, HP-Prime, FX-602P, FX-603P, PC-1403



Visit this user's website Find all posts by this user
Quote this message in a reply
11-13-2024, 03:48 PM
Post: #5
RE: LBL and END handling on the PX41CX and in PX41CX_Interface.xls
(11-12-2024 07:45 AM)krischik Wrote:  it won't decode properly with with PX41CX_Interface.xls

Thanks Martin!
I have not detected a single problem in this strange program.
My interface did not decode LBL 99 properly!
which I will correct!

(For the END END ... what is its use?)

(11-12-2024 07:45 AM)krischik Wrote:  I'm a computer scientist with focus test engineering. I do strange stuff programers hate me for.

I have never hated program testers who help me progress.
I only hate those who hit a screen with a hammer and then complain that the screen does not work!
(That is why in France the instructions for electronic devices often include the following: "do not throw violently on the ground")

(11-12-2024 07:45 AM)krischik Wrote:  I created a little test program mostly consisting of LBL statements

Having been responsible for development and "standards and methods" for several years, I would have immediately fired a programmer who wrote such a program ! Smile

Best regards
Pierre

http://ti58c.phweb.me
http://clones.phweb.me
http://www.instagram.com/ti58c
"No! Do or Do not. There is no try!" [Master Yoda]
Visit this user's website Find all posts by this user
Quote this message in a reply
11-15-2024, 02:55 PM
Post: #6
RE: LBL and END handling on the PX41CX and in PX41CX_Interface.xls
(11-13-2024 03:48 PM)Pierre Wrote:  
(11-12-2024 07:45 AM)krischik Wrote:  it won't decode properly with with PX41CX_Interface.xls
I have not detected a single problem in this strange program.

My PX-41CX has problems loading them again. But that is of course not your problem.

In your code I detected the following two problems:


Code:
PX41
08 4b000000000000 00000000000000 0000000000c000 00000000000000 
0c 00000000000193 1a70016919c18f 0000002c048000 00000000015010 
18c 00000000000000 00000000000000 00000000000000 85000000c6062d 
190 e301b100e00000 ae01ae63ae81ae 85000000000000 541ef454455354 
194 53541df4544553 00c000f5005445 66850000000000 cf66d00066e000 
198 85000000000000 63d00063e00063 000000000000cf 02b200e0000185 
A: 09999999999000  B: 0000002c0480fd  C: 000000002c00fd
S: 00000010000000
M: 000018a5ff83d3  N: 00000000000000  G: 00
EOF
Line 5 .. 6 and 19 are not correct.

Code:
PX41
00 01230000000957 91230000000957 01230000000000 91230000000955 
08 4b000000000000 9123fffffffd45 00000000001000 00000000000000 
0c 00000000001194 1a70016919c193 0000002c048000 00000000007000 
190 00000000000000 00000000000000 00000000000000 00000000c20120 
194 141536c0000900 1c111a12131b1c 1534111a121335 1c1112131b1c14 
198 12131b1c141533 12131b14153211 131b1415311c11 01131010301112 
19c 03000000000002 01230000000047 91230000000047 01230000000957 
1a0 91230000000957 01230000000000 91230000000955 00000000000000 
A: 09999999999000  B: 0000002c0480fd  C: 000000002c00fd
S: 00101010000000
M: 000018a5ff83d3  N: 00000000000000  G: 20
EOF
Negative Exponents are on the next line.


https://uiq3.sf.net/rpn-45/
Developer RPN-45, FX-602P Simulator, FX-603P Simulator
HP16C, HP35s, HP-Prime, FX-602P, FX-603P, PC-1403



Visit this user's website Find all posts by this user
Quote this message in a reply
11-15-2024, 05:30 PM
Post: #7
RE: LBL and END handling on the PX41CX and in PX41CX_Interface.xls
Found another one:

Code:

PX41
04 00000000000000 45472054455354 00000000000052 00000000000000 
08 47000000000000 40000002d98000 0000000000c000 00000000000000 
0c 00000000001190 1a70016919c18f 0000012c044000 00000000017027 
18c 00000000000000 00000000000000 00000000000000 06000085c80c2d 
190 99899c059d049e e3926392e3995a 906390e3ce63ce 18ce99916391e3 
194 989591169017ce 119a929b939814 968e978f9a109b 958a2b960c970d 
198 85928693879489 93029403950491 54455354309201 c000f800524547 
A: 09999999999000  B: 0000012c0440fd  C: 000000012c00fd
S: 00100001000000
M: 001018a5ff83d3  N: 000000000c1440  G: 00
EOF

Line 40 .. 44 should look like this

Code:

; LASTX =  0.000000000E+00
; ALPHA = '                REG TEST'
; SIZE =  100
; A: 09999999999000  B: 0000012c0440fd  C: 000000012c00fd
; S: 00100001000000
; M: 001018a5ff83d3  N: 000000000c1440  G: 00
; PRG = 19B .. 18F
LBL 'REGTEST'       ; C000F80052454754455354
STO 00              ; 30
ST+ 01              ; 9201
ST- 02              ; 9302
ST* 03              ; 9403
ST/ 04              ; 9504
STO IND 05          ; 9185
ST+ IND 06          ; 9286
ST- IND 07          ; 9387
ST* IND 09          ; 9489
ST/ IND 10          ; 958A
RCL 11              ; 2B
ISG 12              ; 960C
DSE 13              ; 970D
ISG IND 14          ; 968E
DSE IND 15          ; 978F
ASTO 16             ; 9A10
ARCL 17             ; 9B11
ASTO IND 18         ; 9A92
ARCL IND 19         ; 9B93
VIEW 20             ; 9814
VIEW IND 21         ; 9895
STO 22              ; 9116
RCL 23              ; 9017
X<> 24              ; CE18
X<> IND 25          ; CE99
STO 99              ; 9163
STO IND 99          ; 91E3
RCL 99              ; 9063
RCL IND 99          ; 90E3
X<> 99              ; CE63
X<> IND 99          ; CEE3
ST+ 99              ; 9263
ST+ IND 99          ; 92E3
SREG 90             ; 995A
SREG IND 09         ; 9989
FIX 5               ; 9C05
SCI 4               ; 9D04
ENG 6               ; 9E06
RTN                 ; 85
.END.               ; C80C2D

That should be easy to fix ?.

Code:
    
    '-------------------------------------------------------
    ' Check for FIX, SCI and ENG
    If Left(CodeString, 2) = "9C" Or Left(CodeString, 2) = "9D" Or Left(CodeString, 2) = "9E" Then
        codecomp = Mid(CodeString, 1, 2)
        Instruction = Decode_HP41(codecomp) & Val("&h" & Mid(CodeString, 3, 2))
        codecomp = Mid(CodeString, 1, 4)

https://uiq3.sf.net/rpn-45/
Developer RPN-45, FX-602P Simulator, FX-603P Simulator
HP16C, HP35s, HP-Prime, FX-602P, FX-603P, PC-1403



Visit this user's website Find all posts by this user
Quote this message in a reply
11-15-2024, 07:57 PM
Post: #8
RE: LBL and END handling on the PX41CX and in PX41CX_Interface.xls
(11-15-2024 05:30 PM)krischik Wrote:  In your code I detected the following problems...

Hi Martin,
Thanks for your three cases!

Corrections made, tests in progress... soon available!

For the first case, a small problem that I had to work around:
between 08 and 4b000000000000 it is not a space but an invisible character (ascii=160)
(Due to the copy from forum???)

For the third case...
Code:

    '-------------------------------------------------------
    ' Check for FIX, SCI and ENG
    If Left(CodeString, 2) = "9C" Or Left(CodeString, 2) = "9D" Or Left(CodeString, 2) = "9E" Then
        codecomp = Mid(CodeString, 1, 2)
        Instruction = Decode_HP41(codecomp) & " " & Val("&h" & Mid(CodeString, 3, 2))
        codecomp = Mid(CodeString, 1, 2) & " " & Mid(CodeString, 3, 2)
is more relevant.

Thanks for these cases that allow me to improve my tool.
By email it would have been simpler and faster (with possible attachments)

Best regards
Pierre

http://ti58c.phweb.me
http://clones.phweb.me
http://www.instagram.com/ti58c
"No! Do or Do not. There is no try!" [Master Yoda]
Visit this user's website Find all posts by this user
Quote this message in a reply
11-21-2024, 05:00 PM (This post was last modified: 11-21-2024 05:03 PM by krischik.)
Post: #9
RE: LBL and END handling on the PX41CX and in PX41CX_Interface.xls
(11-15-2024 07:57 PM)Pierre Wrote:  By email it would have been simpler and faster (with possible attachments)

While I would prefer a proper bug tracker. With me bugs per E-Mail often get overlooked if I don't fix them right away.

Anyway, I noticed two bugs in the „Valid Keys“ part of the „Data“ sheet. The Bugs are in the ENTER row and the last row. I have the correct map here:

Code:
   ---
   --  Assignment key codes  => User Key Code
   HP41_Key_Map : array (HP41_Byte_Code range 16#00# .. 16#4c#) of Integer := [
      16#01# => 11,     --  Σ+
      16#11# => 12,     --  1/x
      16#21# => 13,     --  √x
      16#31# => 14,     --  log
      16#41# => 15,     --  ln
      16#02# => 21,     --  x⇋y
      16#12# => 22,     --  R↓
      16#22# => 23,     --  sin
      16#32# => 24,     --  cos
      16#42# => 25,     --  tan
      16#13# => 32,     --  XEQ
      16#23# => 33,     --  STO
      16#33# => 34,     --  RCL
      16#43# => 35,     --  SST
      16#04# => 41,     --  ENTER
      16#24# => 42,     --  CHS
      16#34# => 43,     --  EEX
      16#44# => 44,     --  ←
      16#05# => 51,     --  -
      16#15# => 52,     --  7
      16#25# => 53,     --  8
      16#35# => 54,     --  9
      16#06# => 61,     --  +
      16#16# => 62,     --  4
      16#26# => 63,     --  5
      16#36# => 64,     --  6
      16#07# => 71,     --  ×
      16#17# => 72,     --  1
      16#27# => 73,     --  2
      16#37# => 74,     --  3
      16#08# => 81,     --  ÷
      16#18# => 82,     --  0
      16#28# => 83,     --  .
      16#38# => 84,     --  R/S
      16#09# => -11,    --  INV Σ+
      16#19# => -12,    --  INV 1/x
      16#29# => -13,    --  INV √x
      16#39# => -14,    --  INV log
      16#49# => -15,    --  INV ln
      16#0A# => -21,    --  INV x⇋y
      16#1A# => -22,    --  INV R↓
      16#2A# => -23,    --  INV sin
      16#3A# => -24,    --  INV cos
      16#4A# => -25,    --  INV tan
      16#1B# => -32,    --  INV XEQ
      16#2B# => -33,    --  INV STO
      16#3B# => -34,    --  INV RCL
      16#4B# => -35,    --  INV SST
      16#0C# => -41,    --  INV ENTER
      16#2C# => -42,    --  INV CHS
      16#3C# => -43,    --  INV EEX
      16#4C# => -44,    --  INV ←
      16#0D# => -51,    --  INV -
      16#1D# => -52,    --  INV 7
      16#2D# => -53,    --  INV 8
      16#3D# => -54,    --  INV 9
      16#0E# => -61,    --  INV +
      16#1E# => -62,    --  INV 4
      16#2E# => -63,    --  INV 5
      16#3E# => -64,    --  INV 6
      16#0F# => -71,    --  INV ×
      16#1F# => -72,    --  INV 1
      16#2F# => -73,    --  INV 2
      16#3F# => -74,    --  INV 3
      16#10# => -81,    --  INV ÷
      16#20# => -82,    --  INV 0
      16#30# => -83,    --  INV .
      16#40# => -84,    --  INV R/S
      others => 0];

Interestingly the SwissMicros website has a bug here as well. hp41cx-prog-handbook.pdf has the correct mappings.

Now, lets see how to send an E-Mail.

https://uiq3.sf.net/rpn-45/
Developer RPN-45, FX-602P Simulator, FX-603P Simulator
HP16C, HP35s, HP-Prime, FX-602P, FX-603P, PC-1403



Visit this user's website Find all posts by this user
Quote this message in a reply
11-23-2024, 04:54 PM
Post: #10
RE: LBL and END handling on the PX41CX and in PX41CX_Interface.xls
(11-21-2024 05:00 PM)krischik Wrote:  Interestingly the SwissMicros website has a bug here as well.

I probably inherited bugs from the SwissMicros tool since I empirically started from their coding/decoding to build my code tables.
And I corrected them case by case based on my interface tests between DM41X and PX-41CX and thanks to the various reports made by users.

I will of course correct quickly the two bugs in the „Valid Keys“.

http://ti58c.phweb.me
http://clones.phweb.me
http://www.instagram.com/ti58c
"No! Do or Do not. There is no try!" [Master Yoda]
Visit this user's website Find all posts by this user
Quote this message in a reply
11-23-2024, 06:06 PM
Post: #11
RE: LBL and END handling on the PX41CX and in PX41CX_Interface.xls
(11-23-2024 04:54 PM)Pierre Wrote:  I probably inherited bugs from the SwissMicros tool since I empirically started from their coding/decoding to build my code tables.

I found the original code SwissMicros uses: https://sourceforge.net/projects/hp41uc/. However, it is written in C and uses a state machine. Very hard to read. I much prefer reading your Visual Basic code.

Martin

https://uiq3.sf.net/rpn-45/
Developer RPN-45, FX-602P Simulator, FX-603P Simulator
HP16C, HP35s, HP-Prime, FX-602P, FX-603P, PC-1403



Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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