home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
GLEN
/
APBASIC.ZIP
/
INT.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-10-18
|
2KB
|
75 lines
Title Subprogram to generated software interrupts
Page 60,130
; Created 10-17-1987 k. murray
;
Cseg Segment byte public 'Code'
Assume Cs:Cseg,Ds:nothing,Es:nothing
;
; Define in program:
; Sub DoInt IntNo%,Reg%(1) External "Int.Com"
; Call in program:
; DoInt &h21,Registers%()
;
; Stack frame:
; Bp+14 IntNo% offset
; Bp+12 Number of elements
; Bp+10 Dim 1 Size
; Bp+8 Dim 1 Low bounds
; Bp+6 Array Offset
; Bp+4 Return Segment
; Bp+2 Return Offset
; Bp+0 Saved Bp
Start:
DoInt Proc Far
Push Bp
Mov Bp,Sp ; Setup base pointer
Mov Bx,[Bp+14] ; adr. of IntNo%
Mov Al,[Bx] ; get low byte of IntNo%
Mov byte ptr Cs:DoInt02,Al
Push Ds
Push Bp ; save registers in case they change
Mov Di,[Bp+6] ; get offset of array
Push [Di+0] ; push Reg%(0) on stack (flags)
Mov Ax,[Di+2] ; Reg%(1)
Mov Bx,[Di+4] ; Reg%(2)
Mov Cx,[Di+6] ; Reg%(3)
Mov Dx,[Di+8] ; Reg%(4)
Mov Si,[Di+10] ; Reg%(5)
Push [Di+12] ; save Reg%(6) (Di) on stack
Mov Bp,[Di+14] ; Reg%(7)
Mov Es,[Di+18] ; Reg%(9)
Mov Ds,[Di+16] ; Reg%(8) (Do last)
Pop Di ; Get Reg%(6) off stack
Popf ; Pop flags
; registers setup, now do interrupt
Db 0cdh ; initial code for INT
DoInt02 Db 0 ; put interrupt # to do here
; Done with interrupt, save registers back in array
Mov Cs:SvBp,Bp ; save returned Bp for later
Mov Cs:SvDs,Ds ; save returned Ds for later
Pop Bp ; get programs base pointer
Pop Ds ; and data segment
Push Di
Mov Di,[Bp+6] ; Offset of array
Pushf ; save flags on stack
Pop [Di+0] ; and pop into array Reg%(0)
Mov [Di+2],Ax ; Reg%(1)
Mov [Di+4],Bx ; Reg%(2)
Mov [Di+6],Cx ; Reg%(3)
Mov [Di+8],Dx ; Reg%(4)
Mov [Di+10],Si ; Reg%(5)
Pop [Di+12] ; Pop saved Di into Reg%(6)
Mov Ax,Cs:SvBp ; Get Bp and Ds into
Mov Bx,Cs:SvDs ; Ax and Bx
Mov [Di+14],Ax ; Reg%(7)
Mov [Di+16],Bx ; Reg%(8)
Mov [Di+18],Es ; Reg%(9)
Pop Bp ; Restore base pointer
Ret
DoInt Endp
; Data area for program
SvBp Dw 0
SvDs Dw 0
Cseg Ends
End Start