mirror of
https://github.com/dschmenk/apple2pi.git
synced 2024-11-24 12:31:30 +00:00
1 line
23 KiB
Plaintext
1 line
23 KiB
Plaintext
|
; PiDrive - Based on VSDRIVE by David Schmidt
; 1.0 - Initial release
.TITLE "Apple /// PiDrive Driver"
.PROC PIDRIVE
DriverVersion .EQU 1000 ; Version number
DriverMfgr .EQU 4453 ; Driver Manufacturer - DS
;
; SOS Equates
;
ExtPG .EQU 1401 ; Driver extended bank address offset
AllocSIR .EQU 1913 ; Allocate system internal resource
SysErr .EQU 1928 ; Report error to system
EReg .EQU 0FFDF ; Environment register
ReqCode .EQU 0C0 ; Request code
SOS_Unit .EQU 0C1 ; Unit number
SosBuf .EQU 0C2 ; SOS buffer pointer (2 bytes)
ReqCnt .EQU 0C4 ; Requested byte count
CtlStat .EQU 0C2 ; Control/status code
CSList .EQU 0C3 ; Control/status list pointer
SosBlk .EQU 0C6 ; Starting block number
QtyRead .EQU 0C8 ; Pointer to bytes read returned by D_READ
;
; Our temps in zero page
;
Count .EQU 0CE ; 2 bytes
Timer .EQU 0D0 ; 2 bytes
NumBlks .EQU 0D2 ; 2 bytes lb,hb
DataBuf .EQU 0D4 ; 2 bytes
CmdAck .EQU 0D6 ; 1 byte
;
; Communications hardware constants
;
ACIADR .EQU 0C088 ; ACIA Data register
ACIASR .EQU 0C089 ; ACIA Status register
ACIACMD .EQU 0C08A ; ACIA Command mode register
ACIACTL .EQU 0C08B ; ACIA Control register
;
; SOS Error Codes
;
XDNFERR .EQU 010 ; Device not found
XBADDNUM .EQU 011 ; Invalid device number
XREQCODE .EQU 020 ; Invalid request code
XCTLCODE .EQU 021 ; Invalid control/status code
XCTLPARAM .EQU 022 ; Invalid control/status parameter
XNORESRC .EQU 025 ; Resources not available
XBADOP .EQU 026 ; Invalid operation
XIOERROR .EQU 027 ; I/O error
XNODRIVE .EQU 028 ; Drive not connected
XBYTECNT .EQU 02C ; Byte count not a multiple of 512
XBLKNUM .EQU 02D ; Block number to large
XDISKSW .EQU 02E ; Disk switched
XNORESET .EQU 033 ; Device reset failed
;
; Switch Macro
;
.MACRO switch
.IF "%1" <> "" ; If parameter 1 is present
LDA %1 ; Load A with switch index
.ENDC
CMP #%2+1 ; Do bounds check
BCS $010
ASL A
TAY
LDA %3+1,Y ; Get switch index from table
PHA
LDA %3,Y
PHA
.IF "%4" <> "*" ; If parameter 4 omitted,
RTS ; then go to code
.ENDC
$010 .ENDM
;
; Enter Critical Section
;
.MACRO EnterCritSec
PHA
LDA EReg
ORA #080 ; Set 1MHz switch
STA EReg
PLA
PHP ; Disable interrupts
SEI
.ENDM
;
; Leave Critical Section
;
.MACRO LeaveCritSec
PHA
LDA EReg
AND #07F
STA EReg ; Whatever it was - set it back
PLA
PLP ; Restore interrupt state
.ENDM
;
; Comment Field of driver
;
.WORD 0FFFF ; Signal that we have a comment
.WORD 46. ; Length of comment field... entered manually.
|