stardance has been extended another month! the new deadline is october 31 :)

You are browsing as a guest. Sign up (or log in) to start making projects!

2h 2m 51s logged

LOG 4: KEYBOARD IS FINALLY FUNCTIONAL FOR (hopefully) ALL INSTRUCTIONS!!!! (and some bug fixes)

After a long battle with the code i finally figured out how to implement the keyboard without the keys only being picked up every once in a while.

HOW DID I DO IT?

Previously the keyboard was simple a bool array and if i a button was pressed the corresponding part of the keypad array was turned true. The issue with that was that with this simple implementation there had to be one of 2 mandatory pay-offs: Case A would be that the keys would be sticky and never get turned false, Case B would be that they get reset on every iteration of the main loop which is too fast for instructions 0x9E and 0xA1 in certain programs, as they need the value for multiple iterations. Simply holding down the key was actually too slow because of the way holding down a key works on linux which is why i had to do the following implmentation:

Step A:

  • Get the current pressed button, turn it to true and save the time the button was pressed

Step B:

  • Get the time distance between when the button was pressed and the current time .
  • Loop through the keyboard array and check for keys that are true
  • If a key is true and if the time distance is larger/equal than/to the threshold (50 ms), turn that key false.
  • Following from this if the distance is smaller or equal to the acceptable distance the key stays true and the loop can work with it.

BUG FIXES

ISSUE WITH INSTRUCTION 0x8xy6 and 0x8xyE

Previously 0x8xy6 and 0x8xyE bitshifted chip.v_reg[x] either « 1 or » 1 which i found out was false after rereading the docs because a test code wasnt working properly. The fix was just to implement the correct instruction (chip.v_reg[x] = chip.v_reg[y] « 1 or the same using » 1)

0
12

Comments 0

No comments yet. Be the first!