(HP48) Assembler Question
|
02-14-2023, 08:52 AM
Post: #1
|
|||
|
|||
(HP48) Assembler Question
Hi,
i am trying to pop a real from the stack to use this value for further calculations. I expected the result in A(W). But the following Code, causes a reset or memory clear :-) : ... GOSBVL =POP1% GOSBVL =SAVEPTR % do something with A(W) SETHEX % POP1 sets DEC Mode GOSBVL =GETPTRLOOP How do I use POP1% in the right way? Do i have to increase D+1 and D1+5 (did not worked at all) ? My 2nd question is regarding the =LOOP entrypoint on my G with ROM Version M with MetaKernel 2.3 GOVLNG =LOOP causes a soft reset This simple code does not work GOSBVL =SAVEPTR % save regs % some instructions GOSBVL =GETPTR % restore regs GOVLNG =LOOP % exit to RPL I am using this one instead, which never made any problems: GOSBVL =SAVEPTR % some instructions GOSBVL =GETPTRLOOP % exit to RPL But examining the romcode, this should be the same. Ralf |
|||
02-14-2023, 01:19 PM
(This post was last modified: 06-16-2023 08:19 PM by Giuseppe Donnini.)
Post: #2
|
|||
|
|||
RE: (HP48) Assembler Question
1. HOW TO CALL POP1%
POP1% already contains a jump to SAVPTR. Here is what its disassembly looks like (I’ve added some comments to make it as readable as possible): Code: 29FDA =POP1% So, here’s the right way to do it: Code: GOSBVL =POP1% Also note that GETPTRLOOP passes control back to System RPL, so you should use GOVLNG instead of GOSBVL. It’s not a good idea to leave garbage on the hardware return stack. 2. LOOP vs. Loop
In the world of RPL and SATURN Assembly, everything is case sensitive. LOOP can be one of two things:
Loop, on the other hand, is the machine-language entry point you are looking for. Code: 2D564 =Loop To sum it all up: If you want to give control back to the RPL world:
|
|||
02-15-2023, 11:08 AM
Post: #3
|
|||
|
|||
RE: (HP48) Assembler Question
Hi Giuseppe,
thank you for the extensive reply. Perfect! POP1% now works, i did not realize, that SAVEPTR is already included. I will try the LOOP suggestions, i am already using alternatives, so i was wondering if the problem was only metakernel related. Thanks again. Ralf |
|||
02-18-2023, 12:43 PM
(This post was last modified: 02-18-2023 01:59 PM by Giuseppe Donnini.)
Post: #4
|
|||
|
|||
RE: (HP48) Assembler Question
You’re welcome. Note that, conversely, PUSH% already includes a SETHEX instruction as well as a call to GETPTR. Therefore, if in the middle section of your code, you intend to recall the RPL variables in order to modify them yourself, you have to call SAVPTR again before calling PUSH%. Otherwise, the relevant CPU registers will be overwritten by the former (and now obsolete) values.
|
|||
03-02-2023, 10:53 AM
Post: #5
|
|||
|
|||
RE: (HP48) Assembler Question
Hi Giuseppe,
yes i made another program which used push% many times, but in this case i made it intuitively correct. Is there a good tool which can dissasemble this entry points? Like a memory browser. I have only the jazz disasm, which can disam only code or sysrpl. Ralf /41/48/ |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)