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

Lisa Boot ROM RM248.M.TEXT

Lisa · TEXT
FilenameLisa_Boot_ROM_RM248.M.TEXT
Size0.09 MB
Subsection firmware
Downloads1
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
;--------------------------------------------------------------------------
;  Monitor code - first displays requested icons, error codes or messages,
;  and then outputs menu of options to user and awaits input
;--------------------------------------------------------------------------

INITMON				  ;entry point for displays
        .IF  ROM4K = 0
        BSR     SAVEREGS	  ;save registers
        CLR.L   D7		  ;reset reg for error indicators
        CLR.B   STATFLGS	  ; and status flags
        BSET    #NOCONT,STATFLGS  ;set external entry indicator

INIT1
        MOVEM.L D0/A2-A3,-(SP)	  ;save incoming arguments
        BSR     DSABLDSK	  ;disable ints from both drives
        BSR     RSTKBD		  ;reset keyboard
        BSR     CLRRST		  ;and clear reset
        BSR     CursorInit	  ;init cursor and mouse
        MOVEM.L (SP)+,D0/A2-A3	  ;restore arguments

INIT2			        ;internal entry point
        .IF  DEBUG = 0
        MOVEA   #STKBASE,SP     ;reset stack pointer		        RM000
        .ENDC

        .IF  USERINT = 1
        MOVEM.L D0/A2-A3,-(SP)  ;save incoming arguments
        .ENDC
        .ENDC		        ;{ROM4K}

        BSR     SETVLTCH        ;set video latch

        .IF  USERINT = 0
        BSR     CLRSCRN	        ;go clear screen
        MOVEQ   #FIRSTROW,D5    ;set initial cursor ptrs
        MOVEQ   #FIRSTCOL,D6
        .ELSE
        BSR     DRAWDESK        ;display the desktop
        BSR     MAKEALERT       ;draw alert box (in case no icon display)

INIT3   MOVEM.L (SP)+,D0/A2     ;restore arguments

        MOVE.L  A2,D1	        ;icon display?
        BEQ.S   @0	        ;skip if no
        BSR     DSPALRTICON     ;go do icon display

@0      TST     D0	        ;error code display?
        BEQ.S   @2	        ;skip if no
        MOVE.L  A2,D1	        ;icon displayed?
        BNE.S   @1	        ;skip if yes
        MOVEQ   #MSGROW,D5      ;else display error code on same line
        MOVEQ   #CODECOL,D6     ; as error msg
        BSR     DSPDEC	        ;display as decimal #
        BRA.S   @2

@1      BSR     DSPCODE	        ;output error code under icon

@2      MOVE.L  (SP)+,A3        ;restore msg ptr
        .ENDC

        MOVE.L  A3,D0	        ;message display?
        BEQ.S   MONITOR

        .IF  USERINT = 0
        BSR     DSPMSGR	        ;go display it
        .ELSE
        BSR     DSPALRTMSG      ;go display message in alert box
        .ENDC

MONITOR			        ;entry point for no screen setup
        .IF  ROM4K = 0
        ORI     #$0700,SR       ;disable all interrupts
        BSR     SETVCTRS        ;set vectors for ROM space	        CHG028
        .ELSE
@1      NOP		        ;hang for 2716 version of ROM
        BRA.S   @1
        .ENDC

        .IF  ROM4K = 0
;---------------------------------------------------------------------------
;  Now output first level menu, prompt line and cursor.	 Do preliminary
;  check to see if CONTINUE option can be displayed.  This is the Customer
;  mode level of the monitor code.
;---------------------------------------------------------------------------

LEVEL1
        .IF  USERINT = 1
        CLR     RECTCNT	        ;clear active rectangle count
        ANDI.B  #$0F,STATFLGS   ;init flags
        BSET    #BTN,STATFLGS   ;set operating with buttons flag

        BTST    #NOCONT,STATFLGS ;display continue?
        BNE.S   OTHRBTNS        ;skip if no
        MOVE.L  STATUS,D0       ;get test status
        ANDI.L  #CONTMSK,D0     ;mask don't cares
        BNE.S   @1	        ;skip if error that disallows continuing
        TST     BOOTMEM	        ;check boot memory area for R/W errors
        BNE.S   @1	        ;skip if any errors

        MOVE    #BTN2STRT,A1    ;display CONTINUE button
        MOVE.B  #KEY2,D0        ;with alternate keycode
        LEA     CONTMSG,A3      ;and description
        MOVEA   #BTN2MSG,A2     ;and location			        RM000
        CLR.L   D1	        ;don't append '...' string
        BSR     MAKEBUTN
        BRA.S   OTHRBTNS        ;and go make other buttons
@1      BSET    #NOCONT,STATFLGS ;set indicator for no CONTINUE option

OTHRBTNS
        .ENDC

DOMENU
        .IF  USERINT = 0
        LEA     LEV1MSG,A3      ;display rest of menu line and get input
        BSR     WRTMENU
        .ELSE
        BTST    #NORSTRT,STATFLGS ;display RESTART button?
        BNE.S   @1		  ;skip if not
        MOVE    #BTN1STRT,A1	  ;else do display
        MOVE.B  #KEY1,D0
        LEA     RTRYMSG,A3
        MOVEA   #BTN1MSG,A2     ;				        RM000
        CLR.L   D1	        ;don't append '...' string
        BSR     MAKEBUTN

@1      MOVE    #BTN3STRT,A1    ;display STARTUP button
        MOVE    #KEY3,D0
        LEA     STRTMSG,A3
        MOVEA   #BTN3MSG,A2     ;				        RM000
        MOVEQ   #-1,D1	        ;append '...' string
        BSR     MAKEBUTN

;	 MOVE.L	 #KBDBFR,KBDQPTR ;init queue ptr

        BSR     CursorDisplay   ;display mouse cursor
        BSET    #CHKCMD,STATFLGS ;require user keyboard input to be prefaced
                                 ; by the CMD key
GETL1   BSR     GETINPUT        ;and go wait for input
        BCS     GETERR	        ;exit if error
        BSR     CursorHide      ;remove cursor from screen

        .ENDC


;  Check if input valid.  If invalid, beep speaker.

        CMP.B   #KEY3,D0        ;alternate boot?
        BNE.S   @2

        .IF  USERINT = 0
        LEA     DVCEMSG,A3      ;request input
        BSR     WRTBOX1
        BSR     READKEY	        ;get input
        CMP.B   #CMDKEY,D0      ;command key?
        BEQ.S   @1	        ;continue if yes
        BSR     CLRBOX	        ;else clear box
        BRA.S   GETL1XIT        ;and exit
@1      BSR     READKEY	        ;get device input

        .IF     NEWTWIG = 1
        BSR     XLATE	        ;translate to boot id and save
        .ELSE
        MOVE.B  D0,BOOTDVCE     ;save boot device keycode
        BSET    #ALTBOOT,D7     ;set alternate boot indicator
        .ENDC

        BRA     DOBOOT	        ;and go attempt boot

        .ELSE
        BSR     CLRDESK	        ;close the alert box
        BRA     BOOTMENU        ;and go display boot menu
        .ENDC

@2      BTST    #NORSTRT,STATFLGS ;RESTART button displayed?
        BNE.S   CONTCHK		  ;skip if not
        CMP.B   #KEY1,D0        ;retry?
        BNE.S   CONTCHK	        ;skip if not

DORESET
        CLR.L   D7	        ;clear error reg		        RM000
        TST.B   SETUPON	        ;turn on setup bit		        RM000
        BRA     BEGIN3	        ;and restart diags		        RM000

CONTCHK
        .IF  USERINT = 1
        BTST    #NOCONT,STATFLGS ;continue option displayed?
        BNE.S   @4	        ;skip if not
        CMP.B   #KEY2,D0        ;continue option selected?
        BNE.S   @4

;  continue from point of failure

        BSR     CLRDESK	        ;clear desktop			        CHG008
        ANDI.L  #ALTBMSK,D7     ;erase error indicators
        MOVE.L  STATUS,D0       ;get power-up status
        BTST    #MMU,D0	        ;MMU error?
        BNE     VIA2TST	        ;yes - continue from VIA tests

        ANDI.L  #BOOTMSK,D0     ;check if error that continues to boot attempt
        BEQ     BOOTCHK	        ;skip if yes
        MOVE.L  D0,-(SP)        ;else save status
        BSR     MAKETEST        ;make test window

;  do init for continue to other tests

        MOVE.B  #$70,D0	        ;turn off mouse
        BSR     COPSCMD
        MOVE.L  (SP)+,D0        ;restore status

        BTST    #VID,D0	        ;serial # error?
        BEQ.S   @1	        ;skip if not
        MOVEA   #CPUSTRT,A1     ;display CPU icon
        BSR     INVICON
        BRA     PARTST	        ;continue with parity test

@1      LSR.L   #7,D0	        ;skip other CPU errors
        TST.B   D0	        ;clock error?
        BNE     CONFIG	        ;yes - continue with config check

        LSR.L   #2,D0
        TST.B   D0	        ;RS232 error?
        BEQ.S   @2	        ;skip if not
        MOVEA   #IOSTRT,A1      ;else display I/O board icon
        BSR     INVICON
        BRA     DSKTST	        ;cont with disk test

@2      TST.B   PARON	        ;must be memory error - reenable parity
        BRA     IOTST	        ; and continue with I/O board testing

        .ENDC
@4
        .IF  USERINT = 0
        CMP.B   #CMDKEY,D0      ; command?
        BNE.S   GETL1XIT
        BSR     ReadKey	        ; go get next input
        .ENDC

        CMP.B   #SKEY,D0        ; service mode desired?
        BEQ     LEVEL2	        ; skip if yes

;  Indicate invalid by beeping speaker

GETL1XIT
        BSR     SQUAWK	        ; sorry charlie
        .IF  USERINT = 0
        BRA.S   LEVEL1	        ; go wait for another try
        .ELSE
LEV1LOOP
        BSR     CursorDisplay   ;redisplay cursor
        BRA.S   GETL1	        ;go get more input

;  Error exit - go output error and return to level 1

GETERR
        LEA     IOBRD,A2        ;get I/O board icon
        SUBA.L  A3,A3	        ;no error message
        BRA     INIT2
        .ENDC

        .ENDC		        ;{ROM4K}
        .PAGE
;-------------------------------------------------------------------------
;  Subroutine to clear video page of memory or write arbitrary long word
;  pattern to entire screen (WRTSCRN entry point).
;-------------------------------------------------------------------------

CLRSCRN CLR.L   D0	        ; write 0's for white screen
WRTSCRN			        ; entry pt for write to screen (assumes D0 set)
        MOVE.L  SCRNBASE,A0     ; get screen base address
        MOVE    #HEX8K-3,D1     ; set longs count
@1      MOVE.L  D0,(A0)+	   ; clear for video page
        DBF     D1,@1
        RTS

        .IF  ROM4K = 0
        .IF  USERINT = 0
;-------------------------------------------------------------------------
;  Subroutine to clear "dialog box" in display row 1.
;-------------------------------------------------------------------------

CLRBOX  MOVEM.L D5-D6/A0,-(SP)  ;save cursor ptrs and working reg
        MOVEQ   #1,D5	        ;clear from 1,0 to 3,0
        MOVEQ   #0,D6
        BSR     SETCRSR	        ;get address for start
        MOVE.L  A6,A0	        ;save
        MOVEQ   #2,D5	        ;get ending address  in A6
        BSR     SETCRSR
CLRIT   CLR     (A0)+	        ;do clear
        CMPA.L  A0,A6
        BNE.S   CLRIT
        MOVEM.L (SP)+,D5-D6/A0  ;restore and
        RTS		        ; exit

;-------------------------------------------------------------------------
;  Subroutine to display menu line
;-------------------------------------------------------------------------

WRTMENU MOVEM.L D5-D6,-(SP)     ;save current cursor ptrs
        CLR     D5	        ;set menu line ptrs
        MOVEQ   #5,D6
        BSR     DSPMSG
        BSR     SETCUR	        ;draw cursor
        BSR     DRWLINE	        ;and underline
        BSR     ReadKey	        ;go wait for input
        BSR     CLRCUR	        ;clear cursor
        MOVEM.L (SP)+,D5-D6
        RTS

;-------------------------------------------------------------------------
;  Draw underline subroutine
;-------------------------------------------------------------------------

DRWLINE MOVEM.L D0/D5-D6,-(SP)  ;save cursor ptrs and working reg
        ADDQ    #1,D5	        ;draw line just above next row
        MOVEQ   #0,D6
        BSR     SETCRSR	        ;get address
        SUBA.L  #180,A6	        ;decrement to bottom of last line
        MOVEQ   #45,D0	        ;set loop count
DRWIT   MOVE    #$FFFF,(A6)+    ;draw black line
        SUBQ    #1,D0
        BNE.S   DRWIT
        MOVEM.L (SP)+,D0/D5-D6  ;restore and
        RTS		        ; exit

;-------------------------------------------------------------------------
;  Subroutine to write to dialog box
;-------------------------------------------------------------------------

WRTBOX1 MOVEM.L D0/D5-D6,-(SP)  ;save D0 and current cursor ptrs
        MOVEQ   #1,D5	        ;set box 1 coordinates
        CLR.L   D6
        BSR     SETCRSR	        ;get address in A6
        MOVE    #RLONGS,D0
@1      CLR.L   (A6)+	        ;clear box
        SUBQ    #1,D0
        BNE.S   @1
        MOVEQ   #1,D6	        ;space over for neatness
        BSR     DSPMSG	        ;write msg
        BSR     DRWLINE
        MOVEM.L (SP)+,D0/D5-D6  ;restore
        RTS		        ;and exit

        .ENDC
        .PAGE
        .IF  USERINT = 0
;-------------------------------------------------------------------------
;  Subroutine to read keycode from COPS - returns down transitions in D0
;-------------------------------------------------------------------------

ReadKey
        BSR     ReadCOPS
        TST.B   D0	        ;ignore "up" transitions
        BPL.S   ReadKey
        RTS		        ;exit with data

        .ELSE
;-------------------------------------------------------------------------
;  Subroutine to read keycode from COPS - returns down transitions in D0
;-------------------------------------------------------------------------

ReadKey
        BSR     WT4INPUT
        TST.B   D0	        ;ignore "up" transitions and mouse data
        BPL.S   ReadKey
        RTS		        ;exit with data

        .ENDC

;-------------------------------------------------------------------------
;  Subroutine to beep speaker for invalid input
;-------------------------------------------------------------------------

SQUAWK  MOVEQ   #$20,D0	        ; set frequency
        MOVE    #250,D1	        ; 1/8 sec duration
        MOVEQ   #4,D2	        ; low volume
        BSR     TONE	        ; and go do it
        RTS

;-------------------------------------------------------------------------
;  Subroutine to convert keycodes to Ascii
;  Inputs:  D0 = keycode (word)
;  Outputs: D0 = Ascii (byte) or =2 if input invalid
;-------------------------------------------------------------------------

KeyToAscii
        MOVEM.L D1/A0,-(SP)     ;save regs
        LEA     AsciiTable,A0   ;keycode to ascii table
        MOVE    D0,D1	        ;keycode to convert
        ANDI    #$007F,D1       ;ensure valid
        SUBI    #32,D1	        ;decrement for table		        RM000
        BPL.S   @1	        ;skip if valid			        RM000
        MOVEQ   #2,D0	        ;else set for invalid char	        RM000
        BRA.S   @2	        ;				        RM000
@1      MOVE.B  0(A0,D1.W),D0   ;get ascii
@2      MOVEM.L (SP)+,D1/A0     ;restore
        RTS		        ;exit


        .PAGE
;-------------------------------------------------------------------------
;  Monitor level 2 (Service mode) - enables access to memory and disk
;-------------------------------------------------------------------------

LEVEL2
        .IF  USERINT = 0
        BSR     CLRSCRN	        ;clear screen
        MOVE    #$0201,CRTROW   ;set starting display ptrs
        .ELSE
        BSR     CLRDESK	        ;display the desktop

        .IF  BMENU = 0
        MOVEA   #MENULOC,A1     ;set up menu start point	        RM000
        BSR     GETROWCOL
        LEA     MENUHDG,A3      ;and display it
        BSR     DSPMSG
        SUB.W   #91,A1	        ;decrement start pt by 1 row + 1 byte
        LEA     MENUHDG,A3      ;get length of menu heading
        BSR     GETLENGTH
        ADDQ    #1,D2	        ;add an extra byte
        ANDI.B  #$FE,D2	        ;ensure its even
        MOVE    D2,D0	        ;save as width of menu heading "box"
        MOVEQ   #14,D1	        ;set height for "box"
        MOVEQ   #-1,D2	        ;set fill pattern
        BSR     INVERSE	        ;go hilite it
        .ENDC

;  make window for output, and display menu line and pull down menu

        BSR     MAKESVCW        ;output service window
DSPMENU BSR     WRTMENU

;  do final initialization and await input

        BSR     CursorDisplay   ;display cursor

;----------------------------------------------------------------------
;  Program NMI key
;
;	 MOVEQ	 #$5A,D0	 ;set / key for NMI
;	 BSR	 COPSCMD
;	 MOVEQ	 #$61,D0
;	 BSR	 COPSCMD
;----------------------------------------------------------------------

GETLEV2
        BSR     GETINPUT        ;and go await input
        BCS     GETERR	        ;exit if error
        BSR     CursorHide      ;else remove cursor from screen and go
                                ; analyze input

        .ENDC

        .IF  USERINT = 0
DSPMENU
        LEA     LEV2MSG,A3      ;output menu and get input
        BSR     WRTMENU
        .ENDC

;  Check for valid input

        CMP.B   #KEY1,D0        ; display memory?
        BEQ     DSPMEM

        CMP.B   #KEY2,D0        ; set memory?
        BEQ     SETMEM

        CMP.B   #KEY3,D0        ; call routine
        BEQ     CALLRTN

        .IF  ROM16K = 1
        CMP.B   #KEY4,D0        ; loop?
        BEQ     LOOPTST
        .ENDC

        CMP.B   #KEY5,D0        ; video adjust?
        BEQ     VIDAJST

        .IF  BURNIN = 1
        CMP.B   #KEY6,D0        ; power cycle?
        BEQ     PowerCycle
        .ENDC

        CMP.B   #KEY7,D0        ; quit?
        BNE.S   @1
        BCLR    #NORSTRT,STATFLGS ;clear no reset status flag
        CLR.L   D0		  ;set parms for level1 - no error code
        SUBA.L  A2,A2		  ;no icon display
        SUBA.L  A3,A3		  ;no message display
        BRA     INIT2		  ;and go back to level1

@1      BRA     INVALID	        ; else invalid input

        .PAGE
        .IF  USERINT = 1
;---------------------------------------------------------------------------
;  Routine to display the preliminary pull-down menu
;---------------------------------------------------------------------------

WRTMENU
        .IF  BMENU = 0
        MOVEQ   #MITEMS,D1      ;set # of items in menu
        LEA     DISPMSG,A3      ;set ptr to menu entries
        CLR     RectCnt	        ;clear active rectangle count
        ANDI.B  #$07,STATFLGS   ;init flags
        BSET    #MENU,STATFLGS  ;set working with menu flag
        MOVE.L  D1,D4	        ;save item count
        MOVEQ   #MENUWIDTH,D0   ;set menu parms
        MULU    #MENULEN,D1     ;length depends on # of items
        ADDQ    #2,D1	        ;incr for bottom border
        MOVE    #MENUSTRT,A1    ;set start point for menu "box"
        MOVE    #MENU1MSG,A2    ;display menu items
        LEA     MENUID,A4       ;ptr to id's for menu entries
        BSR     MAKEMENU        ;go do it

        .ELSE
        CLR     RectCnt	        ;clear active rectangle count
        ANDI.B  #$0F,STATFLGS   ;init flags
        MOVEQ   #MENUWIDTH,D0   ;set menu parms
        MOVEQ   #MITEMS,D1      ;set # of items in menu
        MULU    #MENULEN,D1     ;length depends on # of items
        LEA     MENUHDG,A3      ;set ptr for menu heading
        BSR.S   DSPMENUBOX      ;go display blank menu box w/ heading

        MOVEQ   #MITEMS,D4      ;set # of items in menu
        MOVE    #MENUSTRT,A1    ;set menu starting point
        MOVE    #MENU1MSG,A2    ;menu items display address
        LEA     DISPMSG,A3      ;set ptr to menu entries
        LEA     MENUID,A4       ;ptr to id's for menu entries
        BSR     MAKEMENU        ;go fill in the menu

        .ENDC		        ;{MENU}

        RTS

        .IF  BMENU = 1
;---------------------------------------------------------------------------
;  Subroutine to display blank menu box with heading
;  Inputs:
;       D0 = menu width
;       D1 = menu length
;       A3 = menu heading
;  Outputs:
;       None
;  Side Effects:
;       D2/A1,A3 trashed
;---------------------------------------------------------------------------

DSPMENUBOX
        MOVEM.L D0-D1,-(SP)     ;save regs
        BSET    #MENU,STATFLGS  ;set working with menu flag
        BSR     CLRMENU	        ;first clear the menu bar
        ADDQ    #2,D1	        ;bump length for bottom border
        MOVE    #MENUSTRT,A1    ;set menu starting point
        BSR     MAKEBOX	        ;display the box
        MOVEA   #MENULOC,A1     ;set up menu heading display point
        BSR     GETROWCOL       ;convert to screen ptrs

        CLR.L   D1	        ;don't display '...' string
        BSR     DSPSTRING       ;display the title
        SUBA.L  A2,A3	        ;get…

Showing first 20,000 characters of 90,901 total. Open the full document →

mp.ls