jchase1970, on Sat Oct 30, 2010 6:26 PM, said:
I wanted to maintain a location and just write the VDP, but I was having trouble with the math function and addressing. I wouldn't normally do it this way it was just the way I thought I could make work and learn from.
When you are learning, you do a lot of things to see what works and what does not, it is part of the process. The hard part is, once you figure things out, not letting some of those hacks become habits.
jchase1970, on Sat Oct 30, 2010 6:26 PM, said:
Yeah, I realize it was 8bit memory but again I wasn't sure where the 16bit memory was so I was just going with the way the examples in the references I was using showed me.
I did the same thing, since I really didn't know what most of the code was doing. I would get something working, then change parts of it to see what would happen. I wrote a lot of "accidental" code (meaning it was totally by luck and accident that it even worked) when I started out with assembly. Unfortunately I didn't have a resource like A.A. or the Internet, so I was stuck with the E/A manual, the Tombstone City source, and the Lottrup book (which teaches a lot of bad habits, unfortunately.)
jchase1970, on Sat Oct 30, 2010 6:26 PM, said:
Funny you should mention your thread, I have, since posting this read though it once and am reading it a 2nd time. Very good stuff, shame I was working so much and missed all of it when you were writing it up.
The nice thing about forum threads is that you can reply to them months or years later. The content is still valid, so reply and quote parts you have questions about, it is on-going even though I have not added anything to it for a while (been working on the F18A project.) Unfortunately life comes first, until we can figure out a way to make a living with our 99/4A computers. :-)
jchase1970, on Sat Oct 30, 2010 6:26 PM, said:
I'm about to write another AL example and set up the workspace as you suggest. So I'll probably be posting it later as I'm sure to have something I can't resolve. But I am getting better.
Ask away. The more things you try to figure out, the more you learn. Also, working through something yourself is the best way to learn a problem and understand it completely. Then you can look at how other people solved that same problem (by reading code), and that's where you really make leaps and bounds in your skills.
jchase1970, on Sat Oct 30, 2010 6:26 PM, said:
What would be the best way to write a 16bit value from a reg to the screen? I can think of a way to do it if I now what base it is, ie 10 or 100 or 1000 or 10000 by diving each place by 10 and adding it to the ascii value for 0 then printing that ascii character the the screen. But this seems overly complex.
If you are talking about keeping a number, like a score, in a 16-bit memory location or register (I recommend a memory location, keep your registers available for doing work, not holding specific values), then there a several options based on a lot of factors. The most direct way is just like you think, you have to keep dividing by 10 to isolate each digit, then adjust that digit for display, which usually means adding 48 to the digit (the ASCII value for the zero character). I have a post about it and code on the CHC site:
Interger to ASCII Conversion
Matthew