Ports 22 and 23 define which rom pages should be executable. According to WikiTI, both exclude the page they are set to. That means, when you set both to the same value, all pages below and above this value should be executable, but the one page in the middle should not be.

However, when both are set to 00, page 00 remains executable. This is interesting, because it doesn't happen for any of the other pages. This seems to suggest page 00 is in a way special because it is always executable. This also doesn't depend on whether page 00 is mounted in bank 0 or bank 1.

On the other hand, when both are set to 01, page 01 is not executable.

Now, this has only been tested on one physical calculator until now, a rev-AB 84+ running 2.43. It has also been tested in both TilEm and WabbitEmu, where both acted wrong, but in different ways. TilEm crashed on both, meaning it doesn't consider page 00 to be special, unlike real hardware. WabbitEmu didn't crash on both, meaning either one of the ports is interpreted as inclusive. jsTIfied does the same as WabbitEmu.

The testing programs used for this are the following:
test1.8xp
test2.8xp
Note: both show up as prgmAAA on-calc and they assume there is a C9 byte at $000F and at $44D0 (on page 01) (as it is the case on 2.43, but almost definitely not on other versions; for example on 2.55, test2 enters an infinite loop)

Furthermore, another thing that is incorrect on WikiTI is that port 22 has precedence over port 23. This is indistinguishable from 23 having precedence over 22 (in both cases, the pages between these values would remain executable) and this statement should therefore be omitted.

Another thing that seems to not be making sense is the state of the calculator at boot, which says both port 22 and 23 read 00, which would imply all pages are executable (00 being executable because 00 is special as test1.8xp proves), but the bullet list below on that page says "All parts of flash except privileged pages are non-executable" which seems to contradict the values of the ports.

Now all that is needed is for others to confirm these findings. So please, if you have a calculator with 2.43, try the programs above and report if they crash. If you don't have a calculator with 2.43, you'll have to assemble the program yourself, this is the code:

Code:
 call unlockflash
 xor a
 out ($22),a
 out ($23),a
 call $000f
 dec a
 out ($22),a
 jp lockflash
and
Code:
 call unlockflash
 ld a,1
 out ($22),a
 out ($23),a
 out ($06),a
 call $44d0
 ld a,$ff
 out ($22),a
 ld a,$07
 out ($06),a
 jp lockflash
(where $000f and $44d0 are C9 bytes on their respective page, and unlockflash and lockflash are routines which unlock and lock flash respectively)
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement