Skip to main content
Home Documents Lisa NEWRWADDR.Text
NEWRWADDR.Text

NEWRWADDR.Text

Lisa · TEXT
FilenameNEWRWADDR.Text
Size0.00 MB
Subsection firmware / ROM88
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
;++
;
;				Write Adr Field Subroutine
;
; (16 sector format) writes 27, 40-usec (10-bit) self-sync nibls, adr fields
; 16-sector start marks (0D5,0AA,096), Body (Track, Sector, Side, Volume,
; Checksum), end field marks, and the write turn off nibl.  It then jumps to
; the "WrSync" code which will write the starting sync for the data field,
; write the data fields and then return to the caller.
;--

	.Org	1200
WrSynTrK	.Equ *			; Write a sync track before first track
	Ldy	#00		; 256 sync bytes * 6 to write (about 2 sectors)
	Beq	WrAdr01

WAdr16	.Equ *
	Ldy	FmtGap		;		Default to 6*5 20 usec 'FF's

WrAdr01	Bit	IIob+Track	;		Look for bit six
	Bvc	$23
	Lda	#01
	Ora	IIob+Side
	Sta	IIob+side		;		set bit zero in side

$23	Lda	#1		;		flag for usage of AdrMk 1 & 2
	Jsr	Sync20		; 6	10/10	Write sync fields
	Lda	AdrMk3		; 3	19	Last byte in starting bitslip
	Jsr	WrNibl1		; 6

	Ldy	#02		; 2
$37	Ldx	IIob+Side,y	; 4		Write Track, Sector, then Side
	Jsr	WrByteX		; 6
	Dey
	Bpl	$37

	Ldx	FmtType		; 3	9	Format type
	Jsr	WrByteX		; 6	13/6
	Lda	IIob+Track	; 3	9	Create Address Checksum
	Eor	IIob+Sector	; 3	12
	Eor	IIob+Side		; 3	15
	Eor	FmtType		; 3	18
	Jsr	WrByte		; 6	24/6	Write the address checksum

	Lda	AdrMk4		; 3	9
	Jsr	WrNibl		; 6
	Lda	AdrMk5		; 3	9	Last byte in address field
	Jsr	WrNibl		; 6

	Jsr	ShtOff		; 6	16	Return to Sense mode
	Lda	#ErrHdr		; 2		UnderRun during header
	Bcs	WstTm		; 2,3		Abort upon error
	Jmp	Write16		; 3		Go & write data to disk


WstTm	Rts			; 6	10

.Page
;++
;			RdAdr
;--

RdAdr	.Equ *
	Lda	#0
	Sta	RangeL
	Lda	#RdAdrTmt
	Sta	RangeH
	Jsr	SetRMode		; Setup PAL on Sony to read mode
	Lda	Q6L		; Switch from SENSE to READ

RdAsyn	Inc	RangeL		; 5
	Bne	RdAd1		; 2,3
	Dec	RangeH		; 5
	Beq	RaErr1		; 2,3

RdAd1	Ldx	#00
$24	Lda	Q7L		; 4...
	Bmi	RdAsn1		; 2,3	Valid if high bit = 1
	Dex			; 2
	Bne	$24		; 2,3	Loop 255 times = 85 bytes
	Beq	RaErr1		; 3

RdAsn1	Cmp	AdrMk1		; 2	Address mark 1?
	Bne	RdAsyn		; 2,3	Branch if not

RdAd2	Lda	Q7L		; 4...
	Bpl	RdAd2		; 2,3
	Cmp	AdrMk2		; 2...	Address mark 2?
	Bne	RdAsn1		; 2,3

RdAd3	Lda	Q7L		; 4...
	Bpl	RdAd3		; 2,3
	Cmp	AdrMk3		; 2...
	Bne	RdAsn1		; 2,3

; Marks read now read address
; Carry is set

	Ldx	#AdrsLen		; 2
	Lda	#000		; 2	Clear CSum
Rfld	Sta	CSum		; 3	27
RdAd4	Ldy	Q7L		; 4
	Bpl	RdAd4		; 2	6	Do again if no valid data
	Lda	DNibl,y		; 4	12	Unpack the data
	Sta	CsmFnd,X		; 4	16	Store in FOUND table
	Eor	CSum		; 3	19	Update the checksum
	Dex			; 2	21	Next field
	Bpl	Rfld		; 2,3	24	Loop until "x" become negative
	Tax			; 2		If "CSum" = 0 then AOK
	Bne	RaErr5		; 2,3		No OK, signal on error

; Now compare against two final bytes and make sure at right track and sector

RaSlp1	Lda	Q7L		; 4...
	Bpl	RaSlp1		; 2,3
	Cmp	AdrMk4		; 2...
	Bne	RaErr2		; 2,3
	Lda	#01		; 2
	Bit	SdFnd		; 3
	Beq	RaSlp2		; 2,3
	Lda	#40
	Ora	TrkFnd
	Sta	TrkFnd

RaSlp2	Lda	Q7L		; 4...
	Bpl	RaSlp2		; 2,3
	Cmp	AdrMk5		; 2...
	Bne	RaErr2		; 2,3
	Lda	IIob+Track	; 3
	Cmp	TrkFnd		; 2
	Bne	RaErr4		; 2
	Lda	IIob+Sector	; 3
	Cmp	SecFnd		; 2
	Bne	RaErr3		; 2
	Clc			; 2... No error
	Lda	VolFnd		; Load the disk ID value just read.
	Sta	Iob+DiskID	; Tell host about what type of disk it is
RaExit	Clv			; Clear the overflow bit (previously used for FATAL)
RaExit1	Lda	Q6H		; Switch back from READ to SENSE
	Rts
;  We abort upon seeing first error-no matter what it is.  These all get reset
;  on seeking (even micro stepping).

RaErr1	Inc	RaStrt		; Start bitslip error -- Fatal error
	Sec
	Bcs	RaExit

RaErr2	Inc	RaEnd		; Ending bitslip error
	Sec
	Bcs	RaExit

RaErr5	Inc	RaCSum		; Checksum error
	Sec
	Bcs	RaExit

RaErr4	Inc	RaTrk		; Track error
RaErr6	Sec	
	Bcs	RaExit
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
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
;--------------------------------------------------------------------------
;  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 →

Home Documents Macintosh Firmware.Zip
Firmware.Zip

Firmware.Zip

Macintosh · ZIP archive
Filenamefirmware.zip
Size1.79 MB
Subsection prototypes / 1985_YACC / firmware
Downloads4
Enjoying MacTrove? Anonymous downloads are free and unlimited. Create a free account to track favorites, contribute metadata corrections, and join the community chat.
About this file

This is a ZIP archive — a binary artifact that can't be previewed in the browser. Unzip with any archive tool (The Unarchiver, built-in Finder on macOS, unzip on Linux).

Home Documents Lisa FORMAT.Text
FORMAT.Text

FORMAT.Text

Lisa · TEXT
FilenameFORMAT.Text
Size0.01 MB
Subsection firmware / ROM88
Downloads3
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
;++
;			Format
;
;--
; REGISTERS
;  IN
;	All =	Any value
;  OUT
;	All =	Destroyed
;
; CALLS
;	ClrBuf	Clears 524 byte buffer and other variables
;	SelSide	Selects side
;	Recall	Recalibrates disk to optical index sensor
;	WriTrk	Write no. of sectors in TempSec
;	VerTrk	Verifies no. of sectors in TempSec
;	SeekAlt	Seeks the teack in IIob+Track and sets speed
;	WrSynTrk	Writes bitslip FF's and A9's then sector 0
;	WArd16	Write sector x, both header and data fields
;	RdAdr	Reads sector header
;	Read16	Reads data fields
;	VfyCksum	Verifies checksum that was read
;	PreNib	Prenibblizes certain bytes for timing purposes
;
;++
.Page
Format	.Equ *				; Format entry point
FormTrk	.Equ *
	Jsr	ClrBuf			; Clear the buffer to be written
	Lda	#7
	Sta	FmtGap
	Jsr	RecalMtr			; Turn on motor & start from a known point (Track 0 )
	Bcs	FormRts			; Abort upon error from Recal

FormTop	Jsr	SeekAlt			; Go to othe track in IIob+Track & set speed
	Ldy	CurClass
	Lda	SecPrtTrk,y		; Fetch number of sectors in current track
	Sta	TempSec			; Save it for WriTrk

	Jsr	WriTrk			; Write a track full of sectors

	Lda	IIob+Command		; If a format track
	Cmp	#FrmTrk			; Then we're done-exit the routine
	Beq	VT00			; Command = FormatTrack (5)

	Lda	Iob+NoSides		; 1 = single side, 2 = double side
	Cmp	#2
	Bne	$39			; if <> 2 then go to incr to next track
	Lda	#20
	Sta	IIob+Side
	Jsr	WriTrk			; Now write second side
	Lda	#00
	Sta	IIob+Side			; Restore to side 0

$39	Inc	IIob+Track
	Lda	IIob+Track
	Cmp	#MaxTrack+1
	Bcc	FormTop			; Until we run out of tracks
	Dec	IIob+Track
	Bne	VT00			; Skip tunring the motor on

Verify	.Equ *				; Verify entry point
	Lda	#MaxTrack
	Sta	IIob+Track		; From inside of disk to outer edge
VerTrk	.Equ *
	Jsr	RecalMtr			; Turn on motor & start from a know point ( track 0 )
	Bcs	FormRts			; Abort upon error from Recal

VT00	.Equ *
	Jsr	SeekAlt			; Go to track in IIob+Track & set speed
	Ldy	CurClass
	Lda	SecPrTrk,y		; Fetch the number of sectors in current track
	Sta	TempSec			; Save it for WriTrk routine

	Jsr	VerTrk
	Bcs	FormErr			; Error, exit from routine

	Lda	IIob+Command		; If a verify track
	Cmp	#FrmtTrk			; Then we're done-exit the routine
	Bcs	$41			; Command = FormatTrack (5) or VerifyTrack (6)

	Lda	Iob+NoSides		; 1 = Single side, 2 = double side
	Cmp	#2
	Bne	$39
	Lda	#20
	Sta	IIob+Side
	Jsr	VerTrk			; Now verify side 1, track x
	Bcs	FormErr			; Error, exit from routine
	Lda	#00
	Sta	IIob+Side

$39	Dec	IIob+Track
	Bpl	VT00

$41	Clc
	Rts

FormErr	Lda	IIob+Track		; Current track number
	Sta	Trkjl0dNumb		; Save for host's usage
	Lda	IIob+Side			; Current side
	And	#20			; leave bit 5 -- side bit
	Beq	$17
	Lda	#1
$17	Sta	SideNumb			; Save for host's usage
	Lda	#SErrFrmt			; Format error code
FormRts	Rts

TooSml	.Equ *
	.Byte	0., 5., 10., 15.		; Not used
	.Byte	20., 25., 30., 35.		; 4:7
	.Byte	40., 45., 50., 55.		; 8:11
	.Byte	60., 65., 70., 75.		; 12:15

JustRit	.Equ *
	.Byte	108., 99., 90., 81., 72.	; Sectors in class * 9 bytes per sector

;++
;  WriTrk will physically format a disk in a 2:1 interleave.  It will
; write sector 0, sector x, sector 1, sector y, etc.
;--
WriTrk	.Equ				; Entry for writing a track of 524 byte sectors
	Jsr	SelSide			; Select proper side
	Lda	TempSec			; Total number of sectors on current track
	Sta	TotCnt			; Init total number of sectors on current track
	Lsr	A			; Divide by 2 and put remainder into carry
	Adc	#0			; Round up by adding carry
	Sta	HihCnt			; Init counter for high sector values
	Lda	#00
	Sta	CntPtr			; Init pointer for which count to use
	Sta	LowCnt			; For counting up from Sector 0
	Sta	IIob+Sector		; Start w/ sector 0

	Jsr	WrSynTrk			; Write 20 usec nibbles and A9's before sector 0
	Dec	TotCnt			; Subtract 1 from total sector count
	Inc	LowCnt			; Increment value to next low sector (1)
$23	Ldx	CntPtr			; Pointer to which cnt to use -- low or high
	Beq	$35			; If = 0 then increment to 1
	Ldx	#0FF			; If = 1 then decrement to 0
$35	Inx
	Stx	CntPtr
	Lda	LowCnt,x			; Fetch sector number
	Sta	IIob+Sector
	Inc	LowCnt,x			; Increment to next sector number
	Jsr	WAdr16			; Write address and data fields
	Dec	TotCnt			; Decrement total sector count
	Bne	$23			; When = 0 then all sectors are written

	Lda	#00
	Sta	IIob+Sector
	Jsr	RdAdrTmt			; If =  then less than 256 bytes were counted
	Bne	IncrG1			; >256 bytes so increase inter-sector gap

	Ldy	FmtGap
	Lda	TooSml,y
	Cmp	RangeL
	Bcs	DecrG1			; a > normal cnt with current Gap amount

	Ldy	CurClass
	Adc	JustRit,y
	Cmp	RangeL
	Bcs	WrTkDone			; A > range so all OK

IncrG1	Lda	#14.
	Cmp	FmtGap			; Limit to 14. self-sync groups of five
	Beq	WrTkDone
	Inc	FmtGap			; incr count for next track

WrTkDone	.Equ *
	Rts

DecrG1	.Equ	*
	Lda	#4.
	Cmp	FmtGap
	Beq	WrTkDone			; Minimum gap is 4 counts of 5 20 usec bytes

;++
;
;--
VerTrk	.Equ *
	Jsr	SelSide			; Select proper side
	Lda	#00
	Sta	IIob+Sector
	Sta	ScTrCnt
VfyTrk1	Lda	MaxRetry
	Sta	RetryCnt

VfyTrk2	Jsr	RdAdr			; Read sector address field
	Bcs	VfyErr
	Jsr	Read16			; Read sector data
	Bcs	VfyErr
	Jsr	VfyCksum			; Verify the checksum
	Bcs	VfyErr			; Must Be zero
VfRtry	Inc	IIob+Sector
	Lda	IIob+Sector
	Cmp	TempSec
	Bne	VfyTrk1			; If equal then carry will be set
	Lda	SctrCnt
	Bne	$74
	Clc
$74	Rts

VfyErr	Dec	RetryCnt
	Bne	VfyTrk2
	Ldy	SctrCnt
	Lda	IIob+Sector		; Current Sector Number
	Sta	SctrSav,y			; Save for host usage
	Inc	SctrCnt
	Bne	VfrTry			; Go to next sector and try again

ClrBuf	.Equ *
	Lda	#00			; Clear the total buffer area
	Tay
$05	Sta	Page02,y			; Zero part of the data buffer
	Sta	Page03,y			; Zero the rest of the data buffer
	Iny
	Bne	$05
	Ldy	#Bufr12SZ			; For 12 bytes header buffer
$10	Sta	Bufr12,y
	Dey
	Bpl	$10
	Sta	Cksum1			; Clear the three checksum butes
	Sta	Cksum2
	Sta	Cksum3
	Jmp	PreNib			; Create 5 composite bytes & return to caller
Home Documents Lisa HIMEM.Text
HIMEM.Text

HIMEM.Text

Lisa · TEXT
FilenameHIMEM.Text
Size0.00 MB
Subsection firmware / ROM88
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
;+
;
;			Himem
;		Welcome to Vector City!
; Himem Constants
;
;--

	.Org	02000-00D			; Length of high memory constants
Cpyrt	.Ascii	"C83APPLE"		; This'l show em, we mean business!
RstJmp	.Byte	04C			; A jump vector to the Restart code
	.Word	Restart			; Restart 6504 reset vector
	.Byte	0, 0			; Used to hold checksum for ROM verification
Home Documents Lisa TRKCLASS.Text
TRKCLASS.Text

TRKCLASS.Text

Lisa · TEXT
FilenameTRKCLASS.Text
Size0.00 MB
Subsection firmware / ROM88
Downloads3
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
;++
;			TrackClass will return the class (from 0 to 8) of
;		the track in IIOB+Track in the "Y" register
;
;		returns:		"Y" reg = class of track
;					"A" reg = IIOB+Track
;					"X" reg = unchanged
;--

TrkClss	.Equ *				; Entry point
	Lda	IIOB+Track		; Fetch current track value
	Ldy	#MaxClass		; Maximum class value
$21	Cmp	ClssTbl,Y		; Track >= Table entry?
	Bcs	$42			; Yep
	Dey
	Bne	$21			; Try the next track class
$42	Rts				; "Y" reg = track class value


ClssTbl	.Equ *				; Start of track class table
	.Byte 00			; Track  0:15
	.Byte 10			; Track 16:31
	.Byte 20			; Track 32:47
	.Byte 30			; Track 48:63
	.Byte 40			; Track 64:79
Home Documents Lisa SY.Text
SY.Text

SY.Text

Lisa · TEXT
FilenameSY.Text
Size0.00 MB
Subsection firmware / ROM88
Downloads3
Enjoying MacTrove? Anonymous downloads are free and unlimited. Create a free account to track favorites, contribute metadata corrections, and join the community chat.
Contents
.ABSOLUTE
.PROC LISA
.LIST
.TITLE "Sony DRIVER FOR LISA"
.INCLUDE VAR
.ORG	1000
.INCLUDE TABLES
.INCLUDE TRKCLASS
.INCLUDE FR3TO1
.INCLUDE DENIBBLE
.INCLUDE NEWRWADDR
.INCLUDE Interface
.INCLUDE LOOP
.INCLUDE CLRTRK
.INCLUDE PRENIB
.INCLUDE CMD
.INCLUDE SEEK
.INCLUDE WAITROM
.INCLUDE NMREAD16
.INCLUDE READ
.INCLUDE CRECKSUM
.INCLUDE VFYCKSUM
.INCLUDE WRITE
.INCLUDE WRITE16
.INCLUDE FORMAT
.INCLUDE RECAL
.INCLUDE Npwm
.INCLUDE HIMEM
.End
Home Documents Lisa VAR.Text
VAR.Text

VAR.Text

Lisa · TEXT
FilenameVAR.text
Size0.02 MB
Subsection firmware / ROM88
Downloads3
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

;---
;				ZERO PAGE MAPPING
;
;	The following equates are for dividing RAM into logical areas;
;	however, as the code grew, this convention was not strictly adhered
;	to and therefore one will find both "LOCAL" and "GLOBAL" variables
;	scattered throughout the RAM area
;+++

IOB	.Equ 00	;  INPUT OUTPUT BLOCK
SHARERAM	.Equ 10	;  READ/WRITE SHARED RAM, INITIALIZED BY 6504 ON BOOT
STATUS	.Equ 20	;  READ ONLY STATUS FROM THE 6504
IIOB	.Equ 30	;  INTERNAL IOB
GLOBALS	.Equ 40	;  6504 INTERNAL GLOBALS
LOCALS	.Equ 68	;  LOCAL VARIABLES

;;	THESE APPEAR, FROM THE LISTING PROVIDED, TO BE HEX NUMBERS UNLESS FOLLOWED BY A DECIMAL
;;	1/6/89 ARS

.PAGE

;---
;
;				IOB
;
;  THE IOB IS ALWAYS COPIED INTO THE INTERNAL IOB (IIOB) AREA BEFORE USAGE
;  SO THAT THE 68K CAN START TO BUILD A NEW COMMAND INTO THE IOB AS SOON AS
;  POSSIBLE.  ALL REFERENMCES TO THE IOB OF IIOB ARE DONE IN THE FOLLOWING
;  FORMAT:
;	IOB	IIOB
;	--------	--------
;  GOBYTE	IOB+GOBYTE	IIOB+GOBYTE
;  DRIVE	IOB+DRIVE	IIOB+DRIVE
;
;+++
IOBSIZE	.Equ 07	;  SIZE OF IOB BLOCK USED FOR PARAMETER PASSING
GOBYTE	.Equ 00	;  COMMAND BYTER FROM 68K

;	00	COMMAND ACCEPTED BY THE 6504, 68K MAY ISSUE A NEW COMMAND
;	80-89	COMMAND FROM 68K TO 6504
;	80	NULL, TESTS HANDSHAKE
;	81	RWTS COMMAND, COMMAND CODE IN 'COMMAND'
;	83	SEEK
;	84	CALL ADDRESS IN 6504
;	85	CLEAR STATUS
;	86	SET MASK
;	87	CLEAR MASK
;	88	WAIT IN ROM
;	89	Go jump to self forever (Their case change ARS)
;
;	01-7f,82,90-ff		*** RESERVED ***

COMMAND	.Equ 01	;  RWTS COMMAND CODE

;	00	READ	Read Read the Data @ Drive/Side/Track/Sector
;	01	WRITE	Write Read the Data @ Drive/Side/Track/Sector
;	02	UNCLAMP	Unclamp the disk in Drive
;	03	FORMAT	Format the disk in Drive
;	04	VERIFY	Verify the disk in Drive
;	05	FORMAT TRACK	Format single Track on the disk in Drive
;	06	VERIFY TRACK	Verify single Track on the disk in Drive
;	07	READBF	Read w/o checksum verification
;	08	WRITEBF	Write w/o checksum creation
;	09	CLAMP	Clamp the disk in Drive
;	0A-FF		*** RESERVED ***

MASK	.Equ COMMAND	;  MASK FOR SETTING AND RESETTING IMSK & IST

;	08	SET OR CLEAR INTERRUPT MASK FOR UPPER DRIVE
;	80	SET OR CLEAR INTERRUPT MASK FOR LOWER DRIVE
;	01	CLEAR DISK INSERTED INTERRUPT FOR UPPER DRIVE
;	10	CLEAR DISK INSERTED INTERRUPT FOR LOWER DRIVE
;	02	CLEAR BUTTOM PRESSED INTERRUPT FOR UPPER DRIVE
;	20	CLEAR BUTTOM PRESSED INTERRUPT FOR LOWER DRIVE
;	04	CLEAR R/W COMMAND COMPLETED INTERRUPT FOR UPPER DRIVE
;	40	CLEAR R/W COMMAND COMPLETED INTERRUPT FOR LOWER DRIVE

ADRL	.Equ COMMAND	;  LOW BYTE OF ADDRESS FOR 6504 CALL
ADRH	.Equ ADRL+1	;  HIGH BYTE OF ADDRESS FOR 6504 CALL
		;  A call to "1FFB" will reset the 65404

DRIVE	.Equ 02	;  DRIVE NUMBER

;	00	DRIVE 0 UPPER DRIVE
;	80	DRIVE 80	LOWER DRIVE

SIDE	.Equ 03	;  SIDE NUMBER

;	00	SIDE 0 UPPER SIDE OF MEDIA
;	01	SIDE 1 LOWER SIDE OF MEDIA

SECTOR	.Equ 04	; SECTOR NUMBER

;	00-15	MAXIMUM DEPENDES ON TRACK NUMBER

TRACK	.Equ 05	;  TRACK NUMBER

;	00-2D	46 TRACKS TOTAL

SPEED	.Equ 06	;  SPEED OVERRIDE

;	00	NOOVERRIDE, SPEED IN DEPENDING ON TRACK NUMBER
;	01-FF	Modifier value added to nominal speed

FMTCNFN	.Equ 07	;  Format configuration byte
		;  Used to ensure format is not executed by mistake
;	FF	FMTCNFM must be = FF for foramt/format track to work

ERRSTAT	.Equ 08	;  ERROR STATUS, RETURNED AFTER R/W COMMANDS
		;  See constants for current error code values

DISKID	.Equ 09	; Current id of the disk last accessed

;	00	UIniFile/DuoFile disk
;	01	Lisa disk
;	02	Macintosh disk

NoSides	.Equ 0A	;  Number of sides of disk drive

DrvError	.Equ 0B	;  Hard errors get returned throught his byte

HostSeek	.Equ 0C	;  When moving the head this location = 'FF'

SekErr	.Equ 0D	;  When seek does not handshake then = '0F'

.Page

;--
;			Shared RAM
;
;  SHARED RAM COMES IN TWO FLAVOERS:  'READ/WRITE' AND 'READ ONLY'.  THE 68K CAN,
;  OF COURSE, READ AND WRITE TO ANY BYTE IN THE RAM AT ANY TIME BUT THIS IS NOT
;  VERY WISE, (ONE MIGHT SAY VERY FOOLISH...), SO THE BY 'READ ONLY' WE MEAN
;  MEMORY THAT NEVER SHOULD BE WRITTEN TO BY THE 68K BUT IS VALID TO READ AT
;  ANY TIME.  TYPICAL 'READ ONY' VARIABLES ARE THE STATUS FLAGS CLMED0 AND
;  CLMPED80 THAT TELLS THE 68K THAT A DISK IS CLAMPED IN DRIVE 0 OR 80
;
;  'READ/WRITE' SHARED MEMORY IS, FOR EXAMPLE, THE IOB BUT IN THIS CASE IT IS
;  A FAMILY OF 'CONSTANTS' SET UP ON COLD START BY THE 6504 TO THEIR DEFAULT
;  VALUES, BUT THEY CAN BE CHANGED AT ANY TIME BY THE 68K TO ANY VALUE.  THERE
;  IS NO CHECKING OF THE RANGE OF THESE VALUES O THE NEW ONE BETTER MAKE SENSE
;  OR THE 6504 MIGHT GO OF TO NEVER, NEVER LAND...
;
;		SHARED:  READ/RWITE
;++

MSpdTbl	.Equ ShareRam
SCDLY	.Equ SHARERAM+5.	;  Speed change delay in 5 ms intervals
HEADELAY	.Equ SHARERAM+6.	;  Head settling time in 5 ms intervals
MAXDDLY	.Equ SHARERAM+7.	;  Timer value in 2/3 second before motor off
ROMIDNUM	.Equ SHARERAM+8.	;  ROM identification number ( 0018/FCC031 )
MAXRETRY	.Equ SHARERAM+9.	;  Maximum number of retries during a read/rwite
MAXRECAL	.Equ SHARERAM+10.	;  Maximum number of recalibrations during a r/w
StpDly	.Equ SHARERAM+11.	;  Step dely time in 100 usec intervals
MONDLY	.Equ SHARERAM+12.	;  Motor on delay time in 5 ms intervals

.Page

;++
;		SHARED:  READ ONLY
;--

Clamped	.Equ Status	;  Disk in Place (=0 EMPYT, =FF CLAMPED)
MtrOn	.Equ Clamped+1	;  DRIVE MOTOR SELECT (0=OFF, FF=ON)

CurTrack	.Equ Status+2	;  value of current track
CurClass	.Equ CurTrack+1	;  Current track class (0:  4)

DrvConn	.Equ Status+4	;  Will be 'FF' if a drive is physically there
FmtType	.Equ DrvConn+1	;  '2' for single, '22' for double sideed

RetryCnt	.Equ Status+6	;  RETRY COUNT
RecalCnt	.Equ RetryCnt+1	;  RECALIBRATION COUNT

ImAlive	.Equ Status+8	; THIS VARIABLE SPINNS AS LONG AS THE MAIN LOOP IS EXECUTING

Counter	.Equ Status+9.	;  GENERAL COUNTER
HoldInx	.Equ Counter+1	;  Holds command index temporarily
FmtGap	.Equ Counter+2	;  Amt * 5 of 20 usec 'FF's to write as selfsync

Imsk	.Equ Status+12.	;  Bits 7 & 3 are mask; if set the drive enabled
DipIntr	.Equ Imsk+1	;  Flag reflects DIP interrupt
OkToGo	.Equ Imsk+2	;  REFLECTS FDIR (=0, FDIRL; <>0, FDIRH)
IST	.Equ Imsk+3	;  INTERRUPT STATUS

;	Bits of IST are numbered for LSb (0) to MSb (7)
;
;	Bit	Meaning
;	---	-------
;	0	Drive 0 disk inserted
;	1	Drive 0 button pressed
;	2	Drive 0 R/W completed
;	3	Logical OR of bit 0,1 & 2
;	4	Drive 80 disk inserted
;	5	Drive 80 button pressed
;	6	Drive 80 R/W completed
;	7	Logical OR of bit 4,5 & 6

AdrMk1	.Equ	IIob+8	;  5 values that indicate start and end of address field
AdrMk2	.Equ	AdrMk1+1
AdrMk3	.Equ	AdrMk1+2
AdrMk4	.Equ	AdrMk1+3
AdrMk5	.Equ	AdrMk1+4

.Page
		; Following 3 byte counter controls both testing
		; for DIP and shutting off teh motors.  When
WtLow	.Equ Globals	; the low 2 bytes = 0 then test for DIP. When
WtMid	.Equ WtLow+1	; the third byte becomes 0 the heads are parked
WtHih	.Equ WTLow+2	; and the motors are turned off
		; For timing and space purposes during writeg
		; of data, an indexed by "y" through zero
INXPTRL	.Equ Globals+3	; pge instruction is used.  The two bytes
INXPTRH	.Equ INXPTRL+1	; hold the base address for the index\.

		; Some constants for timing purposes
K000	.Equ Globals+5	; A constant '00'
K0FF	.Equ K000+1	; A constant 'FF'

		; Following 8 locations hold error counters for
		; various read errors.  The first three are for
		; error w/ reading data and the last five are
		; for errors associated w/ the header.
STSLP	.Equ GLOBALS+8.	; Read Data Starting Bitslip
BSCNT	.Equ StSlp+1	; Read Data ending Bitslip
CSERROR	.Equ StSlp+2	; Read data Checksum error
RASTRT	.Equ StSlp+3	; Read Address Starting Bitslip
RAEND	.Equ StSlp+4	; Read Address Ending Bitslip
RASCTR	.Equ StSlp+5	; Read Address wrong sector
RATRK	.Equ StSlp+6	; Read Address wrong track
RACSUM	.Equ StSlp+7	; Read Address Checksum error
ERRLEN	.Equ 7	; 8 bytes, zero based

CSMFND	.Equ Globals+16.	; CHECKSUM read from disk
VOLFND	.Equ CsmFnd+1		; 0 = UniFile/DuoFile, 1 = Lisa, 2 = Mac
SDFND	.Equ CsmFnd+2		; SIDE FOUND
SECFND	.Equ CsmFnd+3		; SECTOR FOUND
TRKFND	.Equ CsmFnd+4		; TRACK FOUND
CSUM	.Equ CsmFnd+5		; Checksum calculated from ADDRESS data
ADRSLEN	.Equ 4		; LENGTH OF ADDRESS HEADER - 1

TrkFlg	.Equ Globals+22.
MtrFlg	.Equ TrkFlg+1
StpAmt	.Equ TrkFlg+2
Direct	.Equ TrkFlg+3

IndexL	.Equ Globals+26.
IndexH	.Equ IndexL+1
RangeL	.Equ IndexL+2
RangeH	.Equ IndexL+3

CPBY01	.Equ Globals+30.	; Composite byte formed from BUFFER[ 2FF:301 ]
CPBY02	.EQY CPBY01+1		; [ 3FE:3FF ]

CPCKSUM	.Equ Globals+32.	; Composite byte formed from 3 checksum bytes
CKSUM1	.Equ CPCKSUM+1		; First checksum byte
CKSUM2	.Equ CPCKSUM+2		; Second shecksum byte
CKSUM3	.Equ CPCKSUM+3		; Third checksum byte

TCKSM1	.Equ Globals+36.	; During a read of data, the checksum is read
TCKSM2	.Equ TCKSM1+1		; into "CKSM1..3".  A new checksum is created
TCKSM3	.Equ TCKSM1+2		; and stored in these 3 bytes to verify matters

TEMPSEC	.Equ Globals+39.	; TEMPRARY SECTOR COUNTER USED BY FORMAT

.Page

;--
;			LOCAL VARIABLES USED IN ONE OR SEVERAL ROUTINES
;++

RWCSMFLG	.Equ LOCALS		; Flag fro usage of host supplied checksum
DELAY	.Equ LOCALS+1		; COMPUTED DELAY FOR TOTAL SEEK

Sv1	.Equ LOCALS+2		; storage during Write16
Sv2	.Equ Sv1+1
Sv3	.Equ Sv1+2
Sv4	.Equ Sv1+3

TEMP1	.Equ Locals+6.		; 2 Locations for temporary by many routines
TEMP2	.Equ TEMP1+1

DatMk1	.Equ Locals+8		; 5 values that indicate start and end of Data field
DatMk2	.Equ DatMk1+1
DatMk3	.Equ DatMk1+2
DatMk4	.Equ DatMk1+3
DatMk5	.Equ DatMk1+4

LOWCNT	.Equ LOCALS+13.		; Holds value for physiacl interleave count
HIHCNT	.Equ LOWCNT+1.		; Same but opposite/complimentary value
CNTPTR	.Equ LOWCNT+2.		; Pointer to which cnt to use ( high or low )
TOTCNT	.Equ LOWCNT+3.		; Total count of sectors written

TEMP3	.Equ Locals+17.
TEMP4	.Equ TEMP3+1

RtyFlg	.Equ Locals+19.		; flag for use in BadAddr error handling
Uu6	.Equ Locals+20.		; 2 unused locations

Cmdx	.Equ Locals+21.
SaveL	.Equ Locals+22.
SaveH	.Equ Locals+23.
CmdLeng	.Equ 3F		; 64 byte ring buffer of 8 byte IOB's
SavIndex	.Equ 80

; *** NOTE -- Ram from 'C0' to 'FF' is used by the 68K as parameter memory ***

LSTUSED	.Equ 0BF		; last used location in the ZERO PARE RAM

.Page
;--
;
;			CONSTANTS
;
;++

BUFR12SZ	.Equ 0B		; LENGTH OF 12 BYTE BLOCK HEADER - 1
NIBLRETR	.Equ 20		; THE NUMBER OF NIBBLES READ SEARCHING FOR THE
			; FIRST ADDRESS MARK DURING A READ
MAXTRACK	.Equ 4F		; MAXIMUM TRACK NUMBER: 79.
MINTRACK	.Equ 0		; MIMIMUM TRACK NUMBER: 0
MAXCLASS	.Equ 04		; Maximum track class value -- range from 0..4
MINSECNT	.Equ 08		; Minimum sector count
MAXSECNT	.Equ 0C		; Maximum sector count
MINSPEED	.Equ 0D4		; Minimum speed value
MAXSPEED	.Equ 038		; Maximum speed value -- Low # = high speed
OkDly	.Equ 28.

CNFMVAL	.Equ 0FF		; Format configuration check byte
LOW6	.Equ 3F		; mask for low 6 bit

MaxCmd	.Equ 09		; 10 commands return FDirH ( -1 )
CmdNumb	.Equ 07		; Seven commands nao accessed through '81'
NullCmd	.Equ 080		; Null/Handshake command
RwtsCmd	.Equ 091		; Read/Write Track/Sector command value
LwCmdNo	.Equ 083		; Lowest command number ( not including '81' )
ClStsCmd	.Equ 085		; Command to clear interrupt status
WrtCmd	.Equ 01		; Value of command to write data to disk
WrtBfCmd	.Equ 08		; Write data, brute force method
FrmtDsk	.Equ 03		; Value of command host to to format disk
VrfyDsk	.Equ 04		; Value of command host to to verify disk
FrmtTrk	.Equ 05		; Value of command from host to format a track
VrfyTrk	.Equ 06		; Value opf command from host to verify a track

ADM1	.Equ 0D5		; Address mark one
ADM2	.Equ 0AA		; Address mark two
ADM3	.Equ 096		; Address mark three
DDM3	.Equ 0AD		; Data mark three

BitSlp1	.Equ 0DE		; Bit slip mark one
BitSlp2	.Equ 0AA		; Bit slip mark two

RclStep	.Equ 4.		; # of steps to take away from Trk00 during recal
OneScc	.Equ 200.		; constant for a one second wait
TmOutRcl	.Equ 100.		; Timeout for recal wait
RdAdrTmt	.Equ 08.		; Tiomeout for looking for address header
IWMMode	.Equ 01F		; constant to setup IWM modes
TurnRound	.Equ 08.		; 5*8=40 msec turn around time for changing directions

Lrge	.Equ 05.
Smal	.Equ 01.
TblJmp	.Equ 09.
WHih	.Equ 17.		; '11' hex
WLow	.Equ 00.
tLow	.Equ 20.

;  ERROR NUMBERS

GErrCmd	.Equ 01		; Gobyte error:  Invalid command
GErrDrv	.Equ 02		; Gobyte error:  Invalid drive number
GErrSid	.Equ 03		; GoByte error:  Invalid side number
GErrSec	.Equ 04		; Gobyte error:  Invalid Sector number
GErrTrk	.Equ 05		; Gobyte error:  Invalid Track number
GErrMsk	.Equ 06		; Gobyte error:  Invalid mask
GErrClm	.Equ 07		; Gobyte error:  No clamped disk in drive
GErrEna	.Equ 08		; Gobyte error:  Drive not enabled
GErrIntr	.Equ 09		; Gobyte error:  Pending interrupts not cleared
GErrFmPr	.Equ 10.		; Gobyte error:  Invalid format parameter

PErrROM	.Equ 11.		; Program error:  ROM test failed
PErrInt	.Equ 12.		; Program error:  Random IRQ, NMI or BRK

DErrCal	.Equ 13.		; Drive error:  time out while looking for track zero
IWMError	.Equ 14.		; Fatal error:  IWM doesn't respond to commands
StepErr	.Equ 15.		; Handshake diod not occur when stepping
DErrTk0	.Equ 16.		; Drive Error:  Unable to leave track zero location

SErrProt	.Equ 20.		; Errstat error:  Write protect error
SErrFrmt	.Equ 21.		; Errstat error:  Can't verify disk
SErrClmp	.Equ 22.		; Errstat error:  Unable to clamp disk
SErrRd	.Equ 23.		; Errstat error:  Read error
SErrWr	.Equ 24.		; Errstat error:  Write error
SErrUclmp	.Equ 25.		; Errstat error:  Unable to unclamp diskette
SErrNoA9	.Equ 26.		; Errstat error:  Cannot find A9's during chkspd
SErrTmt	.Equ 27.		; Errstat error:  Unable to adjust speed w/in timeout
SErrM1Tk	.Equ 28.		; Errstat error:  Cannot write speed track

ErrHdr	.Equ 30.		; UnderRun while writing header
ErrWrt	.Equ 31.		; UnderRun while writing data fields

.Page
;++
;
;		Data Buffer equates and Bad Block equates
;
;--

StackSt	.Equ 0CF		; Init stack to "01CF" -- push down stack
SctrCnt	.Equ 01D0		; During VERIFY, will no. of bad sectors
TrkNumb	.Equ SctrCnt+1		; Track number where bad sector occurred
SidNumb	.Equ SctrCnt+2		; Side number where bad sector occurred
SctrSav	.Equ SctrCnt+3		; Start of buffer where sector numbers are saved

Page01	.Equ 100		; last 12 bytes of data are for read/write
Bufr12	.Equ 1F4		; last 12 bytes of data for raed/write
Page02	.Equ 200		; 256 bytes of data for read/write
Page03	.Equ 300		;  "

Pg2Len	.Equ 0FF		; # of bytes to read during Wrbf02 loop
Pg3Len	.Equ 0FE		; # of bytes to read during Wrbf03 loop

.Page

;--
;		I/O Space
;++

IOSpace	.Equ 800		; name for beginning of I/O space offsets
Off	.Equ 00		; Offset to switch a phase off
On	.Equ 01		; Offset to switch a phase on
Zero	.Equ 00		; Offset to drive zero
Eighty	.Equ 01		; Offset to drive eighty
Low	.Equ 00		; PwmEna + Low enables output of PWMReg
High	.Equ 01
InWard	.Equ 00		; direction offsets
OutWard	.Equ 01

CA0	.Equ IOSpace		; Control signal 0 for MCI PAL in Sony drive
CA1	.Equ IOSpace+2		; signal 1
CA2	.Equ IOSpace+4		; signal 2
LStrb	.Equ IOSpace+6		; Load strobe -- 0 to 1 to 0 will strobe PAL

MtEna	.Equ IOSpace+8		; Enables output of DrvEna

DrEna	.Equ IOSpace+10.	; = 0 --> drive 0, = 1 ==> drive 80

Q6L	.Equ IOSpace+12.	; Low = Read or Write
Q6H	.Equ Q6L+1		; High = Sense or Write Load
Q7L	.Equ IOSpace+14.	; Low disables writing to disk
Q7H	.Equ Q7L+1		; Enables /WrReq output of IWM

CntEna	.Equ IOSpace+16.	; low enables PWM counter/comparator

PwmEna	.Equ IOSpace+22.	; High enables pulses to Sony, else always low

DisL	.Equ IOSpace+24.	; Memory enable for the 68K
DisH	.Equ DisL+1		; Memory disable for the 68K

Side0Sel	.Equ IOSpace+26.	; Selects side 0
Side1Sel	.Equ Side0Sel+1		; Selects side 1

BootL	.Equ IOSpace+28.	; Disk Diag Line; when High then I'm listening
BootH	.Equ BootL+1

FDirL	.Equ IOSpace+30.	; Deselects the interrupts to the 68K
FDirH	.Equ FDirL+1		; Selects the interrupts to the 68K

PWMReg	.Equ IOSpace+32.	; Selects the PWM register for writing

;
Home Documents Lisa TTKCLASS.Text
TTKCLASS.Text

TTKCLASS.Text

Lisa · TEXT
FilenameTTKCLASS.Text
Size0.00 MB
Subsection firmware / ROM88
Downloads3
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
;++
;			TrackClass will return the class (from 0 to 8) of
;		the track in IIOB+Track in the "Y" register
;
;		returns:		"Y" reg = class of track
;					"A" reg = IIOB+Track
;					"X" reg = unchanged
;--

TrkClss	.Equ *				; Entry point
	Lda	IIOB+Track		; Fetch current track value
	Ldy	#MaxClass		; Maximum class value
$21	Cmp	ClssTbl,Y		; Track >= Table entry?
	Bcs	$42			; Yep
	Dey
	Bne	$21			; Try the next track class
$42	Rts				; "Y" reg = track class value


ClssTbl	.Equ *				; Start of track class table
	.Byte 00			; Track  0:15
	.Byte 10			; Track 16:31
	.Byte 20			; Track 32:47
	.Byte 30			; Track 48:63
	.Byte 40			; Track 64:79
Home Documents Lisa Npwm.Text
Npwm.Text

Npwm.Text

Lisa · TEXT
FilenameNpwm.Text
Size0.00 MB
Subsection firmware / ROM88
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
;++
;--

TimIt	.Equ *
	Lda	#5				; Time 6 pulses
	Sta	Temp2
	Clc					; Should stay clear unless explicitly set
	Jsr	WtZero				; Look for low, then first high
	Bcs	RsOut				; 2,3	10	No edge within timeout period
	Jsr	RsEdge				; 8	8	Now at known locationo
	Bcs	RsOut				; 2,3	10	No edge within timeout period
	Lda	#0				; 2	12
	Sta	RangeL				; 3	15
	Sta	RangeH				; 3	18	Zero both bytes of counter

;++
;	WtZero & RsEdge both have 36 cycles (18.0 uSec) per tick of RangeL:H
;--

$20	Jsr	WtZero				; Look for low
	Bcs	RsOut				; 2,3
	Jsr	RsEdge				; Wait for next edge on pulse
	Bcs	RsOut				; 2,3
	Dec	Temp2				; 5		When less than zero then exit
	Bpl	$20				; 2,3	15*(2+@+%+#) = 180 cycles

RsOut	.Equ *
	Rts					; 6		Common exit point

WtZero	.Equ *
	Bit	K000				; 3		ccV set to Zero
	Bvc	RsEd				; 3	6

RsEdge	.Equ *					;		Look for a rising edge
	Bit	K0FF				; 3	3	ccV eq 0 == low, ccV eq 1 == high
	Bvs	ReEd				; 3	6
RsEd	.Equ *
	Ldy	#00				; 2	8
	Ldx	#0A0				; 2	10	Constant timeout for pulse counting

$10	Dey					; 2	2
	Bne	$20				; 2,3	4,5
	Dex					; 2	6
	Bne	$30				; 2,3	8,9
	Sec					; 2	10	When X-reg = 0 then return error
	Rts

$20	Nop					; 2	7
	Nop					; 2	9	Waste time

$30	Inc	RangeL				; 5	14
	Bne	$40				; 2,3	16,17
	Inc	RangeH				; 5	21
	Bne	$50				; 3	24	Always taken ??

$40	Pha					; 3	20	Waste more time
	Pla					; 4	24

$50	Lda	Q7L				; 4		Bit7=0 ==>tach low, else tach high
	Bvc	$70				; 2,3	30,31	ccV ==> look for low
	Bpl	$90				; 2,3	32,33	If high then fall thru & exit
	Nop					; 2	34
$60	Rts					; 6

$70	Bpl	$60				; 2,3	33,34	If low then exit

$90	Bcc	$10				; 3	36	Always taken?? -- 18.0 uSec loop

ChkLrg	.Equ *
	Lda	#Lrge				; 5
	Sta	Temp1				; For speed adjustment
	Lda	#WLow
	Beq	ChkComm

ChkSml	.Equ *
	Lda	#Smal				; 1
	Sta	Temp1
	Lda	#TLow

;++
;  ChkComm
;     if H < TL
;       then AdjPlus
;     else if H > TL
;       then TstHih
;     else  if L < Tl
;       then AdjPlus
;     else if L = TL
;       then OK
;  TstHih
;     If H > Th
;        then AdjMinus
;     else if H <> Th
;        then OK
;     else if L <= TH
;        then OK
;     else AdjMinus
;--

ChkComm	.Equ *
	Sta	InxPtrL			; Ptr to which constraints ( low of high )
	Lda	CurClass			; Current track class
	Asl	A			; *2 to address word array
	Tay
	Lda	RangeH
	Cmp	@InxPtrL,y		; High must be greater than or equal to lowtable,y
	Bcc	AdjPlus			; High byte low, must spin slower
	Bne	TsHih			; High byte greater -- must see if w/in high boundary
	Inc
	Lda	RangeL
	Cmp	@InxPtrL,y		; Must be greater than or equal to table,y
	Bcc	AdjPlus			; High bytes = and low byte low - slow it down
	Beq	ChkOK			; Both bytes are equal so within range
	Clc
TsHih	.Equ *				; ccC=1 if branched to here so add +1 for not 'Iny'
	Tya
	Adc	#TblJmp			; 9.
	Tay				; Index now points at high side of range
	Lda	@InxPtrL,y
	Cmp	RangeH			; High byte must be <= high boundary
	Bcc	AdjMinus			; High byte is too high, spin disk faster
	Bne	ChkOK			; If <> then low byte must be w/in range
	Iny				; Point @ low byte of boundary value
	Lda	@InxPtrL,y
	Cmp	RangeL			; Low byte is too high, spin disk faster

ChjkOK	.Equ *
	Clc
	Rts

AdjPlus	.Equ *				; ccC = 0 already
	Ldy	CurClass
	Lda	MSpdTbl,y
	Adc	TEmp1			; Add adjustment value
	Sta	MSpdTbl,y
	Sec
	Rts

AdjMinus	.Equ *
	Ldy	CurClass
	Lda	MSpdTbl,y
	Sec
	Sbc	Temp1
	Sta	MSpdTbl,y
	Sec
	Rts

SpdChk	.Equ *				; Main entry point for speed check
	Lda	#WHih			; '11'x
	Sta	InxPtrH
	Jsr	SetTach			; Make sure in Tach sense mode
	Jsr	TimIt			; Time 6 pulses & abort on timeout
	Bcs	SpdErr
	Jsr	ChkLrg			; Must be within +/- 2%
	Bcc	SpdDone
	Lda	#101.			; 100 times total for attempts to adjust
	Sta	Counter

$10	Dec	Counter
	Beq	SpdErr			; Try for 100 times and abort upon inability to adjust
	Jsr	SetSpeed
	Lda	ScDly
	Jsr	Wait
	Jsr	Timit
	Bcs	SpdErr
	Jsr	ChkLrg
	Bcs	$10			; Loop until speed within +/- 2%

$32	Sec				; Make sure error flag is set
	Dec	Counter
	Beq	SpdErr			; Try for 100 times and abort upon inability to adjust
	Jsr	ChkSml			; Now loop until within +/- .5%
	Bcc	SpdDone
	Jsr	SetSpeed
	Lda	ScDelay
	Jsr	Wait
	Jsr	TimIt
	Bcc	$32

SpdErr	.Equ*
	Lda	#SErrTmt

SpdDone	.Equ *
	Rts
Subscribe to firmware
mp.ls