English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 24 June 2021, 16:23   #1
hjalfi
Registered User
 
Join Date: Feb 2019
Location: Zurich
Posts: 38
Looking for standalone floppy driver code

I'm thinking about porting an OS to the Amiga --- Alan Cox's Fuzix, a simple unixoid.


I doubt very much whether it would be possible to use any routines from the Kickstart ROM in this, because Kickstart assumes a particular execution environment, which I won't be. So, I'll have to write all my own hardware control code. This isn't actually particularly hard, except for the floppy disk driver, which because it's mostly software-controlled on the Amiga is complicated and full of edge cases.


Does anyone have a pre-written driver which doesn't depend on anything in Kickstart? I'd imagine that any game written in bare metal mode which needs to read or write floppies would have one of these.


Preferred: C, but I can make do with asm. Needs to have a license which is compatible with the GPL.


Thanks!
hjalfi is offline  
Old 24 June 2021, 16:39   #2
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
I've used PHX's trackloader in the past. It's in assembly, but works really quite well. You can find it included in the source for Celtic Hearts here: https://eab.abime.net/showthread.php?t=96562
roondar is offline  
Old 24 June 2021, 18:09   #3
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Some details: The trackdisk routines are completely standalone (trackdisk.asm). You can ignore the references to memory allocation routines, which are only needed to load compressed files for the game (td_loadcr). The license is public domain, so I don't care if you include it into a GPL-licensed project. Useful functions you will need (and everything referenced by them):
  • td_init - initialization and scan for connected drives
  • td_read - reads one or more blocks from disk
  • td_write - writes one or more blocks from disk
  • td_format - formats a whole track for AmigaDOS
  • td_motoroff - to turn off motor when done with all operations
You cannot use td_selectdisk, which looks for a disk with a 4-byte ID at offset 8 in block 0. You will probably want to select a drive directly, by setting DriveSel.

Functions for loading and decompressing game files can be ignored: td_file, td_loadcr, td_load, td_sizecr.

trackdisk.asm can read and write blocks from a floppy disk in AmigaDOS format (80 cylinders, 2 sides, 11 sectors per track). If you need MSDOS-format, then huge parts have to be changed: td_read, td_trackread, td_write, td_trackwrite, td_format.

I doubt the code will be ideal for a multitasking OS in this state, though. wait_disk_dma busy-waits for the Disk-DMA to finish, by polling the DSKBLK interrupt flag. You certainly want to change that.
phx is offline  
Old 28 June 2021, 12:03   #4
hjalfi
Registered User
 
Join Date: Feb 2019
Location: Zurich
Posts: 38
Excellent, thank-you --- that looks ideal. It even looks small enough that I should be able to get the read part into a boot block, which will make system startup much easier. Fuzix isn't very multitasking (on a machine with no MMU it has to physically copy processes around in memory to do context switching, so it's cheaper not to a lot of the time), so the busy waiting is fine. This should just drop right in.

BTW, since I have people's attention... I'm guessing that there is nothing in the Kickstart ROM that's of any use if I'm not actually using AmigaOS at all. Is that true? Are there things like font tables, helper routines etc that are easily findable and have no dependencies?
hjalfi is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
CUMANA CAX1000s Driver / floppy disk Santi request.Other 0 14 October 2020 17:18
Floppy Driver Utility Name? Pheonix support.Apps 15 27 December 2016 04:00
standalone releases NPI HOL suggestions and feedback 0 28 May 2009 22:32
Power Computing XL HD Floppy driver disk belimar request.Other 5 16 December 2008 07:56
Is it possible to code a virtual MFM-capable floppy drive into WinUAE? Xiantrius support.WinUAE 24 17 July 2008 10:02

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:06.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07029 seconds with 15 queries