HP-15C CE woes: 1 bug, 2 limitations, 3 questions
|
08-09-2023, 06:08 PM
Post: #35
|
|||
|
|||
RE: HP-15C CE woes: 1 bug, 2 limitations, 3 questions
(08-09-2023 04:23 PM)David Hayden Wrote:(08-08-2023 05:34 PM)Valentin Albillo Wrote: I find it sad that HP didn't consider including the instructions BGTO/BGSB (backwards GTO/GSB,) identical to GTO/GSB except that they would search backwards for the label instead of forwardsThe problem with searching backwards is you need to parse the instructions, which can be difficult if they are variable length. That was a big issue on the 41C etc., but 15C instructions can easily be unambiguously parsed in both directions. This is because a single-byte instruction, or the second byte of a two-byte instruction, always has a least significant digit 0x0 through 0xE, while the first byte of a two-byte instruction always has a least significant digit of 0xF. Given a pointer to the start of an instruction, the start of a previous instruction can be found by looking two bytes backward. If the byte is of the form xF, it is the start of the previous instruction, which is a two-byte instruction. Otherwise, the byte only one byte back is the previous single-byte instruction. Obviously if the pointer is to the first byte of program memory, there is no previous instruction, just the nonexistent step 000. Similarly, if the pointer is to the second byte of program memory, then the first byte of program memory is the previous instruction. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)