Reputation: 9
.model tiny
code segment
ASSUME CS:CODE DS:DATA
ORG 100H
begin:
jmp init
off1 dw ?
seg1 dw ?
hr db ?
min db ?
sec db ?
test1:
push ax
push bx
push cx
push dx
push si
push di
push sp
push bp
mov ax, 0B800H
mov es, ax
mov ah, 02h
int 1AH
mov hr, ch
mov min, cl
mov sec, dh
mov bx, 1992
mov al, hr
call disp
call colon
mov al, min
call disp
call colon
mov al, sec
call disp
pop bp
pop sp
pop di
pop si
pop dx
pop cx
pop bx
pop ax
jmp dword ptr off1
disp proc
mov ch, 02h
mov cl, 04h
back:
rol al, cl
mov dl, al
and dl, 0fh
add dl, 30h
mov es:[bx], dl
inc bx
mov byte ptr es:[bx],0bh
inc bx
dec ch
jnz back
ret
disp endp
colon proc
mov byte ptr es:[bx],':'
inc bx
mov byte ptr es:[bx],8eh
inc bx
ret
colon endp
init:
push cs
pop ds
mov ax, 0002
int 10h
cli
mov ah, 35h
mov al,08h
int 21h
mov off1, bx
mov seg1, es
mov ah,25h
mov al, 08h
lea dx, test1
int 21h
sti
mov ah,31h
mov al,00
lea dx,init
int 21h
exit:
mov ah, 4ch
mov AL, 00H
int 21h
code ends
end begin
Though I know how to code NASM programs, I don't get the logic of this program and new functions and syntax is a bit confusing. Could anyone please comment the important parts of this program?
Upvotes: 0
Views: 1604
Reputation: 39556
This program sets the video mode to 80x25 and installs a new interrupt handler for hardware interrupt 08h. Then it terminates to DOS. It has some redundant code near the end!
On every timer tick (18.2 times / second) it displays a clock. This happens at the center of the screen!
Upvotes: 2