+retroclouds Posted July 15, 2011 Share Posted July 15, 2011 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 Quote Link to comment Share on other sites More sharing options...
+adamantyr Posted July 15, 2011 Share Posted July 15, 2011 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 Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 15, 2011 Share Posted July 15, 2011 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 1 Quote Link to comment Share on other sites More sharing options...
marc.hull Posted July 15, 2011 Share Posted July 15, 2011 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. Quote Link to comment Share on other sites More sharing options...
John Doe Posted July 15, 2011 Share Posted July 15, 2011 (edited) Edited February 22, 2014 by Tony Knerr 1 Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 15, 2011 Share Posted July 15, 2011 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 . Quote Link to comment Share on other sites More sharing options...
+retroclouds Posted July 16, 2011 Author Share Posted July 16, 2011 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 Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 16, 2011 Share Posted July 16, 2011 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 1 Quote Link to comment Share on other sites More sharing options...
+Ksarul Posted July 16, 2011 Share Posted July 16, 2011 Thanks Willsy, I don't think I've ever seen that book. . . Quote Link to comment Share on other sites More sharing options...
+retroclouds Posted July 17, 2011 Author Share Posted July 17, 2011 wow, that's a very good book! Too bad TI didn't supply it together with the Editor/Assembler cartridge. Yeah I'm gonna start with some trivial tasks and see how far I get Thanks willsy. Quote Link to comment Share on other sites More sharing options...
+adamantyr Posted July 18, 2011 Share Posted July 18, 2011 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 Quote Link to comment Share on other sites More sharing options...
+retroclouds Posted July 19, 2011 Author Share Posted July 19, 2011 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.