My program that just does gets and puts what was sent worked. But not my latest effort to get a menu program up and running. It doesn’t even seem to get to main().

Hmmm… I noticed that the compiler is inserting it’s own mult and div functions which it needs for atoi. Those were being located in RAM. That turned out to because I removed the _HOME section (among others) from crt0.s when I was trying to get things working. Now, I added it back in and those automatically added arithmetic functions are going to the right place.

Then, all of a sudden the flash programmer started failing. I traced that to the fact I was using the start rather than the iterator in the for loop that erases the sectors in the Arduino, so it was just erasing the first sector over and over. Which was fine when my program fit into one sector…. Literal growing pains.

And…..I seem to be in main() now executing an endless loop of basic pin manipulation that is appearing on the scope as hoped….. Whew!

By the way, I added a “C extension” which lets me specify a maximum buffer length for gets. If the user goes too high, it putchars a BEL. That will either beep or make puTTY flash.

And, now the puts works, but my printf with a %s is spamming a zero. Since the string’s first character is 0, that’s progress…..

There, fixed that bug…..

Now, I’m getting my first menu item spammed over and over….

That was easy enough to fix…..

And now it shows the menu and takes a value. But it didn’t seem to execute the code it’s supposed to…..

OK, my prompt code actually returns the zero based index and I was decrementing it….

And one more bug in my prompt interpreter…..

And voila!

 1 Mark Hamann's Z80 Computer
 3 Version: 0.1 beta
 4 Menu
 6 1) dump text
 7 > 1
 8 Read: 0
 9 Executing...
11 Address (hex)? 0
12 Length (hex)? 20
13 000: c3 69 0 ff ff ff ff ff  c3 72 c ff ff ff ff ff .i...... .r......
14 c3 83 c ff ff ff ff ff  c3 94 c ff ff ff ff ff ........ ........
15 Done!
17 Mark Hamann's Z80 Computer
19 Version: 0.1 beta
20 Menu
22 1) dump text
23 >

So I’ve got a couple of issues to take care of, but from having the program not working a few hours ago to this isn’t too bad.

Time to publish this post….