Ok, writing code like this is a real pain. I think I need to shorten my bootloader to get it up and running faster. Maybe after I get it going I will expand it. I know with old computers where you had to input the bootloader via switches on the front panel, it was highly desirable to write the shortest possible bootloader. So now my plan is:
- Echo characters back to uart (DONE!)
- When a key is pressed, put it at string index, and increase string index
- Backspace key will decrease string index
- Jump to string processing after carriage return entered
- 1st character is command (W - write, J - jump) (anything else jumps back to top)
- if write then
- Next four hexnumbers are the memory address (convert from ASCII)
- Last 2 hexnumbers are data to write (convert from ASCII)
- if a jump,
- Next four hexnumbers are the memory address (convert from ASCII)
- set PC to entered memory address (begin executing!)
So this code must be entered with the exact number of characters (5 or 7). Backspace will still work. It will not echo back the string afterward. Once I get this going, then I can enhance it later. Even this is somewhat complicated. But I could write a better bootloader later. That's how it used to be - very simple bootloader to better bootloader to better bootloader.
If I automated sending code, then I could get rid of the ASCII characters, enter it in binary, get rid of the backspace and echoing of characters. So I could streamline this even more, but I think it's ok as is.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.