jmp start
;==============================
; Draws a horiz and vert line
;==============================
startaddr dw 0a000h ;start of video memory
colour db 1
;==============================
start:
mov ah,00
mov al,19
int 10h ;switch to 320x200 mode
;=============================
horiz:
mov es, startaddr ;put segment address in es ; <--- Error Line 14
mov di, 32000 ;row 101 (320 * 100)
add di, 75 ;column 76
mov al,colour ;cannot do mem-mem copy so use reg
mov cx, 160 ;loop counter
hplot:
mov es:[di],al ;set pixel to colour ; <--- Error
inc di ;move to next pixel
loop hplot
vert:
mov di, 16000 ;row 51 (320 * 50)
add di, 160 ;column 161
mov cx, 100 ;loop counter
vplot:
mov es:[di],al ; <--- Error
add di, 320 ;mov down a pixel
loop vplot
;=============================
keypress:
mov ah,00
int 16h ;await keypress
end:
mov ah,00
mov al,03
int 10h
mov ah,4ch
mov al,00 ;terminate program
int 21h
我從this tutorial剛剛複製了此代碼。學習大會,發佈代碼?
它有三個錯誤與NASM編譯時出現(不使用參數,只-o output.exe
):
14: Error: Invalid combination of opcode and operands
20: Error: Invalid combination of opcode and operands
28: Error: Invalid combination of opcode and operands
如果你突出顯示有錯誤的行,這將是很好的 – Andrey 2010-05-20 11:53:43