Assembly - Chapter - 12 - Updated - Part - 2
Assembly - Chapter - 12 - Updated - Part - 2
12
Part 2
.CODE
MAIN PROC
; Set the cursor size
MOV AH, 1 ; Function 1 - Set cursor size
MOV CH, 0 ; Starting row (top of the cursor)
MOV CL, 13 ; Ending row (bottom of the cursor)
INT 10h ; Call BIOS interrupt to set cursor size
; Exit program
MOV AH, 4CH ; DOS terminate program function
INT 21h ; Call DOS interrupt
MAIN ENDP
END MAIN
Engr. Muhammad Fiaz 9
Engr. Muhammad Fiaz 10
Engr. Muhammad Fiaz 11
.MODEL SMALL
.STACK 100H
.CODE
MAIN PROC
; Set up video segment (optional for text mode operations)
MOV AX, 0B800h ; Video memory segment for color text mode
MOV DS, AX ; Load AX into DS (if needed for direct memory
access)
; Move cursor to the center of the screen (Row 12, Column 39)
MOV AH, 2 ; Function 2 - Set cursor position
XOR BH, BH ; Page 0 (clear BH to 0)
MOV DX, 0C27h ; Row 12 (0Ch), Column 39 (27h)
INT 10h ; Call BIOS interrupt to move the cursor
; Exit program
MOV AH, 4CH ; DOS terminate program function
INT 21h ; Call DOS interrupt
MAIN ENDP
END MAIN
Engr. Muhammad Fiaz 12
Engr. Muhammad Fiaz 13
Engr. Muhammad Fiaz 14
.model small
.stack 100h
.data
msg db 'Current cursor position: Row = ', 0
row db 0
msg2 db ', Column = ', 0
col db 0
newline db 13, 10, '$' ; Carriage return and line feed for new line
.code
main proc
mov ax, @data
mov ds, ax
exit:
mov ah, 4Ch ; Function: Terminate program
int 21h ; DOS interrupt
main endp
end main
.data
; No data section required for this program.
.code
main proc
MOV AX, @data ; Initialize the data segment
MOV DS, AX
; Exit program
MOV AH, 4Ch ; DOS interrupt to terminate the program
INT 21h ; Terminate program
main endp
Engr. Muhammad Fiaz 20
end main
Set Al = 1, select the page 1
Set al = 0,select the page 0
Change these values for different results
.CODE
MAIN PROC
; Set up video segment
MOV AX, 0B800h ; Video memory segment for color text mode
MOV DS, AX ; Load AX into DS
; Exit program
MOV AH, 4CH ; DOS terminate program function
INT 21h ; Call DOS interrupt
; Terminate program
mov ah, 4Ch ; Function: Terminate program
int 21h ; DOS interrupt
.data
; No data section required for this program.
.code
main proc
MOV AX, @data ; Initialize the data segment
MOV DS, AX
; Exit program
MOV AH, 4Ch ; DOS interrupt to terminate the program
INT 21h ; Terminate program
main endp
end main
+92-320-7617-093
[email protected]
Do you have any questions?
https://www.linkedin/in/fiazofficials