assume cs:code
code segment
start: mov ax,cs
mov ds,ax
mov si,offset do7ch
mov di,200H
mov cx,offset do7chend-offset do7ch
mov ax,0
mov es,ax
cld
rep movsb
mov word ptr es:[7ch*4],200H
mov word ptr es:[7ch*4+2],0
mov ax,4c00H
int 21h
do7ch: jmp short set
table dw sub0-do7ch+200H,sub1-do7ch+200H,sub2-do7ch+200H,sub3-do7ch+200H
set: push bx
cmp ah,3
ja sret
mov bl,ah
mov bh,0
add bx,bx
call word table[bx]
sret: pop bx
iret
sub0: push ax
push bx
push cx
push es
mov ax,0b800H
mov es,ax
mov bx,0
mov cx,2000
sub0s: mov byte es:[bx],' '
add bx,2
loop sub0s
pop es
pop cx
pop bx
pop ax
ret
sub1: push ax
push bx
push cx
push dx
push es
mov dl,00000111B
and dl,al
mov ax,0b800H
mov es,ax
mov bx,1
mov cx,2000
sub1s:
mov es:[bx],dl
add bx,2
loop sub1s
pop es
pop dx
pop cx
pop bx
pop ax
ret
sub2: push ax
push bx
push cx
push dx
push es
mov dl,01110000B
and dl,al
mov ax,0b800H
mov es,ax
mov bx,1
mov cx,2000
sub2s:
mov es:[bx],dl
add bx,2
loop sub2s
pop es
pop dx
pop cx
pop bx
pop ax
ret
sub3: push ax
push bx
push cx
push si
push es
mov ax,0b800H
mov es,ax
mov bx,160
mov si,0
mov cx,24
sub3s:
push cx
mov cx,80
sub3s0:
mov al,es:[bx]
mov es:[si],al
add bx,2
add si,2
loop sub3s0
pop cx
loop sub3s
mov cx,80
sub3s1:
mov word ptr es:[bx],' '
add bx,2
loop sub3s1
pop es
pop si
pop cx
pop bx
pop ax
ret
do7chend:
nop
code ends
end start