Use pascal calling conventions for floppy asm functions.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@850 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-04-09 13:11:25 +00:00
parent 950078ad08
commit 7012672d7d
2 changed files with 57 additions and 75 deletions

View File

@ -28,12 +28,8 @@
; $Id$
;
%ifndef SYS
%include "../kernel/segs.inc"
segment HMA_TEXT
%else
segment _TEXT class=CODE
%endif
;
;
; Reset both the diskette and hard disk system
@ -43,12 +39,11 @@
; returns TRUE if successful
;
global _fl_reset
_fl_reset:
global FL_RESET
FL_RESET:
pop ax ; return address
pop dx ; drive
push dx ; restore stack
push ax ;
push ax ; restore address
mov ah,0 ; BIOS reset diskette & fixed disk
int 13h
@ -66,14 +61,15 @@ _fl_reset:
; returns 1 if disk has changed, 0 if not, 0xFFFF if error
;
global _fl_diskchanged
_fl_diskchanged:
global FL_DISKCHANGED
FL_DISKCHANGED:
pop ax ; return address
pop dx ; get the drive number
push dx ; restore stack
push ax ;
push ax ; restore stack
push si ; restore stack
mov ah,16h ; read change status type
xor si,si ; RBIL: avoid crash on AT&T 6300
int 13h
mov al,1
@ -85,6 +81,7 @@ _fl_diskchanged:
fl_dc_ret1: dec ax
fl_dc_ret: cbw
pop si
ret
;
@ -95,8 +92,8 @@ fl_dc_ret: cbw
; Formats one or more tracks, sector should be 0.
;
; Returns 0 if successful, error code otherwise.
global _fl_format
_fl_format:
global FL_FORMAT
FL_FORMAT:
mov ah, 5
jmp short fl_common
;
@ -117,25 +114,25 @@ _fl_format:
;
; Returns 0 if successful, error code otherwise.
;
global _fl_read
_fl_read:
global FL_READ
FL_READ:
mov ah,2 ; cmd READ
jmp short fl_common
global _fl_verify
_fl_verify:
global FL_VERIFY
FL_VERIFY:
mov ah,4 ; cmd verify
jmp short fl_common
global _fl_write
_fl_write:
global FL_WRITE
FL_WRITE:
mov ah,3 ; cmd WRITE
fl_common:
push bp ; C entry
mov bp,sp
mov cx,[bp+8] ; cylinder number (lo only if hard)
mov cx,[bp+0Ch] ; cylinder number (lo only if hard)
mov al,1 ; this should be an error code
cmp ch,3 ; this code can't write above 3ff=1023
@ -146,12 +143,12 @@ fl_common:
ror cl,1
or cl,[bp+0Ah] ; or in the sector number (bits 0-5)
mov al,[bp+0Ch] ; count to read/write
les bx,[bp+0Eh] ; Load 32 bit buffer ptr
mov al,[bp+08h] ; count to read/write
les bx,[bp+04h] ; Load 32 bit buffer ptr
mov dl,[bp+4] ; get the drive (if or'ed 80h its
mov dl,[bp+10h] ; get the drive (if or'ed 80h its
; hard drive.
mov dh,[bp+6] ; get the head number
mov dh,[bp+0Eh] ; get the head number
int 13h ; write sectors from mem es:bx
@ -161,24 +158,24 @@ fl_common:
fl_error:
mov ah,0 ; force into < 255 count
pop bp
ret
ret 14
; COUNT fl_lba_ReadWrite(BYTE drive, UWORD mode, VOID FAR *dap_p)
;
; Returns 0 if successful, error code otherwise.
;
global _fl_lba_ReadWrite
_fl_lba_ReadWrite:
global FL_LBA_READWRITE
FL_LBA_READWRITE:
push bp ; C entry
mov bp,sp
push ds
push si ; wasn't in kernel < KE2024Bo6!!
mov dl,[bp+4] ; get the drive (if ored 80h harddrive)
mov ax,[bp+6] ; get the command
lds si,[bp+8] ; get far dap pointer
mov dl,[bp+10] ; get the drive (if ored 80h harddrive)
mov ax,[bp+8] ; get the command
lds si,[bp+4] ; get far dap pointer
int 13h ; read from/write to drive
pop si
@ -188,25 +185,23 @@ _fl_lba_ReadWrite:
ret_AH:
mov al,ah ; place any error code into al
mov ah,0 ; zero out ah
ret
ret 8
;
; void fl_readkey (void);
;
global _fl_readkey
_fl_readkey: xor ah, ah
global FL_READKEY
FL_READKEY: xor ah, ah
int 16h
ret
global _fl_setdisktype
_fl_setdisktype:
global FL_SETDISKTYPE
FL_SETDISKTYPE:
pop bx ; return address
pop dx ; drive number (dl)
pop ax ; disk type (al)
push ax ; restore stack
push dx
push bx
pop dx ; drive number (dl)
push bx ; restore stack
mov ah,17h
int 13h
jmp short ret_AH
@ -214,16 +209,13 @@ _fl_setdisktype:
;
; COUNT fl_setmediatype (WORD drive, WORD tracks, WORD sectors);
;
global _fl_setmediatype
_fl_setmediatype:
global FL_SETMEDIATYPE
FL_SETMEDIATYPE:
pop ax ; return address
pop dx ; drive number
pop cx ; number of tracks
pop bx ; sectors/track
push bx ; restore stack
push cx
push dx
push ax
pop cx ; number of tracks
pop dx ; drive number
push ax ; restore stack
push di
dec cx ; should be highest track

View File

@ -41,39 +41,29 @@ static BYTE *dskRcsId =
/* #define STATIC */
#ifdef PROTO
BOOL ASMCFUNC fl_reset(WORD);
COUNT ASMCFUNC fl_readdasd(WORD);
COUNT ASMCFUNC fl_diskchanged(WORD);
COUNT ASMCFUNC fl_rd_status(WORD);
BOOL ASMPASCAL fl_reset(WORD);
COUNT ASMPASCAL fl_diskchanged(WORD);
COUNT ASMCFUNC fl_format(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *);
COUNT ASMCFUNC fl_read(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *);
COUNT ASMCFUNC fl_write(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *);
COUNT ASMCFUNC fl_verify(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *);
COUNT ASMCFUNC fl_setdisktype(WORD, WORD);
COUNT ASMCFUNC fl_setmediatype(WORD, WORD, WORD);
VOID ASMCFUNC fl_readkey(VOID);
extern COUNT ASMCFUNC fl_lba_ReadWrite(BYTE drive, WORD mode,
COUNT ASMPASCAL fl_format(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *);
COUNT ASMPASCAL fl_read(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *);
COUNT ASMPASCAL fl_write(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *);
COUNT ASMPASCAL fl_verify(WORD, WORD, WORD, WORD, WORD, UBYTE FAR *);
COUNT ASMPASCAL fl_setdisktype(WORD, WORD);
COUNT ASMPASCAL fl_setmediatype(WORD, WORD, WORD);
VOID ASMPASCAL fl_readkey(VOID);
extern COUNT ASMPASCAL fl_lba_ReadWrite(BYTE drive, WORD mode,
struct _bios_LBA_address_packet FAR
* dap_p);
#ifdef __WATCOMC__
#pragma aux (pascal) fl_reset modify exact [ax dx]
#pragma aux (pascal) fl_diskchanged modify exact [ax dx]
#pragma aux (pascal) fl_setdisktype modify exact [ax bx dx]
#pragma aux (pascal) fl_readkey modify exact [ax]
#pragma aux (pascal) fl_lba_ReadWrite modify exact [ax dx]
#endif
STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer,
ULONG LBA_address, unsigned total, UWORD * transferred);
#else
BOOL ASMCFUNC fl_reset();
COUNT ASMCFUNC fl_readdasd();
COUNT ASMCFUNC fl_diskchanged();
COUNT ASMCFUNC fl_rd_status();
COUNT ASMCFUNC fl_format();
COUNT ASMCFUNC fl_read();
COUNT ASMCFUNC fl_write();
COUNT ASMCFUNC fl_verify();
VOID ASMCFUNC fl_readkey();
COUNT ASMCFUNC fl_setmediatype();
COUNT ASMCFUNC fl_setdisktype();
#endif
#define NENTRY 26 /* total size of dispatch table */