|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T i
Length: 3170 (0xc62)
Types: TextFile
Names: »iutilasm.asm«
└─⟦a05ed705a⟧ Bits:30007078 DKUUG GNU 2/12/89
└─⟦ff23ba0e6⟧ »./ghostscript-1.3.tar.Z«
└─⟦a24a58cd3⟧
└─⟦this⟧ »iutilasm.asm«
; Copyright (C) 1989 Aladdin Enterprises. All rights reserved.
; Distributed by Free Software Foundation, Inc.
;
; This file is part of Ghostscript.
;
; Ghostscript is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
; to anyone for the consequences of using it or for whether it serves any
; particular purpose or works at all, unless he says so in writing. Refer
; to the Ghostscript General Public License for full details.
;
; Everyone is granted permission to copy, modify and redistribute
; Ghostscript, but only under the conditions described in the Ghostscript
; General Public License. A copy of this license is supposed to have been
; given to you along with Ghostscript so you can know your rights and
; responsibilities. It should be in a file named COPYING. Among other
; things, the copyright notice and this notice must be preserved on all
; copies.
; iutilasm.asm
; Assembly code for GhostScript interpreter on MS-DOS systems
utilasm_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:utilasm_TEXT
ifdef FOR80386
.286c
; Macro for 32-bit operand prefix.
OP32 macro
db 66h
endm
endif ; FOR80386
; void ref_assign(ref *pto, ref *pfrom)
; { *pto = *pfrom;
; }
PUBLIC _ref_assign
_ref_assign proc far
mov bx,sp
ifdef FOR80386 ; Use 32-bit moves
les bx,ss:[bx+8] ; pfrom
OP32
mov ax,es:[bx]
OP32
mov cx,es:[bx+4]
mov bx,sp
les bx,ss:[bx+4] ; pto
OP32
mov es:[bx],ax
OP32
mov es:[bx+4],cx
else ; (ifndef FOR80386)
push ds
lds bx,ss:[bx+8] ; pfrom
mov ax,[bx]
mov cx,[bx+2]
mov dx,[bx+4]
push [bx+6]
mov bx,sp
lds bx,ss:[bx+8] ; pto (2 more words on stack)
mov [bx],ax
mov [bx+2],cx
mov [bx+4],dx
pop [bx+6]
pop ds
endif ; FOR80386
ret
_ref_assign endp
ifdef FOR80386
; Replace the multiply and divide routines in the Turbo C library
; if we are running on an 80386.
; Macro to swap the halves of a 32-bit register.
; Unfortunately, masm won't allow a shift instruction with a count of 16,
; so we have to code it in hex.
swap macro regno
OP32
db 0c1h,0c0h+regno,16 ; rol regno,16
endm
regax equ 0
regcx equ 1
regdx equ 2
regbx equ 3
; Multiply (dx,ax) by (cx,bx) to (dx,ax).
PUBLIC LXMUL@
LXMUL@ proc far
swap regdx
mov dx,ax
swap regcx
mov cx,bx
OP32
db 0fh,0afh,0d1h ; imul dx,cx
OP32
mov ax,dx
swap regdx
ret
LXMUL@ endp
; Divide two stack operands, leave the result in (dx,ax).
setup32 macro
mov bx,sp
OP32
mov ax,ss:[bx+4] ; dividend
endm
PUBLIC LDIV@, LUDIV@, LMOD@, LUMOD@
LDIV@ proc far
setup32
OP32
cwd
OP32
idiv word ptr ss:[bx+8] ; divisor
OP32
mov dx,ax
swap regdx
ret 8
LDIV@ endp
LUDIV@ proc far
setup32
OP32
xor dx,dx
OP32
div word ptr ss:[bx+8] ; divisor
OP32
mov dx,ax
swap regdx
ret 8
LUDIV@ endp
LMOD@ proc far
setup32
OP32
cwd
OP32
idiv word ptr ss:[bx+8] ; divisor
OP32
mov ax,dx
swap regdx
ret 8
LMOD@ endp
LUMOD@ proc far
setup32
OP32
xor dx,dx
OP32
div word ptr ss:[bx+8] ; divisor
OP32
mov ax,dx
swap regdx
ret 8
LUMOD@ endp
endif ; FOR80386
utilasm_TEXT ENDS
END