So basically I've developed a password system for a future game. There are 64 characters which correspond to a number from 0-63, which then correspond a respective 6-bit string. 42 boolean variables are then loaded 6 at a time from the 6 bits in each password character. The password itself is 7 characters long (hence the 42 variables that can be loaded from it) plus an 8th character which basically acts as a checksum for error detection.
So for example, if the first character in the password is 4, that corresponds to %00000100. So 0 would be loaded into var5, 0 to var4, 1 to var3, 0 to var 2, 0 to var1, and 0 to var0.
Reading the password and error-checking all works fine, I just can't figure out how to load the data from the password into what would be the variables for the game.
My plan for this last step is to shift the binary string right and shift it back left into its respective variable.
But when I check the hex editor, some of the varx variables are 3 or some other number, when they should only be 0 or 1, and I don't understand why it's happening
So for example, if the first character in the password is 4, that corresponds to %00000100. So 0 would be loaded into var5, 0 to var4, 1 to var3, 0 to var 2, 0 to var1, and 0 to var0.
Reading the password and error-checking all works fine, I just can't figure out how to load the data from the password into what would be the variables for the game.
My plan for this last step is to shift the binary string right and shift it back left into its respective variable.
Code:
Lda passwordbuffer ; 7 bytes reserved that hold the values of the 7 characters entered
Lsr a
Rol var5 ;in an actual game these would obviously have different names
Lsr a
Rol var4
Lsr a
Rol var3
Lsr a
Rol var2
Lsr a
Rol var1
Lsr a
Rol var0
Lsr a
Rol var5 ;in an actual game these would obviously have different names
Lsr a
Rol var4
Lsr a
Rol var3
Lsr a
Rol var2
Lsr a
Rol var1
Lsr a
Rol var0
But when I check the hex editor, some of the varx variables are 3 or some other number, when they should only be 0 or 1, and I don't understand why it's happening