;name of the program :three.asm
.model small
.STACK
.code
TEST_WRITE_HEX PROC
MOV DL,3Fh ;moves the value 3Fh to the register DL
CALL WRITE_HEX ;Calls the procedure
MOV AH,4CH ;4Ch function
INT 21h ;Returns the control to operating system
TEST_WRITE_HEX ENDP ;Finishes the procedure
PUBLIC WRITE_HEX
;........................................................;
; This procedure converts into hexadecimal number the byte is in the register DL and show the digit number;
;Use:WRITE_HEX_DIGIT ;
;........................................................;
WRITE_HEX PROC
PUSH CX ;pushes the value of the register CX to the stack memory
PUSH DX ;pushes the value of the register DX to the stack memory
MOV DH,DL ;moves the value of the register DL to register DH
MOV CX,4 ;moves the value numeric 4 to register CX
SHR DL,CL
CALL WRITE_HEX_DIGIT ;shows on the computer screen, the first hexadecimal number
MOV DL,DH ;moves the value of the register DH to the register DL
AND DL,0Fh ;ANDing the upper bit
CALL WRITE_HEX_DIGIT ; shows on the computer screen, the second hexadecimal number
POP DX ;pops the value of the register DX to register DX
POP CX ; pops the value of the register DX to register DX
RET ;Returns the control of the procedure called
WRITE_HEX ENDP
PUBLIC WRITE_HEX_DIGIT
;......................................................................;
; ;
; This procedure converts the lower 4 bits of the register DL into hexadecimal ;number and show them in the computer screen ;
;Use: WRITE_CHAR ;
;......................................................................;
WRITE_HEX_DIGIT PROC
PUSH DX ;Pushes the value of the register DX in the stack memory
CMP DL,10 ;compares if the bit number is minus than number ten
JAE HEX_LETTER ;No , jumps HEX_LETER
ADD DL,"0" ;yes, it converts into digit number
JMP Short WRITE_DIGIT ;writes the character
HEX_LETTER:
ADD DL,"A"-10 ;converts a character into hexadecimal number
WRITE_DIGIT:
CALL WRITE_CHAR ;shows the character in the computer screen
POP DX ;Returns the initial value of the register DX to register DL
RET ;Returns the control of the procedure called
WRITE_HEX_DIGIT ENDP
PUBLIC WRITE_CHAR
;......................................................................;
;This procedure shows the character in the computer screen using the D.O.S. ;
;......................................................................;
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
This program prints a predefined value on the screen
;name of the program:five.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
This program prints the 256 ASCII code on the screen
dosseg
.model small
.stack
.code
write proc
mov ah,2h;
Quantum Computing: Revolutionizing the Future with Cutting-Edge
Advancements Introduction to Quantum Computing
-
Quantum Computing: Revolutionizing the Future with Cutting-Edge
Advancements
Introduction to Quantum Computing
Quantum computing is tran...
No comments:
Post a Comment