--- Begin Message ---
diff -ruNp old/config.c new/config.c
--- old/config.c 2004-04-14 16:04:04.000000000 +0000
+++ new/config.c 2004-04-22 12:55:04.000000000 +0000
@@ -488,7 +488,7 @@ VOID configDone(VOID)
unsigned short kernel_seg;
unsigned short hma_paras = (HMAFree+0xf)/16;
- allocmem(hma_paras, &kernel_seg);
+ kernel_seg = allocmem(hma_paras);
p = para2far(kernel_seg - 1);
p->m_name[0] = 'S';
@@ -2592,7 +2592,7 @@ VOID DoInstall(void)
r.b.b.l = 0x02; /*low memory, last fit
*/
init_call_intr(0x21, &r);
- allocmem(((unsigned)_init_end + ebda_size + 15) / 16, &installMemory);
+ installMemory = allocmem(((unsigned)_init_end + ebda_size + 15) / 16);
InstallPrintf(("allocated memory at %x\n",installMemory));
diff -ruNp old/init-mod.h new/init-mod.h
--- old/init-mod.h 2004-04-14 09:41:28.000000000 +0000
+++ new/init-mod.h 2004-04-22 12:54:08.000000000 +0000
@@ -157,10 +157,10 @@ unsigned ASMPASCAL init_call_intr(int nr
unsigned ASMPASCAL read(int fd, void *buf, unsigned count);
int ASMPASCAL open(const char *pathname, int flags);
int ASMPASCAL close(int fd);
-int ASMPASCAL dup2(int oldfdk, int newfd);
-int ASMPASCAL allocmem(UWORD size, seg * segp);
+int ASMPASCAL dup2(int oldfd, int newfd);
+seg ASMPASCAL allocmem(UWORD size);
void ASMPASCAL init_PSPSet(seg psp_seg);
-int ASMPASCAL init_DosExec(int mode, exec_blk * ep, char * lp);
+int ASMPASCAL init_DosExec(int mode, exec_blk * ep, const char * lp);
int ASMPASCAL init_setdrive(int drive);
int ASMPASCAL init_switchar(int chr);
void ASMPASCAL keycheck(void);
@@ -171,7 +171,7 @@ void ASMPASCAL set_DTA(void far *dta);
#pragma aux (pascal) init_DosOpen modify exact [ax bx dx]
#pragma aux (pascal) close modify exact [ax bx]
#pragma aux (pascal) dup2 modify exact [ax bx cx]
-#pragma aux (pascal) allocmem modify exact [ax bx dx]
+#pragma aux (pascal) allocmem modify exact [ax bx]
#pragma aux (pascal) init_PSPSet modify exact [ax bx]
#pragma aux (pascal) init_DosExec modify exact [ax bx dx es]
#pragma aux (pascal) init_setdrive modify exact [ax bx dx]
diff -ruNp old/intr.asm new/intr.asm
--- old/intr.asm 2004-04-09 14:28:54.000000000 +0000
+++ new/intr.asm 2004-04-22 12:59:30.000000000 +0000
@@ -94,7 +94,9 @@
segment HMA_TEXT
-;; COUNT ASMPASCAL res_DosExec(COUNT mode, exec_blk * ep, BYTE * lp)
+;
+; int ASMPASCAL res_DosExec(int mode, exec_blk * ep, const char * lp);
+;
global RES_DOSEXEC
RES_DOSEXEC:
pop es ; ret address
@@ -106,12 +108,13 @@ RES_DOSEXEC:
push ds
pop es ; es = ds
int 21h
- jc short no_exec_error
- xor ax, ax
-no_exec_error:
+ sbb dx,dx ; CF=0?
+ and ax,dx ; then ax=0
ret
-;; UCOUNT ASMPASCAL res_read(int fd, void *buf, UCOUNT count);
+;
+; unsigned ASMPASCAL res_read(int fd, void *buf, unsigned count);
+;
global RES_READ
RES_READ:
pop ax ; ret address
@@ -121,23 +124,20 @@ RES_READ:
push ax ; ret address
mov ah, 3fh
int 21h
- jnc no_read_error
- mov ax, -1
-no_read_error:
+ sbb dx,dx ; CF=1?
+ or ax,dx ; then ax=-1
ret
segment INIT_TEXT
;
-; void init_call_intr(nr, rp)
-; REG int nr
-; REG struct REGPACK *rp
+; unsigned ASMPASCAL init_call_intr(int nr, iregs * rp);
;
global INIT_CALL_INTR
INIT_CALL_INTR:
INTR
;
-; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX)
+; int ASMPASCAL init_call_XMScall(void FAR * driverAddress, UWORD ax, UWORD dx);
;
; this calls HIMEM.SYS
;
@@ -154,8 +154,10 @@ INIT_CALL_XMSCALL:
push es ; driver address ("jmp es:cx")
push cx
retf
-
-; void FAR *DetectXMSDriver(VOID)
+
+;
+; void FAR * ASMPASCAL DetectXMSDriver(VOID);
+;
global DETECTXMSDRIVER
DETECTXMSDRIVER:
mov ax, 4300h
@@ -163,8 +165,8 @@ DETECTXMSDRIVER:
cmp al, 80h
je detected
- xor ax, ax
- xor dx, dx
+ xor ax,ax
+ cwd
ret
detected:
@@ -179,13 +181,18 @@ detected:
pop es
ret
+;
+; void ASMPASCAL keycheck(void);
+;
global KEYCHECK
KEYCHECK:
mov ah, 1
int 16h
ret
-;; int open(const char *pathname, int flags);
+;
+; int ASMPASCAL open(const char *pathname, int flags);
+;
global INIT_DOSOPEN
INIT_DOSOPEN:
;; init calling DOS through ints:
@@ -198,13 +205,14 @@ INIT_DOSOPEN:
common_int21:
int 21h
- jnc common_no_error
-common_error:
+ jnc common_ret
mov ax, -1
-common_no_error:
+common_ret:
ret
-;; int close(int fd);
+;
+; int ASMPASCAL close(int fd);
+;
global CLOSE
CLOSE:
pop ax ; ret address
@@ -213,7 +221,9 @@ CLOSE:
mov ah, 3eh
jmp short common_int21
-;; UCOUNT read(int fd, void *buf, UCOUNT count);
+;
+; unsigned ASMPASCAL read(int fd, void *buf, unsigned count);
+;
global READ
READ:
pop ax ; ret address
@@ -224,7 +234,9 @@ READ:
mov ah, 3fh
jmp short common_int21
-;; int dup2(int oldfd, int newfd);
+;
+; int ASMPASCAL dup2(int oldfd, int newfd);
+;
global DUP2
DUP2:
pop ax ; ret address
@@ -234,7 +246,9 @@ DUP2:
mov ah, 46h
jmp short common_int21
-;; VOID init_PSPSet(seg psp_seg)
+;
+; void ASMPASCAL init_PSPSet(seg psp_seg);
+;
global INIT_PSPSET
INIT_PSPSET:
pop ax ; ret address
@@ -244,7 +258,9 @@ INIT_PSPSET:
int 21h
ret
-;; COUNT init_DosExec(COUNT mode, exec_blk * ep, BYTE * lp)
+;
+; int ASMPASCAL init_DosExec(int mode, exec_blk * ep, const char * lp);
+;
global INIT_DOSEXEC
INIT_DOSEXEC:
pop es ; ret address
@@ -256,12 +272,13 @@ INIT_DOSEXEC:
push ds
pop es ; es = ds
int 21h
- jc short exec_no_error
- xor ax, ax
-exec_no_error:
+ sbb dx,dx ; CF=0?
+ and ax,dx ; then ax=0
ret
-;; int init_setdrive(int drive)
+;
+; int ASMPASCAL init_setdrive(int drive);
+;
global INIT_SETDRIVE
INIT_SETDRIVE:
mov ah, 0x0e
@@ -272,28 +289,31 @@ common_dl_int21:
int 21h
ret
-;; int init_switchar(int char)
+;
+; int ASMPASCAL init_switchar(int chr);
+;
global INIT_SWITCHAR
INIT_SWITCHAR:
mov ax, 0x3701
jmp short common_dl_int21
-;; int allocmem(UWORD size, seg *segp)
+;
+; seg ASMPASCAL allocmem(UWORD size);
+;
global ALLOCMEM
ALLOCMEM:
pop ax ; ret address
- pop dx ; segp
pop bx ; size
push ax ; ret address
mov ah, 48h
int 21h
- jc short common_error
- mov bx, dx ; segp
- mov [bx], ax
- xor ax, ax
+ sbb bx,bx ; CF=1?
+ or ax,bx ; then ax=-1
ret
-;; void set_DTA(void far *dta)
+;
+; void ASMPASCAL set_DTA(void far *dta);
+;
global SET_DTA
SET_DTA:
pop ax ; ret address
diff -ruNp old/kernel.asm new/kernel.asm
--- old/kernel.asm 2004-04-13 22:41:14.000000000 +0000
+++ new/kernel.asm 2004-04-22 12:15:56.000000000 +0000
@@ -123,7 +123,7 @@ kernel_start:
mov sp,init_tos
int 12h ; move init text+data to higher memory
mov cl,6
- shl ax,cl
+ shl ax,cl ; convert kb to para
mov dx,15 + init_end wrt INIT_TEXT
mov cl,4
shr dx,cl
@@ -136,35 +136,27 @@ kernel_start:
sti ; now enable them
mov ax,cs
mov dx,__InitTextStart wrt HMA_TEXT ; para aligned
+ shr dx,cl
%ifdef WATCOM
- mov si,dx
- mov cl,4
- shr si,cl
- add ax,si
+ add ax,dx
%endif
mov ds,ax
- mov cx,-2 + init_end wrt INIT_TEXT ; word aligned
- mov si,cx
- mov di,cx
+ mov si,-2 + init_end wrt INIT_TEXT ; word aligned
+ lea cx,[si+2]
+ mov di,si
shr cx,1
- inc cx
std ; if there's overlap only std is safe
rep movsw
; move HMA_TEXT to higher memory
- mov si,dx ; si = __InitTextStart wrt HMA_TEXT
- mov cl,4
- shr dx,cl
-
sub ax,dx
mov ds,ax ; ds = HMA_TEXT
mov ax,es
sub ax,dx
mov es,ax ; es = new HMA_TEXT
- mov cx,si ; cx = __InitTextStart wrt HMA_TEXT
- dec si
- dec si
+ mov si,-2 + __InitTextStart wrt HMA_TEXT
+ lea cx,[si+2] ; cx = __InitTextStart wrt HMA_TEXT
mov di,si
shr cx,1
rep movsw
diff -ruNp old/proto.h new/proto.h
--- old/proto.h 2004-04-17 15:59:46.000000000 +0000
+++ new/proto.h 2004-04-22 12:59:30.000000000 +0000
@@ -227,8 +227,8 @@ void FcbCloseAll(void);
UBYTE FcbFindFirstNext(xfcb FAR * lpXfcb, BOOL First);
/* intr.asm */
-COUNT ASMPASCAL res_DosExec(COUNT mode, exec_blk * ep, BYTE * lp);
-UCOUNT ASMPASCAL res_read(int fd, void *buf, UCOUNT count);
+int ASMPASCAL res_DosExec(int mode, exec_blk * ep, const char * lp);
+unsigned ASMPASCAL res_read(int fd, void *buf, unsigned count);
#ifdef __WATCOMC__
#pragma aux (pascal) res_DosExec modify exact [ax bx dx es]
#pragma aux (pascal) res_read modify exact [ax bx cx dx]
--- End Message ---