Jump to content
Sign in to follow this  
Thelen

loading file in asm from disk

Recommended Posts

I can't find information about this: how can i load a file in assembler from disk ?

 

for instance : I want to load a binary file(.bin) to memory adress 4000-40FF from diskdrive d1:

 

how can i do this ?

 

Thanks,

 

Thelen

Share this post


Link to post
Share on other sites

oh... :) long time ago... it's easy & not so easy depending how flexible you want to have it...

 

you can access single sectors on atari n assembler without any DOS but it just can read sectors (think of the boot routine build in ROM).

 

if you need file access then you definitly need a so called "mini DOS"... as you have to access directory, loading without any hassle with file length etc... and such a stuff i haven't wrote... Fox, our main coder wrote one for numen demo...

 

let's summarise what i know:

 

sectors 1-4 on a atari disc, doesn't matter which density can contain a "boot block" and all 4 sectors have 128 byte length. other densities have other sector length... so i still assume you will use DOS 2.x format.

 

with the rom routines you can now read 128 bytes at ounce... you just have to set several parameters like diskdrive number, sector number, buffer adress, sector length, disk command (read slow, read fast, format disc, etc...) and then jump into the standard "SIO"-routine...

 

so if you want to read more than 128 bytes you have to increment the buffers, sector numbers on your own... if you want to read different filesize than 128,256,512, etc... then you have to write your own "move buffer to memory" routine and of course you have to deal with "linked sectors". f.e. in atari dos 2.x a disc sector contains 125 bytes data, the other 3 bytes contain flags for fileend, next sector, checksum (??? i think so... i can remember something... like "CRC" error in DOS).

 

sorry... it is so long ago when i wrote my disk mon that i can not remember the memory locations right now... but i guess $d30x could be something to search for...

 

hve

Share this post


Link to post
Share on other sites

thelen,

 

I'm assuming you've gotten the bin file on a real Atari disc or a valid ATR image for an emulator...

 

At the simplest level the data will be loaded by DOS at the address you decided when you created it...

 

If you created the file yourself then simply assemble it at the address you want (with your chosen assembler) and then load it, with say DOS 2.5 using option L to load it - it will load into RAM at the address you org'd the code to...

 

If its executable data option M will run it at that address if you want...

 

If its raw binary data you can simply load it using the option L...

 

If you use XASM then you can add the line:

 

; make autorunning

 

run prog

 

Adding this to your XASM file, will cause the code assembled to run automatically from the address you org'd the code to when you load it into DOS with option L...

 

sTeVE

Share this post


Link to post
Share on other sites

ooops...steve...maybe i had gone too far... ;) if this was the problem... then my answer would be more simple... as your bottom line says...

 

hve

Share this post


Link to post
Share on other sites

No you didn't gone to far :) ...but i have find a solution. Since 2 days i'm using XASM, and i use the ins 'file' function. Real loading from diksdrive is a little complecated for me. so i implement the file in my source code.

 

how can i copy a XASM atr. image to real disk (of course i have sio2pc), but when i want a directory in dos it can't find anything. and sio2pc says the disk image is 0 bytes in size.

 

Thelen

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...