; Copyright (c) 1988 Regents of the University of California.
; Redistribution and use in source and binary forms are permitted
; provided that this notice is preserved and that due credit is given
; to the University of California at Berkeley. The name of the University
; may not be used to endorse or promote products derived from this
; software without specific prior written permission. This software
; is provided ``as is'' without express or implied warranty.
; @(#)spintasm.asm 3.2 (Berkeley) %G%
; The code in this file complete the spint calls
; XXX mov si, spint_si[si]
_TEXT segment byte public 'CODE'
_DATA segment word public 'DATA'
CONST segment word public 'CONST'
_BSS segment word public 'BSS'
DGROUP group CONST, _BSS, _DATA
assume cs:_TEXT, ds:DGROUP, ss:DGROUP, es:DGROUP
start_sp dw 1 dup (?) ; For use in our 'longjmp'
start_ss dw 1 dup (?) ; For use in our 'longjmp'
spint_segment dw 1 dup (?) ; Segment of spawn control block
spint_offset dw 1 dup (?) ; Offset of spawn control block
old_si dw 1 dup (?) ; SI of interrupt issuer (temporary)
old_ds dw 1 dup (?) ; DS of interrupt issuer (temporary)
issuer_ss dw 1 dup (?) ; ss of person who called us (permanent)
issuer_sp dw 1 dup (?) ; sp of person who called us (permanent)
int21_stack db 100 dup (?) ; Stack for int21.
; _spint_int gets control on an interrupt. It switches the stack
; and does a 'return' from _spint_start.
; _spint_start issues the dos interrupt after setting up the passed
; registers. When control returns to it, it sets spint->done to non-zero.
; Now, switch to a different (short) stack. This is so
; that our games won't mess up the stack int 21 (hardware and,
; possibly, software) stores things on.
mov sp, offset int21_stack
add sp, (length int21_stack) - 4
int 21H ; Issue DOS interrupt
mov spint_done[si], 1 ; We are done
; After _spint_int has faked a return from start_spawn, we come here to
; return to the interrupt issuer.
__spint_continue proc near
mov sp, cs:issuer_sp ; Restore SP
mov ss, cs:issuer_ss ; Restore SS