Verticle lines in emu8086

How do I get this code to show a verticle line?

Page 1 of 1

2 Replies - 4155 Views - Last Post: 04 December 2008 - 07:19 PM Rate Topic: -----

#1 espenodge  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 28
  • Joined: 21-November 08

Verticle lines in emu8086

Posted 04 December 2008 - 05:52 PM

How do I change the code so that a vertical line is displayed from coordinates (50, 50) - (50, 75) in addition to the horizontal line currently displayed by the program?



; video.asm
; uses interrupts to set video mode and draw a line

include 'emu8086.inc'

org  100h; set location counter to 100h

jmp CodeStart

DataStart:
	xStart dw 50	   ; x coordinate of line start
	yStart dw 50	   ; y coordinate of line start
	length dw 25	   ; length of line

CodeStart:

   ; set the video mode 320x200, 256 colors
	mov al, 13h
	mov ah, 0
	int 10h

   ; initialize cx (x coord) to xStart + length
	mov cx, xStart
	add cx, length

	
   ; loop from (xStart+length) to xStart to draw a horizontal line
	LoopStart:	

	   ; draw a pixel
	   ; set color in al, x in cx, y in dx
		mov al, 50
		mov dx, yStart
		
	   ; set sub function value in ah to draw a pixel
	   ; and invoke the interrupt
		mov ah, 0ch
		int 10h
		
	   ; decrement the x coord
		sub cx, 1
		
	   ; test to see if x coord has reached start value
		cmp cx, xStart
	
   ; continue loop if cx >= xStart
	jae LoopStart
	
	ret



Is This A Good Question/Topic? 0
  • +

Replies To: Verticle lines in emu8086

#2 espenodge  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 28
  • Joined: 21-November 08

Re: Verticle lines in emu8086

Posted 04 December 2008 - 07:06 PM

I know I have to create another loopstart but I cant figure out how to get the second line to form, i got it to move and change its size, but I cant get two of them...
Was This Post Helpful? 0
  • +
  • -

#3 espenodge  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 28
  • Joined: 21-November 08

Re: Verticle lines in emu8086

Posted 04 December 2008 - 07:19 PM

Nevermind I guess I just figured out my own code :P
I was putting the ystart in the wrong place.


	  ; video.asm
; uses interrupts to set video mode and draw a line

include 'emu8086.inc'

org  100h; set location counter to 100h

jmp CodeStart

DataStart:
	xStart dw 50	   ; x coordinate of line start
	yStart dw 50	   ; y coordinate of line start
	length dw 25	   ; length of line

CodeStart:

   ; set the video mode 320x200, 256 colors
	mov al, 13h
	mov ah, 0
	int 10h

   ; initialize cx (x coord) to xStart + length
	mov cx, xStart
	add cx, length
	
  
	
   ; loop from (xStart+length) to xStart to draw a horizontal line
	LoopStart:	

	   ; draw a pixel
	   ; set color in al, x in cx, y in dx
		mov al, 50
		mov dx, yStart
		
	   ; set sub function value in ah to draw a pixel
	   ; and invoke the interrupt
		mov ah, 0ch
		int 10h
		
	   ; decrement the x coord
		sub cx, 1
		
	   ; test to see if x coord has reached start value
		cmp cx, xStart
	
   ; continue loop if cx >= xStart
	jae LoopStart
				   
			
			; next set the dx (y coord) to ystart and add length
	mov dx, ystart
	add dx, length
					   
					   
   ; loop from (ystart+length) to 
	LoopStart2:	

	   ; draw a pixel
	   ; set color in al, x in cx, y in dx
		mov al, 50
		mov cx, xStart
		
	   ; set sub function value in ah to draw a pixel
	   ; and invoke the interrupt
		mov ah, 0ch
		int 10h
		
	   ; decrement the y coord
		sub dx, 1
		
	   ; test to see if y coord has reached start value
		cmp dx, yStart
	
   ; continue loop if dx >= yStart
	jae LoopStart2
	
	ret



Was This Post Helpful? 1

Page 1 of 1