source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc@ 197

Last change on this file since 197 was 193, checked in by gregli@…, 13 years ago

Space optimizations in AccessDPT.asm, transfer one routine to a macro (retaining some encapsulation), and transfer the unique part of another routine to the one place it was being called (which also makes what it was doing more transparent).

File size: 3.0 KB
RevLine 
[99]1; Project name : XTIDE Universal BIOS
[3]2; Description : Defines for DPT structs containing custom
3; Disk Parameter Table used by this BIOS.
4%ifndef CUSTOMDPT_INC
5%define CUSTOMDPT_INC
6
[150]7; Base DPT for all device types
[173]8struc DPT ; 10 bytes
[3]9 ; General Disk Parameter Table related
[158]10 .wFlags:
11 .bFlagsLow resb 1
12 .bFlagsHigh resb 1
[150]13 .bIdevarsOffset resb 1 ; Offset to IDEVARS for this drive
[175]14%ifdef MODULE_SERIAL
15 .bSerialPortAndBaud resb 1 ; Packed I/O port and baud rate for serial drives
16%else
17 resb 1 ; without serial port support, alignment byte
18%endif
[3]19
[150]20 ; IDE Drive related
[173]21 .dwCylinders resb 4 ; Number of Cylinders
22 .wHeadsAndSectors:
23 .bHeads resb 1 ; Number of Heads (1...255)
24 .bSectors resb 1 ; Number of Sectors per Track (1...63)
[150]25endstruc
[3]26
[150]27; DPT for ATA devices
[173]28struc DPT_ATA ; 10 + 2 bytes = 12 bytes
[150]29 .dpt resb DPT_size
30
31 ; Block size is specified in sectors (1, 2, 4, 8, 16, 32 or 64).
32 ; 128 is not allowed to prevent offset overflow during data transfer.
[3]33 .wSetAndMaxBlock:
[150]34 .bSetBlock resb 1 ; Current block size (at least 1)
35 .bMaxBlock resb 1 ; Maximum block size, 0 = block mode not supported
[3]36endstruc
37
[150]38LARGEST_DPT_SIZE EQU DPT_ATA_size
[3]39
40
[158]41; Bit definitions for DPT.bFlagsLow
42MASKL_DPT_CHS_SHIFT_COUNT EQU (7<<0) ; Bits 0...3, P-CHS to L-CHS bit shift count (0...4)
43FLGL_DPT_SLAVE EQU FLG_DRVNHEAD_DRV ; (1<<4), Drive is slave drive
44MASKL_DPT_ADDRESSING_MODE EQU (3<<5) ; Bits 5..6, Addressing Mode (bit 6 == FLG_DRVNHEAD_LBA)
45FLGL_DPT_ENABLE_IRQ EQU (1<<7)
[3]46
[158]47; Bit definitions for DPT.bFlagsHigh
48FLGH_DPT_REVERSED_A0_AND_A3 EQU (1<<0) ; XTIDE mod, Address lines 0 and 3 reversed
[165]49FLGH_DPT_BLOCK_MODE_SUPPORTED EQU (1<<1) ; Use block transfer commands (must be bit 1!)
[175]50%ifdef MODULE_SERIAL
[165]51FLGH_DPT_SERIAL_DEVICE EQU (1<<2) ; Serial Port Device
[175]52%endif
[158]53FLGH_DPT_INTERRUPT_IN_SERVICE EQU (1<<3) ; Set when waiting for IRQ
54FLGH_DPT_RESET_nDRDY EQU (1<<4) ; Drive ready to accept commands
55FLGH_DPT_RESET_nINITPRMS EQU (1<<5) ; Initialize Device Parameters successfull
56FLGH_DPT_RESET_nRECALIBRATE EQU (1<<6) ; Recalibrate successfull
57FLGH_DPT_RESET_nSETBLOCK EQU (1<<7) ; Initialize Block Mode successfull
58MASKH_DPT_RESET EQU 0F0h
59
[150]60; Addressing modes for DPT.wFlags
61ADDRESSING_MODE_FIELD_POSITION EQU 5
62ADDRESSING_MODE_LCHS EQU 0 ; L-CHS Addressing Mode (NORMAL in many other BIOSes)
63ADDRESSING_MODE_PCHS EQU 1 ; P-CHS Addressing Mode (LARGE in many other BIOSes)
64ADDRESSING_MODE_LBA28 EQU 2 ; 28-bit LBA Addressing Mode
65ADDRESSING_MODE_LBA48 EQU 3 ; 48-bit LBA Addressing Mode
[3]66
[193]67%macro CustomDPT_GetUnshiftedAddressModeToALZF 0
68 mov al, [di+DPT.bFlagsLow]
69 and al, MASKL_DPT_ADDRESSING_MODE
70%endmacro
71
[173]72; Number of Sectors per Track is fixed to 63 for LBA assist calculation.
73; 1024 cylinders, 256 heads, 63 sectors = 8.4 GB limit (but DOS does not support more than 255 heads)
74MAX_LCHS_CYLINDERS EQU 1024
75LBA_ASSIST_SPT EQU 63
[3]76
[173]77
[3]78%endif ; CUSTOMDPT_INC
Note: See TracBrowser for help on using the repository browser.