Draw line in graphics mode such that it draws Greencolor lines on screen boundar
ID: 3612364 • Letter: D
Question
Draw line in graphics mode such that it draws Greencolor lines on screen boundary as shown in the diagrambelow:Requirment:
Assembly Language program code fulfilling the abovementioned requirements Plz write Assembly code of basic Processors such as 8080or 8088 Code formate is this [org 0x0100] .......... ........... ..........coding .......... ............. ......... mov ax,0x4c00 ;terminate program int 0x21 Plz write Assembly code of basic Processors such as 8080or 8088 Code formate is this [org 0x0100] .......... ........... ..........coding .......... ............. ......... mov ax,0x4c00 ;terminate program int 0x21
Explanation / Answer
The following program draws a horizontal line on the screen fromlocation (240, 170) to (240,470) by writing pixels on the screenusing function (AH=0Ch) of INT 10h.
.MODEL SMALL // this defines thememory model
.STACK 100 //define a stack segment of 100 bytes
.DATA //thisis the data segment
.CODE //this is the code segment
MOV AX,@DATA //get the address of the data segment
MOV DS, AX //and store it in DS register
MOV AH, 00h //set video mode
MOV AL, 12h //graphics 640x480
INT 10h
// Draw a green color line from (240, 170) to (240, 470)
MOV CX, 170 //start from row 170
MOV DX, 240 //and column 240
MOV AX, 0C02h //AH=0Ch and AL = pixel color (green)
BACK: INT 10h //draw pixel
INC CX //go to next column
CMP CX, 470 //check if column=470
JB BACK //if not reached column=470, then continue
MOV AH, 07h //wait for key press to exit program
INT 21h
MOV AX, 4C00H //Exit to DOS function
INT 21H
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.