Sunday, April 16, 2017

Retrochallenge 2017 RC2017/04 Project Updates

This is the page for the Retrochallenge 2017 RC2017/04

The goal for this challenge is to further optimize the 6502 Enigma Z30 Machine Simulator for the Kim UNO.

This page will grow as entries are added.

Will be tweeting about it with the #rc201704 #retrochallenge tags

All the source code is available at:

For this challenge, we will be updating:


Optimized several routines. Went after the low fruit first.

The more interesting one was unrolling two loops in SETCHL resulted in smaller code than the original.

Moved the call for moving the rotors (MOVROT) to READKY., Now the F2 handler is really small, copy the values to show in the screen, call READKY and if B is pushed, save the values in the screen.

Got code down to 695 bytes, smaller than v1.

Noticed that on F3 screen, when GEA0 shows, pushing [PC] exits to main screen instead of just doing nothing. That's not good.


Used the Virtual 6502 Emulator to debug the code

Realized that when MOVROT was moved to READKY, affects the key pressed stored in A. Pushing [PC], (value 0x14) increments the letter A (value 0x0A) in the word GEA0 to the letter B (value 0x0B). This value is left in the accumulator and the READKY routine exits to the F3 handler. The F3 handler sees the 0x0B value in the accumulator, interprets that as the key [B] being pushed and exits.
Saving the accumulator and restoring after MOVROT fixed the bug.

Gained 2 bytes, 697, but still small than v1

Learned how to use the Relocate and Moveit utilities included with the KIM Uno to move the code down two bytes instead of typing it again.

Created v3 in github.

No comments:

Post a Comment