;definice pouzivany ze souboru _def.inc
;
;
;endln macro ;oddeli radek
;initVRAM_txt macro
;print macro ; vypise retezec z [ds:dx]
;printS macro retezik ; vypise retezec
;printS_enDln macro retezik ; vypise retezec s endline
;oznam_chybu MACRO hlaska ;oznami chybu a vyskoci s beepem
;mezeraP Proc NEAR ;udela nekolikrat enter - cx krat
;mezera MACRO pocetkrat
;getCursorPos macro ;naplni CursorX a CursorY aktualni pozici
;getstrP Proc NEAR ;ax @data,di offset retezce,cx max delka
;Getstr MACRO retezec,max_delka
;w_char Macro ;di radek ,dx sloupec, al char ,es = 0B800 H
;write_char Macro x,y,znak
;CLrscr_txt macro vypln,znak ;v al vypln , v ah pismeno
;znakDOSP PROC NEAR ;v dl znak
;znakDOS MACRO znak
;FillS MACRO retezec,znakem,delka ;vyplni retezec o delce delka urcitym znakem
;str_lengthP Proc
;str_length MACRO nazev,delka ;zjisti delku retezce ukonceneho '$'
;
;
;
;
;
;
;
;
;
;--------------------------------------------
endln macro ;oddeli radek
mov ah,2 ;pis na display
mov dl,13 ;znak endln
int 21h
mov dl,10 ;znak carr. ret ??
int 21h
endm
;--------------------------------------------
initVRAM_txt macro
mov di,0B800h
mov es,di
xor di , di
endM
;--------------------------------------------
print macro ; vypise retezec z [ds:dx]
mov ah,9h ;zobraz retezec
int 21h
endm
;--------------------------------------------
printS macro retezik; vypise retezec z [ds:dx]
pushA
mov ax,@data ;ax odkazuje na dataseg
mov ds,ax
mov dx,offset retezik ;vypsani autora
mov ah,9h ;zobraz retezec
int 21h
popA
endm
;--------------------------------------------
printS_enDln macro retezik; vypise retezec z [ds:dx]
pushA
mov ax,@data ;ax odkazuje na dataseg
mov ds,ax
mov dx,offset retezik ;vypsani autora
mov ah,9h ;zobraz retezec
int 21h
ENDLN
popA
endm
;_______________________________________________________________________-
mezeraP Proc NEAR ;udela nekolikrat enter - CX krat
mov ah,2 ;pis na display
mov dl,13 ;znak endln
int 21h
tu:
mov dl,10 ;znak carr. ret ?? nebo nak tak se menuje
int 21h
loop tu
RET
MEZERAP ENDP
mezera MACRO pocetkrat
pushA
mov CX,pocetkrat
call mezeraP
popA
endm
;_______________________________________________________________________-
oznam_chybu MACRO hlaska
prints_endln hlaska
call beep
jmp konec
endM
;_______________________________________________________________________-
getCursorPos macro
mov ah,03h
int 10h
mov cursorX,dl
mov cursorY,dh
endm
;_______________________________________________________________________-
getstrP Proc NEAR ;v ax @data,di offset mista dat v pameti
;v cx max delka pokud nezmackne enter
N1:
xor ah,ah
int 16h ;cti klavesu ->al
cmp ah,01ch ;rozsirene kody... ah enter
;jinac pismeno v al
jz kvido
mov byte ptr es:[di],al
mov ah,2 ;pis na display
mov dl,al ;znak
int 21h
inc di
loop N1
KVIDO:
mov al,36 ;"$"
mov byte ptr es:[di],al
RET
GetstrP endp
Getstr MACRO retezec,max_delka
pushA
mov cx,max_delka
mov di,@data ;ax odkazuje na dataseg
mov es,di
mov di,offset retezec ;vypsani autora
call GetstrP
popA
ENDM
;--------------------------------------------
w_char Macro ;di radek
;dx sloupec
;al char
;es > 0B800 H
mov bx,di
shl di,7
shl bx,5
add di,bx ;v bx pozice dvojbunky v obr.pameti
STOSB
ENDM
;--------------------------------------------
write_char Macro x,y,znak ;di radek
pushA
mov di,0b800h
mov es,di
mov al,znak
w_char
popA
endM
;--------------------------------------------
CLrscr_txt macro vypln,znak ;v al vypln
;v ah pismeno
mov al,vypln
mov ah,znak
push di
push es
push cx
initVRAM_TXT
mov cx,2000
rep stosw ;2b*32k= 64k x vlozit barvu
pop cx
pop es
pop di
endm
;_______________________________________________________________________-
znakDOSP PROC NEAR ;v dl znak
mov ah,02h
int 21h
RET
znakDOSp ENDP
znakDOS MACRO znak
pushA
mov dl,znak
call znakDOSP
popA
endM
;--------------------------------------------
FillS MACRO retezec,znakem,delka ;vyplni retezec o delce delka urcitym znakem
pushA
mov al,znakem
mov cx,delka
mov di,@data ;nastavim segment ES na seg ,kde sou data
mov es,di
mov di,offset retezec
; les di,offset pom_dup ;dsdjisdfjiodsfjiosdijojidosf chyba du do posilky
rep stosb
; inc di
mov al,'$'
stosb ;zapisu znak ukonceni retezce pro dosovske vypsani retezce fci int 21h
;pri primem vypsani retezce do obr. pameti staci pouze znat delku
;to samo jako loopek1: ,mov byte ptr es:[di],al , loop loopek1
;ted se cx zmensilo jako svina az na nulu,ale
popA
ENDM
;_______________________________________________________________________
str_lengthP Proc NEAR
xor dx,dx ;ze zacatku je nulova velikost
mov al,'$'
otoc01:
mov bl, byte ptr ds:[di]
cmp byte ptr ds:[di],al ;porovnej s '$'
jz kon01 ;dostal se na konec
inc di
inc dx
cmp di,65535 ;maximalni delka ... veci cislo registr 16 bitovy neumi (tj. vcetne 0
jz nula01
jmp short otoc01
jmp short kon01
nula01:
xor dx,dx ;asi se nekde stala chyba - je moc velky ? az tak ? _ asi ti to
;ukazuje na nejakou sracku a ne na reteZec, CI NENI UKONCEN '$' !!!!
kon01:
RET
str_lengthP ENDP
;,
;--------------------------------------------
str_length MACRO nazev,delka
mov di,@data
mov ds,di
mov di,offset nazev
call str_lengthP
mov delka,dx
endM