vitoco Posted May 31, 2017 Share Posted May 31, 2017 (edited) Hi! I'm trying to assemble the source code of ATARI BASIC cartridge from Bill Wilkinson's book using AMAC, as it seems that those listings were produced by this assembler. The AMAC version I'm using is "Atari Macro Assembler and Program Text Editor.atx" I downloaded from Atarimania, which only runs inside its own ATX disk (it seems to have a copy protection validation). AMAC complains about the length of the .ASM file (about 230K!!!) so I had to split it in multiple files, adding a main source with a sequence of the INCLUDE pseudo operator. Then I got a crash in Altirra. While debugging, I tried a simple test with a file that includes a second one. AMAC read both files in two passes and finished OK, but the OBJ generated had exactly 8 bytes ($FFFF,$02E0,$02E1,$0000), i.e. it didn't take my simple code. If I assemble the second file directly, I get what I expected. Is there something I'm missing about INCLUDE in AMAC? Hints? Thanks... BTW, if someone has the ASM file(s) of ATARI BASIC cartridge that is not the result of a disassembly and that could be successfully assembled, please let me know. EDIT: Changed the post title. Edited June 3, 2017 by vitoco Quote Link to comment Share on other sites More sharing options...
luckybuck Posted June 1, 2017 Share Posted June 1, 2017 Hi vitoco, you may want to take a look here: https://atariwiki.org/wiki/Wiki.jsp?page=Atari%20Macro%20Assembler%20and%20Program-Text%20Editor%20CX8121 including version C !!! https://atariwiki.org/wiki/Wiki.jsp?page=Articles#section-Articles-SourceCode Quote Link to comment Share on other sites More sharing options...
vitoco Posted June 1, 2017 Author Share Posted June 1, 2017 Thanks luckybuck, but rev C of AMAC also failed with INCLUDE. About the Atari BASIC sources, one of them is a disassembled source, full with address-like labels, another one is a processed copy of the OCR text from the scanned book like the one I'm trying to compile, but it has more errors than mine, even though it has been edited to fix some typos. I couldn't download the third one (error 404), which is the first one in the wiki. Quote Link to comment Share on other sites More sharing options...
luckybuck Posted June 1, 2017 Share Posted June 1, 2017 (edited) The 404 error on the AtariWiki has been fixed, as well as the source code file. Would be cool to have an Atari Basic Version C as working source code, ready for assemble and executable. Did you check drac0303'shttp://drac030.krap.pl/en-fixes.php D version and https://atariwiki.org/wiki/Wiki.jsp?page=Atari%20Macro%20Assembler%20and%20Program-Text%20Editor%20CX8121 ? Edited June 1, 2017 by luckybuck Quote Link to comment Share on other sites More sharing options...
vitoco Posted June 1, 2017 Author Share Posted June 1, 2017 Altirra craches with D version (using DOS 2.0) while reading the included file of my test. I didn't see your post update 'till now. I'm not sure if using DOS XL or or Sparta would change that behavior. About the 404 error, I could get that page now and it seems to be very similar to the sources I'm working with, but it contains some typos. If I assemble my source successfully, I'll send it to you. Quote Link to comment Share on other sites More sharing options...
vitoco Posted June 1, 2017 Author Share Posted June 1, 2017 Altirra craches with D version (using DOS 2.0) while reading the included file of my test. I spoke too quick. I was using a previous beta of Altirra that failed to write to disk in VRWSave mode. I've just apdated to 2.90-test34 and now it does not crash. But I still get the 8 bytes (empty) OBJ file with version D of AMAC. I think I'll try LINK instead of INCLUDE. Quote Link to comment Share on other sites More sharing options...
vitoco Posted June 3, 2017 Author Share Posted June 3, 2017 LINK worked, I'm now stucked with MACROs. It seems that it is not as free text as I thought. One space more or one space less is the difference between success or an assembly error. Quote Link to comment Share on other sites More sharing options...
luckybuck Posted June 3, 2017 Share Posted June 3, 2017 Sounds good, you will gonna make it. Just go ahead. :-) Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted June 3, 2017 Share Posted June 3, 2017 I had some hassles when looking at some sources which also used includes recently. However I was using the Hard-Disk mapped to a folder and also to D: mode in Altirra. The mapping was needed as the assembler hard codes the D into the paths it uses. This was able to work but I think it was fussy over the $9B for line endings over Cr/Lf editing the files under Windows. Ultimately the sources I had were using up too much memory which was confirmed by constructing a single file, replacing includes with the file's content. Quote Link to comment Share on other sites More sharing options...
vitoco Posted June 3, 2017 Author Share Posted June 3, 2017 (edited) I had some hassles when looking at some sources which also used includes recently. However I was using the Hard-Disk mapped to a folder and also to D: mode in Altirra. The mapping was needed as the assembler hard codes the D into the paths it uses. This was able to work but I think it was fussy over the $9B for line endings over Cr/Lf editing the files under Windows. Ultimately the sources I had were using up too much memory which was confirmed by constructing a single file, replacing includes with the file's content. My Altirra configuration for this is D1 to boot DOS and load AMAC. Then I change D1: to a R/W ATR disk for both OBJ and LST output. The ASM sources are in D2: which is a mounted folder as virtual DOS disk. The sources are in ASCII, but I wrote a simple script to split it into a sequence of ATASCII files, turning line endings into EOL ($9B) and adding a TAB ($7F) to the ENDM (end of macro) pseudo-op. When I was splitting using INCLUDE, I created a base TEST.ASM file with all the INCLUDEs to D2:TESTnn.ASM while the files TEST01.ASM and so on were created to the folder. During the assembly, It said it was reading the files, but it the result was an empty OBJ file (only 8 bytes only with binary header $FFFF and run address pointing to $0000). I've just tried swapping D1 and D2 in Altirra and inside the TEST.ASM file, but the result was the same. Anyway, I think I work around it using LINK at the end of each piece, but my problem now is that MACRO pseudo-op is brain dead!!! It seems that AMAC has problems with its macros buffer/cache/etc... It reads the macro, but it screws the lines when it replaces the parameters, resulting in syntax errors. I tried A and unofficial D revisions of AMAC. Same results. Edited June 4, 2017 by vitoco Quote Link to comment Share on other sites More sharing options...
luckybuck Posted June 3, 2017 Share Posted June 3, 2017 HI vitoco, did you try the C version of AMAC on the AtariWiki? Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted June 3, 2017 Share Posted June 3, 2017 Perhaps also check by using the program text editor to verify the sources look and save legitimately. Quote Link to comment Share on other sites More sharing options...
vitoco Posted June 3, 2017 Author Share Posted June 3, 2017 HI vitoco, did you try the C version of AMAC on the AtariWiki? Yes, I got the same error and result, but in this case is harder to debug, because I couldn't make it list the macro expansion to the LST (PRN) file. Perhaps also check by using the program text editor to verify the sources look and save legitimately. I verified my test file with MEDIT. It looked fine, including the TAB ($7F) in ENDM line. Quote Link to comment Share on other sites More sharing options...
vitoco Posted June 4, 2017 Author Share Posted June 4, 2017 I decided to attach here one of my testing sources to show what is actually happening, so I copied it, edited the copy, removed all the commented out lines and changed the labels to English ones. Then I converted it to ATASCII using my script and assembled using AMAC rev C. Guess what? Well, I got back the macro expansions in the listing, but there were some of the original spanish labels in it. I double checked the source and there were no spanish labels in it. So, where do they came from? I'm sure they were kept in memory from a previous assembly. Is that a reasonable behavior? I think not. Quote Link to comment Share on other sites More sharing options...
gpounce Posted December 8, 2019 Share Posted December 8, 2019 I had consistent failures of MACRO/ENDM using AMAC A and C (and I had a tab char <esc><tab> inserted just before the ENDM text), until I capitalized the macro labels. Didn't matter if the macro definitions were early or later in the file. Quote Link to comment Share on other sites More sharing options...
luckybuck Posted December 8, 2019 Share Posted December 8, 2019 Sorry, for the late replay. Did you all took these books: https://atariwiki.org/wiki/Wiki.jsp?page=Atari BASIC#section-Atari+BASIC-SourceCode and the source code from here: https://atariwiki.org/wiki/Wiki.jsp?page=Articles#section-Articles-ProgrammingLanguages ? Further: https://atariwiki.org/wiki/Wiki.jsp?page=Atari Macro Assembler for the manuals and the hint for the protection? If all is done and you are running into problems with even the ATX image, then you really found something big and new! If so, then please let us know. Thank you very much. Quote Link to comment Share on other sites More sharing options...
gpounce Posted December 8, 2019 Share Posted December 8, 2019 (edited) I'm using AMAC D downloaded from the atariwiki page (many thanks!) - no problems with protection; I'm running on my homebrew disk emulator with an 800 and it is not reporting any strange sector reads The MACRO/ENDM issue arose on AMAC A, so I started looking around & found D which I updated to on general principles- I continued having the macro issue until I capitalized the macro labels. The error asserted by AMAC was an unterminated macro (my source has 2 macros- used to save and restore a stack frame). Intererestingly the macro references elsewhere in code are in lowercase, the definitions are in uppercase. I've disassembled the output .obj file, the macros are substituting in properly. I chose AMAC because I'm not into line numbers so do the editing using the program-text editor on my 800XL, assemble with AMAC on the 800, both mounting the same floppy on my disk emulator which handles that sort of use. That way the 800XL stays in the editor, and I assemble and test on the 800. Wouldn't mind interfacing a system emulator to my disk emulator so I could avoid exiting/restarting it. Edited December 8, 2019 by gpounce 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.