mirror of
https://github.com/antoinevignau/source.git
synced 2025-01-07 07:29:49 +00:00
1 line
14 KiB
Plaintext
1 line
14 KiB
Plaintext
|
;*******************************************************
;
; SCSI Driver 'Write' filter.
;
; Written by Matt Gulick. Started June 14,1988
;
; Copyright Apple Computer, Inc. 1988,89
;
;*******************************************************
;*******************************************************
;
; This file contains the 'Write' filter as defined in
; the ERS.
;
;*******************************************************
;*******************************************************
;
; Revision History:
;
;*******************************************************
; June 14, 1988 File started.
; June 21, 1988 Modified to mach the results of
; the Code Review and added
; register comments.
STRING PASCAL
BLANKS OFF
PAGESIZE 70
PRINT NOGEN
PRINT NOMDIR
MACHINE M65816
IMPORT unit_state
IMPORT test_unit_rdy
IMPORT auto_sense_data
IMPORT main_drvr
IMPORT call_type
IMPORT w_update_cache
IMPORT divend
IMPORT divsor
IMPORT result
IMPORT max_blk_cnt
IMPORT divide
IMPORT check_532_rw
PRINT OFF
INCLUDE 'scsihd.equates'
INCLUDE 'M16.MEMORY'
INCLUDE 'M16.UTIL'
PRINT ON
EJECT
;*******************************************************
;
; Main Entry point to the 'Write' filter. This
; "Filter" takes the information given by the caller
; on direct page and builds the equivilent to a Write
; Extended Control Call. In order of appearence:
;
; Verify that Device # <09> $0000
; Call Number = $0003
; Block Size = dib.blksize
;
; We now Build the SCSI Main Driver Command and send
; it.
;
; The following will be validated by the Main Driver
; when it builds the command.
;
; Request Count = Block Size * i
; Block Number = Blk Num + Offset
; This is for partitions.
;
; After calling the Main driver and if no errors were
; encountered, then the Transfer count will be
; updated.
;
; Inputs: None.
;
; Outputs: Acc = 0
; Carry = 0
; Y register = Unspecified
; X register = Unspecified
; P register = 0=M=X=e
; Direct Page = GS/OS Direct Page
; Data Bank = Ours
;
; Errors: See Spec.
;
;*******************************************************
EXPORT Write
Write PROC
;-------------------------------------------------------------------------------
IF scsi_dtype = scanner THEN
;
; Device is not writable.
;
lda #drvr_bad_req
sec
rts
ENDIF
;-------------------------------------------------------------------------------
IF scsi_dtype = apple_cd\
OR scsi_dtype = changer THEN
;
; Device is not writable.
;
lda #drvr_wrt_prot
sec
rts
ENDIF
;-------------------------------------------------------------------------------
IF scsi_dtype <> apple_cd\
AND scsi_dtype <> changer\
AND scsi_dtype <> scanner THEN
stz @cache
;
; Is the device Removable?
;
ldy #dib.dvcchar
lda [dib_ptr],y
and #removable
beq @write ;No.
;
; This device is removable. Now we
; need to check to see if the unit
; has gone offline, (then we need to
; report that to the OS) or if the
; unit has come back online (Rebuild
; the DIBs).
;
jsr unit_state
bcs @rts_out
;
; Is the device online?
;
ldy #dib.dvcflag
lda [dib_ptr],y
and #dvc_hardofl
bne @off_line ;Yes.
lda [dib_ptr],y
and #dvc_online
bne @write ;Yes.
;
; Device is currently offline.
;
@off_line lda #drvr_off_line
sec
@rts_out rts
;
; Let's check the request count. If
; this is $00000000, then exit clean
; with no data transfered.
;
@write lda <rqst_cnt
and #$01ff ;Cheap Check for multiple of 512
bne @bad_rqst_cnt
lda <rqst_cnt
ora <rqst_cnt+2
bne @chk_max
jmp @completed
;
|