OpenCores
URL https://opencores.org/ocsvn/System09/System09/trunk

Subversion Repositories System09

[/] [System09/] [branches/] [mkfiles_rev1/] [src/] [Flex9/] [f9-dkcf8.asm] - Diff between revs 42 and 66

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 42 Rev 66
*
*
** FLEX 9 COMPACT FLASH DISK DRIVERS
** FLEX 9 COMPACT FLASH DISK DRIVERS
*
*
* FOR SYS09BUG 1.2 ON THE BURCHED B5-X300
* FOR SYS09BUG 1.2 ON THE BURCHED B5-X300
* WITH I/O MAPPED AT $XE000
* WITH I/O MAPPED AT $XE000
* AND ROM MAPPED AT $XF000
* AND ROM MAPPED AT $XF000
* THE BURCHED B5-X300 HAS 256KBYTES OF SRAM
* THE BURCHED B5-X300 HAS 256KBYTES OF SRAM
* THE FIRST 64K IS USED BY FLEX,
* THE FIRST 64K IS USED BY FLEX,
* THE SECOND 192K MAY BE USED AS A RAM DISK
* THE SECOND 192K MAY BE USED AS A RAM DISK
*
*
*
*
IMASK  EQU $10     IRQ MASK CC
IMASK  EQU $10     IRQ MASK CC
FMASK  EQU $40     FIRQ MASK CC
FMASK  EQU $40     FIRQ MASK CC
DATREG EQU $FFF0   DAT REGISTERS
DATREG EQU $FFF0   DAT REGISTERS
*
*
CF_BASE    EQU $E040
CF_BASE    EQU $E040
CF_DATA    EQU CF_BASE+0
CF_DATA    EQU CF_BASE+0
CF_ERROR   EQU CF_BASE+1 ; read error
CF_ERROR   EQU CF_BASE+1 ; read error
CF_FEATURE EQU CF_BASE+1 ; write feature
CF_FEATURE EQU CF_BASE+1 ; write feature
CF_SECCNT  EQU CF_BASE+2
CF_SECCNT  EQU CF_BASE+2
CF_SECNUM  EQU CF_BASE+3
CF_SECNUM  EQU CF_BASE+3
CF_CYLLO   EQU CF_BASE+4
CF_CYLLO   EQU CF_BASE+4
CF_CYLHI   EQU CF_BASE+5
CF_CYLHI   EQU CF_BASE+5
CF_HEAD    EQU CF_BASE+6
CF_HEAD    EQU CF_BASE+6
CF_STATUS  EQU CF_BASE+7 ; read status
CF_STATUS  EQU CF_BASE+7 ; read status
CF_COMAND  EQU CF_BASE+7 ; write command
CF_COMAND  EQU CF_BASE+7 ; write command
*
*
* Command Equates
* Command Equates
*
*
CMDREAD    EQU $20 ; Read Single sector
CMDREAD    EQU $20 ; Read Single sector
CMDWRITE   EQU $30 ; Write Single sector
CMDWRITE   EQU $30 ; Write Single sector
CMDFEATURE EQU $EF
CMDFEATURE EQU $EF
FEAT8BIT   EQU $01 ; enable 8 bit transfers
FEAT8BIT   EQU $01 ; enable 8 bit transfers
HEADLBA    EQU $E0
HEADLBA    EQU $E0
*
*
* Status bit equates
* Status bit equates
*
*
BSY        EQU $80
BSY        EQU $80
DRDY       EQU $40
DRDY       EQU $40
DRQ        EQU $08
DRQ        EQU $08
ERR        EQU $01
ERR        EQU $01
       ORG   $DE00
       ORG   $DE00
*
*
* DISK DRIVER JUMP TABLE
* DISK DRIVER JUMP TABLE
*
*
READ   JMP   READSC
READ   JMP   READSC
WRITE  JMP   WRITSC
WRITE  JMP   WRITSC
VERIFY JMP   BUSY
VERIFY JMP   BUSY
RESTOR JMP   RESTR1
RESTOR JMP   RESTR1
DRIVE  JMP   DRVSEL
DRIVE  JMP   DRVSEL
DRVRDY JMP   CHKDRV
DRVRDY JMP   CHKDRV
QUICK  JMP   CHKDRV
QUICK  JMP   CHKDRV
COLDDR JMP   INITDR
COLDDR JMP   INITDR
WARMDR JMP   WARMD1
WARMDR JMP   WARMD1
SEEK   JMP   SEEKTS
SEEK   JMP   SEEKTS
*
*
* RAM SPACE
* RAM SPACE
*
*
DRVNUM FCB   0
DRVNUM FCB   0
*
*
*
*
* INITIALIZE CF CARD FOR 8 BIT LBA MODE
* INITIALIZE CF CARD FOR 8 BIT LBA MODE
*
*
INITDR BSR WAITRDY
INITDR BSR WAITRDY
       LDA  #HEADLBA
       LDA  #HEADLBA
       STA  CF_HEAD
       STA  CF_HEAD
       LDA #FEAT8BIT
       LDA #FEAT8BIT
       STA CF_FEATURE
       STA CF_FEATURE
       LDA #CMDFEATURE
       LDA #CMDFEATURE
       STA CF_COMAND
       STA CF_COMAND
       BRA WAITRDY
       BRA WAITRDY
*
*
* RESTORE DISK DRIVER (SEEK TRACK 00)
* RESTORE DISK DRIVER (SEEK TRACK 00)
*
*
RESTR1 BSR   DRVSEL
RESTR1 BSR   DRVSEL
       CLRA           ; Track 0
       CLRA           ; Track 0
       LDB   #$01     ; Sector 1
       LDB   #$01     ; Sector 1
*
*
* Seek track and sector
* Seek track and sector
* A holds track number (0 - ??)
* A holds track number (0 - ??)
* B holds sector number (1 - ??)
* B holds sector number (1 - ??)
* Sector numbers starts from 1
* Sector numbers starts from 1
* subtract 1 to start from sector 0 on CF
* subtract 1 to start from sector 0 on CF
*
*
SEEKTS DECB
SEEKTS DECB
       STB  CF_SECNUM
       STB  CF_SECNUM
       STA  CF_CYLLO
       STA  CF_CYLLO
       LDB  DRVNUM
       LDB  DRVNUM
       STB  CF_CYLHI
       STB  CF_CYLHI
       LDB  #$01
       LDB  #$01
       STB  CF_SECCNT
       STB  CF_SECCNT
       CLRB
       CLRB
WARMD1 RTS
WARMD1 RTS
*
*
* READ SECTORS FROM CF
* READ SECTORS FROM CF
*
*
*
*
READSC BSR  SEEKTS
READSC BSR  SEEKTS
       LDA  #CMDREAD ; IDE READ MULTIPLE
       LDA  #CMDREAD ; IDE READ MULTIPLE
       STA  CF_COMAND
       STA  CF_COMAND
       BSR  WAITRDY
       BSR  WAITRDY
*
*
* READ LOOP
* READ LOOP
*
*
       CLRB
       CLRB
RDLP1  BSR  WAITDRQ
RDLP1  BSR  WAITDRQ
       LDA  CF_DATA
       LDA  CF_DATA
       STA  ,X+
       STA  ,X+
       DECB
       DECB
       BNE  RDLP1
       BNE  RDLP1
*
*
       CLRB
       CLRB
RDLP2  BSR  WAITDRQ
RDLP2  BSR  WAITDRQ
       LDA  CF_DATA
       LDA  CF_DATA
       DECB
       DECB
       BNE  RDLP2
       BNE  RDLP2
*
*
       BSR  WAITRDY
       BSR  WAITRDY
       CLRB
       CLRB
       RTS
       RTS
*
*
* WRITE SECTOR TO CF
* WRITE SECTOR TO CF
*
*
WRITSC BSR  SEEKTS   ; SEEK TRACK & SECTOR
WRITSC BSR  SEEKTS   ; SEEK TRACK & SECTOR
       LDA  #CMDWRITE; IDE WRITE MULTIPLE
       LDA  #CMDWRITE; IDE WRITE MULTIPLE
       STA  CF_COMAND
       STA  CF_COMAND
       BSR  WAITRDY
       BSR  WAITRDY
*
*
* WRITE LOOP
* WRITE LOOP
*
*
       CLRB
       CLRB
WRTLP1 BSR  WAITDRQ
WRTLP1 BSR  WAITDRQ
       LDA  ,X+
       LDA  ,X+
       STA  CF_DATA
       STA  CF_DATA
       DECB
       DECB
       BNE  WRTLP1
       BNE  WRTLP1
*
*
       CLRB
       CLRB
WRTLP2 BSR  WAITDRQ
WRTLP2 BSR  WAITDRQ
       CLRA
       CLRA
       STA  CF_DATA
       STA  CF_DATA
       DECB
       DECB
       BNE WRTLP2
       BNE WRTLP2
*
*
       BSR  WAITRDY
       BSR  WAITRDY
       CLRB
       CLRB
       RTS
       RTS
*
*
* CHECK FOR BUSY
* CHECK FOR BUSY
* Doubles as VERIFY
* Doubles as VERIFY
*
*
BUSY   CLRB            Never busy
BUSY   CLRB            Never busy
       RTS
       RTS
*
*
* DRIVE SELECT DISK DRIVER
* DRIVE SELECT DISK DRIVER
*
*
DRVSEL LDA   3,X       GET DRIVE # FROM FCB
DRVSEL LDA   3,X       GET DRIVE # FROM FCB
       CMPA  #3
       CMPA  #3
       BLS   DRVS2     IF > 3, SET IT TO 0
       BLS   DRVS2     IF > 3, SET IT TO 0
       CLRA
       CLRA
DRVS2  STA   DRVNUM
DRVS2  STA   DRVNUM
       CLRB            ; SET Z, CLEAR C
       CLRB            ; SET Z, CLEAR C
       RTS
       RTS
*
*
* CHECK DRIVE READY DISK DRIVER
* CHECK DRIVE READY DISK DRIVER
*
*
CHKDRV LDA  3,X
CHKDRV LDA  3,X
       CLRB             ; CLEAR C, SET Z
       CLRB             ; CLEAR C, SET Z
       RTS
       RTS
*
*
* WAIT UNTIL READY
* WAIT UNTIL READY
*
*
WAITRDY LDA  CF_STATUS
WAITRDY LDA  CF_STATUS
        BITA #BSY
        BITA #BSY
        BNE  WAITRDY
        BNE  WAITRDY
        LDA  CF_STATUS
        LDA  CF_STATUS
        BITA #DRDY
        BITA #DRDY
        BEQ  WAITRDY
        BEQ  WAITRDY
        RTS
        RTS
*
*
* WAIT FOR DATA REQUEST
* WAIT FOR DATA REQUEST
*
*
WAITDRQ LDA  CF_STATUS
WAITDRQ LDA  CF_STATUS
        BITA #DRQ
        BITA #DRQ
        BEQ  WAITDRQ
        BEQ  WAITDRQ
        RTS
        RTS
*
*
        END
        END
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.