Modify This codings (drawline in graphics mode) such that it draws Green color l
ID: 3612376 • Letter: M
Question
Modify This codings (drawline in graphics mode) such that it draws Green color lines onscreen boundary as shown in the diagram below:
001 ;draw line in graphics mode
002 [org0x0100]
003 mov ax ,0x00D;set 320x200 graphics mode
004 int0x10 ;bios videoservices
005
006 mov ax ,0x0c07;put pixel in white color
007 xorbx,bx ; page number 0
008 movcx,200 ; x position 200
009 movdx,200 ; y position 200
010
011l1: int 0x10 ;bios video services
012 dec dx ;decrease y position
013 loop l1 ; decrease x position and repeat
014
015 movah,0 ; service 0- get keystroke
016 int0x16 ;bios keyboard service
017
018 mov ax,0x0003 ; 80x25 text mode
019 int0x10 ;bios videoservices
020
021 mov ax,ox4c00 ;terminate program
022 int 0c21
Explanation / Answer
.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.