From 4eb1c56e0d7a3636d555fa5756b1f3cb2118c995 Mon Sep 17 00:00:00 2001 From: David Lee Date: Fri, 5 Jul 2024 14:18:32 -0700 Subject: [PATCH] linux build fixes --- Microsoft Pascal v1/m.sh | 4 +- Microsoft Pascal v2/DJLDOS.ASM | 121 ++++++++++++++++++ .../{djldos.OBJ => DJLDOS.OBJ} | Bin Microsoft Pascal v2/m.sh | 24 ++++ 4 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 Microsoft Pascal v2/DJLDOS.ASM rename Microsoft Pascal v2/{djldos.OBJ => DJLDOS.OBJ} (100%) create mode 100644 Microsoft Pascal v2/m.sh diff --git a/Microsoft Pascal v1/m.sh b/Microsoft Pascal v1/m.sh index 53254fc..3e07270 100644 --- a/Microsoft Pascal v1/m.sh +++ b/Microsoft Pascal v1/m.sh @@ -1,8 +1,8 @@ str=$(tr '[a-z]' '[A-Z]' <<< $1) -rem -h flag is required for pas2 and generated apps so the top of ram is on a 64k-1 boundary -rem due to bugs in the apps that try to copy 64k-1 bytes of ram and wrap. +# -h flag is required for pas2 and generated apps so the top of ram is on a 64k-1 boundary +# due to bugs in the apps that try to copy 64k-1 bytes of ram and wrap. rm $str.EXE 2>/dev/null rm $str.COD 2>/dev/null diff --git a/Microsoft Pascal v2/DJLDOS.ASM b/Microsoft Pascal v2/DJLDOS.ASM new file mode 100644 index 0000000..275a5fc --- /dev/null +++ b/Microsoft Pascal v2/DJLDOS.ASM @@ -0,0 +1,121 @@ +; utility functions for calling into DOS from Microsoft Pascal v1 through v4 +; +; function dostime : word; External; +; var startTicks: word; +; startTicks := dostime; +; +; function getpsp : word; External; +; var psp : word; +; psp := getpsp; +; +; function pspbyte( offset : word ) : integer; External; +; var result : integer; +; result := pspbyte( 80 ); { get command tail length } +; + +.model large + +code segment +assume cs:code + +; returns a count of hundredths of a second in ax +; only uses hs, seconds, and the low digit of minutes since that's all that fits in two bytes +; 54000 = 9 * 60 * 100 +; + 5900 = 59 * 100 +; + 99 +; -------- +; 59999 + +public getticks +getticks PROC FAR + push bx + push cx + push dx + push di + push si + + mov ah, 2ch + int 21h + push dx + mov ah, 0 + mov al, dh + mov bx, 100 + mul bx + pop dx + mov dh, 0 + add ax, dx + + push ax + mov ax, cx + and ax, 0ffh + mov cx, 10 + mov dx, 0 + div cx + mov ax, dx + mov cx, 6000 + mul cx + pop bx + add ax, bx + + pop si + pop di + pop dx + pop cx + pop bx + ret +getticks ENDP + +public getpsp +getpsp PROC FAR + push bx + push cx + push dx + push di + push si + + mov ah, 062h + int 21h + mov ax, bx + + pop si + pop di + pop dx + pop cx + pop bx + ret +getpsp ENDP + +public pspbyte +pspbyte PROC FAR + push bx + push cx + push dx + push di + push si + push es + push bp + + mov bp, sp + mov ah, 062h + int 21h + mov es, bx + + ; the argument is here. 7 pushes above + 2 for the return address = 9 * 2 = 18. + + mov bx, word ptr[ bp + 18 ] + xor ah, ah + mov al, byte ptr es: [ bx ] + + pop bp + pop es + pop si + pop di + pop dx + pop cx + pop bx + ret +pspbyte ENDP + +code ends +end + diff --git a/Microsoft Pascal v2/djldos.OBJ b/Microsoft Pascal v2/DJLDOS.OBJ similarity index 100% rename from Microsoft Pascal v2/djldos.OBJ rename to Microsoft Pascal v2/DJLDOS.OBJ diff --git a/Microsoft Pascal v2/m.sh b/Microsoft Pascal v2/m.sh new file mode 100644 index 0000000..3e07270 --- /dev/null +++ b/Microsoft Pascal v2/m.sh @@ -0,0 +1,24 @@ +str=$(tr '[a-z]' '[A-Z]' <<< $1) + + +# -h flag is required for pas2 and generated apps so the top of ram is on a 64k-1 boundary +# due to bugs in the apps that try to copy 64k-1 bytes of ram and wrap. + +rm $str.EXE 2>/dev/null +rm $str.COD 2>/dev/null +rm $str.LST 2>/dev/null +rm $str.MAP 2>/dev/null +rm $str.OBJ 2>/dev/null + +ntvdm -r:. -u -c pas1 $str,$str,$str,$str +rm CON.LST 2>/dev/null +ntvdm -r:. -u -h -c pas2 +ntvdm -r:. -u -c link $str djldos,,,, + +rm $str.COD 2>/dev/null +rm $str.LST 2>/dev/null +rm $str.MAP 2>/dev/null +rm $str.OBJ 2>/dev/null + +ntvdm -h -p $str +