Document 25
Document 25
[org 0x0100]
jmp start
; PCB layout:
; ax,bx,cx,dx,si,di,bp,sp,ip,cs,ds,ss,es,flags,next,dummy
; 0, 2, 4, 6, 8,10,12,14,16,18,20,22,24, 26 , 28 , 30
char: dw '*'
col dw 0,80,75,70
delay:
pusha
pushf
mydelay:
mydelay1:
dec bx
jnz mydelay1
loop mydelay
popf
popa
ret
; takes the row no, column no, and number to be printed as parameters
clrscr: push es
push ax
push cx
push di
pop di
pop cx
pop ax
pop es
ret
printnum: push bp
mov bp, sp
push es
push ax
push bx
push cx
push dx
push di
call clrscr
mov dl,'*'
pop di
pop dx
pop cx
pop bx
pop ax
pop es
pop bp
ret 6
mov bp, sp
push ax
push bx
; add byte[col],5
pop bx
pop ax
mov sp, bp
pop bp
ret
initpcb: push bp
mov bp, sp
push ax
push bx
push cx
push si
mov cl, 5
mov cl, 9
exit: pop si
pop cx
pop bx
pop ax
pop bp
ret 6
timer: push ds
push bx
push cs
shl bx, 1
shl bx, 1
shl bx, 1
shl bx, 1
mov cl, 5
cli
sti
nextkey:
cmp word[lineno],0
je reset
reset:
mov word[lineno],24
jmp nextkey
Q2
[org 0x0100]
jmp start
dw 0, 0, 0, 0, 0 ; task1 regs
dw 0, 0, 0, 0, 0 ; task2 regs
col db 0
col2 db 3
row db 0
row2 db 0
char db '*'
printloop:
pusha
mov [col],ax
reset:
mov cx, 1
mov byte[row],0
l1:
mul bx
; set cursor
mov bh, 0
je notspace
dec dh
mov cx, 1
int 0x10
notspace:
mov cx, 1
call small_delay
je reset
jmp l1
small_delay:
pusha
mov cx, 0x00FF ; Outer loop count (reduce for smaller delay)
delay_outer:
mov bx, 0x00FF ; Inner loop count (reduce for smaller delay)
delay_inner:
dec bx
jnz delay_inner
dec cx
jnz delay_outer
popa
ret
taskone:
call printloop
jmp taskone ; infinite task
tasktwo:
call printloop
timer: push ax
push bx
xor ax, ax
sti
jmp $