0
我正在爲我的課程做一些編碼,我認爲我在正確的軌道上,但是我遇到了垂直線問題。當我運行這段代碼時,它會在同一個確切的位置同時繪製兩條水平線,但是我需要沿着垂直線50,50至50,75而不是水平線50,50至75,50從第2條線移動。我不問的答案我只是需要一個微調和解釋,謝謝:需要關於彙編器視頻模式的幫助
; 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:
xStart1 dw 50 ; x coordinate of line start 1
yStart1 dw 50 ; y coordinate of line start 1
xStart2 dw 50 ; x coordinate of line start 2
yStart2 dw 50 ; y coordinate of line start 2
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 xStart1 + length
; initialize bx (y coord) to yStart2 + length
mov cx, xStart1
mov bx, yStart2
add cx, length
add bx, length
; loop from (xStart1+length) to xStart1 to draw a horizontal line
; loop from (yStart1+length) to yStart1 to draw a vertical line
LoopStart:
; draw a pixel
; set color in al, x in cx, y in dx
mov al, 50
mov dx, yStart1
; set sub function value in ah to draw a pixel
; and invoke the interrupt
mov ah, 0ch
int 10h
; decrement the x coord for line 1
; decrement the y coord for line 2
sub cx, 1
sub bx, 1
; test to see if x coord has reached start value
cmp cx, xStart1
; continue loop if cx >= xStart1
jae LoopStart
ret
所以我改哪一個? – 2011-04-07 05:24:54
@Crash_Override:呃,即使你根本不懂彙編語言,也很容易知道你當前正在使用哪個代碼*現在改變它來改變另一個代碼! – 2011-04-07 05:27:18
這更接近嗎? – 2011-04-07 05:34:58