Metropoli BBS
VIEWER: c0c2.asm MODE: TEXT (ASCII)
;common file #2

;included by c0.asm

  align 4
_int10h:
  sti
  push ds
  push es
  mov ds,cs:seldata
  mov es,seldata
  mov _int,10h

;ds & es must == seldata

_gen_int:
  sub esp,sizeof callstruct  ;FIX : v2.00 : no longer use just one callback
  push edi                   ;struct which would not have allowed to call
  mov edi,esp                ;int 10h in a IRQ
  add edi,4
  pop dptr[edi+0h]
  mov dptr[edi+4h],esi
  mov dptr[edi+8h],ebp
  mov dptr[edi+0ch],0
  mov dptr[edi+10h],ebx
  mov dptr[edi+14h],edx
  mov dptr[edi+18h],ecx
  mov dptr[edi+1ch],eax
  mov wptr[edi+20h],0  ;flags
  mov ax,_es_
  mov wptr[edi+22h],ax
  mov ax,_ds_
  mov wptr[edi+24h],ax
  mov wptr[edi+26h],0  ;FS
  mov wptr[edi+28h],0  ;GS
  mov wptr[edi+2ah],0  ;IP ;
  mov wptr[edi+2ch],0  ;CS ;ignored
  mov wptr[edi+2eh],0  ;SP ;
  mov wptr[edi+30h],0  ;SS ;dito (but must be 0)

  mov ax,300h
  mov bx,_int
  mov cx,0
  int 31h     ;ignore error!
  mov esi,dptr[edi+4]
  mov ebp,dptr[edi+8]
  mov ebx,dptr[edi+10h]
  mov edx,dptr[edi+14h]
  mov ecx,dptr[edi+18h]

  mov ax,wptr[edi+22h]     ;NEW : es,ds are now returned from RMODE !!!
  mov _es_,ax
  mov ax,wptr[edi+24h]
  mov _ds_,ax

  mov al,bptr[edi+20h]
  and al,1  ;mask carry flag
  ; current stack
  ; ESP=>es,ds,off,sel,flags
  and bptr[esp+16],0feh
  or [esp+16],al   ;set carry from interrupt
  mov eax,dptr[edi+1ch]
  mov edi,dptr[edi]
  add esp,sizeof callstruct

  pop es
  pop ds
  iretd    ;flags updated from above.
[ RETURN TO DIRECTORY ]