Jump to content
IGNORED

how do you start an asm program?


Recommended Posts

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.

post-40949-0-17256700-1558718192.png

post-40949-0-65070000-1558718198.png

post-40949-0-99148200-1558718206.png

Edited by Ute
  • Like 2
Link to comment
Share on other sites

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

Link to comment
Share on other sites

$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
  • Like 2
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...