Jump to content


The AtariAge Forum is undergoing a major upgrade today.  The forum is currently in read-only mode except for the Announcements Forum.  Please read this important post!

Photo

how do you start an asm program?


8 replies to this topic

#1 funkheld OFFLINE  

funkheld

    Moonsweeper

  • 378 posts

Posted Fri May 24, 2019 9:05 AM

Hi good afternoon
 
how do you start an asm program at  $6000?
 
Thank you.
Greeting


#2 JoSch OFFLINE  

JoSch

    Dragonstomper

  • 612 posts
  • Location:Germany

Posted Fri May 24, 2019 9:12 AM

That depends on the assembler, you are using.

Most use "ORG $6000".



#3 funkheld OFFLINE  

funkheld

    Moonsweeper

  • Topic Starter
  • 378 posts

Posted Fri May 24, 2019 9:16 AM

Hi, Thank You.
I wanted a finished compiled asm program at $ 6000
is that possible with call ... or?
 
Thank you.
Greeting


#4 JoSch OFFLINE  

JoSch

    Dragonstomper

  • 612 posts
  • Location:Germany

Posted Fri May 24, 2019 9:18 AM

 

Hi, Thank You.
I wanted a finished compiled asm program at $ 6000
is that possible with call ... or?
 
Thank you.
Greeting

 

What assembler are using?



#5 funkheld OFFLINE  

funkheld

    Moonsweeper

  • Topic Starter
  • 378 posts

Posted Fri May 24, 2019 9:24 AM

this beginning bei $6000 : vscrold3.xex

 

Greeting



#6 JoSch OFFLINE  

JoSch

    Dragonstomper

  • 612 posts
  • Location:Germany

Posted Fri May 24, 2019 11:09 AM

try "org $6000" before the first assembler instruction.



#7 Ute OFFLINE  

Ute

    Star Raider

  • 89 posts
  • Location:Utah

Posted Fri May 24, 2019 11:24 AM

Here is a simple example by Peter Dell. It shows how to start an assembly program at a certain address. This example uses org $0400, but just substitute that for $6000. What you're missing is what tells the assembler where to start. You can use either RUNAD(02E0-02E1) or INITAD(02E2-02E3). The difference being INITAD will run as soon as that location loads. RUNAD will execute after the entire program has loaded. First example shows a typical way to point RUNAD to the org address. Second shows what it looks like disassembled. If you're using MADS assembler you can just use the 'run' command followed by the address you want to start from.

Attached Thumbnails

  • Start.png
  • StartDis.png
  • Start3.png

Edited by Ute, Fri May 24, 2019 11:25 AM.


#8 sanny OFFLINE  

sanny

    Moonsweeper

  • 400 posts
  • Location:Bavaria

Posted Fri May 24, 2019 11:41 AM

how do you start an asm program at  $6000?

 

what exactly do you mean with "start"? How to start the program after it was compiled? Or what to write in the source code before instructions? Or how to define start address of program?

 

Please be more specific...  "NOT ENOUGH INFORMATION ERROR"...



#9 ricortes OFFLINE  

ricortes

    Dragonstomper

  • 692 posts

Posted Fri May 24, 2019 6:31 PM

$02E0 is a magic number for files. What happens is while/after a file is loaded, the OS checks that position for a change and if it does, jumps to that location.

 

The way assemblers work is different ORG are appended to the preceding file. The above wouldn't work if it was assembled to memory and run from memory. That is, the first ORG sets that data stream in the file to that location. DOS will examine the first 6 bytes created to determine if it is a binary file, where to start loading it, and where it ends. When DOS finishes this, it sees if there are any additional bytes in the file. If there is more in the file, the same process is repeated. In this case, the only thing the second file does is put two bytes at the magic place for DOS to jump to. In this case, the first file gets loaded at $6000, DOS continues and loads the second file at $02E0, sees $02E0 has changed so it jumps<or JSR if INIT VECTOR at $02E2 is used> to that location.

 

It's a really nice feature because you can actually load files that use the same memory or data or initiate routines. For instance you may want to switch the OS to RAM, load a new character font to the OS area, the load your mainline code to the same area the first OS switching program used. Or you could load an OS switcher, do a next file with just the address of the OS character set and the new font, then load your program. Very trick IMHO. You could load an entire OS with a new font, load a switcher somewhere else, then replace the OS and continue reusing those locations for your program. It would be possible to use an entire disk for a game or application where the INIT code just does dungeon levels in an RPG for instance.


Edited by ricortes, Thu May 30, 2019 9:59 AM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users