Jump to content
IGNORED

File I/O in assembly language


 Share

Recommended Posts

I'm looking for some examples on how to do disk file access using TMS9900 assembly language

What I'm looking for is how to sequentially read a file, write a file, random access. Reading the catalog, etc.

 

What requirements are there in regards to VDP memory, scratch-pad memory, etc.

How to access the DSR.

 

Anyone ? :)

 

 

EDIT: hhmmm this is not related to the Tutankham project :)

Link to comment
Share on other sites

I'm looking for some examples on how to do disk file access using TMS9900 assembly language

What I'm looking for is how to sequentially read a file, write a file, random access. Reading the catalog, etc.

 

What requirements are there in regards to VDP memory, scratch-pad memory, etc.

How to access the DSR.

 

Anyone ? :)

 

 

EDIT: hhmmm this is not related to the Tutankham project :)

 

The TI Tech Page has good information for this; I've used it to create the file reading system for my CRPG. I call the "FILES" subroutine, for example, to reduce the number of active files to 1 and free up space in VDP, and do a lot of random access.

 

I'm going on vacation for the weekend, so I can't provide more details from my project, but when I get back I can do so.

 

Adamantyr

Link to comment
Share on other sites

You write a PAB in VDP memory, and set >8356 in pad to point to the length byte of your PAB.

 

It's actually fairly easy to do in assembly language. Reading a catalog is a bitch, because the numeric data comes back in Radix 100 format.

 

Doing things like relative file IO in assembly is quite simple once you get the hang of it. The trick is to write little subroutines that each do a little bit of work on the PAB. I generally 'work' on the PAB in normal CPU memory, then transfer it to VDP at the end, when I've finished setting it up.

 

Eg.

 BL @OPCODE       ; write an OPEN opcode to the opcode field 
 DATA OPEN,MYPAB  ; (byte 0) of the pab at address MYPAB

 LI R0,45         ; set record number 45
 BL @SETREC       ; call the 'set record' routine
 DATA MYPAB       ; update the PAB at address MYPAB in cpu memory

 

Once you have a little library of these helper routines, is very easy.

 

Attached is a PDF that I made for myself some time that summarises the layout of PABs. Hope you find it useful!

 

If you need to know anything, just go ahead and ask... Adam, Matthew, Tursi, Marc, myself etc will be happy to help.

PAB Info.pdf

  • Like 1
Link to comment
Share on other sites

You write a PAB in VDP memory, and set >8356 in pad to point to the length byte of your PAB.

 

It's actually fairly easy to do in assembly language. Reading a catalog is a bitch, because the numeric data comes back in Radix 100 format.

 

Doing things like relative file IO in assembly is quite simple once you get the hang of it. The trick is to write little subroutines that each do a little bit of work on the PAB. I generally 'work' on the PAB in normal CPU memory, then transfer it to VDP at the end, when I've finished setting it up.

 

Eg.

 BL @OPCODE       ; write an OPEN opcode to the opcode field 
 DATA OPEN,MYPAB  ; (byte 0) of the pab at address MYPAB

 LI R0,45         ; set record number 45
 BL @SETREC       ; call the 'set record' routine
 DATA MYPAB       ; update the PAB at address MYPAB in cpu memory

 

Once you have a little library of these helper routines, is very easy.

 

Attached is a PDF that I made for myself some time that summarises the layout of PABs. Hope you find it useful!

 

If you need to know anything, just go ahead and ask... Adam, Matthew, Tursi, Marc, myself etc will be happy to help.

 

 

Thanks for the pat on the back but Marc knows absolutely dick about this mysterious file stuff. It is also outside my current scope (which is restricted to games, songs and beer.) I don't know if Ernie ever made it over here but I do know he is a file wizard. Tim also knows his way around that oldest of dark magics ;-).

 

This would be a good subject for a tell all type of manuscript. Provided it was dumbed down for us mere mortals.

Link to comment
Share on other sites

I'll see if I can put some sort of document together if adamantyr doesn't beat me to it. Iirc its covered quite well in one of the assembly books. I'll look it up tomorrow .

 

Thanks. I appreciate it a lot. The info I got in this thread is a good starting point.

 

I'm kinda hoping that InsaneMultitasker chimes in. This morning I recalled that he was working on exact such document about a year ago.

Dunno how far he got, but perhaps forces can be bundled :)

 

At this time I'm starting collecting the information, unfortunately no time for hacking.

I have some (oracle) business to take care off next week and most likely I won't be having internet access.

So I'll be silent for a while :ponder:

Link to comment
Share on other sites

Chapter 5, section 5.6, page 162 is the start of the Assembly File IO in the attached book "Simplified 99/4 Assembly Language" by Ken Kulp. This is a brilliant book.

 

I think you'll find it explains everything you need to know. It doesn't explain reading the disk catalog, but don't make that your first File IO project, choose something simpler to start with! Like, writing "hello mother" to a file, and then reading it back etc!

 

Hope you like the attached.

 

Mark

994a Assembly Language.pdf

  • Like 1
Link to comment
Share on other sites

I'm back from vacation... did you figure out how to do files in my absence?

 

One thing that isn't documented with relative files is WHEN to actually populate the PAB with the record you want. I've found the best time to do this is on the read/write operation. I initially had the record placed with the open operation, but I found that while that worked with the TI Disk Controller, the Myarc HDFC actually ignored it.

 

Adamantyr

Link to comment
Share on other sites

I'm back from vacation... did you figure out how to do files in my absence?

 

One thing that isn't documented with relative files is WHEN to actually populate the PAB with the record you want. I've found the best time to do this is on the read/write operation. I initially had the record placed with the open operation, but I found that while that worked with the TI Disk Controller, the Myarc HDFC actually ignored it.

 

Adamantyr

 

I'm out of town. The hotel I'm in doesn't have WIFI. So I downloaded a few things in advance, still collecting infos at this time. Expecting to dig into it the next week. Thanks

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...