home *** CD-ROM | disk | FTP | other *** search
- ;INSTALL, Public domain.
- ;Please tell me about any enhacements,changes,bugs or brain-damage in this
- ;code. bryce@cogsci.berkeley.EDU -or- ucbvax!cogsci!bryce
- ;Bryce Nesbitt 1712 Marin Ave. Berkeley, Ca 94707-2206
- ;
- ;FUNCTION:
- ; Works just like the CLI INSTALL command.
- ;
- ;BUGS:
- ; I use ARP.LIBRARY for all my parsing. You don't have that and I can't
- ; give it to you yet. Thus this version of INSTALL is hardwired for DF0:
- ;
- ; For some reason that is not entirely my fault, if the disk in DF0: is
- ; write-protected INSTALL will merrily report success.
- ;
- ; The second "bug" will be worked around in the final ARP release.
- ;
- ;NOTES:
- ; Assembled with METACOMCO and blink'ed with BLINK
- ;
- NOLIST
- INCLUDE 'exec/types.i'
- INCLUDE 'exec/memory.i'
- INCLUDE 'exec/ports.i'
- INCLUDE 'exec/io.i'
- INCLUDE 'libraries/dos.i'
- INCLUDE 'libraries/dosextens.i'
- INCLUDE 'devices/trackdisk.i'
- ;INCLUDE 'lib/exec_lib.i' ;my peculiarities.
- ;INCLUDE 'lib/dos_lib.i' ;you don't have these
- blink macro
- bchg #1,$bfe001
- endm
- jsrlib MACRO
- xref _LVO\1
- jsr _LVO\1(a6)
- ENDM
- jmplib MACRO
- xref _LVO\1
- jmp _LVO\1(a6)
- ENDM
- LIST
- **************************
-
- ;--Get ready...--
- move.l 4,a6
- lea.l DOSName,a1
- jsrlib OldOpenLibrary
- move.l d0,a6
-
- lea.l bblock,a0
- move.l a0,a1
-
- move.l #128+127,d3
- moveq #0,d0
- move.l d0,4(a0)
- move.w #0,CCR
- chksum move.l (a1)+,d1
- addx.l d1,d0
- dbra d3,chksum
- neg.l d0
- subq.l #1,d0
- move.l d0,4(a0)
-
- moveq #0,d0
- bsr WRITELBLOCK
- bne.s e_block
-
- lea.l yess,a0
- moveq #yese-yess,d3
- bra.s in
- e_block lea.l nos,a0
- moveq #noe-nos,d3
- in move.l a0,d2
- jsrlib Output
- move.l d0,d1
- beq.s e_output
- jsrlib Write
- moveq #0,d0
- rts
- e_memory
- e_output
- e_deviceproc moveq #20,d0
- rts
- ;
- ; port=CREATEPORTE(),exec
- ; d0 a6
- ; z=error
- ;
- ;FUNCTION: Create a nameless message port, 0 priority.
- ;RESULT: The port pointer or Z=1 if an error occured.
- ;REGISTERS: A6 must contain exec!
- ;EXAMPLE: bsr CREATEPORTE
- ; beq.s noport ;Not enough memory (or signals)
- ;
- ;xref CREATEPORTE
- CREATEPORTE move.l a2,-(a7)
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- moveq #MP_SIZE,d0
- jsrlib AllocMem
- move.l d0,a2
- tst.l d0
- beq.s cp_nomemory
- moveq #-1,d0
- jsrlib AllocSignal ;d0=return
- moveq #-1,d1
- cmp.l d0,d1 ;-1 indicates bad signal
- bne.s cp_sigok
- move.l a2,a1
- moveq #MP_SIZE,d0
- jsrlib FreeMem
- cp_nomemory move.l (a7)+,a2
- moveq #0,d0
- rts
-
- cp_sigok move.b d0,MP_SIGBIT(a2)
- move.b #PA_SIGNAL,MP_FLAGS(a2)
- move.b #NT_MSGPORT,LN_TYPE(a2)
- clr.b LN_PRI(a2)
- suba.l a1,a1 ;a1=0/Find this task
- jsrlib FindTask ;[d0=this task]
- move.l d0,MP_SIGTASK(a2)
- lea.l MP_MSGLIST(a2),a0 ;Point to list header
- NEWLIST a0 ;Init new list macro
- move.l a2,d0
- move.l (a7)+,a2 ;cc's NOT affected
- rts
- ;
- ;DELETEPORTE(port),exec
- ; a1 a6
- ;
- ;FUNCTION: Deletes the port by first setting some
- ; fields to illegal values then calling FreeMem.
- ;RESULT: none
- ;REGISTERS: A6 must contain exec!
- ;
- ;xref DELETEPORTE
- DELETEPORTE move.l a1,-(a7)
- moveq #-1,d0
- move.b d0,LN_TYPE(a1)
- move.l d0,MP_MSGLIST+LH_HEAD(a1)
- moveq #0,d0 ;Clear upper 3/4 of d0
- move.b MP_SIGBIT(a1),d0
- jsrlib FreeSignal
- move.l (a7)+,a1
- moveq #MP_SIZE,d0
- jmplib FreeMem
- ;
- ;WRITELBLOCK(buffer,block)
- ; a0 d0
- ;
- WRITELBLOCK movem.l d2/a3/a6,-(a7)
- move.l 4,a6
- ;move.l d0,d2
- move.l a0,a3
- suba.l #IOTD_SIZE,a7
- moveq #IOTD_SIZE-1,d0 ;clear the new IORequest (slowly)
- move.l a7,a0
- clearit clr.b (a0)+
- dbra d0,clearit
- bsr CREATEPORTE
- beq e_TDport
- move.l d0,MN_REPLYPORT(a7)
- move.b #NT_MESSAGE,LN_TYPE(a7)
- lea.l TrackName,a0
- move.l a7,a1
- moveq #0,d0
- moveq #0,d1
- jsrlib OpenDevice ;[a0-name|d0=unit|a1-IO|d1-flags]
- tst.l d0
- bne.s e_TDopen
-
- move.w #CMD_WRITE,IO_COMMAND(a7) ;ETD!!
- move.l #1024,IO_LENGTH(a7)
- ;moveq #9,d0
- ;asl.l d0,d2 ;shift d2 by d0
- ;move.l d2,IO_OFFSET(a7)
- clr.l IO_OFFSET(a7)
- move.l a3,IO_DATA(a7)
- move.l a7,a1
- jsrlib DoIO ;[a1-IO]
- move.b IO_ERROR(a7),d0 ;cc's set
- bne.s e_TDerror
-
- move.w #CMD_UPDATE,IO_COMMAND(a7) ;ETD!!
- ;move.l #1024,IO_LENGTH(a7)
- ;moveq #0,d2
- ;move.l d2,IO_OFFSET(a7)
- ;move.l a3,IO_DATA(a7)
- move.l a7,a1
- jsrlib DoIO ;[a1-IO]
-
- move.w #TD_MOTOR,IO_COMMAND(a7) ;ETD!!
- clr.l IO_LENGTH(a7) ;motor off
- ;moveq #0,d2
- ;move.l d2,IO_OFFSET(a7)
- ;move.l a3,IO_DATA(a7)
- move.l a7,a1
- jsrlib DoIO ;[a1-IO]
- moveq #0,d7
- move.b IO_ERROR(a7),d7
- bra e_good
- e_TDerror
- e_TDopen
- e_TDport moveq #-1,d7
-
- e_good move.l MN_REPLYPORT(a7),a1
- bsr DELETEPORTE
- adda.l #IOTD_SIZE,a7 ;cc's not
- movem.l (a7)+,d2/a3/a6 ;cc's not
- move.l d7,d0
- rts
-
- DATA
- ;----------------------------------------------------------------------
- ;This is the actual boot-block. From the descriptions in the RKM I was
- ;able to determine the registers. From there to code was three steps;
- ;I tired OpenLibrary on DOS, zilch. Tried returning the value from
- ;FindResident, crash. And at last the correct answer -> extract the
- ;init pointer from the resident structure.
- ;
- ;Later investigation revealed:
- ;At boot-block time DOS.LIBRARY has not been built. A perfect time to
- ;add a totally different DOS! If you want to call the current DOS you
- ;will need a hyper-kludge.
- ;The code at the jump address returned by the boot code builds the DOS
- ;library, sends a message the does a REMTASK (!). No hope of using a JSR
- ;to return control.
- ;
- ;This area is checksumed on the fly, so feel free to change it either
- ;in source or object form.
- ;
- cnop 0,4
- bblock dc.b 'DOS',0 ;Disk Type
- dc.l 0 ;Checksum
- dc.l 880 ;Root block key
-
- move.l 4,a6
- lea.l DOSName(pc),a1
- jsrlib FindResident
- move.l d0,a0
- tst.l d0
- bne.s LibOpenOk
- subq.l #1,d0 ;make -1
- rts ;failure
- DOSName dc.b 'dos.library',0
- LibOpenOk move.l $16(a0),a0 ;Initial Jump
- moveq #0,d0 ;success
- rts
- here
- dcb.b 1024-(here-bblock),0 ;Pad block with zeros
- ;-- static data --
- yess dc.b 'Disk in drive DF0: is now bootable.',10
- yese
- nos dc.b 'Install DF0: failed',10
- noe
- TrackName dc.b 'trackdisk.device',0
- END
-
-