home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
trl14db.zip
/
TRLSRC.EXE
/
TR_DBASE.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-10-22
|
4KB
|
212 lines
; trdbase.asm
;
; by Alastair Dallas, Ralph Davis, Tom Rettig, and Leonard Zerman
;
; Placed in the public domain by Tom Rettig Associates, 10/22/1990.
;
public doit ; execute function call
public getvec ; fetch INT vector
public pv_int ; service trpass interrupt
public setvec ; set INT vector
public tr_int ; service trlib interrupt
; C functions defined in trlib.c:
extrn callfunc:far ; process trlib call
extrn trpass:far ; process trpass call
extrn trret:far ; process trret call
; data defined in trlib.c:
extrn pstk:byte
extrn pcount:word
; Lattice environmental variables (defined in Lattice's c.asm):
extrn _mneed:dword ; minimum heap size (redefined in trlib.c)
extrn _psp:dword ; address of PSP
extrn _tsize:word ; total size in paragraphs
DOS equ 21h ; DOS interrupt vector
dgroup group dataseg
dataseg segment word public 'data'
reg_ax dw ?
reg_bx dw ?
reg_cx dw ?
reg_dx dw ?
reg_bp dw ?
reg_sp dw ?
reg_si dw ?
reg_di dw ?
reg_ds dw ?
reg_es dw ?
reg_ss dw ?
dataseg ends
codeseg segment byte
assume cs:codeseg,ds:dgroup
;------------------------------------------------
doit proc far
; execute function call
; entry: <sp+4> = function address
; swap ret addr and func arg:
; stack on entry: revised stack:
; func.seg (ax) ret.seg (cx)
; func.off (bx) ret.off (dx)
; ret.seg (cx) func.seg (ax)
; ret.off (dx) func.off (bx)
pop dx
pop cx
pop bx
pop ax
push cx
push dx
push ax
push bx
ret
doit endp
;------------------------------------------------
getvec proc far
; get INT vector
; entry: <sp+4> = vector number
; exit: vector in AX:BX
push bp
mov bp,sp
mov al,[bp+6] ; vector number
mov ah,35h ; get vector
int DOS ; vector in es:bx
mov ax,bx
mov bx,es
pop bp
ret
getvec endp
;------------------------------------------------
pv_int proc far
; service trpass interrupt
; entry: DS:BX = variable address
; AL = 0 for parameter variable, AL = 1 for return variable
push ds
push bx
mov bx,dgroup
mov ds,bx
and ax,ax
jz pv1
call trret
jmp pvx
pv1:
call trpass
pvx:
add sp,4
iret
pv_int endp
;------------------------------------------------
setvec proc far
; set INT vector
; entry: <sp+4> = vector number
; <sp+6> = new vector
push bp
mov bp,sp
mov al,[bp+6] ; vector number
mov ah,25h ; set vector
push ds ; preserve ds for Lattice
lds dx,[bp+8] ; offset address
int DOS
pop ds
pop bp
ret
setvec endp
;------------------------------------------------
; temporary storage
save_ds dw ?
save_ax dw ?
tr_int proc far
; service trlib interrupt
; entry: DS:BX = function name asciiz string
mov cs:save_ds,ds
mov cs:save_ax,ax
mov ax,dgroup
mov ds,ax
mov ax,cs:save_ax
mov reg_ax,ax
mov reg_bx,bx
mov reg_cx,cx
mov reg_dx,dx
mov reg_bp,bp
mov reg_sp,sp
mov reg_si,si
mov reg_di,di
mov ax,cs:save_ds
mov reg_ds,ax
mov reg_es,es
mov reg_ss,ss
push ax ; original ds
push bx
call callfunc
add sp,2
mov ax,reg_ax
mov bx,reg_bx
mov cx,reg_cx
mov dx,reg_dx
mov bp,reg_bp
mov sp,reg_sp
mov si,reg_si
mov di,reg_di
mov es,reg_es
mov ss,reg_ss
mov ds,reg_ds
push ax
mov al,20h
out 20h,al ; end of interrupt signal
pop ax
iret
tr_int endp
codeseg ends
END