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

CLRTRK.Text

Lisa · TEXT
FilenameCLRTRK.Text
Size0.00 MB
Subsection firmware / ROM88
Downloads5
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
;++
;	Sync20 will clear a track partially bny writing 20 usec 'FF's to
;	the disk.  Sync20 will use theh values in the "y" reg as the number
;	of sets of sync nibbles to write to the disk.
;
;	INPUT
;		Y = number to write
;		A = Addr/Data Mark flag -->0 0 == Data & 1 == Addr
;
;	OUTPUT
;		X = Destroyed
;		Y = 'FF'
;		A = Unknown
;	  "Counter" = 'FF'
;--

BsTbl	.Equ *				; 5 20 usec bytes coded in the following 6 bytes
	.Byte	0FF, 0FC, 0F3, 0CF, 03F, 0FF
Sync20	.Equ *				; Entry point
	Sty	Counter
	Sta	Temp1
	Lda	#0FF			;
	Sta	Q7H			;		Change from SENSE to WRITE LOAD
$05	Ldy	#05			; 2		Transfer 6 bytes, zero based
$07	Lda	BsTbl,y			; 4
$10	Ldx	Q6L			; 4		Sense line encoded in Bit &
	Bpl	$10			; 2,3		Wait for Bit 7 to become a '1'
	Sta	Q6H			; 4

	Dey				; 2
	Bpl	$07			; 2,3
	Dec	Counter			; 5
	Bne	$05			; 2,3

$20	Ldx	Q6L			; 4
	Bpl	$20			; 2,3
	Sta	Q6H			; 4
	Lda	Temp1			; 3
	Bne	$50			; 2,3		if !=0 then use address mark values
	Lda	DatMk1			; 3	12	First data field mark
	Jsr	WrNib1			; 6	14/6
	Lda	DatMk2			; 3	9	second data field mark
	Jmp	WrNib1			; 3	12	Rts to caller from WrNib1

$50	Lda	AdrMk1			; 3	12	first address field mark
	Jsr	WrNib1			; 6	14/6
	Lda	AdrMk2			; 3	9	second address field mark
	Jmp	WrNib1			; 3	12	Rts to caller from WrNib1
Home Documents Lisa CMD.Text
CMD.Text

CMD.Text

Lisa · TEXT
FilenameCMD.Text
Size0.01 MB
Subsection firmware / ROM88
Downloads4
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
;++
;
;			Cmd
;
; Cmd is the commmand interpreter; it looks at the Iob Gobyte and evaluates the
; command to be done.  If an interrupt is pending, '81' command will be
; aborted.  All commands are checked for the validity of their parameters by
; the "Validate" routine.
;
; REGISTERS
;	All =	Destroyed
;
; CALLS
;	Validate	Validates the parameters of the Iob
;	Rwts	Handles all commands related to the disk
;	Seek	Moves the heads to Drive/Side/Track
;	Call	Will call routine
;	ClrIst	Clears the Interrupt Status Bye
;	SetIMsk	Enables drives for interrupts using mask byte
;	ClrIMsk	Disables drives for interrupts using mask byte
;	WaitROM	Waits for particular GoByte sequence before Cold Restart
;	ESAD	Will only access ROM; loops forever on until reset
;++
.Page

;++
;	For x:=IobSize Downto 0 do		Transfer Iob into internal copy
;	   iiob,x := iob,x;
;	"A" reg will be left containing GoByte
;--
Cmd	.Equ *				; Entry point for Cmd
	Ldy	CmdX
	Ldx	#IobSize			; Move only the eight bytes that are passed
Cmd1	Lda	Iob,x			; Fetch
	Sta	IIob,x			; And deposit
	Sta	@SaveL,y			; for posterity
	Dey
	Dex				; Count down
	Bpl	Cmd1

	Sty	Cmdx
	Iny
	Bne	$32
	Ldy	#CmdLeng
	Sty	CmdX

;	If IIob.Gobyte = 81 then
;	   Goto Rwts

$32	Cmp	#RwtsCmd			; Rwts command?
Beq	Rwts				; Yes & let Rts from Rwts return to Loop

;	Else
;	Begin
;	   In not (IIob.GoByte in [Valid IIob.GoByte]) then
;	   begin
;	      Iob.GoByte := 001;		Invalid command
;               Carry := Clear		Command completed
;	      Return
;	   end;
;	Validate

	Cmp	#NullCmd			; If null command then exit
	Beq	CmdNoErr

	Sec
	Sbc	#LwCmdNo			; Subtract lowest command number
	Bcc	Cmd3			; Oooops!  Not a valid GoByte command
	Cmp	#CmdNumb+1		; Number of commands in range
	Bcc	Cmd5			; Skip if valid GoByte command
Cmd3	Lda	#GErrCmd			; Else signal invalid GoByte
	Bne	CmdClnUp			; Cleanup & exit

Cmd5	Tax				; Index to command already in A-reg!
	Sta	HoldInx			; Save index fro the moment
	Lda	TestGoB,x			; Fetch Parsing for GoByte Commands
	Jsr	Validate			; And validate it
	Bcs	CmdClnUp			; Not a valid command
	Lda	HoldInx			; Get back the index to the command

;	If Valid then
;	case GoByte of
;	83:	Seek			Seek to track
;	84:	Call			Call 6504 address
;	85:	ClrIst			Clear Ist (Interrupt Status) bits
;	86:	SetIMsk			Set (enable) bits in IMsk (Interrupt Mask)
;	87:	ClrIMsk			Clear (disable) bits in Imsk (Interrupt Mask)
;	88:	WaitRom			Wait in Rom (used by 68K ram test)
;	89:	ESAD			Jump to self in Rom and never return
;	End; {case}
;	End;

	Asl	A			; To index into word table
	Tax				; Use command number as index
	Jsr	Cmd6
	Lda	HoldInx			; Fetch the index (0..6)
	Beq	CmdRts			; Skip if comand was a "Seek" command
	Cmp	#01			; Also skip if it was a "Call" command
	Beq	CmdRts
CmdNoErr	.Equ *
	Lda	#0			; Signal no error

CmdClnUp	Sta	Iob+ErrStat		; Common error reporting code for Cmd and Rwts
	Lda	#00
	Sta	Iob+GoByte		; Allow host to process error (if any)

CmdRts	Rts				; And exit

;--
;
;	Cmd Jump Table Dispatcher
;

Cmd6	Lda	CmdJmp+1,x		; Fetch th ehigh byte
	Pha				; Put it on the stack
	Lda	CmdJmp,x			; Then the low byte
	Pha
	Rts				; and jump indirect top of stack

CmdJmp	.Word	Seek-1,Call-1,ClrIst-1,SetIMsk-1,ClrIMsk-1
	.Word	WaitRom-1,ESAD-1

.Page
;++
;
;		Rwts
;
; Rwts (Read Write Track Sector) is the routine that parses and dispatches
; all commands that affect the disk ( except Seek).  If no interrupts are
; pending and all parameters are valid, then the memory will be disabled to
; access by the 68K and the proper routine will be called.
;
; REGISTER
;  IN
;	A =	IIob+GoByte
;
;  OUT
;	All ==	Destroyed
;
; CALLS
;	Validate	Validates parameters for Cmd, driven by TestTbl
;	Init	Set up Global conditions used by most commands
;	Read	Reads Drive/Side/Track/Sector
;	Write	Writes Drive/Side/Track/Sector
;	Unclamp	Unclamps the disk in Drive
;	Format	Formats the disk in Drive starting at Side/Track
;	Verify	Reads the disk in Drive starting at Side/Track
;	FormTrack	Formats single Track on Disk in Drive
;	VerTrack	Read single Track on Disk in Drive
;	ReadBF	Read Drive/Side/Track/Sector w/o checksum verify
;	WriteBF	Writes Drive/Side/Track/Sector w/o checksum creation
;	ClpEnty	Will clamp disk in drive
;
;++
.Page

Rwts	.Equ *				; Entry point for Rwts

;	Validate IIob.Command;
;	if not valid then
;	begin
;	   Iob.GoByte := Command error
;	   Carry := Clear
;	   return from Rwts
;	end
;	Validate;
;	if not valid then return from rwts
;	else
;	begin
;	   lock memory
;	   init
;	   call command
;	   Ist := R/W command done
;	   UpdInt
;	end
;	end
;	return from rwts
;++

	Lda	OkToGo			; If <> 0 then interrupt is pending
	Beq	AOk
	Lda	#GeErrIntr		; Pending interrupt error
NotAOk	Jsr	CmdClnUp			; Report error
	Beq	Rw400			; Send an interrupt back to host

AOk	Ldx	IIob+Command		; Fetch the command number
	Cpx	#MaxCmd+1			; compare against maximum command
	Bcc	Rwts4			; Skip if valid
	Lda	#GeErrCmd			; Signal a command error
	Bne	NotAOk			; Local error exit handler

Rwts4	Lda	TestTbl,X			; Fetch bit mask of parameters to check
	Jsr	Validate			; Validate return carry clear if OK
	Jsr	CmdClnUp			; Will clear GoByte and return error code
	Bcs	Rw400			; If error the return FDirH

Rwts40	Jsr	Init			; Set up global conditions used by most commands
	Lda	IIob+Command		; Load with command byte
	Asl	A			; Mult by two to address word entry
	Tax				; Put into index register
	Jsr	Rwts7			; Push return address on stack and execute cmd

	Sta	DisL			; Unlock memory
	Sta	BootH			; Tell 68K that memory is available
	Bcc	Rwts5			; If carry clear then no error
	Sta	Iob+ErrStat		; If error then report this to host

Rw400	.Equ *
	Ldy	CmdX			; And save for posterity
	Cpy	#CmdLeng
	Bne	$10
	Ldy	#6
	Bne	$20
$10	Tya
	Clc
	Adc	#7			; Point at "Speed" byte
	Tay
$20	Lda	Iob+ErrStat
	Sta	@SaveL,y

Rwts5	Lda	#040			; Use drive 80
	Ora	Ist			; Set bit in interrupt status
	Sta	Ist
	Jmp	UpdInt

;--
;
;		Rwts command dispatcher

Rwts7	Lda	RwtsJmp+1,x		; Fetch the high byte of the routine
	Pha				; Push it
	Lda	RwtsJmp,x			; Fetch the low byte of the address
	Pha				; Push it to the stack
	Sta	BootL			; Tell the 68K that memory is disabled
	Sta	DisH			; Disable address al last possible moment
	Rts				; Pop address and jump to it

RwtsJmp	.Word	Read-1,Write-1,UnClamp-1
	.Word	Format-1,Verify-1,FormTrak-1,VerTrack-1
	.Word	ReadBF-1,WriteBf-1,ClpEnty-1

.Page
;++
;
;			Validate
;
; Validates the Iob parameters passed from the 68K depending on the
; bit pattern in the A-reg.
;
; REGISTERS
;  IN
;	A =	Parameters in the Iob to be tested:
;
;	Bit	Contents
;	---	--------
;	0 (LSb)	Drive and a clamped disk
;	1	Side #
;	2	Sector #
;	3	Track #
;	4	Mask
;	5	Confirmation byte
;	6	Write Protection
;	7 (MSb)	Format/Verify parameters
;
;	X =	Any value
;	Y =	Any value
;
;  OUT
;	A =	Destroyed
;	X =	Destroyed
;	Y =	Destroyed
;
; CALLS
;	EnblTest	Test for drive being enabled for interrupts
;	TrkClss	Returns w/ "Y" = class of Track
;	ReadDWP	Tests for write protected disk
;---
.Page

Validate	.Equ *				; Entry point for validate
	Sta	Temp1			; Save "A" here during validation
	Beq	VldNoTst			; If zero then no testing required
	Ldx	#0E			; Test bits 7-0, use 14. to index word array
Valid1	Lsr	Temp1			; Shift and test the carry bit
	Bcc	Valid20			; Bit not set; skip this test
	Stx	Temp2			; Save the "X" couinter value
	Lda	ValJmp+1,x		; Pick up the high byte
	Pha				; Put it on the stack
	Lda	ValJmp,x			; Pick up the low byte
	Pha				; Put it too on the stack
	Rts				; Jmp to the test

; This is the return point after a successful test

Valid2	Ldx	Temp2			; Restore "X" counter value
Valid20	Dex				; Loop count -2 = next test address index
	Dex
	Bpl	Valid1			; Will loop until index is negative
VldNoTst	Lda	#0
	Clc				; Signal no errors
	Rts

; This the return point after a failed test

Valid3	Sec				; Something went wrong
	Rts

;--
;
;		Test drive number, if the drive is enabled and for a clamped disk

ValidDr	Lda	IIob+Drive
	Cmp	#80			; Must use 'Lower' drive value
	Bne	$28
	Lda	Clamped
	Bne	$57			; Yes, there is a clamped disk
$28	Lda	#GeErrClm			; No disk in drive error
	Bne	$57			; Always taken

$57	Jsr	EnblTest			; Test if the drive is enabled
	Bcs	Valid2			; Yes, the drive is enabled
	Lda	#GeErrNA			; Drive not enabled
	Bne	Valid3			; Always taken

;--
;
;		Test side number

ValidSI	Lda	#GeErrSid			; Assume error
	Ldy	IIob+Side
	Beq	Valid2			; side 0 is always good
	Cpy	#01			; now see if side 1
	Bne	Valid3			; Not side 1 either
	Ldy	#02
	Cpy	Iob+NoSides		; Will range from 0 to 2 -- must be 2 for dual sided
	Bne	Valid3			; Not a dual sided drive
	Beq	Valid2

;--
;
;		Test sector number

ValidSe	Jsr	TrkClss			; Find track class
	Lda	IIob+Sector		; New sector number
	Cmp	SecPrTrk,y		; Compare against max sectors per track class
	Bcc	Valid2			; Ok, within limits
	Lda	#GeErrSec			; Oops, to many
	Bne	Valid3			; Always taken

;--
;
;		Test track number

ValidTr	Lda	IIob+Track		; Fetch the track
	Cmp	#MaxTrack+1		; And test against the maximum track number
	Bcc	Valid2			; Ok, nothing wrong so far
	Lda	#GeErrTrk			; Track number i too high, signal error
	Bne	Valid3			; Always taken

;--
;
;		Test mask

ValidCF	Inc	Iob+FmtCnfM		; If correct byte, this will inc to zero
	Beq	Valid2			; Ok, byte was = FF
	Lda	#GeErrFmPr		; Wrong byte
	Bne	Valid3			; Always taken

;--
;
;		Test for write protection

ValidWP	Jsr	ReadWP			; Test for a write protected disk
	Bcs	Valid2			; Carry = 1 ==> not protected
	Lda	#SErrProt			; Write protection error constant
	Bne	Valid3			; Always taken

;--
;
;		Test for format and verify parameters

ValidFV	Lda	IIob+Track
	Ora	IIob+Side			; Must have Trk/Side = 0
	Beq	Valid2			; Params are Ok-continue
	Lda	#GeErrFmPr		; Track/Side <> 0 error
	Bne	Valid3			; Always taken

;--
;
; Validation jump table
;	Table must be in this order -- Drive must be validated and selected
;	prior to checking for write protection

ValJmp	.Word	ValidFV-1,ValidWP-1,ValidCF-1,ValidMA-1,ValidTr-1
	.Word	ValidSe-1,ValidSi-1,ValidDr-1

.Page
;++
;
;		EnblTest
;
; Test IMsk against X-reg to find out if the drive indexed by x is enabled.
;
;--
;
; REGISTERS
;  IN
;	A =	Any Value
;	X =	=0, Drive 0; =2, Drive 80
;	Y =	Any value
;  OUT
;	A=	Destroyed
;	X =	Unchanged
;	Y =	Unchanged
;	Carry =	=Clear, drive not enabled; =Set drive enabled
;
;--

EnblTest	.Equ *				; Entry point for EnblTest

	Lda	#080			; Drive 80
EnblTst1	And	IMsk			; Test against interrupt mask
	Adc	#0F8			; Cause overflow if 008 or larger
	Rts

.Page
;++
;
;		Init
;
; Set up global conditions used by most Rwts commands
;
; REGISTERS
;  IN
;	A =	Any value
;	X =	Any value
;	Y =	Any value
;
;  OUT
;	A =	Destroyed
;	X =	Destroyed
;	Y =	Unchanged
;
;++
;
;	RetryCnt := MaxRetry;
;	RecalCnt := MaxRecal;
;	Error counters := 0;

Init	.Equ *				; Entry point for Init
	Lda	MaxRetry
	Sta	RetryCnt
	Lda	MaxRecal
	Sta	RecalCnt
	Lda	MaxDDly			; Motor off delay time
	Sta	WthHih
	Lda	IIob+Side
	Beq	$09
	Lda	#20			; If side 1 then set only bit 5
	Sta	IIob+Side
$09	Lda	#00
	Sta	WtLow			; Reset 3 byte counter
	Sta	WtMid
	Sta	RtyFlg			; When = 2 then abort read or write operation
	Ldx	#ErrLen			; Number of error counters
$12	Sta	StSlp,x			; Zero the counter
	Dex
	Bpl	$12			; Zero based index
	Rts

.Page
;++
;
;		Call
;
; Calls a routine in the Rom or Ram as specified by the address in AdrL, AdrH.
; This is mostly used by diagnostics.  You can always return from the call by
; Executing an Rts.
;
;
; REGISTERS
;  IN
;	A =	Any value
;	X =	Any value
;	Y =	Any value
;
;  OUT
;	A =	Destroyed
;	X =	Destroyed
;	Y =	Destroyed
;
;++

; First make sure that the motors are off
;  then jump off into the blue

Call	.Equ *				; Entry point for call
	Jsr	PrkClr0			; Park heads, turn off motors & clear GoByte
	Jmp	@IIob+Adrl		; Jump indirect on the address in the IIob

.Page

;++
;
;		ClrIst
;
; Clears selected bits in the Ist (Interrupt Status) and then checks if FDir
; should still be high. Mask should contain a 1 for the bits in Ist to
; be switched off
;
; REGISTERS
;  IN
;	A =	Any value
;	X =	Any value
;	Y =	Any value
;  OUT
;	A =	Destroyed
;	X =	Unchanged
;	Y =	Unchanged
;
; CALLS
;	UpdInt	Updates FDir depending in Ist
;
;++

ClrIst	.Equ *				; Entry point for ClrIst
	Lda	IIob+Mask			; Fetch the mask
	Eor	#0FF			; Ones complement
	And	Ist			; And with Ist to switch off selected bits
	Sta	Ist			; Save new Ist
ClrExit	Jmp	UpdInt			; Calculate new status of FDir

.Page

;++
;
;		SetIMsk
;
; Sets (Enables) the interrupt mask fro drive 0 and drive 80 and computes the
; new status if FDir.
;
; REGISTERS
;  IN
;	A =	Any value
;	X =	Any value
;	Y =	Any value
;  OUT
;	A =	Destroyed
;	X =	Unchanged
;	Y =	Unchanged
;
; CALLS
;	UpdInt	Update FDir status
;
;	Imsk := $88
;	Call UpdInt -- will return from UpdInt to caller
;++

SetImsk	.Equ *				; Entry point for SetIMsk
	Lda	IIob+Mask
	Ora	IMsk
	Sta	IMsk			; Save the new IMsk value
	Jmp	UpdInt			; Calculate the new status of FDir

.Page
;++
;
;		ClrImsk
;
; Clears (Disables) then IMsk (Interrupt Status) selectivly.  Computes new status
; of the FDir.
;
; REGISTERS
;  IN
;	A =	Any value
;	X =	Any value
;	Y =	Any value
;  OUT
;	A =	Destroyed
;	X =	Unchanged
;	Y =	Unchanged
;
; CALLS
;	UpdInt	Update FDir
;
;	Call UpdInt -- Will return from UpdInt to caller
;++

ClrIMsk	.Equ *				; Entry point for ClrIMsk
	Lda	IIob+Mask
	Eor	#0FF
	And	IMsk
	Sta	IMsk			; Save new IMsk value
	Jmp	UpdInt			; Calculate new status of FDir
Home Documents Lisa FR3TO1.Text
FR3TO1.Text

FR3TO1.Text

Lisa · TEXT
FilenameFR3TO1.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
;++
;		FR3TO1 will take three bytes and create one composite byte from them.
;
;		Input register usage:
;			A :=	>CCCCCCCC<
;			X :=	>BBBBBBBB<
;			Y :=	>AAAAAAAA<
;
;		Output register usage:
;			A :=	>00AABBCC< == Nibblized
;--

FR3TO1	.Equ *			; From three to one routine
	Lsr	A		; Ignore low six bits of "A" as they
	Lsa	A		;  will get shifted out and lost
	Sta	Temp1		; >00CCxxxx<
	Txa
	And	#0C0		; Clear low bits
	Ora	Temp1		; >BBCCxxxx<
	Lsr	A
	Lsr	A
	Sta	Temp1		; >00BBCCxx<
	Tya
	And	#0C0		; Clear low bits
	Ora	Temp!		; >AABBCCxx<
	Lsr	A
	Lsr	A		; >00AABBCC<
	Tax
	Lda	Nibl,X		; Nibblize the new composite byte
	Rts
Home Documents Lisa Interface.Text
Interface.Text

Interface.Text

Lisa · TEXT
FilenameInterface.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
;++
;		Interface Routines
;--

SelSide	.Equ *
	Ldx	#0
	Lda	#20
	Bit	IIob+Side
	Beq	SetSel
	Inx

SetSel	.Equ *
	Lda	Ca0+High
	Lda	Ca1+High
	Lda	Side0Sel,x
	Txa
	Rts

SetLow	.Equ *
	Ldx	#Low			; set Side Select line low
	Beq	SetSel

SetHigh	.Equ *
	Ldx	#High			; Set line high
	Bne	SetSel

ReadWp	.Equ *
	Jsr	SetHigh
RdS2	Lda	Ca1+Low
RdS1	Lda	Ca2+Low
ReadIt	.Equ *				; Read sense bit & rotate into ccC
	Lda	Q6H			; Ensure state machine in proper state
	Lda	Q7L			; Read sense daata into bit 7
	Asl	A			; Move bit 7 into carry
	Rts

ReadIndx	.Equ *
	Clc
Rid	.Equ *
	Jsr	SetHigh
	Lda	Ca0+Low
	Bcc	RdS1			; set Ca2 = 0
	Bcs	RdS2			; set Ca1 & Ca2 = 0

ReadDip	.Equ *
	Sec
	Bcs	Rid

DoStrb	.Equ *
	Sta	LStrb+High
	Nop
	Nop
	Sta	LStrb+Low
	Rts

TrMtOff	.Equ *				; Will turn motors off
	Sta	Ca2+High
	Lda	#00
	Beq	TurnMtr

TrMtrOn	.Equ *				; Will turn the Sony motor on
	Sta	Ca2+Low
	Lda	#0FF

TurnMtr	.Equ *
	Sta	MtrOn			; Set state register in Ram
	Jsr	SetLow			; Set side select line low
	Sta	Ca0+Low
	Jmp	DoStrb

TMOn	.Equ *				; Turn on motor & setup for tach reading
	Jsr	TrnMtrOn			; will leave Ca0 = 0
	Lda	#80.			; 400(5*80) msec constant
	Jsr	Wait
SetTach	.Equ *
	Jsr	SetHigh			; set Side Select = 1 for Tach input
	Lda	Ca2+Low			; '10011' for tach mode
	Rts

SetDrexX	.Equ *				; use value in Xreg for direction
	Stx	Direct
SetDrct	.Equ *
	Jsr	SetLow			; set Side Select line low
	Sta	Ca0+Low
	Sta	Ca1+Low
	Ldx	Direct			; 0 or 1 for offset of direction
	Sta	Ca2,x
	Jmp	DoStrb

DoStep	.Equ *
	Lda	#1
	Sta	Temp1			; Try twice
	Jsr	SetLow			; Set Side Select line low
	Sta	Ca1+Low
	Sta	Ca2+Low
	Jsr	DoStrb
$10	Jsr	WaitAlt			; Wait 12 ms for /Step to go high
	Jsr	ReadIt			; ccC = /Step -- 0 = low & 1 = high
	Bcs	DoStDone			; /Step is high so all is cool
	Lda	#StepErr
	Sta	Iob+SeekErr		; For external debugging aid ( FCC01B )
	Dec	Temp1
	Bpl	$10			; wait another 12 ms
DoStDone	.Equ *				; fall through and exit w no error
	Rts

DoSeek	.Equ *
	Jsr	SetDrct			; Set the direction
$23	Jsr	DoStep
	Dec	StpAmt			; Count down the number of steps to take
	Bne	$23			; Exit upon reaching zero
	Rts

SetSpeed	.Equ *
	Jsr	TrkClss			; Return w/ "Y" = class of IIob+Track
SetSpdy	.Equ *				; already has "y" = track class
	Sty	CurClass
	Lda	MSpdTbl,y
	Sta	PwmReg
	Rts

SetRMode	.Equ *
	Jsr	SelSide			; use value in IIob+Side to set proper side
	Sta	Ca0+Low
	Sta	Ca1+Low
	Sta	Ca2+High			; 'x100' is input to MCI PAL on Sony
	Rts

UnClamp	.Equ *
	Jsr	SetLow
	Sta	Ca2+High			; '0111'
	Lda	LStrb+High
	Lda	#150.			; 3/4 sec (200*5 usec ) delay for ejection
	Jsr	Wait			; Will wait & return w/ carry cleared
	Lda	LStrb+Low
	Lda	#0
	Sta	Clamped			; Tell me disk is no longer clamped
	Clc
	Rts

HardInit	.Equ *				; Initialize hardware -- PWM & Iwm
	Ldx	#0e	
$7	Sta	IOSpace,x			; Reset all IWM internal latches to zero state
	Dex	
	Dex
	Bpl	$7			; Loop 8 times
	Lda	#202.
	Jsr	Wait			; wait for 1.01 sec for timer to expire

	Ldx	#0			; $10000 times before timeout
	Stx	Temp1

$15	Dex	
	Bne	$30
	Dec	Temp1
	Beq	HardAbort			; If timeout then IWM is out to lunch

$30	Lda	Q6H			; Put IWM state machine into SENSE mode
	Lda	Q7L			; Read status data
	Tay				; Save IWM's status information
	And	#20			; Test bit #5
	Bne	$15			; Wait for bit #5 to be clear ( 0 )

	Tya				; Restore status info
	And	#IWMMode			; Mask off unneeded bits

	Cmp	#IWMMode			; look for proper bits to be set
	Beq	$45			; if same then all is OK


	Lda	#IWMMode			; Asynch, 8 MHz, latch, 2 usec calls, no timer
	Sta	Q7H			; Setup to proper Sony mode
	Lda	Q7L			; back to SENSE mode
	Jmp	$15			; Walk through & make sure it works

$45	Sta	DrEna+High		; Select drive 1
	Sta	MtEna+On			; Now enable that drive for ever and ever
	Ldx	MSpdTbl			; Default speed code for track 0
	Stx	CntEna+Low		; Enable counter/comparator
	Stx	PWMReg			
	Stx	PwmEna+High		; Enable output of Pwm pulse
	Rts

HardAbort	.Equ *
	Lda	#IWMError			; Fatal error w/ IWM -- does not respond
	Sta	Iob+ErrStat
	Jmp	FatalErr			; Abort and never return

ChkDrv	.Equ *				; Check for drive connected and number of sides
	Lda	#1
	Sta	Iob+NoSides		; Assume single sided drive
	Jsr	SetLow			
	Sta	Ca2+High			; '0111'
	Sec				; Assume no drive exists
	Lda	Q7L			; High bit = status
	Bmi	$30			; If bit7 = 1 then no drive is connected
	Dec	DrvConn			; Set drive connected flag
	Clc	
	Sta	Ca0+Low			; Assume only single sided
	Ldx	Q7L
	Bpl	$23			 
	Inc	Iob+NoSides		; 2 = double sided drive
	Ora	#20			; Set double sided flag for format field
$23	Sta	FmtType			; For use in formatting
$30	Rts				; ccC = 0 ==> drive connected
Home Documents Lisa DENIBBLE.Text
DENIBBLE.Text

DENIBBLE.Text

Lisa · TEXT
FilenameDENIBBLE.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
;--
;
;				De-Nibble Table
;
; 7-Bit to 6-Bit 'Denibbleze' table (16 sector format).
; Valid codes 096 to 0FF only.
; Codes with more than one pair of adjacent zeroes or with no adjacent ones
; (except Bit 7) are excluded.
;
;++

	.Org	1196
DNibl	.Equ *-96
	.Byte 000,001,098
	.Byte 099,002,003
	.Byte 09C,004,005
	.Byte 006,0A0,0A1
	.Byte 0A2,0A3,0A4
	.Byte 0A5,007,008
	.Byte 0A8,0A9,0AA
	.Byte 009,00A,00B
	.Byte 00C,00D,0B0
	.Byte 0B1,00E,00F
	.Byte 010,011,012
	.Byte 013,0B8,014
	.Byte 015,016,017
	.Byte 018,019,01A
	.Byte 0C0,0C1,0C2
	.Byte 0C3,0C4,0C5
	.Byte 0C6,0C7,0C8
	.Byte 0C9,0CA,01B
	.Byte 0CC,01C,01D
	.Byte 01E,0D0,0D1
	.Byte 0D2,0AF,0D4
	.Byte 0D5,020,021
	.Byte 0D8,022,023
	.Byte 024,025,026
	.Byte 027,028,0E0
	.Byte 0E1,0E2,0E3
	.Byte 0E4,029,02A
	.Byte 02B,0EB,02C
	.Byte 02D,02E,02F
	.Byte 030,031,032
	.Byte 0F0,0F1,033
	.Byte 034,035,036
	.Byte 037,038,0F8
	.Byte 039,03A,03B
	.Byte 03C,03D,03E
	.Byte 03F
Subscribe to ROM88
mp.ls