Path: news.uiowa.edu!chi-news.cic.net!io.org!van-bc!pm06.pomo.wis.net!user From: dmanzer@wimsey.com (Doug Manzer) Newsgroups: comp.sys.apple2.programmer,comp.sys.apple2 Subject: HELP! Disk device driver won't boot. Date: Wed, 31 Jan 1996 19:57:52 -0800 Organization: Online at Wimsey Lines: 132 Message-ID: NNTP-Posting-Host: pm06.pomo.wis.net Xref: news.uiowa.edu comp.sys.apple2.programmer:6074 comp.sys.apple2:98367 I'm trying to write device driver firmware for my PC-based file server for the Apple 2. The firmware resides on a converted parallel printer card which connects to a parallel port on the PC. So far I've gotten an initial version of the device driver to communicate with the server, and can format a volume, read and save files, etc. (A ProdDos "volume" is implemented as a binary file on the PC). However, I can't get it to boot reliably. It works occasionally, but mostly I get a message: *** UNABLE TO LOAD PRODOS *** The specs I'm using are in Gary Little's book _Apple ProDOS_, Advanced Features for Programmers, which says: "The first two blocks (0 and 1) of every standard ProDOS-formatted disk contain an assembly language program, called the _boot record_, that is automatically loaded into memory at $800 and executed (by a call to $801)." Ok, I wrote code to do that on entry at $C100 (it's hard-coded for slot 1 at the moment). This part seems to work, as I can tell by debug messages from the server on the PC's screen that two blocks are being read from the ProDOS volume file. Then I call $801, where the following should happen: "When the boot record starts executing, it first loads the volume directory blocks (it assumes that these are located at their standard positions: blocks 2-5) into the 2K memory area from $C00-$13FF." However, I can tell from the PC that it doesn't get that far before hanging up with UNABLE TO LOAD PRODOS. Here's some of the code I'm using (the $C1 stuff) -- this is the only version that ever worked, where a ProDOS volume file is fixed at 1 MB for the time being: C:\PD\P2A.ASM Jan 29, 1996 7:25pm Page 1 (Jan 29, 1996 6:03pm) 4 ;======= 5 ; PC file server - ProDos device driver 6 ;======= 7 8 0100 stack equ $0100 9 C080 ioport equ $C080 ; add $n0 for actual i/o addr 10 C060 cin equ $C060 ; cassette input port 11 12 0042 command equ $42 ; command code for disk op 13 0043 sldrive equ $43 ; slot/drive # 14 0044 buffer equ $44 ; & $45 15 0046 block equ $46 ; & 47 16 17 0000 datsav equ 0 18 CFFF exp_off equ $CFFF ; expansion ROM soft sw 19 C800 entry equ $C800 ; real work done here 20 21 ;======= 22 ; START OF PROGRAM CODE 23 ;======= 24 25 C100 .org $C100 26 27 ; disk controller signature bytes 28 C100 C9 20 cmp #$20 29 C102 C9 00 cmp #00 30 C104 C9 03 cmp #03 31 C106 C9 00 cmp #00 32 33 ; boot entry 34 C108 A9 00 lda #0 ; action code for boot 35 C10A 8D FF CF sta exp_off ; expansion ROM off 36 C10D 20 00 C8 jsr entry 37 38 ; ProDos command entry point 39 C110 cmd: 40 C110 A9 01 lda #1 ; action code for cmd 41 C112 8D FF CF sta exp_off ; expansion ROM off 42 C115 20 00 C8 jsr entry 43 C118 60 rts 44 45 C1FC .org $C1FC 46 47 ; device size in blocks ($0800 blocks = 1 mb) 48 C1FC' 00 .byte $00 ; block count lo 49 C1FD' 08 .byte $08 ; block count hi 50 51 ; device attributes 52 C1FE' 47 .byte $47 ; like ProFile 53 54 ; ProDos device driver entry point address lo 55 C1FF' 10 .byte