📄 rxdosbio.asm
字号:
TITLE 'rxdos bios interface drivers'
PAGE 59, 132
.LALL
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Real Time Dos ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; This material was created as a published version of a DOS ;
; equivalent product. This program logically functions in ;
; the same way as MSDOS functions and it is internal data ;
; structure compliant with MSDOS 6.0 ;
; ;
; This product is distributed AS IS and contains no warranty ;
; whatsoever, including warranty of merchantability or ;
; fitness for a particular purpose. ;
; ;
; ;
; (c) Copyright 1990, 1997. Api Software and Mike Podanoffsky ;
; All Rights Reserved Worldwide. ;
; ;
; This product is protected under copyright laws and may not ;
; be reproduced in whole or in part, in any form or media, ;
; included but not limited to source listing, facsimile, data ;
; transmission, cd-rom, or floppy disk without the expressed ;
; written consent of the author. ;
; ;
; License for distribution for commercial use or resale ;
; required from: ;
; ;
; Api Software ;
; 12 South Walker Street ;
; Lowell, MA 01851 ;
; ;
; internet: mikep@world.std.com ;
; ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; Compile with MASM 5.1 ;
;...............................................................;
include rxdosmac.asm
include rxdosdef.asm
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; RxDOSBIO.SYS ;
;...............................................................;
RxDOSBIOS SEGMENT PARA PUBLIC 'CODE'
assume cs:RxDOSBIOS, ds:RxDOSBIOS, es:RxDOSBIOS, ss:RxDOSBIOS
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Load remainder of RxDOS ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; When rxdosbio.sys is loaded by the disk boot loader, it ;
; loads automatically the first three sectors regardless of ;
; the cluster allocation. For RxDOS, only the first sector in ;
; a cluster needs to actually be loaded. This loads this ;
; portion of the rxdosbio.sys code, which loads the remainder ;
; of the program using FAT allocations. ;
; ;
; The boot program has also detected and read the first sector ;
; of the root directory which is located at 0000:0500 (that ;
; is, 50:0). ;
; ;
; Boot sequence is ;
; ;
; MBR (master boot record) ;
; loads at 0:7c00, relocated to 60:0 ;
; located at physical address cyl: 0 head: 0 sector: 1 ;
; ;
; BOOT (boot record) ;
; loads at 0:7c00 ;
; located at start of partition (logical sector 0) ;
; ;
; RXDOSBIO.SYS ;
; loads initially at 70:0, relocated high ;
; boot record loads first three sectors (regardless of ;
; cluster size) ;
; initial part of rxdosbio.sys loads remainder of module ;
; high in low memory, then loads rxdos.sys ;
; ;
; RXDOS.SYS ;
; loaded by rxdosbio.sys ;
; ;
; RXDOSCMD.EXE ;
; ;
;...............................................................;
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Startup Code ;
;...............................................................;
org 0000h
public RxDOSBIOS_Start
RxDOSBIOS_Start: jmp RxDOSBIOS_Initialize
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Block Device Info ;
;...............................................................;
DISKBLOCK struc
_dskNextPointer dd ? ; pointer to next
_dskPhysDriveNumber db ? ;
_dskDOSLogicalDiskUnit db ? ;
_dskBPB db sizeBPB dup(?) ;
_dskFATSystemStatus db ? ;
_dskDevOpenCount dw ? ;
_dskDeviceType db ? ; 22
_dskStatusFlag dw ? ; 23
_dskCylinders dw ? ; 25
_dskDefaultBPB db sizeBPB dup(?) ; 27
_dskPartitionBeginHead db ? ; begin head address
_dskPartitionBeginSector db ? ; begin sector address
_dskPartitionBeginCylinder db ? ; begin cylinder address
_dskPartitionEndHead db ? ; end head address
_dskPartitionEndSector db ? ; end sector address
_dskPartitionEndCylinder db ? ; end cylinder address
_dskCylinderAtLastOp db ? ; 46
_dskClockAtLastOp dd ? ; 47
_dskVolumeName db (sizeFILENAME + 1) dup(?)
_dskSerialNumber dd ? ; 57
_dskFATSystemID db 8 dup(?) ; 5B
_dskExtHiddenSectors dd ? ; extended hidden sectors
DISKBLOCK ends
sizeDISKBLOCK equ size DISKBLOCK
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Type Codes
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DSKFILESYSTYPE_12Bits equ 00h
DSKFILESYSTYPE_16Bits equ 40h
DSKFILESYSTYPE_Invalid equ 80h
DSKFILESYSTYPE_IsValid equ 40h ; only bits 7, 6 are assignable
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Form Codes
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DSKFORMTYPES_40_9 equ 00h ; 40 cyls, <= 9 sect/track
DSKFORMTYPES_80_15 equ 01h ; 80 cyls, 15 sect/track
DSKFORMTYPES_80_9 equ 02h ; 80 cyls, 9 sect/track
DSKFORMTYPES_HARDDISK equ 03h ; hard disk
DSKFORMTYPES_FLOPPY_OTHER equ 07h ; other floppy disk types
DSKFORMTYPES_80_36 equ 07h ; 80 cyls, 36 sect/track 1.44M
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Status Codes
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IsNonRemovable equ 0001h ; non-removable media
ChgLineSupportedbyBIOS equ 0002h ; change line supported
BPBLocked equ 0004h ; BPB Locked status
GoodTrackLayout equ 0008h ; if continuous sectors on track
SharesPhysDevice equ 0010h ; if physical unit partitioned
ActiveUnit equ 0020h ; if active unit
DiskChangeDetected equ 0040h ; disk change detected
DASD_SetRequired equ 0080h ; DASD_SetRequired
VerifyWrite equ 0100h ; Verify Write
RW_Disabled equ 0200h ; read/ write disabled
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Media Descriptor Table ;
;...............................................................;
MEDIADESCRIPT struc
_mdtSpecifyByte dw ?
_mdtTimerTillMotorOff db ?
_mdtBytesPerSector db ? ; 0 = 128, 1=256, 2=512, 3=1024
_mdtSectorsPerTrack db ?
_mdtGapLengthinBytes db ?
_mdtDataLengthinBytes db ?
_mdtGapLengthForFormat db ?
_mdtFillByteForFormat db ?
_mdtHeadSettleTime db ? ; in ms
_mdtMotorStartupTime db ? ; in 1/8 seconds
MEDIADESCRIPT ends
sizeMEDIADESCRIPT equ size MEDIADESCRIPT
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Data ;
;...............................................................;
BootDrive: db 0
BootDrive_BPB: dw sizeCCBData ; __bsBytesPerSector
db 1 ; __bsSectorsPerCluster
dw 1 ; __bsResSectors
db 2 ; __bsNumCopiesFAT
dw 00E0h ; __bsMaxAllocRootDir
dw 0960h ; __bsMaxSectors
db 0f9h ; __bsMediaDescriptor
dw 7 ; __bsSectorsPerFat
dw 15 ; __bsSectorsPerTrack
dw 2 ; __bsHeads
dd 0 ; __bsHiddenSectors
dd 0960h ; __bsHugeSectors
RxDOSBIOS_INITBLOCK: db sizeSYSINIT dup(0)
diskParameterTable: dd 0 ; disk parameter table
_FATbuffer_SectorNumber: dd -1 ; allocated FAT sector
_FATbuffer: dd 0
RootDirSector: dd 0 ; root directory sector
ReservedBeforeDataSector: dd 0 ; first data sector
RXDOSBIO_ClusterAddr: dw 0 ; cluster address of RxDOSBIO.SYS
RXDOS_ClusterAddr: dw 0 ; cluster address of RxDOS.SYS
_FloppyDrives: dw 0 ; # floppy drives
_FixedDrives: dw 0 ; # fixed drives
RxDOS_LoadSegment: dd 0 ; where RxDOS loaded
ptr_StartBlockedDeviceTable: dd 0 ; ptr to Disk Parameter Blocks
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; location of system entries in root directory
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RXDOSBIO_SYS equ (0 * sizeDIRENTRY)
RXDOS_SYS equ (1 * sizeDIRENTRY)
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; messages
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RXDOSBIO_MSGLoadingRxDOS: db "Starting RxDOS...", 0
RXDOSBIO_MSGErrorLoadingSystem: db 0Dh, 0Ah, "Error loading RxDOS. Please reboot. ", 0
IFDEF RxDOS_DEBUG
RXDOSBIO_MSGDEBUG_CANTLOAD: db "Can't Load DEBUG Image", 0
ENDIF
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Load Program Using FAT ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Input: ;
; dx starting cluster address ;
; es:di buffer ;
; ;
; Output: ;
; cy error reading file ;
;...............................................................;
_LoadProgram:
Entry
def _sectorsToRead ; sectors to read
def _scanEndCluster, dx ; last cluster scanned
def _currentCluster, dx ; cluster address of pgm /start
def _relCluster ; rel cluster offset required
ddef _buffer, es, di ; where to load
xor dx, dx
mov ax, word ptr [ _buffer. _pointer ][ bp ]
div word ptr [ BootDrive_BPB. _bpbBytesPerSector ]
div byte ptr [ BootDrive_BPB. _bpbSectorsPerCluster ]
xor ah, ah
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -