Skip to main content
Home Documents Lisa Lisa Boot ROM RM248.B.TEXT
Lisa Boot ROM RM248.B.TEXT

Lisa Boot ROM RM248.B.TEXT

Lisa · TEXT
FilenameLisa_Boot_ROM_RM248.B.TEXT
Size0.08 MB
Subsection firmware
Downloads2
Enjoying MacTrove? Anonymous downloads are free and unlimited. Create a free account to track favorites, contribute metadata corrections, and join the community chat.
Contents
.PAGE
        .LIST
;-------------------------------------------------------------------------
;  All is OK - check for boot device and then do bootstrap
;-------------------------------------------------------------------------

DOBOOT  BSR     CURSORINIT      ;init cursor/mouse

BOOTCHK
        CLR.L   D0	        ;clear for use
        BTST    #ALTBOOT,D7     ;check if alternate boot command rcvd
        BEQ.S   @1	        ;skip if no
        MOVE.B  BOOTDVCE,D0     ;get alternate boot code

       .IF     BURNIN = 1
        CMP.B   #PC,D0	        ;power-cycle mode?
        BNE.S   DVCECHK	        ;if no, go determine device
        BSR     SAV2PM	        ;if yes, save in parameter memory
       .ENDC

        BRA.S   DVCECHK	        ;and go determine device

@1
        .IF USERINT = 1
        BTST    #BTMENU,D7      ;boot menu wanted?
        BNE     BOOTMENU        ;skip if yes
        .ENDC

        BSR     CHKPM	        ;next step is to check parameter memory

        .IF  AAPL = 1
        BCS     NMISET	        ;skip if not to default boot
        .ELSE
        BCC.S   @2	        ;skip if valid

;  set default boot

        TST.B   SYSTYPE	        ;else check if Lisa 1			        CHG030
        BEQ.S   @5	        ;skip if yes				        CHG030
        MOVEQ   #1,D2	        ;else set wait flag			        CHG030
        BSR     CHKPROFILE      ;and go check if hard disk attached	        CHG030
        BEQ.S   @5	        ;skip if yes to do boot from hard disk	        CHG030
        MOVEQ   #TWIG2,D0       ;else set for boot from floppy		        CHG030
        BRA.S   @3	        ;					        CHG030

@5      MOVEQ   #PROFILE,D0     ;else if not valid do default boot from Profile
        BRA.S   @3
        .ENDC

@2      MOVE.B  DVCCODE,D0      ;else read device code
        LSR.B   #4,D0	        ;rotate to low nibble
        BRA.S   DVCECHK

        .IF  NEWTWIG = 0
        BSR     EXPAND	        ;convert id to keycode
        .ENDC

@3
        .IF  ROM16K = 1
;  Do special check for Applenet and I/O test cards

        MOVE    #TSTCRD,D1      ;search first for a bootable test card
        MOVE    #TSTQUAL,D4
        BSR     SEARCH	        ;go do search
        BNE.S   DVCECHK	        ;skip if not found
        MOVE    D2,D3	        ;else save its id
        MOVE    #APPLENET,D1    ;next search for an Applenet card
        MOVE    #APPLQUAL,D4
        BSR     SEARCH
        BEQ.S   @4	        ;skip if found to boot from it (DMT need)
        MOVE    D3,D2	        ;else do boot from I/O test card (DIAG need)
        BPL.S   DVCECHK	        ; unless card boot bit not set		        CHG012
@4
        MULU    #3,D2	        ;convert to boot id
        MOVE    D2,D0	        ;and set boot id for appropriate slot
        .ENDC

;  Alternate boot desired - check which

DVCECHK MOVE.B  D0,BOOTDVCE     ;save for later reference

        .IF TWIGGY = 1
        TST.B   D0	        ;boot from upper drive?		        CHG009
        BNE.S   @1	        ;no - go to next check
        TST.B   SYSTYPE	        ;check system type		        CHG009
        BEQ.S   @11	        ;skip if Lisa 1.0		        CHG009
@10     BRA     PROBOOT	        ;else do Pepsi boot		        CHG009

@11     MOVE.B  #DRV1,D0        ;else set drive #		        CHG009
        BRA.S   @2	        ;and go do boot

@1      CMP.B   #TWIG2,D0       ;boot from lower drive?		        CHG009
        BNE.S   @3	        ;skip if no
        MOVE.B  #DRV2,D0        ;else set drive #
@2      BRA     TWGBOOT	        ;and go boot
        .ENDC

@3
        .IF PROFLE = 1
        CMP.B   #PROFILE,D0     ;boot from Profile?
        BEQ.S   @10	        ;yes - go do it			        CHG009
        .ENDC

        CMP.B   #IO1PORT2,D0    ;boot from slot 1, ports 1-2?
        BGT.S   @4	        ;skip if not
        MOVE.L  #SLOT1L,A1      ;set slot address
        BRA.S   @9	        ;and go do boot

@4      CMP.B   #IO2PORT2,D0    ;boot from slot 2, ports 1-2?
        BGT.S   @5	        ;skip if not
        MOVE.L  #SLOT2L,A1      ;set slot address
        BRA.S   @9	        ;and go do boot

@5      CMP.B   #IO3PORT2,D0    ;boot from slot 3, ports 1-2?
        BGT.S   @6	        ;skip if not
        MOVE.L  #SLOT3L,A1      ;set slot address

@9      BRA     IOSBOOT	        ;and go do boot

@6
        .IF     BURNIN = 1
        CMP.B   #PC,D0	        ;power-cycle?
        BEQ     CHKPASS	        ;go do cycling
        .ENDC

        .IF  ROM4K = 0
@7      CMP.B   #MON,D0	        ;abort boot?
        BNE.S   LSTCHK	        ;skip if no match

        .IF  USERINT = 1
        BCLR    #NORSTRT,STATFLGS ;allow restart option but
        BSET    #NOCONT,STATFLGS  ; no CONTINUE button for direct to monitor jump
        BSR     CLRMENU		  ;clear menu bar and
        BSR     MAKEPCALRT	  ; open alert box for monitor or power cycling
        .ENDC

        .IF  BURNIN = 1

;  Check if completing power-cycling operation

        .IF  DEBUG = 0
        LEA     PMERR,A3        ;set vector for parameter mem error
        MOVE.L  A3,BUSVCTR
        .ENDC

        BSR     CHKPM	        ;check validity of parameter memory
        BCS.S   PMEXIT	        ;skip if not
        MOVE.B  DVCCODE,D0      ;get boot code
        LSR.B   #4,D0	        ;shift to lower nibble

        .IF     NEWTWIG = 0
        BSR     EXPAND	        ;convert to keycode
        .ENDC

        CMPI.B  #PC,D0	        ;exiting from power-cycling?
        BNE.S   PMEXIT	        ;skip if no
        CLR.B   DVCCODE	        ;else reset boot and
        BCLR    #6,MEMCODE      ; memory test indicators

        LEA     LOOPMSG,A3      ;display loop count
        BSR     DSPMSG
        MOVE.L  #LCNTHI,A0      ;set ptr to loop count
        MOVEP   (A0),D0	        ;get it
        MOVEQ   #4,D1	        ;set # of digits to display
        BSR     OUTCHR	        ;and do display
        MOVEQ   #PCCOL,D6       ;reset col for proper left margin

        BSR     DSPCLK	        ;display final clock value
        BSR     TWGDSP	        ;and display Twiggy error count

;  Normal exit

PMEXIT
        .IF  DEBUG = 0
        BSR     SETBUSVCT       ;restore normal bus error vector        RM000
        .ENDC		        ;{debug}

        .ENDC		        ;{BURNIN}

        BRA     MONITOR	        ;and go to monitor

        .IF  BURNIN = 1
;  Bus error handler for parameter memory error

PMERR   LEA     PMMSG,A3        ;setup error message
        LEA     IOBRD,A2        ;and icon
        CLR.L   D0	        ;no error code
        BRA     INITMON	        ;exit to monitor

        .ENDC		        ;{BURNIN}
        .ENDC		        ;{ROM4K}

LSTCHK
        .IF  AAPL = 1
        CMP.B   #APPLE,D0       ;Apple boot?
        BEQ     NMISET	        ;exit if yes
        .ENDC

        .IF  USERINT = 0
        LEA     BADBOOT,A3      ;else display error msg
        BSR     DSPMSGR
        BRA     MONITOR	        ;go to monitor
        .ELSE
        BSR     SQUAWK	        ;else sound error tone
        BRA     BOOTMENU        ;and go to boot menu
        .ENDC

        .PAGE
;-------------------------------------------------------------------------
;  Subroutine to check parameter memory validity.  Calls generalized
;  verify checksum routine.
;-------------------------------------------------------------------------

CHKPM   MOVEM.L D0-D1/A0,-(SP)  ;save regs
        MOVEA.L #PMSTRT,A0      ;set starting ptr
        MOVE    #PMWRDS-1,D0    ;and # of words to check
        MOVE    D0,D1	        ;set for shared memory
        BSR.S   VFYCHKSM        ;and go do checksum
@1      MOVEM.L (SP)+,D0-D1/A0  ;restore regs
        RTS

        .IF BURNIN = 1
;-------------------------------------------------------------------------
;  Subroutine to save boot device code to parameter memory.
;-------------------------------------------------------------------------

SAV2PM  MOVEM.L D0-D1/A0,-(SP)  ;save regs

        .IF     NEWTWIG = 0
        BSR     XLATE	        ;convert keycode to boot id
        MOVE.B  D2,D0
        .ENDC

        LSL.B   #4,D0	        ;rotate device code to upper nibble
        MOVE.B  DVCCODE,D1      ;read current setting
        ANDI.B  #$0F,D1	        ;clear device indicator
        OR.B    D1,D0	        ;save other data
        MOVE.B  D0,DVCCODE      ;and write new device code

;  also set for full memory test

        BSET    #6,MEMCODE      ;ensure memory test indicator set

;  then compute new checksum

        MOVEA.L #PMSTRT,A0      ;compute new checksum
        MOVEQ   #PMWRDS-2,D0    ;leaving out checksum word
        BSR.S   WRTSUM
@2      MOVEM.L (SP)+,D0-D1/A0  ;restore regs
        RTS

;----------------------------------------------------------------------
;  Subroutine to write new checksum to parameter memory area
;----------------------------------------------------------------------

WRTSUM  MOVE    D0,D1	        ;set for shared memory
        BSR.S   VFYCHKSM
        NOT     D3	        ;compute 2's complement
        ADDQ    #1,D3
        MOVEP   D3,(A0)	        ;write as new checksum
        RTS

        .ENDC

;-------------------------------------------------------------------------
;  Subroutine to verify 16 bit checksum validity for memory contents.
;
;  Inputs Required:  A0 = starting address for verify
;		     D0 = # of words-1 to read
;		     D1 = 0 for regular memory (uses MOVE.W)
;		        = nonzero for shared memory (uses MOVEP)
;
;  Outputs:	     Carry bit set if computed checksum not 0.
;		     D2 = expected checksum  (last word read)
;		     D3 = computed checksum
;-------------------------------------------------------------------------

VFYCHKSM
        CLR.L   D2	        ;clear regs for use
        CLR.L   D3
CKLOOP  TST     D1	        ;shared memory?
        BEQ.S   @1	        ;skip if no
        MOVEP   (A0),D2	        ;else read alternate bytes
        ADDQ.L  #4,A0	        ;bump address
        BRA.S   @2	        ;skip to do checksum
@1      MOVE    (A0)+,D2        ;read words
@2      ADD     D2,D3	        ;add to computed checksum
        ROL     #1,D3	        ;rotate for better effectiveness
        DBF     D0,CKLOOP       ;loop until done
        TST     D3	        ;expected result = 0
        BEQ.S   CKXIT
        ORI.B   #$01,CCR        ;else set error indicator
CKXIT   RTS

        .IF     NEWTWIG = 0
;-------------------------------------------------------------------------
;  Subroutine to expand boot id read from parameter memory to keycode
;-------------------------------------------------------------------------

EXPAND  LEA     KEYTBL,A2       ;set ptrs to keycode table
        LEA     TBLEND,A3
        CLR.L   D2	        ;use for search id
@1      CMP.B   D2,D0	        ;check for match
        BEQ.S   @2	        ;skip if yes
        ADDQ    #1,D2	        ;incr search id
        ADDQ.L  #1,A2	        ;bump table ptr
        CMPA.L  A2,A3	        ;at end?
        BNE.S   @1	        ;loop if not
        MOVE.B  #APPLE,D0       ;else set for default boot
        BRA.S   @3	        ;and go to exit
@2      MOVE.B  (A2),D0	        ;get keycode
@3      RTS

        .ENDC
        .IF  USERINT = 1
;-------------------------------------------------------------------------
;  Subroutine to expand boot id read from parameter memory to keycode
;  Returns with keycode in D0.
;-------------------------------------------------------------------------

EXPAND  MOVEM.L D2/A2-A3,-(SP)  ;save regs
        LEA     KEYTBL,A2       ;set ptrs to keycode table
        LEA     TBLEND,A3
        CLR.L   D2	        ;use for search id
@1      CMP.B   D2,D0	        ;check for match
        BEQ.S   @2	        ;skip if yes
        ADDQ    #1,D2	        ;incr search id
        ADDQ.L  #1,A2	        ;bump table ptr
        CMPA.L  A2,A3	        ;at end?
        BNE.S   @1	        ;loop if not
        MOVEQ   #PROFILE,D0     ;else set for default boot
        BRA.S   @3	        ;and go to exit
@2      MOVE.B  (A2),D0	        ;get keycode
@3      MOVEM.L (SP)+,D2/A2-A3  ;restore regs
        RTS

;-------------------------------------------------------------------------
;  Routine to search I/O slots for specific card
;  Expects  D1 = card id to search for
;	    D4 = qualifier for search (mask)
;  Returns  CC = 0 if card found and
;	    D2 = slot #
;-------------------------------------------------------------------------

SEARCH  MOVEM.L D0/D3,-(SP)     ;save regs
        MOVEQ   #0,D2	        ;setup as slot counter
        MOVEQ   #2,D3	        ;set # of slots - 1 to check
        LEA     IO1ID,A0        ;get location of saved slot id's
@1      ADDQ    #1,D2	        ;bump slot #
        MOVE    (A0)+,D0        ;read slot id
        AND     D4,D0	        ;mask it
        CMP     D1,D0	        ;match?
        BEQ.S   @2	        ;skip if yes
        DBF     D3,@1
        TST     D2	        ;set nonzero status if no match
@2      MOVEM.L (SP)+,D0/D3     ;restore regs
        RTS		        ;exit

        .PAGE
;-------------------------------------------------------------------------
;  Routines to display boot icon menu
;-------------------------------------------------------------------------

BOOTMENU
        ANDI.B  #$0F,STATFLGS   ;initialize flags
        CLR     RectCnt	        ;clear active rectangle counter
        MOVEQ   #1,D6	        ;set min # of boot alternates	        CHG009
                                ; i.e., at least have lower drive
                                ;  to boot from
        TST.B   SYSTYPE	        ;check system type		        CHG009
        BNE.S   @10	        ;Skip if Lisa 2			        CHG009
        ADDQ    #1,D6	        ;else incr count for upper floppy drive CHG009

@10     MOVEQ   #1,D2	        ;set flag to do wait if needed	        RM011
        BSR     CHKPROFILE      ;go check for attached Profile
        BNE.S   @1	        ;skip if not there
        ADDQ    #1,D6	        ;else bump boot count

@1      CLR.L   D4	        ;set flag for no status check
        BSR     RDSLOTS	        ;go scan the I/O slots
        LEA     IO1ID,A0        ;check results
        MOVE    (A0)+,D0        ;read first ID
        BPL.S   @2	        ;skip if not bootable or not there
        MOVE.L  #SLOT1L,A2      ;set slot address
        BSR     RDSLT	        ;go check if any icons
        BCS.S   @2	        ;skip if any error
        ANDI    #$03,D3	        ;else clear don't care bits (max count = 2)
        ADD     D3,D6	        ;and add to icon count

@2      MOVE    (A0)+,D0        ;check slot 2
        BPL.S   @3	        ;skip if not bootable
        MOVE.L  #SLOT2L,A2      ;set slot address
        BSR     RDSLT	        ;go check if any icons
        BCS.S   @3	        ;skip if any error
        ANDI    #$03,D3	        ;else clear don't care bits (max count = 2)
        ADD     D3,D6	        ;and add to icon count

@3      MOVE    (A0)+,D0        ;check final slot
        BPL.S   @4
        MOVE.L  #SLOT3L,A2      ;set slot address
        BSR     RDSLT	        ;go check if any icons
        BCS.S   @4	        ;skip if any error
        ANDI    #$03,D3	        ;else clear don't care bits (max count = 2)
        ADD     D3,D6	        ;and add to icon count

;  set starting icon display address according to boot count

@4      CMP.B   #10,D6	        ;max of 10 icons in menu
        BLE.S   @5	        ;skip if OK
        MOVEQ   #10,D6	        ;else set max count

;  now display blank boot icon menu

@5      MOVEQ   #BMENUWIDTH,D0  ;set menu parameters
        MOVE.L  D6,D1	        ;get count of entries
        MULU    #BMENULEN,D1    ;length depends on number of entries
        LEA     STRTMSG,A3      ;set menu heading
        BSR     DSPMENUBOX      ;and go display the menu

        MOVE    #MENUSTRT,MenuBase ;setup base menu address
        MOVE    #MENU1MSG,IconAddr ;and display pt for first entry

;  next fill in the menu entries with icons and alternate keycodes
;  D0 set with system type

ICONCHK
        MOVE.B  SYSTYPE,D0      ;read system type	        CHG009/CHG029
        BEQ.S   @1	        ;skip if Lisa 1.0	        CHG009
        CMP.B   #3,D0	        ;else check if internal disk    CHG009/CHG029
        BNE.S   @2	        ;skip if not - no upper icon    CHG009/CHG029

        CLR.L   D2	        ;else set for no wait	        CHG009
        BSR     CHKPROFILE      ; and check if integral disk    CHG009
                                ; installed		        CHG009
        BNE.S   @2	        ;skip if not		        CHG009
        LEA     UPPER,A2        ;set icon ptr for integral disk CHG009
        BRA.S   @3	        ;and go display		        CHG009

@1      LEA     DRIVEN,A2       ;set icon ptr for drive	        CHG009
        MOVEQ   #1,D1	        ;set drive id #		        CHG009
@3      MOVEQ   #TWIG1,D2       ;set id code		        CHG009
        MOVEQ   #-1,D3	        ;set compressed icon indicator
        BSR     DSPMNTRY        ;display the entry

@2      LEA     DRIVEN,A2       ;set icon ptr for drive	        CHG009
        MOVEQ   #2,D1	        ; and drive id #	        CHG009
        MOVEQ   #TWIG2,D2       ;set id code
        MOVEQ   #-1,D3	        ;set compressed indicator
        BSR     DSPMNTRY        ;display the entry

        CLR.L   D2	        ;set flag for no wait	        RM011
        CMP.B   #3,D0	        ;skip check if internal disk    CHG009/CHG029
        BEQ.S   SCNSLTS	        ;			        CHG009/CHG029

        BSR     CHKPROFILE      ;else check if external disk attached
        BNE.S   SCNSLTS	        ;skip if not
        LEA     PROICON,A2      ;else set icon ptr for Profile
        MOVEQ   #PROFILE,D2     ;set id code
        MOVEQ   #-1,D3	        ;set compressed indicator
        BSR     DSPMNTRY        ;display the entry

;  check for bootable devices in slots (what a pain!)

SCNSLTS CLR.L   D0	        ;clear for use
        LEA     IO1ID,A0        ;set ptr for slot id
        MOVE    (A0)+,D0        ;get id
        BPL.S   CHKS2	        ;skip if not bootable or not there
        MOVE.L  #SLOT1L,A2      ;else set slot address
        MOVEQ   #1,D1	        ;set slot # for generic display if no ROM icon
        MOVEQ   #IO1PORT1,D2    ;set base boot id for slot
        BSR     CHKSLOT	        ;go check slot and display icons

CHKS2   MOVE    (A0)+,D0        ;read next id
        BPL.S   CHKS3	        ;skip if not bootable or not there
        MOVE.L  #SLOT2L,A2      ;else set slot address
        MOVEQ   #2,D1	        ;set slot # for generic display
        MOVEQ   #IO2PORT1,D2    ;set base boot id for slot
        BSR     CHKSLOT	        ;go check slot and display icons

CHKS3   MOVE    (A0)+,D0        ;read slot 3 id
        BPL.S   WT4BOOT	        ;skip if not bootable or not there
        MOVE.L  #SLOT3L,A2      ;else set slot address
        MOVEQ   #3,D1	        ;set slot # for generic display
        MOVE    #IO3PORT1,D2    ;set base boot id for slot
        BSR     CHKSLOT	        ;go check slot 3 and display icons

;---------------------------------------------------------------------------
;  Menu displayed - now wait for operator selection
;---------------------------------------------------------------------------

WT4BOOT
        BSR     CursorDisplay	 ;display cursor on screen
        BSET    #CHKCMD,STATFLGS ;set flag for CMD key check
        BSR     GETINPUT        ;go wait for user input
        BCS     GETERR	        ;skip if error
        BSR     XLATE	        ;translate and save boot id
        BSR     CursorHide      ;remove cursor from screen
        BSR     CLRDESK	        ;clear desktop
        BRA     BOOTCHK	        ;and go start boot

        .PAGE
;---------------------------------------------------------------------------
;  Routine to check for Profile attached to built-in parallel port.
;  Checks for Profile connected (OCD) and tries an initial handshake to
;  ensure the device is a Profile.
;
;  Inputs: D2 = nonzero if full wait for Profile ready should be done
;  Outputs: Zero condition code bit cleared if error
;------------------------------------------------------…

Showing first 20,000 characters of 83,273 total. Open the full document →

mp.ls