[movitz-devel] First-cut floppy driver
Frode Vatvedt Fjeld
ffjeld at common-lisp.net
Sun Jan 18 21:25:49 UTC 2004
Nyef <nyef at softhome.net> writes:
> Attached is a first cut for a floppy driver. [..]
Thanks!
I thought I'd just offer some comments about style etc. (Of course,
I'd appreciate other's comments and views too.)
> Anyway, here it is. It goes in movitz/losp/x86-pc/, and you may need
> to modify all.lisp in the same directory to load it.
The all.lisp was something I added so I could conveniently include
everything in the los0 image, which has been functioning as a testing
base.
And, the whole require/provide design isn't very good. If anyone has
ideas about for example some defsystem design, that'd be great.
> ;;; (setf *package* (find-package "X86-PC.FLOPPY")) to switch to
> ;;; this package.
There's a toplevel-command :package that does this easier. E.g.
INIT> :pa x86-pc.floppy
X86-PC.FLOPPY>
> ;; I/O port locations
>
> (defconstant +fd-main-status-register+ #x3f4)
> (defconstant +fd-data-register+ #x3f5)
> (defconstant +fd-digital-output-register+ #x3f2)
> (defconstant +fd-that-other-register+ #x3f7)
If there's any chance at all that a floppy controller can live at
another I/O base address (?), relavtive addressing should be used.
> (defun fd-status ()
> (io-port +fd-main-status-register+ :unsigned-byte8))
I think it's pointless to both have a separate package and prefix
every symbol. Packages are name-spaces (not software modules), so I'm
leaning towards for example that the floppy driver should live in the
x86-pc package.
BTW I plan on renaming muerte.x86-pc to just x86-pc. The muerte prefix
is really a remnant from a previous scheme where every movitz package
was required to have such a prefix.
> (defun (setf fd-motor) (value)
> (if (null value)
> (setf (fd-dor) 0)
> (progn
> ;; FIXME: Should delay after this setf for motor to come up to speed.
> (setf (fd-dor) #x1c))))
It's a very good idea I believe to ensure that every setf function
returns the value argument. Sooner or later, someone will be very
surprised when they discover that
(setf (fd-motor) nil)
returns #x0.
Great work!
Now who's volunteering for PCI, IDE, USB, SCSI, SVGA & friends? :-)
--
Frode Vatvedt Fjeld
More information about the movitz-devel
mailing list