; quick debugger DOSSEG .MODEL SMALL .STACK 4096 .DATA .CODE VideoSegment EQU 0B800h Old9 label FAR int9 PROC ; start of ISR for 9h push ax push bx push cx push dx push si push di push ds push es push bp ; preserve stack mov bp,sp mov ax,0040h mov ds,ax mov bx,ds:[001Ah] mov cx,ds:[001Ch] pushf ; call old int9 routine StartOf9: call Old9 cmp bx,ds:[001Ch] je endint mov ax,ds:[bx] cmp ax,3b00h jne endint mov ax,0b800h mov es,ax mov byte ptr es:[0],'*' mov ds:[001Ah],bx mov ds:[001Ch],cx mov ax,[bp+16] mov bx,152 call outputnum mov ax,[bp+14] mov bx,152+160 call outputnum endint: mov sp,bp ; restore stack pop bp pop es pop ds pop di pop si pop dx pop cx pop bx pop ax iret ; return from interrupt int9 ENDP outputnum PROC mov cx,VideoSegment mov ds,cx mov byte ptr ds:[bx+1],7 mov byte ptr ds:[bx+3],7 mov byte ptr ds:[bx+5],7 mov byte ptr ds:[bx+7],7 push ax and ax,0f000h mov cl,12 shr ax,cl cmp al,10 jae alpha1 add al,48 jmp endout1 alpha1: add al,55 endout1: mov ds:[bx],al pop ax push ax and ax,00f00h mov cl,8 shr ax,cl cmp al,10 jae alpha2 add al,48 jmp endout2 alpha2: add al,55 endout2: mov ds:[bx+2],al pop ax push ax and ax,0000f0h mov cl,4 shr ax,cl cmp al,10 jae alpha3 add al,48 jmp endout3 alpha3: add al,55 endout3: mov ds:[bx+4],al pop ax push ax and ax,00000fh cmp al,10 jae alpha4 add al,48 jmp endout4 alpha4: add al,55 endout4: mov ds:[bx+6],al pop ax ret outputnum ENDP EndofCode: ; end of resident part of code ProgramStart: mov ax,cs ; set data segment = code segment mov ds,ax mov ax,3509h ; get original interrupt vector 9h int 21h mov word ptr Startof9+1,bx ; patch old procedure address into code mov word ptr Startof9+3,es lea dx,int9 ; set interrupt vector 9h mov ax,2509h int 21h lea dx,EndOfCode ; get length of code to remain resident mov cl,4 ; divide by 4 to calculate paragraphs shr dx,cl add dx,11h ; add 1 for remainder and 10 for PSP mov ah,31h ; terminate and stay resident int 21h END ProgramStart