trucchi-com

assembler per principianti


EsempiN. 1;98-10.ASM .model small .stack 100h.DATA.CODE main:MOV AX,@DATAMOV DS,AXMOV AX,0 ;0000MOV AH,12D ;0C00MOV AL,12H ;0C12MOV AL,0H ;0C00 0h = 00h MOV AL,12H ;0C12MOV AL,0b ;0C00 0b = 0h MOV AH,4ChINT 21hend mainEND.N. 2;exam2.asm;02/10/2001;shows * on the computer screen.model small.stack.codemov ah,2h ;moves the value 2h to register ahmov dl,2ah ;moves the value 2ah to register dlmov cx,10 ciclo: int 21h ;21h interruptionloop ciclomov ah,4ch ;4ch function, goes to operating systemint 21h ;21h interruptionEND ;finishes the program codeN.3;led1;programma che accende 8 led in successione collegati in output alla porta ;parallela .model small .stack 100h.DATA.CODE MOV AX,@DATAMOV DS,AXmov dx,378h ; indirizzo della porta parallelamov al,00000001b ; inizia dal primo led accesomov cx,0ffffh ; conta il numero di cicliripeti: out dx,al ; outputmov bx,0 ; ritardoinic1: mov ah,200inic2: dec ahjnz inic2dec bxjnz inic1rol al,1 ; prepara il prossimo outputloop ripetiMOV AH,4ChINT 21hENDN. 4 ;98-10.ASM .model small .stack 100h.DATA.CODE main:MOV AX,@DATAMOV DS,AXmov ax,0ffffhadd ax,0001hmov ax,0001hsub ax,0003hmov ax,0ffffhadd ax,0ffffhmov ax,0002hsub ax,0002hmov ah,00hsub ah,02hmov ah,20hsub ah,20hmov ah,00hadd ah,0ffhmov ah,00hadd ah,11hadd al,04hMOV AH,4ChINT 21hend mainEND. N. 5;exam2.asm;02/10/2001;stampa un quadrato di asterischi 10*10.model small.stack.codemov ah,2h ;moves the value 2h to register ahmov dl,2ah ;moves the value 2ah to register dlmov cx,10 ;assigned loop valuelab1:int 21h ;21h interruptionmov dl,32int 21hmov dl,2ahloop lab1 ;loopmov dl,10int 21hmov dl,13int 21hmov cx,8lab3:mov dl,2ahint 21hmov dl,32int 21hmov dl,2ahmov bx,cxmov cx,16lab4:mov dl,32int 21hloop lab4mov cx,bxmov dl,2ahint 21hmov dl,10int 21hmov dl,13int 21hloop lab3mov dl,2ahmov cx,10lab2:int 21hmov dl,32int 21hmov dl,2ahloop lab2mov ah,4ch ;4ch function, goes to operating systemint 21h ;21h interruptionEND ;finishes the program codeN. 6;stampa stringa colorata e di dimensione superiore (forse).model small .stack 100h.DATAstringa db 'sistemi$'.CODE ;-----------------------------------------------------inizio:MOV AX,@DATAMOV DS,AXret;-----------------------------------------------------fine:MOV AH,4ChINT 21hret;-----------------------------------------------------stampacol:mov bh,0mov bl,2int 10hmov ah,09lea dx,stringaint 21hret;-----------------------------------------------------;stampadim:;ret;-----------------------------------------------------main:call iniziocall stampacol; call stampadimcall fineend mainEND.  N. 7  .model small .stack 100h.DATA.CODE MOV ah,02hmov dl,2ahmov bh,0 ; controllo numero asterischiriga: inc bh ; stabilisce quanti asterischi devono essere stampati sulla riga correntemov bl,0aster:int 21h ; stampa un asteriscoinc blcmp bl,bh ; termina quando sono stati stampati bh asterischijne astermov dl,10int 21hmov dl,13int 21hmov dl,2ahcmp bh,5jne riga ; stampa un'altra rigaMOV AH,4ChINT 21hENDt_asterischi.asm stringacolore.asm quadrato di asterischi.asm prova.asm led.asm Asterischi da http://megarchivio.cjb.net