Jump to content
IGNORED

Recommend me an assembler


Recommended Posts

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

Link to comment
Share on other sites

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.

 

Debugging and testing capabilities

 

This is an image I just posted a little while ago on my development blog. You don't really need much.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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...

 

attachicon.gifcc65-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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

(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 by bugbear
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by bugbear
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...