Subversion Repositories MB01 Project

Rev

Blame | Last modification | View Log | Download | RSS feed

;----------------------------------------------------------
; GLOBAL.INC
; PROGETTO: B1601
;
; Definizioni globali
;----------------------------------------------------------

.LIST off
        
; Evita inclusioni multiple
.IFNDEF _GLOBAL_INC_

_GLOBAL_INC_    .DEFL   1

        .CHIP 65816
        .RADIX 10
        .SYMBOLS        
        .LINKLIST
        .DEBUG  ASM
        .OPTIONS dc2
        .LINEAR on
        .SPACES on

;----------------------------------------------------------
; ---- parametri dipendenti dal clock
;----------------------------------------------------------
        
; specificare CLK in MHz
PHI2    .SET    4       ; default 4MHz

; specificare periodo timer clock in ms
TJIFFY  .SET    10      ; default 10ms

;----------------------------------------------------------


        .INCLUDE        inc\macro.inc
        .INCLUDE        inc\segm.inc
        .INCLUDE        inc\chips.inc
        .INCLUDE        inc\kbd.inc
        .INCLUDE        inc\scn.inc
        .INCLUDE        inc\bios.inc

SYSTMRCNT       .EQU    4       ; numero timer di sistema

;;VDC20MHZ      .EQU    0        

RAM0TOP         .EQU    $FC00           ; Top + 1 RAM banco 0 
RAM0SYS         .EQU    $FE00           ; Start SYS. RAM banco 0

STACK_ADDR      .EQU    $DFFF           ; top stack
STACK_END       .EQU    $8000

; DP
P0MAT   .EQU    $0200
FSWP0   .EQU    $0500
CBMP0   .EQU    $7F00
CBMFSP0 .EQU    $7E00

P0USB0          .EQU    $3F00   ; USB #0 D.P. 
P0LDT           .EQU    $4000   ; LDT D.P. 
P0FAT           .EQU    $4100   ; FAT D.P.
P0OS            .EQU    $4200   ; O.S. main D.P.
P0FPU           .EQU    $3F00

; buffer locale funzione _vprinter
LVPBUF          .EQU    (STACK_ADDR + 1)
; CBM FS work area
CBMFSW_START    .EQU    (LVPBUF + $0100)
CBMVIEC_START   .EQU    (CBMFSW_START + $0100)

VBBCHARRAM      .EQU    $010000 ; video RAM caratteri (2K)
VBBATTRRAM      .EQU    $010800 ; video RAM attributi (2K)
VBBPALRAM       .EQU    $011000 ; video RAM palette (1K)

; addon serial test board
.IFDEF          _ADDSER_INC_
PICRAM          .EQU    $011400 ; 1K till $0117FF
EMURAM          .EQU    $011800 ; 2K window till $011FFF
.ENDIF

SPOUTBUFF       .EQU    $050000
SPOUTBUFF2      .EQU    $052000
SPINBUFF        .EQU    $054000
SPINBUFF2       .EQU    $058000
SPOUTBUFF3      .EQU    $05C000
SPINBUFF3       .EQU    $05D000
;SPOUTBUFF4     .EQU    $05E000
;SPINBUFF4      .EQU    $05F000
SPOUTBUFF4      .EQU    $060000
SPINBUFF4       .EQU    $068000

SPXON           .EQU    $11     ; XON seriale per handshake software
SPXOFF          .EQU    $13     ; XOFF seriale per handshake software


; bank of dma buffer's
DMABNK          .EQU    $02
; DMA buffer's assign
DR0SYS          .EQU    $00     ; 36 sec. system cache
DR1SYS          .EQU    $24     ; 36 sec. system cache
DR0CACHE        .EQU    $48     ; 36 sec. track cache
DMAFREE0        .EQU    $6C     ; 20 sec. free cache (cbm wr cache)
;CLCACHE                .EQU    $80     ; 64 sec. cluster cache
BCBDMA          .EQU    $80     ; 64 sec. BCB cache
DMAFREE1        .EQU    $C0     ; 20 sec. free cache (cbm wr cache)
DMALXBUF        .EQU    $D4     ; 8 dma buffer associated with lindx (cbm-fs)
DR1CACHE        .EQU    $DC     ; 36 sec. track cache

XMWIN           .EQU    $012000
XMWSIZ          .EQU    $2000   
XMSTART         .EQU    $2000
XMSTOP          .EQU    $4000
XMBANK          .EQU    1

DMASAVE         .EQU    $014000 ; save 36 sec. ($4800)

DISKDEVSTR      .EQU    $018800

MBR0ATA         .EQU    $018800
MBR1ATA         .EQU    $018A00
PBR0ATA         .EQU    $018C00
PBR1ATA         .EQU    $018E00
ID0ATA          .EQU    $019000
ID1ATA          .EQU    $019200
MBR0USB         .EQU    $019400
PBR0USB         .EQU    $019600

CBMEMUBUF       .EQU    $019800
MONBUF          .EQU    $019900
SPBUF           .EQU    $019A00 ; 512 bytes

MAXDRV          .EQU    4       ; max. drive's number
ATADRV          .EQU    2       ; first ata device

MAXDDIRS        .EQU    $40
DEFDIR0         .EQU    $019C00
DEFDIR1         .EQU    DEFDIR0 + MAXDDIRS
DEFDIR2         .EQU    DEFDIR1 + MAXDDIRS
DEFDIR3         .EQU    DEFDIR2 + MAXDDIRS

USB0STR         .EQU    $019D80 ; usb #0 disk string descriptor (30 char's)
USB1STR         .EQU    $019D9E ; usb #1 disk string descriptor
USBBUF          .EQU    $019DBC ; temp. usb buffer (64 bytes)

TOSWKM          .EQU    $019E00 ; TOS working memory
TOSSEG          .EQU    $010000
HCBSEG          .EQU    $040000 ; HCB struct's bank

;--- bank $01 --- editor
EDBUFNAM        .EQU    $01C800 ; 80 x 10 bytes
EDSAVE01        .EQU    $01CB00
;               .EQU    $01CB20 ; save page 01 from ScnLinTmp
EDBUFFILE       .EQU    $01CC00 ; file name to save/load
EDDSKERR        .EQU    $01CC50 ; disk error string
EDBUFLIN        .EQU    EDDSKERR
EDCURFILE       .EQU    $01CD00 ; editor: current buffer filename
                ;.EQU   $01CD50
EDERRSIZ        .EQU    (EDCURFILE - EDDSKERR)
EDCRTSAV        .EQU    $01D000 ; 4k: save video bufefr (editor)
EDDSKBUF        .EQU    $01E000 ; 8k disk buffer
EDDSKBUFSIZ     .EQU    $2000   ; size
EDWRKEND        .EQU    $020000

;----------------------------------------------------------
; ---- dispositivi I/O TEXT
;----------------------------------------------------------
TXTD_KEYB       .SET    $00     ; tastiera (solo input)
TXTD_SER1       .SET    $01     ; porta seriale 1 (se presente)
TXTD_SER2       .SET    $02     ; porta seriale 2 (se presente)
TXTD_SCN        .SET    $03     ; video screen (primario o secondario)
TXTD_PRN1       .SET    $04     ; porta parallela 1 (se presente)
TXTD_PRN2       .SET    $05     ; porta parallela 2 (se presente)

TXTD_MAX        .SET    (TXTD_PRN2 + 1)

FDPBSIZE        .EQU    $09     ; size struttura FDPB
FDMAXDRIVE      .EQU    2

; errori FDC
FDC_BAD         .EQU    $01     ; bad controller
FDC_SNDTOUT     .EQU    $02     ; timeout sendto FDC
FDC_RESTOUT     .EQU    $03     ; FDC timeout result phase/ATA timeout busy
FDC_INTTOUT     .EQU    $04     ; timeout interrupt FDC/ATA
FDC_BADRES      .EQU    $05     ; too many bytes in result phase
FDC_FAULT       .EQU    $06     ; restore/recalibrate error
FDC_SEEK        .EQU    $07     ; seek error
FDC_DLOSS       .EQU    $08     ; perdita dati lettura dati
FDC_DATACRC     .EQU    $09     ; errore CRC data
FDC_NOID        .EQU    $0A     ; ID non trovato
FDC_WP          .EQU    $0B     ; write protect
FDC_MARK        .EQU    $0C     ; errore mark address
FDC_BADFMT      .EQU    $0D     ; mismatch track readID/unknow format
FDC_NODRIVE     .EQU    $0E     ; drive non presente
FDC_FMT         .EQU    $0F     ; mismatch format
FDC_NOTREADY    .EQU    $10     ; not ready - no disk
FDC_CHANGE      .EQU    $11     ; disco cambiato
FDC_VER         .EQU    $12     ; errore di verifica dati               
FDC_BADBUF      .EQU    $13     ; buffer non valido
FDC_PARAMS      .EQU    $14     ; parametri non validi
FDC_BADOP       .EQU    $15

ATA_NOTREADY    .EQU    $01
ATA_DLOSS       .EQU    $02
ATA_FAULT       .EQU    $03
ATA_EBIT        .EQU    $04
ATA_DEVRES      .EQU    $05
ATA_VERF        .EQU    $06
ATA_IDCKS       .EQU    $07
ATA_BADOP       .EQU    $08
ATA_XMEM        .EQU    $09
ATA_MEM         .EQU    $0A
ATA_MBR         .EQU    $0B

; RTC error's
RTC_BADFNC      .EQU    $01     ; invalid function
RTC_BADTIME     .EQU    $02
RTC_BADDATE     .EQU    $03

;----------------------------------------------------------
; ---- SYSTEM ERRORS
;----------------------------------------------------------

EZERO           .EQU    0        ; 'no error'
EINVFNC         .EQU    1       ; 'invalid function number'
EINV            .EQU    1

ENOENT          .EQU    2       ; 'no such file or directory'
ED_FILE         .EQU    2

ENOPATH         .EQU    3       ; 'path not found'
ED_PATH         .EQU    3
ED_ACCESS       .EQU    5       ; 'access denied'

ENOMEM          .EQU    8       ; 'not enough memory'
EINVMEM         .EQU    9       ; 'invalid memory block address'

ED_FORMAT       .EQU    11

ENODEV          .EQU    15      ; 'no such device or drive'
ED_DRIVE        .EQU    15

ENOTRDY         .EQU    21      ; 'drive not ready'
ED_NOTRDY       .EQU    21      ; 'drive not ready'
ED_RDFAIL       .EQU    30      ; 'disk read failure'
EINVPATH        .EQU    35      ; 'invalid path format'

; error class
CLASS_MEDIA     .EQU    11      ; media failure

; error locus
;OC_
;----------------------------------------------------------
; ---- FAT
;----------------------------------------------------------

; attributi file
ATTR_READ_ONLY  .EQU    $01
ATTR_HIDDEN     .EQU    $02
ATTR_SYSTEM     .EQU    $04
ATTR_VOLUME_ID  .EQU    $08
ATTR_DIRECTORY  .EQU    $10
ATTR_ARCHIVE    .EQU    $20

ATTR_LONG_NAME  .EQU    $0F

DA_VOLUME       .EQU    $08
DA_DIR          .EQU    $10

LFN_MAXENT      .SET    $05     ; max. numero entry LFN
LFN_MAXLEN      .SET    ((LFN_MAXENT * 13) + 1)
;LFN_MAXLEN     .SET    ((5 * 13) + 1)

SFN_MAXLEN      .SET    (8 + 1 + 3 + 1)

        ;.INCLUDE       inc\fat.inc
        .INCLUDE        inc\fsys.inc
        .INCLUDE        inc\cbm.inc

.ENDIF          ;; _GLOBAL_INC_

.LIST           on