Jump to content
IGNORED

ATASM issue with .BYTE and other issues


Recommended Posts

I just got back into 6502 assembly language after a 25 year hiatus. I picked up the ATASM and the Eclipse plug-in for it. I found a audio example in De Re Atari (Atari Archives) which pasted in and compiled but Atari800win (latest) crashes every time I compile and run it. It seems to fail at TEMPO .BYTE 1. According to the ATASM (1.07) and Mac/65 docs, this is a completely valid macro. The debugger ain't giving me a clue.

BTW: I fixed line

0250     *=  $B0

so that the "o" is a 0.

Also, according to the plug-ins web site (WUDSN), it is suppose to give the ability of Content Assist but when I do what it says, "Content assist by pressing CTRL-Space for directives, legal opcode, illegal opcodes and pseudo opcodes", it doesn't work. I figured others might know how to fix this issue.

 

Anyway, thanks for the help.

Link to comment
Share on other sites

I just got back into 6502 assembly language after a 25 year hiatus. I picked up the ATASM and the Eclipse plug-in for it. I found a audio example in De Re Atari (Atari Archives) which pasted in and compiled but Atari800win (latest) crashes every time I compile and run it. It seems to fail at TEMPO .BYTE 1. According to the ATASM (1.07) and Mac/65 docs, this is a completely valid macro. The debugger ain't giving me a clue.

You might need to add a run-block, otherwise Atari800win might start the code at $B0 instead of $4000:

* = $2E0
.WORD $4000

so long,

 

Hias

Link to comment
Share on other sites

Sorry, just need some clarification.

* = $2E0
.WORD $4000

 

Here is the portion of the code I think the issue is in and possible refers to your fix.

 

AUDCTL =    $D208
AUDF1  =    $D200 ; Create varibles at 3 memory locations (D200, D201, & D20F)
AUDC1  =    $D201 ;
SKCTL  =    $D20F ;
 *=$B0 ;Then set address to $B0
TEMPO  .BYTE 1 ;Store 1 at $B0
MSC    .BYTE 0 ;Store 0 at $B1
 *=$4000 ;Set starting address at $4000 (AKA: da program counter)
 LDA  #0
 ...

 

That seem legit to me. So...

  1. What exactly is causing the issue?
  2. How does your code fix that
  3. What line would I insert your code?

 

Thanks

Link to comment
Share on other sites

Run address can generally go anywhere.

 

AtAsm has the annoying habit though of constructing your load module in address order, and not in order that stuff appears in the program, e.g. if you have a segment at $6000 then one later at $4000, the object module will put them back in order.

 

Also, it's generally not a good idea to assemble direct to zero-page or any low memory area < $480 - best to just set those locations within the program, otherwise you might get conflict with some DOSes or loaders.

Link to comment
Share on other sites

  • What exactly is causing the issue?
  • How does your code fix that
  • What line would I insert your code?

Usually COM loaders run the program at the beginning of the very first block if no RUN address is specified ($2E0/$2E1).

 

ATasm saves the block in ascending address order (unless you are using a .bank statement). You see the various blocks (and their order) at the end of the ATasm output:

Assembly successful
 Compiled 112 bytes (~0k)
   Block: 00b0-00b1 (2 bytes)
   Block: 4000-406d (110 bytes)

So the first block is the 2 bytes zeropage variables (obviously not the code you'd like to run), and Atari800Win most certainly tries to start the program at $B0.

 

Just add the 2 statements at the very end of the code and you'll be fine. The output now looks like this:

  Compiled 114 bytes (~0k)
   Block: 00b0-00b1 (2 bytes)
   Block: 02e0-02e1 (2 bytes)
   Block: 4000-406d (110 bytes)

The COM file now has a RUN block with the low/high byte of the 6502 code (it doesn't matter if it's in the "middle" of the object file, RUN is only checked after the whole file has been loaded) and will be started at $4000 (instead of $B0).

 

BTW: if you add a ".bank" statement at the very beginning of the code and just before the "* = $2E0" line

.bank
0100 ;
0110 ; VONLY      Bob Fraser 7-23-81
...
.bank
* = $2E0
.WORD $4000

ATasm will store the $2E0 block at the end of the file:

Assembly successful
 Compiled 114 bytes (~0k)
   Block: 00b0-00b1 (2 bytes)
   Block: 4000-406d (110 bytes)
   Block: 02e0-02e1 (2 bytes)

For this RUN block it's not important, but you need it if you want to add an INIT block ($2E2/3, which is JSRed to immediately after the block is loaded). If you don't force ATasm to output the blocks in the correct sequence, the INIT might be executed before the code is loaded. This is a very common pitfall when using ATasm and I ran into it, too, some time ago.

 

so long,

 

Hias

Link to comment
Share on other sites

Sweet!!! Just that little addition made it at least not crash each time.

It's not exactly working. It just plays a tone now....but it's a start. I'll do a little more debugging.

So, I guess I need to learn a little more about the pitfalls of using Atasm. As I reading the apps documentation I see that macros haven't been well tested. I was hoping to use Windows as my dev environment but I don't like how I can't step through the code. The Mac/65 Assembler that I have doesn't have a debugger so I'll need to do a little more searching.:D

 

Thanks for assisting me so quickly with this. I'm sure I'll be asking a bunch more question in the future but I'll try to do my homework first.

 

Thanks again! :thumbsup:

Edited by Justin Payne
Link to comment
Share on other sites

So, I guess I need to learn a little more about the pitfalls of using Atasm.

Hi Justin. Yes, this one has surely bothered every ATASM user one his first project ;-)

On http://www.wudsn.com you can find the FAQ via WUDSN IDE/FAQ. There I try to add all these "pitfalls" and the corresponding hints. if you have something that should be added, just drop me a line.

Link to comment
Share on other sites

Where exactly is this info? The FAQ doesn't seem to contain any info I could troubleshoot these issues.

 

NM. I found the other FAQ page. I'll read it and if I have more questions, I'll shoot ya a mail.

 

Thx

Edited by Justin Payne
Link to comment
Share on other sites

  • 4 weeks later...

Hey all,

 

I'm having some issues with Atasm as well. For example, how would I compile multiple source files together as seen here? http://www.atariarchives.org/roots/chapter_7.php

When I just put them together in the same file, the compiler complains that TXTBUF is defined twice, but I have no idea what the second definition means ("TXTBUF=*"). When I remove it and try to run the binary on my virtual Atari, it throws an unrecoverable error asking me if I want to warmstart or coldstart (although this may be for some other reason).

Edited by AriX
Link to comment
Share on other sites

Generally you don't assemble multiple programs like that.

 

When developing a program though, it's fairly normal to split things up then .include routines in an assembly, but for those examples you're better off keeping them all seperate.

 

Many assemblers allow Local labels, so you could take that route, but IMO with those examples just keep them as seperate files.

 

TXTBUF = *

just means that the label will have the value of whatever the location counter is at the time.

 

So e.g.

*= $600

lda #1 ; asm to $600,1

jsr print ; asm to $602,3,4,

text = * ; this will be $605

 

the label "text" in this case would have value $605

Link to comment
Share on other sites

Generally you don't assemble multiple programs like that.

 

When developing a program though, it's fairly normal to split things up then .include routines in an assembly, but for those examples you're better off keeping them all seperate.

 

Many assemblers allow Local labels, so you could take that route, but IMO with those examples just keep them as seperate files.

 

TXTBUF = *

just means that the label will have the value of whatever the location counter is at the time.

 

So e.g.

*= $600

lda #1 ; asm to $600,1

jsr print ; asm to $602,3,4,

text = * ; this will be $605

 

the label "text" in this case would have value $605

 

Appreciate the insight, but I'm still a bit confused. I separated the files and used includes, but it still complains of the same thing. I don't understand why the program defines this label twice or why it is set to the PC; I'm just not that far along in learning 6502 asm yet. When I remove one of the labels or separate them by changing all of the instances of TXTBUF in one of the files to TXTBUF2, the program crashes (it seems to be trying to execute code at $0016 for some reason). How can I successfully compile this and get it to run?

Maybe I just need to somehow tell something where to look in memory for what I want it to run? ($600)

Edited by AriX
Link to comment
Share on other sites

.include generally means the assembler will include a file as if it was just inline with the rest of the program.

 

So, you can't have duplicate labels, and any common memory locations can get assembled to twice.

 

Like I said - just way easier to keep the files seperate and also assemble them seperately.

Link to comment
Share on other sites

.include generally means the assembler will include a file as if it was just inline with the rest of the program.

 

So, you can't have duplicate labels, and any common memory locations can get assembled to twice.

 

Like I said - just way easier to keep the files seperate and also assemble them seperately.

 

Okay - how can I do that with atasm? Just combine them into two separate object files? How would I then run them together in Atari800?

Sorry for my n00by questions :P

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