Lisa Boot ROM RM248.G.TEXT
Lisa Boot ROM RM248.G.TEXT
Lisa · 1983 · TEXT
| Filename | Lisa_Boot_ROM_RM248.G.TEXT |
|---|---|
| Size | 0.07 MB |
| Year | 1983 |
| Subsection | firmware |
| Downloads | 1 |
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
.IF EXTERNAL = 1
.LIST
.ENDC
.IF USERINT = 1
;**********************************
; Mini-Graphics Package *
; Contributed by Mike Urquhart *
; Copyright 1983, 1984 Apple *
;**********************************
;________________________________________________________________________________
;
; DRAWDESK:
;
; this routine performs the following sequences:
;
; 1. clears the screen to a white background.
; 2. makes a menu bar by drawing a single pixel horizontal
; line across the screen.
; 3. fills the screen area below the menu bar with the stantard
; gray shade.
;
; Also has an entry point called CLRDESK that only does item (3).
;
; Destroys regs D0-D2,A1,A5-A6
;________________________________________________________________________________
;
; 1. clear screen to white background
DRAWDESK
clr.l d2
bsr.s whiten
;
; 2. make menu bar border
CLRDESK moveq #ROWBYTES,d0 ;set length of line = 90 bytes
moveq #-1,d2 ;draw a black pattern
move.w #MENULINE,A1 ;start at offset 1440 address
moveq #1,d1 ;draw only 1 pixel line
bsr.s paint_box
;
; set a6 to starting pixel address for grey routine below
; set a5 to limit
;
move #DESKLINE,a6
move #DESKLMT,a5 ;set limit
;
; 3. make the grey background: to make the gray background, alternating
; rows of $5555 and $AAAA starting with $AAAA are written to the
; screen area.
;
gray MOVE.L #DESKPATRN,D2 ;set up grey pattern
gray1 swap d2 ;start with the $AAAA pattern
moveq #1,d1 ;draw a one pixel high line
move.l a6,a1 ;starting pixel address must be in a1 for call
bsr paint_box
@1 add d0,a6 ;bump to next pixel line
cmp.w a5,a6 ;is a6 less then max?
blt.s gray1 ;loop if yes
rts ;else done
;_________________________________________________________________________
;
; subroutine blacken and whiten: clears full screen to black or white
;
; Calls: bsr blacken (no parameters)
;
; clr.l d2
; bsr whiten
;
; registers used: d2.l - contains either FFFFFFFF or 0 on return
; d0.b - destroyed but contains $5A (90) on return
; d1.w - destroyed-->should contain 0 on return
; a1.l - destroyed
;
;
; This routine calls paint_box, so other registers may be destroyed.
;
;
;_________________________________________________________________________
BLACKEN
moveq #-1,d2 ;black fill pattern
whiten
move.w #MaxY-1,d1 ;number of pixels in screen box heigth
moveq #ROWBYTES,d0 ;length of screen box is 90 bytes
suba.l A1,A1 ;clear A1
bsr.s paint_box
rts
;------------------------------------------------------------------------
; Subroutine to clear only menu bar on desktop
; Inputs:
; None
; Outputs:
; None
; Side Effects:
; None
;------------------------------------------------------------------------
CLRMENU MOVEM.L D0-D2/A1,-(SP) ;save regs
MOVEQ #ROWBYTES,D0 ;width of menu bar is 90 bytes
MOVEQ #MBARLEN,D1 ;heigth is 15 pixels
MOVEQ #0,D2 ;set fill pattern
SUBA.L A1,A1 ;upper left corner is at offset 0
BSR.S PAINT_BOX ;go do it
MOVEM.L (SP)+,D0-D2/A1 ;restore and
RTS ; exit
;________________________________________________________________________________
;
; Routine paint_box
;
; Call: BSR paint_box
; or
; BSR paintb2
;
; register setup:
;
; D2 must contain a one word fill pattern.
; D0 must contain the width of the box(horizontally) or the length of
; the line.
; D1 must contain the heigth(vertically of the box) in horizontal pixel
; rows:
; A1 must contains the screen displacement in the range 0..32670
;
; __________________________________
; . .
; . fill pattern . <-------heigth in pixels
; __________________________________
; ^
; ........... length horizontally
;
; Assumptions: location SCRNBASE contains the video address
;
; registers used-->D0-D3,A0-A2
;________________________________________________________________________________
PAINT_BOX
paintb1 lea movinst,A4
bra.s cont
inverse lea exclusive,A4
cont ADD.L SCRNBASE,A1 ;add video address to starting pixel address offset.
paintb2
MOVE.L A2,-(SP) ;save reg
; do some setup steps
;
CLR.L D3 ;clear for use
MOVE.W D0,D3 ;modify width/length
NEG.l D3 ;negate the width/length (D3 = -width/length)
;
; add the length of one horizontal pixel row-2 to the -width/length
; to derive an offset which can be added to the updated address pointer
; (when it reflects the right corner or end point of the box/line)
; in order to arrive at the next row starting address.
;
ADDI.l #ROWBYTES,D3 ;create displacement for following sequence
;
;
;
MOVE.L A1,A2 ;create ending column check address
ADD.L D0,A2 ;add length of line to obtain ending column address
;
; A1 now points to the left top coordinate of the box or line.
; A2 now points to the right top coordinate of the box or line.
;
startop
jmp (A4) ;execute the correct operation (EOR or MOVE)
movinst
MOVE.w D2,(A1)+ ;start the sequence
bra.s compare
exclusive
eor.w D2,(A1)+
compare CMP.L A1,A2 ;reached the right most point?
BEQ.S nextline ;yes
BRA.S startop
;
; YES
;
nextline
ADD.L D3,A1 ;add 1 horizontal line length (5A) minus line length
ADDA #ROWBYTES,A2 ;to reach the left most point of the box on the RM000
SUBQ.W #1,D1 ;next horizontal scan line.
BNE.S startop ;loop until done.
;
MOVE.L (SP)+,A2 ;restore and
RTS ;return
;------------------------------------------------------------------------
; Entry point to set cursor ptrs and make alert box for power cycling
;------------------------------------------------------------------------
MAKEPCALRT
MOVEQ #PCROW,D5 ;set row ptr
MOVEQ #PCCOL,D6 ;and col ptr
;then drop into alert box routine
;________________________________________________________________________
;
; MAKEALERT
;
; This routine creates an alert box with no title.
;________________________________________________________________________
MAKEALERT
movem.l d0-d1/a1,-(sp)
MOVEQ #ALRTWIDTH,D0 ;set parameters for box
MOVE.L #ALRTHIGH,D1
MOVEA #ALRTSTRT,A1
bsr.s makebox
movem.l (sp)+,d0-d1/a1
rts
;________________________________________________________________________
;
; MAKETEST
;
; This routine creates an alert box for test icon display.
;________________________________________________________________________
MAKETEST
movem.l d0-d1/a1,-(sp)
MOVEQ #TSTWWIDTH,D0 ;set parameters for alert box
MOVEQ #TSTWHIGH,D1
MOVEA #TSTWSTRT,A1
BSR.S MAKEBOX ;go draw box
MOVEQ #TSTMROW,D5 ;set cursor ptrs
MOVEQ #TSTMCOL,D6
LEA CHKMSG,A3 ;set message ptr
MOVEQ #-1,D1 ;append '...' string
BSR DSPSTRING ;and go display it
BSR DSPCPU ;display test icons
BSR DSPIOB
BSR DSPMBRD
BSR DSPXCRD
movem.l (sp)+,d0-d1/a1
rts
;________________________________________________________________________
;
; MAKEDBOX
;
; This routine creates a dialog box.
;________________________________________________________________________
MAKEDBOX
movem.l d0-d1/a1,-(sp)
MOVEQ #DBOXWIDTH,D0 ;set parameters for dialog box
MOVEQ #DBOXHIGH,D1
MOVEA #DBOXSTRT,A1
bsr.s makebox
movem.l (sp)+,d0-d1/a1
rts
;________________________________________________________________________
;
; routine makewindow
;
; This routine creates a fixed window of the folder type.
; The calling routine must provide the address of the
; string which will be used to fill in the title box.
;
; Call:
; move <window width>,d0
; move <window heigth>,d1
; move <upper left corner address>,a1
; lea <string address>,a3
; bsr makewindow
;
; This routine calls makebox
;
;________________________________________________________________________
MAKEWINDOW
movem.l d0-d1/a1,-(sp)
bsr.s makebox
;
; now draw the title box by drawing a single black line across
; the width of the window about 17 pixels from the top edge
;
MOVE.L A1,-(SP) ;save start point
add.w #MENULINE,a1
moveq #1,d1 ;set heigth of one pixel
moveq #-1,d2
bsr.s paint_box
MOVE.L (SP)+,A1 ;restore start point
bsr writetitle
movem.l (sp)+,d0-d1/a1 ;restore and return
rts
;________________________________________________________________________
;
; Routine makebox;
;
; This routine creates a window of either the folder type
; or the dialog box type. Is is the responsibility of
; the calling process to append the title box and title
; to the window if it is the folder type.
;
; Call:
; move.w <window width>,d0 (range 0..90) even
; move.w <window heigth>,d1 (range 0..364)
; move.w <startingpixeladdress>,a1 (range 0..32670)
; bsr makebox
;
; registers used: d0,d1,d2,d3,d4,a1,a2
;________________________________________________________________________
MAKEBOX
;
; make the basic window--->no edges D2 must be set to 0 on call
; d0 must be set to the width (90 maximum)
; d1 must be set to the heigth (364 maximum)
; A1 must be the offset address (0..32670)
;
;
movem.l d0-d4/a1-a4,-(sp)
movem.l d0-d1/a1,-(sp) ;save the heigth and the starting pixel address
clr.l d2 ;the pattern
bsr paint_box
;
; now draw the individual edges including the shadow edges on the right
; and bottom of the window
;
;
; draw bottom horizontal edge
;
sub.l d3,a1
sub.l d0,a1 ;a1 is currently equal to the lower right point
; of the box so we can subtract the width to
; calculate the lower left point of the box.
moveq #1,d1 ;set 1 pixel heigth
moveq #-1,d2 ;set the line pattern
bsr paintb2 ;remember a4 is set up to point to the move.w
; instruction
;
; draw bottom horizontal shadow
;
@1 addq #2,a1 ;shadow begin offset by 2
moveq #1,d1 ;draw a one pixel line
subq #2,d0
bsr paintb2 ;go
;
; draw top horizontal edge
;
@2 movem.l (sp)+,d0-d1/a1 ;restore original parameters
movem.l d1/a1,-(sp)
moveq #1,d1 ;draw a 1 pixel line
bsr paint_box
;
; now draw the right edge plus the right edge's shadow, use a1
; with a column parameter of 0
;
movem.l (sp)+,d4/a2
moveq #1,d2
subq #2,d4
subq #2,d0
add.l d0,a1
move.l d4,d1
clr.l d0
bsr.s paint_v
move.w #182,d0 ;set one byte offset from right edge
moveq #7,d2
move.l d4,d1
bsr.s paintbit ;draw first pixel line of the right shadow
move.w #272,d0
moveq #6,d2
move.l d4,d1
subq #1,d1 ;reduce heigth by 1 to compensate for shadow offset
bsr.s paintbit
;
; now draw the left vertical edge of the box
;
move.l a2,a1 ;restore the starting pixel address
add.l SCRNBASE,a1 ;add in video address
moveq #90,d0
add.l d0,a1
move #32768,d2 ;set the pattern
move.l d4,d1 ;the heigth minus two
clr.l d0 ;column 0 offset
bsr.s paint_v
movem.l (sp)+,d0-d4/a1-a4
rts
;_________________________________________________________________________
;
; Routine paint_v
;
; This routine "paints" a vertical column one word wide.
;
; Call: BSR paint_v
;
; register setup:
;
; A1 must contain the screen base address.
; D2 must contain a one word pattern.
; D1 must contain the number of pixels in the vertical length of the line
; in the range 1..364
; D0 must contain the screen word column in the range 0..44
;
; Assumptions: location SCRNBASE contains the video address
;
; registers used: D0-D1
;________________________________________________________________________
;
PAINT_V
paintv1
@1 MOVE.W D2,0(A1,D0.W) ;write to screen
SUBQ.W #1,D1 ;decrement count
BEQ.S @2 ;return
ADDI.W #ROWBYTES,D0 ;bump to next horizontal line
BRA.S @1 ;loop to continue writing vertical.
;
@2 RTS ;return
;_________________________________________________________________________
;
; Routine paintbit
;
; This routine "paints" a vertical line one bit wide.
;
; Call: BSR paintbit
;
; register setup:
;
; A1 must contain the screen base address.
; D2 must contain the bit number to set
; D1 must contain the number of pixels in the vertical length of the line
; in the range 1..364
; D0 must contain the screen word column in the range 0..44
;
; Assumptions: location SCRNBASE contains the video address
;
; registers used: D0-D1
;________________________________________________________________________
PAINTBIT
@1 bset d2,0(a1,d0.w)
subq.w #1,d1 ;subtract one from heigth
beq.s @2 ;done
addi.w #ROWBYTES,d0 ;increment to next pixel row.
bra.s @1
@2 RTS ;return
;______________________________________________________________________
;
; Routine makebutton --> creates a black lined box of the size
; specified by the parameters with button
; "label" and description if specified.
; Also makes entries in active rectangle
; table for later use with mouse.
;
; the left top corner is addressed by a1,
; the alternate keycode is contained in d0.
; the description is in A3.
; description location is in A2.
; '...' string appended to message if d1 nonzero
;
;
; Call:
;
; move.w <left/top corner point>,a1
; move.b <alternate keycode>,d0
; lea <button description>,a3
; move.l <description location>,a2
; <set d1 for '...' string>
; bsr makebutn
;
; Destroys regs D0-D2,D5,D6,A3
;______________________________________________________________________
MAKEBUTN
MOVEM.L D1/A2,-(SP) ;save string indicator and location ptr
LEA RectTable,A2 ;get ptr to active rect table
MOVE (A2),D2 ;get current count of rect's
MULU #5,D2 ;five entries per rect
ADD D2,D2 ;double for word index
ADDQ #1,(A2)+ ;incr for new rect
MOVE D0,0(A2,D2.W) ;save keycode id for new rect
BSR KeyToAscii ;convert keycode to Ascii
MOVE D0,D4 ;save for later display
; compute X,Y pixel coordinates from starting address
BSR GETROWCOL ;get pixel row, byte col
MULU #8,D6 ;convert to pixel col
MOVE D6,2(A2,D2.W) ;save upper left X
MOVE D5,4(A2,D2.W) ; and Y coordinates
MOVEQ #BTNWIDTH,D0 ;set button parameters
MOVEQ #BTNHIGH,D1
BSR.S DRAWBUTN ;draw the button
MOVE.L A1,-(SP) ;save original val
MOVE LwrRight,a1 ;compute lower right coordinates
BSR GETROWCOL ;get pixel row
MULU #8,D6 ;and pixel col
MOVE D6,6(A2,D2.W) ;save as X and
MOVE D5,8(A2,D2.W) ; Y coordinates
MOVE.L (SP)+,A1 ;restore starting value
; Add the button label and description
movem.l d0-d4/a1-a3,-(sp) ;save parameters
lsr.l #1,d0 ;divide window width
bsr getrowcol ;get the row and column coordinate of
;the window corner point
add.l d0,d6 ;adjust column pointer
lsr.l #1,d1 ;divide window heigth
subq.l #4,d1 ;decrement by half font heigth
add.l d1,d5 ;adjust row coordinate
SUBQ #1,D6 ;go back 1 and
CLR D0 ;display apple icon
BSR DSPVAL
MOVE.L D4,D0 ;get char to display
bsr dspval ;and go display alternate keycode
movem.l (sp)+,d0-d4/a1-a3 ;retrieve parameters
MOVEM.L (SP)+,D1/A2 ;retrieve location and string indicator
MOVE.L A2,A1 ;compute output pt for description
BSR GETROWCOL
BSR DSPSTRING ;and display it
RTS
;______________________________________________________________________
;
; Routine drawbutton --> creates a black lined box of the size
; specified by the parameters.
;
; the left top corner is addressed by a1,
; the width is indicated by d0.
; the heigth is indicated by d1.
;
;
; this routine calls paint_box, and paintbit.
;
; inputs: d0=window width in bytes (should be even)
; d1=heigth in pixels
; a1=window left/top corner point as a
; 0..32670 screen offset address.
;
; Call:
;
; move.w <left/top corner point>,a1
; move.w <button width>,d0
; move.w <button height>,d1
; bsr drawbutn
;______________________________________________________________________
DRAWBUTN
movem.l d0-d4/a1-a3,-(sp) ;stack the arguments
;
;
; draw the top edge of the button
;
moveq #-1,d2 ;set the black bit pattern for paint_box
moveq #1,d1 ;set a 1 pixel line
bsr paint_box
;
; draw the right vertical edge of the button
;
sub.l d3,a1 ;on return from paint_box, a1 points to the
;real address of the left point of the next
;horizontal pixel line of the button, so d3,
;which contains the displacement to the prior
;lines right edge is added to the
;left point to obtain the correct
;address for the right edge.
move.l 4(sp),d1 ;momentarily restore the heigth
clr.l d0
moveq #7,d2 ;set the 1 bit mask for paintbit
bsr.s paintbit ;draw the right edge
;
; now draw the left edge of the button
;
move.l 20(sp),a1 …
Showing first 20,000 characters of 71,115 total. Open the full document →