bugbear Posted May 5, 2017 Share Posted May 5, 2017 OK; time to get my toes wet; I have spent my life (over 30 years) coding on Unix boxes, often under cross assembly. I am very comfortable with the "Unix Way". As much work as possible in ASCII files, Vim for editing, small tools each doing one job, source files, object files, linkers, all tied together with Makefiles, macro generators, little specialised code generators (e.g. in perl). I like macros. I do NOT like monoliths, but I guess I just said that. My modern Unix is (L)ubuntu, and I'm running Altirra under Wine. So; what assembler (and other tools) are recommended for someone like me? (Most of the software lists appear very PC/Windows oriented) BugBear Quote Link to comment Share on other sites More sharing options...
+Ryan Witmer Posted May 5, 2017 Share Posted May 5, 2017 I develop for the 5200 on Slackware Linux. I use DASM for assembly and a simple makefile, and I write all my code in vim. I use the Atari++ emulator for testing, not for any particular reason, it was just the first one I found. There may be better options. This is an image I just posted a little while ago on my development blog. You don't really need much. Quote Link to comment Share on other sites More sharing options...
gozar Posted May 6, 2017 Share Posted May 6, 2017 OK; time to get my toes wet; I have spent my life (over 30 years) coding on Unix boxes, often under cross assembly. I am very comfortable with the "Unix Way". As much work as possible in ASCII files, Vim for editing, small tools each doing one job, source files, object files, linkers, all tied together with Makefiles, macro generators, little specialised code generators (e.g. in perl). I like macros. I do NOT like monoliths, but I guess I just said that. My modern Unix is (L)ubuntu, and I'm running Altirra under Wine. So; what assembler (and other tools) are recommended for someone like me? (Most of the software lists appear very PC/Windows oriented) BugBear I'm just learning assembler, and settled on MADS. I've compiled it under Linux and OS X, and use VIM with syntax highlighting. Right now I use a simple mads SOURCE to compile since I only have source code in one file. Quote Link to comment Share on other sites More sharing options...
pirx Posted May 6, 2017 Share Posted May 6, 2017 mads, it is crazy!!! (in a positive way) Quote Link to comment Share on other sites More sharing options...
tschak909 Posted May 6, 2017 Share Posted May 6, 2017 I use Atari Macro Assembler with its MEDIT text editor, on the native hardware. -Thom 1 Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted May 6, 2017 Share Posted May 6, 2017 I am very comfortable with the "Unix Way". As much work as possible in ASCII files, Vim for editing, small tools each doing one job, source files, object files, linkers, all tied together with Makefiles, macro generators, little specialised code generators (e.g. in perl). I like macros. ca65 from the cc65 package. Open source, active development (not a one man show) and a linker. Quote Link to comment Share on other sites More sharing options...
FifthPlayer Posted May 6, 2017 Share Posted May 6, 2017 Also see this thread for some recommendations: http://atariage.com/forums/topic/228122-best-6502-assembler-for-a-newbie/ Quote Link to comment Share on other sites More sharing options...
sanny Posted May 7, 2017 Share Posted May 7, 2017 As mentioned before, try cc65. Active developent for the Atari support there is done on Linux, just using ASCII files. The build system uses Makefiles, I'm using Emacs (sorry, very little Vim) to make changes and the Linux version of atari800 to test. Just clone with git and type make to build the lastest version. You'll get command line tools for the assembler, linker, C compiler, etc. which you can use in your own Makefiles. To create more involved programs you should consider reading the linker manual, there are many things you can to with the linker scripts. regards, chris Quote Link to comment Share on other sites More sharing options...
bugbear Posted May 8, 2017 Author Share Posted May 8, 2017 As mentioned before, try cc65. Active developent for the Atari support there is done on Linux, just using ASCII files. The build system uses Makefiles, I'm using Emacs (sorry, very little Vim) to make changes and the Linux version of atari800 to test. Just clone with git and type make to build the lastest version. You'll get command line tools for the assembler, linker, C compiler, etc. which you can use in your own Makefiles. To create more involved programs you should consider reading the linker manual, there are many things you can to with the linker scripts. regards, chris Given my background in Unix/C, I suspect the cc65 suite may well be a good match for my abilities/preferences/prejudices. Is there an A8 specific assembler example, that goes all the way from Asm source to a file that can be loaded in Altirra? (I'll be using Gnu Make, I assume) BugBear Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted May 8, 2017 Share Posted May 8, 2017 Is there an A8 specific assembler example, that goes all the way from Asm source to a file that can be loaded in Altirra? http://atariage.com/forums/topic/209776-example-ca65-startup-code/?do=findComment&comment=2711619 Quote Link to comment Share on other sites More sharing options...
sanny Posted May 8, 2017 Share Posted May 8, 2017 Two test programs I wrote once. I think they are small enough that you get the basic idea of the flow, and maybe see some of cc65's macro capabilities... cc65-asm-example.tar.gz Quote Link to comment Share on other sites More sharing options...
bugbear Posted May 9, 2017 Author Share Posted May 9, 2017 Two test programs I wrote once. I think they are small enough that you get the basic idea of the flow, and maybe see some of cc65's macro capabilities... cc65-asm-example.tar.gz Thanks for that - cc65 downloaded and compiled (not sure how to "install" properly, hacker for the moment), and you sample linked up fine. But it's made a .com file. Altirra supports: Support for most popular 8-bit image file formats: ATR, ATX, ATZ, DCM, XFD, PRO, ARC, BAS, ROM, BIN, A52, CAS, SAP. So I don't have my "Altirra ready" file. Do I need to further process the .com file? BugBear Quote Link to comment Share on other sites More sharing options...
MaPa Posted May 9, 2017 Share Posted May 9, 2017 You can open the .com file in Altirra.. you just can't associate .com file with Altirra of course Just rename the .com file to .xex which is file extension used for atari binary files. Quote Link to comment Share on other sites More sharing options...
sanny Posted May 9, 2017 Share Posted May 9, 2017 Thanks for that - cc65 downloaded and compiled (not sure how to "install" properly, hacker for the moment), and you sample linked up fine. I also newer "install" it. I'm just putting the "bin" directory of the compiled source into my PATH. But it's made a .com file. Yes. That's an Atari executable. If you want to put it onto a disk image there are tools available for that. I'm not using Altirra personally (since it's for Windows), but I guess, like written in the previous post by MaPa, it supports running an executable "directly". Atari800 definitely can do that. Quote Link to comment Share on other sites More sharing options...
bugbear Posted May 9, 2017 Author Share Posted May 9, 2017 OK, call me ambitious; I'm trying to assemble analmux's demo from here, as a proof of concept ca65 project. http://atariage.com/forums/topic/229764-source-code-released-scrolling-mcs-pmu-rmt/?do=findComment&comment=3203170 Specifically "Basis SMB3 Silence". It builds fine under the (supplied) xasm So obviously, I'm now trying to make it work under ca65. Linking lies ahead of me, but for the moment, assembly is the barrier. I've written some dirty perl to change over most of the syntax variations (83 lines, handy stuff perl), and I've created a coupla' macros to handle some of xasm builtins (e.g. mva, mwa) and I have now solved all these issues (I think). The last error I get at assembly stage is that a symbol "dlist" is undefined. Here's the source of my confusion. If I do a grep in the ORIGINAL SOURCES dlist doesn't appear to be defined: egrep -n dlist *asx main.asx:28:dlistv equ $d402 main.asx:113: mwa #helpscreen_dlist dlst main.asx:122: mwa #dlist dlst main.asx:146: mwa #dlist dlst main.asx:238: sta dlist main.asx:239: sta dlist+2 main.asx:240: mva #$f0 dlist+1 main.asx:242: mwa #dlist+3 z_dest main.asx:251: mva #65 dlist+78 main.asx:252: mwa #dlist dlist+79 main.asx:253: mwa #dlist dlistv main.asx:289: mwa dlst dlistv main.asx:538: sta dlist+69 main.asx:542: sta dlist+3 main.asx:544: sta dlist+66 main.asx:545: mva #$74 dlist+72 main.asx:546: mva #$d4 dlist+75 main.asx:619:ju_2 lda dlist+2,x main.asx:620: sta dlist+5,x main.asx:626: sta dlist+4 main.asx:629: sta dlist+5 main.asx:657:jd_2 lda dlist+6,x main.asx:658: sta dlist+3,x main.asx:665: sta dlist+76 main.asx:668: sta dlist+77 main.asx:701:jl_2 lda dlist+4,x main.asx:703: dec dlist+5,x main.asx:704:jl_3 dec dlist+4,x main.asx:744:jr_2 inc dlist+4,x main.asx:746: inc dlist+5,x main.asx:901:helpscreen_dlist main.asx:903: dta $42,a(helpscreen_data),$02,$02,$02,$02,$41,a(helpscreen_dlist) In my translated assembler it's the equivalent of line 122 (above) that goes wrong. Can anyone help? BugBear Quote Link to comment Share on other sites More sharing options...
bugbear Posted May 9, 2017 Author Share Posted May 9, 2017 Found it (literally, sort of) https://github.com/pfusik/xasm/blob/master/xasm.1.txt "Labels and instructions are case-insensitive." dlist isn't defined, but Dlist is. It looks like ca65 is case-sensitive. (searchy, confirmed) http://www.cc65.org/doc/ca65-11.html#ss11.11 ONWARDS! BugBear Quote Link to comment Share on other sites More sharing options...
bugbear Posted May 9, 2017 Author Share Posted May 9, 2017 (edited) (passing whinge - the first cross-compiler I used professionally was by Whitesmiths. It allowed symbols of any length, and case was significant. . . nice . . but only the first 6 characters were actually significant. You could have a typo in positions 7 onwards and it wouldn't matter. BugBear Edited May 9, 2017 by bugbear Quote Link to comment Share on other sites More sharing options...
bugbear Posted May 9, 2017 Author Share Posted May 9, 2017 OK, linking failed; /ld65 -o main.com -vm -m main.map -C atari-asm.cfg main.o Unresolved external `__AUTOSTART__' referenced in: /home/bugbear/code/cc65-master/cfg/atari-asm.cfg(6) Unresolved external `__EXEHDR__' referenced in: /home/bugbear/code/cc65-master/cfg/atari-asm.cfg(5) ld65: Error: 2 unresolved external(s) found - cannot create output file make: *** [main.com] Error 1 but that's exactly what Sanny's (thank you) example covers. In his xdoscmdl.s he has: ; file format stuff .export __AUTOSTART__: absolute = 1 .export __EXEHDR__: absolute = 1 .import __MAIN_START__, __BSS_LOAD__ .segment "AUTOSTRT" .word RUNAD ; defined in atari.inc .word RUNAD+1 .word my_entry .segment "EXEHDR" .word $FFFF .segment "MAINHDR" .word __MAIN_START__ .word __BSS_LOAD__ - 1 So I put that in a separate include file (wrapped in .pushseg/.popseg), changed the entry point from my_entry to anallmux's start, and... it linked!! And ... promptly crashed in Altirra.So I set a breakpoint (bp) at $9000, did cold restart, loaded the boot image, ran: g EXE: Loading program 0006-7CA0 to 2E00-AA9A EXE: Loading program 7CA5-7CA6 to 02E0-02E1 EXE: Launching at 9000 Breakpoint 0 hit ( 96:256, 14) A=53 X=20 Y=01 S=F9 P=30 ( ) 9000: 00 BRK It ain't loading right. Main.s has org $9000 start jsr maininit So the code in RAM at $9000 should definitely not be BRK. Does anyone know what I've done wrong? BugBear Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted May 9, 2017 Share Posted May 9, 2017 You shouldn't really need to use the ORG keyword when using the CC65 suite of tools, the linker is taking care of where things end up and you can say which segments code/data etc goes to? Quote Link to comment Share on other sites More sharing options...
tschak909 Posted May 9, 2017 Share Posted May 9, 2017 sigh...I just don't understand why one should jump right to this assembler...it's much easier to start with native development on the machine. -Thom Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted May 9, 2017 Share Posted May 9, 2017 this=ca65? It originally was native development on the Atari. http://www.umich.edu/~archive/atari/8bit/Languages/Cc65/ Quote Link to comment Share on other sites More sharing options...
bugbear Posted May 9, 2017 Author Share Posted May 9, 2017 (edited) You shouldn't really need to use the ORG keyword when using the CC65 suite of tools, the linker is taking care of where things end up and you can say which segments code/data etc goes to? I know - but this project started on Xasm. I'm trying to get a substantial project onto cc65. Since the original project is known to work, I'm trying to keep changes to an unavoidable minimum. I know I don't "need" ORGs, but they should work - it's a supported keyword in ca65, right? Of course, I'm unfamiliar with the file format, and load-run model of Atari/Altirra, so I'm flying high, blind and without a parachute. It's fun! BugBear Edited May 9, 2017 by bugbear Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted May 9, 2017 Share Posted May 9, 2017 Appreciate that, the key/fun is to 'let go' I, and others I should imagine, have gone through similar before (e.g. I think I have the RMT player in ca65 somewhere) so happy to assist if you PM. Quote Link to comment Share on other sites More sharing options...
sanny Posted May 9, 2017 Share Posted May 9, 2017 I know I don't "need" ORGs, but they should work - it's a supported keyword in ca65, right? Yes, it's supported, but has a different meaning than on most other assemblers. It means "assemble code pretending it's running at location x". But the code itself is placed in the output file at the current location. (See http://cc65.github.io/doc/ca65.html#ss11.78) I haven't looked at the program you're trying to convert. If the whole program should be located at $9000, simply give the "-S" command line parameter to the linker. If just some parts should be at $9000, and the rest somewhere else, you'd need to create your own linker config file and you can't use atari-asm.cfg. See http://cc65.github.io/doc/atari.html#ss11.4 for some examples. You can ignore the "stack" and "heap" memory areas mentioned on this page, they are only relevant for C code. Quote Link to comment Share on other sites More sharing options...
sanny Posted May 9, 2017 Share Posted May 9, 2017 I just noticed that the documentation at http://cc65.github.io/doc/atari.html#ss11.4 are a bit outdated. Generally they still apply, though. I need to update them.... 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.