Jump to content
IGNORED

How to run code assembled with Atari Macro Assembler


Recommended Posts

Hello. I have made a little program using Program Editor and Atari Macro Assembler suite. When I assemble the program the system creates an object file. How do I execute this object file?

 

The ATA Manual does not say nothing about this.

 

Thanks for your help.

Link to comment
Share on other sites

2 hours ago, MrFish said:

From Atari DOS, use the "L. Binary Load" command.

 

It asks for a file. Do I have to insert the object code file? I did and the emulator (atari800win) hung up.

 

I think I should insert the "executable" file, the same way I insert "AMAC" or "MEDIT", but there is not "exec" file like those called TEST, being TEST.OBJ my assembled object file.

 

 

Link to comment
Share on other sites

Chances are the file you created has no run/init headers as part of the binary.

In many cases you can just use Doses run at address command, in some cases the Dos will just run at the load address if no run address is supplied.

 

But you can generally get the assembler to put it in for you - put a section of code similar to this before or after the remainder.

e.g.

  *=$2E0

  .WORD RUN_ADR,INIT_ADR

 

If you have no requirement for a seperate initialize section then just omit INIT_ADR.

Link to comment
Share on other sites

10 hours ago, nuadok said:

It asks for a file. Do I have to insert the object code file? I did and the emulator (atari800win) hung up.

Atari DOS does not have dedicated "object code files", and there is no such thing as "linking". If you want to link two "object codes" into "one executable" you just concatenate the files. If you want to load an executable from the DUP menu, you better make sure that the address the binary is loaded to does not overlap with the memory area the DUP is loaded into, or you will not be able to return to the DUP menu after loading the file to run it.

 

Thus, there are two things you can do:

 

1) Give your program a run address so DUP can run your file directly after having loaded it, so there is no need to RUN it manually. This is done by adding the following lines to your code:

 

  *=$2e0 ; this is the run address vector

  .WORD startAddress

 

2) Just place the program in an address space the DUP does not need. Off my head, I do not remember where the 2.0S/2.5 DUP requires its memory, but I would believe you may be safe at $3c00 and above.

 

Link to comment
Share on other sites

DUP can binary load over itself to a point - the binary loader is fairly early in the code.

The system is usually smart enough to know when an overwrite has occurred so that a reload of DUP can be performed if needed.

Note the logic for use of MEM.SAV gets thrown in there also.

Edited by Rybags
Link to comment
Share on other sites

Hello again. 

 

The program still freezes.

 

I got this test code:

1.jpg

 

I assembly it:

2.jpg

 

Run it and it freezes:

3.jpg

 

I have not been able to find a complete test code written with Atari Macro Assembler in Internet. Can you provide me a complete one and what exactly do i have to do to run it?

 

Thanks.

 

Note: I read the AMA Manual and it says nothing about how to run a program.

Link to comment
Share on other sites

Apparently, the people here are not familiar with the AMAC syntax.

1. Select a memory location for your program with ORG.
2. Terminate your program somehow (e.g. RTS for return to DOS).
3. Specify the run address as an argument to END.

 ORG $6000
MAIN LDA 710
 STA 712
 LDY #1
 RTS

 END MAIN

This program changes the border color to the background color and returns to DOS.
LDY #1 is not essential. If missing, some DOSes will report an error when they get back control.
 

  • Like 2
Link to comment
Share on other sites

30 minutes ago, fox said:

Apparently, the people here are not familiar with the AMAC syntax.

1. Select a memory location for your program with ORG.
2. Terminate your program somehow (e.g. RTS for return to DOS).
3. Specify the run address as an argument to END.

 


 ORG $6000
MAIN LDA 710
 STA 712
 LDY #1
 RTS

 END MAIN

 

This program changes the border color to the background color and returns to DOS.
LDY #1 is not essential. If missing, some DOSes will report an error when they get back control.
 

Hello Mr Fox. It worked. I tested changing LDA 710 to LDA 711 and added a jump to avoid returning inmediately to be sure that the program was executed:

 

 ORG $6000
MAIN LDA 711
 STA 712
 LDY #1
 JMP MAIN
 RTS

 END MAIN

It changes the background color to pink (it seems that the original background color is black).

 

How did you learn this? 

 

Thanks again.

 

Edited by nuadok
Link to comment
Share on other sites

3 hours ago, nuadok said:

Hello again. 

 

The program still freezes.

Errr... The contents of $2e0 is not $2e0 itself (as you put into your source), but the entry address in the code from which it is run. So, for example, if your code starts at "Main", then

 

*=$2e0

.WORD Main

 

would do the job.

Link to comment
Share on other sites

18 hours ago, nuadok said:

How did you learn this? 

I learned that in the 80s. There were these excellent books in Polish: "Asembler 6502" by Jan Ruszczyc and four parts of "Mapa pamięci Atari XL/XE".

 

AMAC is not a friendly environment to study the 6502 asm. Try Quick Assembler (QA) instead. It's an IDE. For the start:


 opt 21
 org $600
loop lda $d40b
 sta $d01a
 jmp loop

In the "Setup" menu set the run address to 0600. Then select "Assembly" and "Run". Shift+Break to terminate your program.
 

Link to comment
Share on other sites

From personal experience, you don't really need to enter anything into $2E0.

 

Both Assemler Editor and MAC65 will compile the code which when loaded will run at the load address.

 

Obviously if you need an INIT then RUN you would use $2E2 and $2E0  with the addresses of the INIT code and the RUN code.

 

I think I've only ever used these addresses with BOOT Cassettes and Disks where there is no DOS

Link to comment
Share on other sites

1 hour ago, TGB1718 said:

Both Assemler Editor and MAC65 will compile the code which when loaded will run at the load address.

 

I think I've only ever used these addresses with BOOT Cassettes and Disks where there is no DOS

Ehem, not quite. So, first for "binary load files". If you want to run a binary load file either as AUTORUN.SYS or from the DUP menu of any of the Atari DOSes, e.g. DOS 2.0S, 2.5 or 3.0, then it *needs* a run address or it will not be run. This is different for Os A/+ and related products from OSS. They use an implicit run address which is the load address of the first segment of the file, unless there is a run address explicitly given. Many game DOSes (such as NDOS) follow the same convention, i.e. implicitly assume a RUN address if none is given. However, as said, for compatibility with Atari DOSes, you'll need one.

 

Second, BOOT tapes and disks are an entirely different business. They do not use a binary load file structure (the thing that starts with a 0XFF 0XFF pair), but use the boot structure: First, a boot flag which has no meaning but must be present, then the number of sectors (or blocks) to be loaded, followed by the load address where to place the data, followed by the RUN address. The init address is then the load address + 6. However, this mechanism does not use $2e0 to $2e3, but $a,$b and $c,$d.

  • Like 1
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...