i'm trying to make an assembly program that prints out ten vertical lines, each with a different color. i would greatly appreciate it if someone looked it over and sent me some feedback. if someone could tell me what to add, or give me some source code, that would be appreciated. could you send any feedback to ntolles1@rochester.rr.com ? :roll: heres my program so far:

INCLUDE Irvine16.inc

DrawVerticalLine PROTO,
Xcoord:WORD,
Ycoord:WORD,
lineLength:WORD,
color:BYTE

.data
saveMode BYTE ? ; saved video mode

.code
main PROC
mov ax,@data
mov ds,ax

call SetVideoMode
call SetScreenBackground

mov eax, red + (blue * 16)
;call settextcolor
INVOKE DrawVerticalLine, 20, 30, 80, 1
INVOKE DrawVerticalLine, 40, 30, 80,2
INVOKE DrawVerticalLine, 60, 30, 80,3
INVOKE DrawVerticalLine, 80, 30, 80,4
INVOKE DrawVerticalLine, 100, 30, 80,5
INVOKE DrawVerticalLine, 120, 30, 80,6
INVOKE DrawVerticalLine, 140, 30, 80,7
INVOKE DrawVerticalLine, 160, 30, 80,8
INVOKE DrawVerticalLine, 180, 30, 80,9
INVOKE DrawVerticalLine, 200, 30, 80,1

call RestoreVideoMode
exit
main ENDP

SetScreenBackground PROC
mov dx,3c8h
mov al,0
out dx,al


mov dx,3c9h
mov al,0
out dx,al
mov al,0
out dx,al
mov al,35
out dx,al

ret
SetScreenBackground ENDP

SetVideoMode PROC

mov ah,0Fh ; get current video mode
int 10h
mov saveMode,al ; save it

mov ah,0 ; set new video mode
mov al,13h ; to mode 13h
int 10h

push 0A000h ; video segment address
pop es ; ES = A000h (video segment).

ret
SetVideoMode ENDP


RestoreVideoMode PROC

mov ah,10h ; wait for keystroke
int 16h
mov ah,0 ; reset video mode
mov al,saveMode ; to saved mode
int 10h
ret
RestoreVideoMode ENDP


DrawVerticalLine PROC,
Xcoord:WORD,
Ycoord:WORD,
lineLength:WORD,
color:BYTE

pusha


; Change color at index 1 to white (63,63,63)
mov dx,3c8h ; video palette port (3C8h)
mov al,color ; set palette index 1
out dx,al

mov dx,3c9h ; colors go to port 3C9h
mov al,30 ; red
out dx,al
mov al,30 ; green
out dx,al
mov al,0 ; blue
out dx,al


mov ax, 320 ; 320 for video mode 13h
mov esi, ecx

inc ax

mul yCoord ; y-coordinate
add ax, xCoord ; x-coordinate
dec ecx
.if(ecx==0)
exit
.endif

; Place the color index into the video buffer.
mov cx, lineLength ; pixel counter
mov di,ax ; AX contains buffer offset

; Draw the vertical line

DP1:
mov BYTE PTR es:, 1 ; store color index
add di,320 ; move one pixel down
Loop DP1

popa
ret

DrawVerticalLine ENDP
END main
Posted on 2004-12-03 11:18:22 by ntolleson
Hai. Is the code working? i see your code use the graphic port. I have try it but it not working. Please check compiler creation forum and check for FARABI. I think I have the PMode example with graphic function for that function. Or see the game programming forum 3D software, I add the link for 32-bit example.
Posted on 2004-12-03 21:26:23 by realvampire