Assembler - systémová knihovna

Kategorie >>Programování>> Assembler - systémová knihovna


;pause macro ;ceka na stisk klavesy
;initmouse macro
;mouseCursorOn macro
;mouseCursorOff macro
;startMOUSE PROC ;init mouse + cursor mouse ON
;mouse_stat macro mx,my,buttons
;
;
;beep PROC NEAR
;delayP Proc ;milisekundy ulozene v promenne DX
;delay Macro milisek
;
;

;--------------------------------------------
pause macro ;ceka na stisk klavesy
xor ah,ah
int 16h
endm

;--------------------------------------------
initmouse macro
xor ax,ax
int 33h ;ax=ffffh,ovladac ok, ax=0 neni ovladac mysi
endm

;--------------------------------------------
mouseCursorOn macro
mov ax,1
int 33h
endm

;--------------------------------------------
mouseCursorOff macro
mov ax,2
int 33h
endm


;______________________________________Obrázek____________________________
startMOUSE PROC near
pushA
initmouse
cmp ax, 0fffh
jnz faklabrejle ;mys nepojede fakla sTARAa mama
mousecursorOn
faklabrejle:
popA
ret
Startmouse endP
;__________________________________________________________________
mouse_stat macro mx,my,buttons
mov ax,3
int 33h
mov mx,cx
mov my,dx
mov buttons,bx
endm


;__________________________________________________________________
SET_m_xy macro mx,my
mov ax,4

mov cx,mx
mov dx,my
int 33h

endm

;--------------------------------------------
beep PROC NEAR
pushA
in al, 61h
or al, 3
out 61h, al
mov al, 0b6h
out 43h, al
mov al, 40h
out 42h, al
mov al, 02h
out 42h, al
mov cx, 100
p_sm1: mov ax, 0FFFFh
p_sm0: dec ax
NOP ;kvuli casovaci, aby se to nesralo prilis castyma prerusenima
NOP
NOP
jnz p_sm0
loop p_sm1
in al, 61h
and al, 0fch
out 61h, al
popA
RET
beep ENDP


;--------------------------------------------

;*************** POZOR JESTE SEM TAM HAZE CHYBY, ASI PREDELAT

delayP Proc NEAR;milisekundy ulozene v DX
;v dx milis.
MOV AH,00h ;cti hodiny od resetu
int 1ah ;->v dx je nizsi pocet taktu (18.2 / s)

xor dx,dx
MOV ax,ms ;nahravam jiz ulozene milisekundy

mov bx,55
div bx ;ax = milisekund/55 .. tj pocet taktu co pockat
add pom_cas,ax ;zkontrolovat zda nemuze generovat OF .. ono to nevadi, pac
;kdyz to pretece , tak to vlastne jede.. snad se to nevysere
otockaloop:
int 1ah
NOP
NOP ;abych to preruseni prilis nepredrel
NOP
cmp dx,pom_cas
jae vyskockaloop ;pokud vetsi nebo rovno casu, na kterej cekam.. konec
jmp otockaloop
vyskockaloop:

RET
DELAYP EndP



delay Macro milisek

pusha ;Save registers
mov ms,milisek
call DelayP
popa ;Restore registers
endM




Vloženo: 23.02.2007 00:42
Přečteno:2740
Autor: David Mizera

Hlasů: 0 Hodnocení(jako ve škole): nehlasováno
 

Komentáře (0)

   -     Nový Komentář