CSEG segment assume CS CSEG DS CSEG ES CSEG SS CSEG org 100h _zapuskat

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
CSEG segment
assume CS:CSEG, DS:CSEG, ES:CSEG, SS:CSEG
org 100h
_zapuskator:
call INPUT_LETTER
call CHECK_LETTER
call PRINT_LETTER
jmp _zapuskator ; :D
PRINT_LETTER proc
;push sp ; save address
push ax ; save key
mov ax, 0B800h ; videobuffer segment
mov es, ax
pop ax ; restore key
mov ah, 31 ; blue bg, white letters
mov di, 0 ; position (ax = 2 bytes)
mov es:[di], ax
ret
PRINT_LETTER endp
INPUT_LETTER proc
mov ah, 10h ; input function
int 16h ; bios
ret
INPUT_LETTER endp
CHECK_LETTER proc
cmp al, 0 ; if (al == 0) ah != 0
jz _zapuskator ; ignore
cmp al, 1Bh ; if (<ESC>)
jz _exit
ret
CHECK_LETTER endp
_exit:
int 20h
CSEG ends
end _zapuskator