trucchi-comtutti i trucchi che nessuno sà |
AREA PERSONALE
TAG
MENU
CONTATTA L'AUTORE
Nickname: romoletto640
|
|
|
![]() ![]() ![]() ![]() Età: 59 Prov: EE |
« assembler per principianti | INTRODUZIONE ALLA PROGRAMMAZIONE » |
assembler per principiantiEsempi N. 1 ;98-10.ASM .model small .stack 100h .DATA .CODE main: MOV AX,@DATA MOV DS,AX MOV AX,0 ;0000 MOV AH,12D ;0C00 MOV AL,12H ;0C12 MOV AL,0H ;0C00 0h = 00h MOV AL,12H ;0C12 MOV AL,0b ;0C00 0b = 0h MOV AH,4Ch INT 21h end main END. N. 2 ;exam2.asm ;02/10/2001 ;shows * on the computer screen .model small .stack .code mov ah,2h ;moves the value 2h to register ah mov dl,2ah ;moves the value 2ah to register dl mov cx,10 ciclo: int 21h ;21h interruption loop ciclo mov ah,4ch ;4ch function, goes to operating system int 21h ;21h interruption END ;finishes the program code N.3 ;led1 ;programma che accende 8 led in successione collegati in output alla porta ;parallela .model small .stack 100h .DATA .CODE MOV AX,@DATA MOV DS,AX mov dx,378h ; indirizzo della porta parallela mov al,00000001b ; inizia dal primo led acceso mov cx,0ffffh ; conta il numero di cicli ripeti: out dx,al ; output mov bx,0 ; ritardo inic1: mov ah,200 inic2: dec ah jnz inic2 dec bx jnz inic1 rol al,1 ; prepara il prossimo output loop ripeti MOV AH,4Ch INT 21h END N. 4
;98-10.ASM .model small .stack 100h .DATA .CODE main: MOV AX,@DATA MOV DS,AX mov ax,0ffffh add ax,0001h mov ax,0001h sub ax,0003h mov ax,0ffffh add ax,0ffffh mov ax,0002h sub ax,0002h mov ah,00h sub ah,02h mov ah,20h sub ah,20h mov ah,00h add ah,0ffh mov ah,00h add ah,11h add al,04h MOV AH,4Ch INT 21h end main END.
N. 5 ;exam2.asm ;02/10/2001 ;stampa un quadrato di asterischi 10*10 .model small .stack .code mov ah,2h ;moves the value 2h to register ah mov dl,2ah ;moves the value 2ah to register dl mov cx,10 ;assigned loop value lab1: int 21h ;21h interruption mov dl,32 int 21h mov dl,2ah loop lab1 ;loop mov dl,10 int 21h mov dl,13 int 21h mov cx,8 lab3: mov dl,2ah int 21h mov dl,32 int 21h mov dl,2ah mov bx,cx mov cx,16 lab4: mov dl,32 int 21h loop lab4 mov cx,bx mov dl,2ah int 21h mov dl,10 int 21h mov dl,13 int 21h loop lab3 mov dl,2ah mov cx,10 lab2: int 21h mov dl,32 int 21h mov dl,2ah loop lab2 mov ah,4ch ;4ch function, goes to operating system int 21h ;21h interruption END ;finishes the program code N. 6 ;stampa stringa colorata e di dimensione superiore (forse) .model small .stack 100h .DATA stringa db 'sistemi$' .CODE ;----------------------------------------------------- inizio: MOV AX,@DATA MOV DS,AX ret ;----------------------------------------------------- fine: MOV AH,4Ch INT 21h ret ;----------------------------------------------------- stampacol: mov bh,0 mov bl,2 int 10h mov ah,09 lea dx,stringa int 21h ret ;----------------------------------------------------- ;stampadim: ;ret ;----------------------------------------------------- main: call inizio call stampacol ; call stampadim call fine end main END.
N. 7
.model small .stack 100h .DATA .CODE MOV ah,02h mov dl,2ah mov bh,0 ; controllo numero asterischi riga: inc bh ; stabilisce quanti asterischi devono essere stampati sulla riga corrente mov bl,0 aster: int 21h ; stampa un asterisco inc bl cmp bl,bh ; termina quando sono stati stampati bh asterischi jne aster mov dl,10 int 21h mov dl,13 int 21h mov dl,2ah cmp bh,5 jne riga ; stampa un'altra riga MOV AH,4Ch INT 21h END t_asterischi.asm stringacolore.asm quadrato di asterischi.asm prova.asm led.asm Asterischi da http://megarchivio.cjb.net |