Here’s how we get from a key press to the HP-65 (or emulator) actually doing something …
The HP-65 key press routine is part of the wait loop. After all, that is the main thing it is waiting for.
As you know, the wait loop starts at 00726. After a few instructions it gets to 00623 which checks the s0 flag to see if a key has been pressed. If not, it continues to 00452 and then through the rest of the loop. However, if s0 is 1 then we get to 00625 and start processing a key press.
The first thing it does is wait a bit. 00625-00627 simply loops 16 times. It starts with P=12 and adds 1 each time until P gets back to 12.
00630 clears the “a key has been pressed” flag (the s0 value that got us to here).
00710 turns off the display and puts a 0 in a[0] as a starting point for what comes later.
00715 puts us in the 01000 address space and causes us to execute a 01316 “key -> rom” instruction just after that. In effect we now do a “switch statement” to 01000 + the scan code of the pressed key. See below:
00726 if s9 = 0 00727 goto 00622 00622 12 -> p ; P= 12 00623 if s0 = 0 00624 goto 00452 00625 p + 1 -> p ; P= 13 00626 if p # 12 00627 goto 00625 ; P= 14, 15, 0, 1, 2, ..., 11 00625 p + 1 -> p ; P= 12 00626 if p # 12 00627 goto 00625 00630 0 -> s0 ; S= ............ 00631 if s10 = 0 00632 goto 00641 00641 if s5 = 0 00642 goto 00734 00734 if s8 = 0 00735 goto 00710 00710 jsb 00675 .00675 12 -> p .00676 1 -> f3 .00677 dispoff .00700 c <-> m ; C= 00000000000221 M =00000000000000 .00701 shiftl a[w] ; A= 00000000009990 .00702 return 00711 1 -> f7 00712 if s3 = 0 00713 goto 00715 00715 rom 2 01316 key -> rom
Where does it go next? See HP-65 Program Code Jump Table.