I want to print "Hello." every 55ns. what am I doing wrong?
.model small
.stack 100h
pusha MACRO
push ax
push bx
push cx
push dx
push sp
push bp
push si
push di
ENDM
popa MACRO
pop di
pop si
pop bp
pop sp
pop dx
pop cx
pop bx
pop ax
ENDM
.data
old_vec dw 1 dup(?)
old_seg dw 1 dup(?)
HELLO db "HELLO.$"
.code
start:
mov ax, @data
mov ds, ax
mov ax, es:[20h]
mov bx, es:[20h+2] ;saving the old ISR ADDRESS
mov old_vec, ax
mov old_seg, bx
mov es:[20h], OFFSET PRINT_HELLO ; setting the ivt to point to PRINT_HELLO
mov es:[20h + 2], SEG PRINT_HELLO
COMMENT @
mov bx, offset old_vec
mov ax, word ptr[bx]
mov es:[20h], ax
mov bx, offset old_seg
mov ax, word ptr[bx]
mov es:[20h+2], ax
@
;for1:
; jmp for1
.exit
mov ah, 4ch
int 21h
PRINT_HELLO proc far
pushf
pusha
mov ax, offset old_seg
mov bx, ax
mov es, word ptr[bx]
mov bx, offset old_vec
mov bx, word ptr[bx]
call far PTR es:[bx] ; calling the old interrupt handler
mov dx, offset HELLO
mov ah, 09h
int 21h
popa
iret
PRINT_HELLO endp
end
The comments are used for debugging...
2 more question -
- are the cli and sti commands necessary even if I call int 21h?
- When I go back to the OS, I guess that "Hello." won't be in memory, but it should print garbage no? and how do I add the String to memory?
Thanks a lot!!!