I have no idea why my code isn´t working. Programming the EEPROM worked fine before. Now it programs only first 2 bytes and the rest is zero. I tried writing 0x55 everywhere and it worked. So either I don´t know how to use if properly or there is something outside the code I am missing.
This is probably not enough information for you to help me so feel free to ask.
*The function of the offset is to split resulting 32 bits into 3 parts of 8 bit size. (Last 8 bits are useless)
Please help. I would really, !really! appreciate it.
Disclaimer: Yes, I was inspired by Ben Eater´s how to bit 8 bit computer.
it's not a great idea to use data as a local variable in function and as a global, that leads to confusion when reading the program.
your long list of if could benefit having using an if-else type of construct. it also feels quite repetitive so probably could become a loop.
why do you bit-OR an address with a specific masks here if (0b00011111000 == (address | 0b00011111000 /*LDA*/)) { or here if (0b00111111000 == (address | 0b00011111000 /*LDB*/)) {and next fews and not later if (0b11010010000 == address /*SUBA*/) {this feels inconsistent but may be there is a good reason
Thank you very much! I finally discovered what I was missing.
I wasnt printing the whole memory.
Data variable might have caused some trouble as you pointed out.
I forgot to put "=" into the for loop condition.
If else made the whole code much faster, thank you for that advice aswell.
The function of the mask was to check if only first and last 3 bits have some specific value, because some instructions include the address for the instruction. Instruction decoder doesnt care about the address.
Next time I will try to look at it after some pause before asking for help. I just couldnt see it when I was programming it, but today it stroke me immediately.