All interrupt handlers that dump stack (13 words of stack) to screen could corrupt output because AX value could be not preserved during int10 call. So function code (ah=0eh) is lost and it's next value (and function) depends on bios implementation. In my case it was ah=3 "read cursor position" but could be "set mode", for example.
The current code works fine with some emulators as they preserve AX value, but looking at the original IBM PC XT BIOS from 1982/86, the following comment is placed in int10 header:
CS,SS,DS,ES,BX,CX,DX PRESERVED DURING CALL
ALL OTHERS DESTROYED
entry.asm:167
mov bp, sp
xor si, si ; print 13 words of stack for debugging LUDIV etc.
stack_loop:
mov dx, [bp+si]
call print_hex
mov al, ' '
int 10h
<<--- AX value is lost here
inc si
inc si
cmp si, byte 13*2
jb stack_loop
mov al, 0dh
int 10h <<- and here
mov al, 0ah
int 10h <<- and here
2 lines above you have
mov al, ' '
which REALLY destroys AX. no need to go to the IBM BIOS
btw: this is an abort program handler.
close this bug
First, the file entry.asm, can be seen at:
https://github.com/PerditionC/fdkernel/blob/master/kernel/entry.asm
I disagree with Tom, the reported error is the code make the assumption that... at least AX, and more precisely AH... will not by changed by Int 10h, and indeed I don't see why we can make this assumption.
So at first glance, in this code most:
int 10h
should be replaced by:
push ax
int 10h
pop ax
Still a bit unsure if I miss an other register... but preserve AH value is essential for this code to work.