ballyalley Posted November 11, 2014 Share Posted November 11, 2014 This is my first posting in the programming area. With the level of knowledge around here I feel sort of embarrassed to even ask this, but it seems better to ask my question here than in the general Atari forum.I'm trying to learn 6502 assembly using "Atari Roots: A Guide to Atari Assembly Language" by Mark Andrews. I've encountered a stumbling block and I can't proceed. My questions concern two programs in the book. For reference, "Atari Roots" can be downloaded here:http://www.atarimania.com/documents/Atari-Roots-A-Guide-to-Atari-Assembly-Language.pdfI'm having trouble getting two example programs to work. These are supposed to work together to print the short phrase, "TAKE ME TO YOUR LEADER," on the screen and then loop forever. I have typed and assembled the programs using the cart version of MAC/65 1.02. I have used Altirra to move these programs from my DOS 2.0S disk image to my H: drive. Here is information about the programs:1) PRINTSC - Source code is called: PRINTSC.M65. Object code is also called: PRINTSC.OBJ. Program source is from pages 108-109 of "Atari Roots."2) VISITOR - Source code is called: VISITOR.M65. Object code is also called: VISITOR.OBJ. Program source is from page 110 of "Atari Roots."I've attached the four files in one zip file, here:Atari Roots Programs.zipI have checked a printout of the assembly listing (not included in the archive) against the assembly source code in the book and they seem identical to me.Here is how I try to run the program:1) Without a cart or BASIC installed, I load DOS 2.0S. I load both programs into RAM and then run the program from $0617.2) The program ends with a blank screen. I've used the debugger in both the disk and cart-based versions of MAC/65 and I can see that the program is not locked up. The program reached the end of "VISITOR" and is in infinate loop as it should be.3) I check the text buffer at $5041 and I see the the text message has been moved there as is expected. However, "PRINTSC" (the CIO program) has not printed the message to the screen.I don't understand any of the CIO program yet (that's explained in a later chapter). Can someone please explain to me what I'm doing wrong here? Why isn't the message printing to the screen?Thanks for the help. 1 Quote Link to comment Share on other sites More sharing options...
kenjennings Posted November 12, 2014 Share Posted November 12, 2014 I tried various ways of running this. If I leave the mac/65 cart in it catches a BRK out in open memory where something broken had jumped. Looking at page 6 afterwards shows some $9B bytes where not expected (Atari EOL). So, it may be that page 6 is being overwritten. Page 6 is a baaaaad place to keep and run things. I changed the visitor code to assemble at $5200 then examining it after loading shows the right bytes in the right locations. It still locks up when running. I haven't had any more time to fiddle with it. I recall Atari Roots is a notoriously typo'd book. And examples like this that assmble to locations that can be jumped on by so much other code does not help. Sidebar: I use M65 for tokenized, SAVE format. L65 for LISTed format. Quote Link to comment Share on other sites More sharing options...
Xuel Posted November 13, 2014 Share Posted November 13, 2014 You have the wrong instruction at the beginning of OSCR. It should be LDX #$20, not LDA #$20. Fixing that yields the following: The way you had it, X retained the value of #$17, i.e. the final value of X in the loop in VIZTOR. This caused the setup code in OSCR to trash IOCB 1 and 2 and generally foul things up. Good luck in your 6502 studies! 1 Quote Link to comment Share on other sites More sharing options...
ballyalley Posted November 13, 2014 Author Share Posted November 13, 2014 You have the wrong instruction at the beginning of OSCR. It should be LDX #$20, not LDA #$20. Fixing that yields the following: I fixed the program and it ran as expected. Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.