![]() | |
Ana Sayfa | Kayıt ol | Yardım | Ortak Alan | Ajanda | Bugünkü Mesajlar | XML | RSS | |
![]() | #11 | ||
ยŦยк ![]() Üyelik tarihi: Jan 2007
Mesajlar: 11.262
Tecrübe Puanı: 42 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | PUBLIC WRITE_CHAR ;................................................. ...............; ;This procedure shows the character in the computer screen using the DOS. ;................................................. ...............; WRITE_CHAR PROC PUSH AX ;pushes the value of the register AX in the stack memory MOV AH,2 ;2h Function INT 21h ;21h Interruption POP AX ;Pops the initial value of the register AX to the register AX RET ;Returns the control of the procedure called WRITE_CHAR ENDP END TEST_WRITE_HEX ;finishes the program code Example 4 This program prints the 256 ASCII code on the screen ;name of the program: four.asm .model small .stack .code PRINT_ASCII PROC MOV DL,00h ;moves the value 00h to register DL MOV CX,255 ;moves the value decimal number 255. this decimal number will be 255 times to print out after the character A PRINT_LOOP: CALL WRITE_CHAR ;Prints the characters out INC DL ;Increases the value of the register DL content LOOP PRINT_LOOP ;Loop to print out ten characters MOV AH,4Ch ;4Ch function INT 21h ;21h Interruption PRINT_ASCII ENDP ;Finishes the procedure WRITE_CHAR PROC MOV AH,2h ;2h function to print character out INT 21h ;Prints out the character in the register DL RET ;Returns the control to the procedure called WRITE_CHAR ENDP ;Finishes the procedure END PRINT_ASCII ;Finishes the program code Example 5 This program prints a defined character using an ASCII code on the screen. dosseg .model small ; the name of the program is five.asm .stack .code write proc mov ah,2h; mov dl,2ah; int 21h mov ah,4ch int 21h write endp end write Example 6 This program reads characters form the keyboard and prints them on the screen until find the return character. .model small; the name of the program is six.asm .stack; .code; EEL: MOV AH,01 ; 1 function (reads one character from the keyboard) INT 21h ; 21h interruption CMP AL,0Dh ; compares the value with 0dh JNZ EEL ;jumps if no equal of the label eel MOV AH,2h ; 2 function (prints the character out on the screen) MOV DL,AL ;moves the value of the register AL to the register DL INT 21h ;21 interruption MOV AH,4CH ;4C function (returns the control to the DOS. operating system) INT 21h ;21 interruption END ;finishes the program | ||
![]() | ![]() |
Bu konuyu arkadaşlarınızla paylaşın |
Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir) | |
| |
![]() | ![]() |