mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2024-12-29 07:29:15 +00:00
4325cdcc78
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included. The Tools directory, containing mostly junk, is also excluded.
148 lines
4.1 KiB
Plaintext
148 lines
4.1 KiB
Plaintext
;_______________________________________________________________________
|
|
;
|
|
; File: SonySWIM3AMIC.a
|
|
;
|
|
; Written by: Gary Rensberger 1-Feb-93
|
|
; Broken out of SonySWIM3.a by Monte Benaresh 1/4/94.
|
|
;
|
|
; Copyright: © 1993-94 by Apple Computer, Inc., all rights reserved.
|
|
;
|
|
; Change History (most recent first):
|
|
;
|
|
; <SM2> 1/31/94 LB Changed SWIM3 register accesses to use the new address table in
|
|
; SWIM3Vars. See <SM22> comments in SonySWIM3.a.
|
|
; <1> 1/4/94 LB first checked in
|
|
;_______________________________________________________________________
|
|
;
|
|
; AMIC DMA routines for Sony SWIM3 driver
|
|
;
|
|
; This file contains the hardware-specific routines for the AMIC DMA
|
|
; controller, used on PDM. These routines are installed into vectors
|
|
; which are called by the Sony SWIM3 floppy driver.
|
|
;
|
|
; To do:
|
|
;_______________________________________________________________________
|
|
|
|
|
|
with SWIM3Vars
|
|
|
|
;_______________________________________________________________________
|
|
;
|
|
; Routine: jsr StartDMAAction
|
|
; Inputs: d0.l- DMA timeout value
|
|
; d1 - drive#
|
|
; a1 - Globals
|
|
; Outputs: none
|
|
; Destroys: d0,a0
|
|
; Calls: none
|
|
; Called by: RawTrackRead, ReadRawHeader
|
|
;
|
|
; Function: This routine saves state in the DMARegSave area, and starts
|
|
; the DMA, returning to the caller's caller.
|
|
;_______________________________________________________________________
|
|
|
|
jStartAMICDMAAction
|
|
movem.l a3/d1-d3,DMARegSave(a1) ; save state
|
|
move.l (sp)+,DMACompletionPtr(a1) ; stuff the completion routine
|
|
|
|
bsr.s StartDMATimeout ; start a time-out for the DMA
|
|
|
|
movea.l DMABaseAddr(a1),a0 ; get ptr to DMA controller
|
|
ori.b #(1<<DMAIE),\
|
|
DMAFloppyCS(a0) ; enable the interrupt
|
|
|
|
move.b #StartAction,([vOnes,a1]) ; Start action
|
|
|
|
moveq #noErr,d0 ; return to caller's caller with no error
|
|
rts
|
|
|
|
;_______________________________________________________________________
|
|
;
|
|
; Routine: jsr SetUpDMAXFer
|
|
; Inputs: a0 - DMA transfer address
|
|
; a1 - SonyVars ptr
|
|
; d0 - bit 31 = 0 -> read
|
|
; = 1 -> write
|
|
; bits 0-30 -> transfer count
|
|
; Outputs: none
|
|
; Destroys: d0
|
|
; Calls:
|
|
; Called by:
|
|
;
|
|
; Function: Sets up address, count, and direction for a DMA
|
|
; transfer.
|
|
;_______________________________________________________________________
|
|
|
|
jSetUpAMICDMAXfer
|
|
move.l a2,-(sp) ; use a2 for DMA regs ptr
|
|
movea.l DMABaseAddr(a1),a2 ; get ptr to DMA controller
|
|
move.b d0,DMAFloppyCount+1(a2)
|
|
lsr.w #8,d0
|
|
move.b d0,DMAFloppyCount(a2) ; setup the count
|
|
|
|
move.w a0,d0 ; get 16-bit address
|
|
move.b d0,DMAFloppyBase+3(a2) ; set floppy DMA buffer addr
|
|
lsr.w #8,d0
|
|
move.b d0,DMAFloppyBase+2(a2)
|
|
nop
|
|
|
|
move.b DMAFloppyCS(a2),d0 ; get current reg value
|
|
bclr #DMADIR,d0 ; assume DMA direction is 'read'
|
|
btst.l #31,d0 ; test direction bit
|
|
beq.s @read
|
|
@write
|
|
ori.b #(1<<DMADIR),d0 ; set bit for write
|
|
@read
|
|
ori.b #(1<<DMARUN),d0
|
|
move.b d0,DMAFloppyCS(a2) ; Start the DMA controller
|
|
|
|
move.l (sp)+,a2
|
|
rts
|
|
|
|
;_______________________________________________________________________
|
|
;
|
|
; Routine: jsr ClearDMAInt
|
|
; Inputs: a1 - SonyVars ptr
|
|
; Outputs: none
|
|
; Destroys: none
|
|
; Calls:
|
|
; Called by:
|
|
;
|
|
; Function: Clears floppy DMA controller interrupt.
|
|
;_______________________________________________________________________
|
|
|
|
jClearAMICDMAInt
|
|
move.l a0,-(sp)
|
|
|
|
movea.l DMABaseAddr(a1),a0 ; get ptr to DMA controller
|
|
andi.b #~((1<<DMAIE)+(1<<DMARUN)),\
|
|
DMAFloppyCS(a0) ; disable the interrupt
|
|
ori.b #(1<<DMAIF),DMAFloppyCS(a0) ; clear the floppy DMA interrupt
|
|
|
|
move.l (sp)+,a0
|
|
rts
|
|
|
|
;_______________________________________________________________________
|
|
;
|
|
; Routine: jsr StopDMA
|
|
; Inputs: a1 - SonyVars ptr
|
|
; Outputs: none
|
|
; Destroys: none
|
|
; Calls:
|
|
; Called by:
|
|
;
|
|
; Function: Stops the floppy DMA channel.
|
|
;_______________________________________________________________________
|
|
|
|
jStopAMICDMA
|
|
move.l a0,-(sp)
|
|
|
|
movea.l DMABaseAddr(a1),a0 ; get ptr to DMA controller
|
|
andi.b #~(1<<DMARUN),DMAFloppyCS(a0) ; Stop the DMA controller
|
|
|
|
move.l (sp)+,a0
|
|
rts
|
|
|
|
|
|
endwith ; SWIM3Vars
|