Skip to content

Instantly share code, notes, and snippets.

@shirriff
Last active June 8, 2024 14:45
Show Gist options
  • Save shirriff/81e0cb7802ee613058f0313e810f1512 to your computer and use it in GitHub Desktop.
Save shirriff/81e0cb7802ee613058f0313e810f1512 to your computer and use it in GitHub Desktop.
HP Nanoprocessor code to determine the number of days in a month
d0 STR-0 Store the next byte (7) in register 0.
07
0c SLE Skip two instructions if accumulator <= register 0.
03 DED Decrement the accumulator in decimal mode
5f NOP No operation
d0 STR-0 Store the next byte (0x31) in register 0
31
30 SBZ-0 Skip two instruction bytes if accumulator bit 0 is zero
81 JMP-1 Jump to 0x1c9 (end of this code block)
c9
a1 CBN-1 Clear accumulator bit 1
d0 STR-0 Store the next byte (0x30) in register 0
30
0f SAN Skip two instruction bytes if accumulator not zero
d0 STR-0 Store next byte (0x28) in register 0
28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment