* SETUP.SYSTEM by Sean Nolan * * This program is in the public domain. * * * * This program mimics the ProDOS-16 SYSTEM.SETUP convention. * It can be used to install RAM disk drivers, clock drivers, * and IIGS Classic Desk Accessories on bootup under ProDOS-8. * * This program loads and calls all BINary and SYStem files in * a subdirectory named SETUPS. It then looks for the second * system program in the volume directory whose name ends in * ".SYSTEM", and runs that. * * This program was assembled using Merlin Pro. TYP $FF ;save as a system file ORG $BD00 ;load at $2000, but run at $BD00 ***** equates CH = $24 IN2 = $280 FileType = IN2+16 AuxCode = IN2+31 RESET = $3F2 IObuffer = $B900 PRODOS = $BF00 QuitVect = $BF03 DEVNUM = $BF30 BITMAP = $BF58 INIT = $FB2F VTABZ = $FC24 HOME = $FC58 RDKEY = $FD0C SETVID = $FE93 SETKBD = $FE89 SETNORM = $FE84 ***** boot code VolName = * ;The first 17 bytes are overwritten with the ;name of the volume from which this was run. LDX #1 ;mark page $BD as free in the system bitmap STX BITMAP+23 ;so we can put Online result in our code. DEX ;relocate this program to $BD00-BEFF Loop1 LDA $2000,X STA $BD00,X LDA $2100,X STA $BE00,X INX BNE Loop1 DEX TXS ;init stack pointer JMP Enter ;jump to relocated code DirName DFB 6 ;DirName and VolName must be in the same page ASC "SETUPS" ***** Get name of boot volume Enter LDA DEVNUM ;get name of last volume accessed STA OnlineN JSR PRODOS DFB $C5 ;ONLINE DA OnlineP LDA VolName+1 ;insert a slash before the name AND #$0F TAX INX STX VolName LDA #'/' STA VolName+1 LDA QuitVect+1 ;save the original quit vector STA QuitMod1+1 LDA QuitVect+2 STA QuitMod2+1 ***** Clean up before & after calling files MainLoop LDX #2 ;point Reset vector and ProDOS Loop3 LDA Jump+1,X ;Quit vectors to MainLoop. STA RESET,X LDA Jump,X STA QuitVect,X DEX BPL Loop3 TXS ;fix stack pointer (X=$FF) JSR Close ;close all open files LDX #23 ;clear system bit map LDA #0 Loop2 STA BITMAP,X DEX BPL Loop2 LDA #$CF ;mark pages 0, 1, 4-7 as used STA BITMAP LDA #%111 ;mark pages $BD-$BF as used STA BITMAP+23 LDA $C082 ;Language card off STA $C00C ;40-column STA $C00E ;normal character set STA $C000 ;80STORE off JSR SETNORM ;normal JSR INIT ;display text page 1 JSR SETVID ;PR#0 JSR SETKBD ;IN#0 * Make sure boot volume is around * AND set prefix to the boot volume VolMount JSR HOME JSR PRODOS ;set prefix to volume DFB $C6 ;SET PREFIX DA Pfx2P BCC VolOK LDX #13 Loop6 LDA VolText-1,X ;print message "Insert volume " STA $5A8+4,X DEX BNE Loop6 Loop7 LDA VolName+1,X ;print volume name ORA #$80 STA $5A8+19,X INX CPX VolName BCC Loop7 LDA #35 ;go to CH=35, CV=11 STA CH LDA #11 JSR VTABZ JSR RDKEY ;wait for a keypress JMP VolMount ***** Get name of next file at IN2 VolOK JSR NextFile ;get name of next file at IN2 BCS ExitLoop ;if error, we're done with setup files ***** Load and call setup file JSR PRODOS ;set prefix to SETUPS DFB $C6 ;SET PREFIX DA Pfx1P JSR ReadFile ;read in file whose name is at IN2 ;and call it if there was no error. Jump JMP MainLoop ;3 bytes here copied into ProDOS quit vector DFB #$BD!$A5 ;3 bytes ending here are copied into reset vector ExitLoop INC RESET+2 ;scramble reset vector QuitMod1 LDA #0 ;restore original quit vector STA QuitVect+1 QuitMod2 LDA #0 STA QuitVect+2 ***** Look for second system program on disk LDA #0 ;modify NextFile routine so that it searches STA Number+1 ;the volume directory for system files only. STA ChekType+1 LDA #