2011-11-12 101 views
0

我想組裝此代碼,但它返回一個錯誤。你能幫我解決嗎?謝謝。錯誤A2006:未定義的符號:DGROUP

INCLUDE irvine16.inc 
.data 
    array db 31h,32h,33h,34h ;use db to define array 
    COUNT = ($-array)  ;The $ operator gives the value of the location counter. 
.code 
main proc 
    mov ax, @data  ;copy the address of the data segment 
    mov ds, ax  ;@data into the DS register 
    mov bx, offset array ;the offset operator returns the 16-bit offset of a label 
    mov cx, COUNT ;set up cx register as a counter register. 
    mov ah, 02  ;use function 2 of int 21h - display char stored in dl on screen 
LP1: mov dl, [bx]  ;LP1 is a label 
    int 21h 
    inc bx 
    loop LP1  ;decrement cx; if cx not =0,loop back to label LP1. 
    mov ax, 4c00h 
    int 21h 
main endp 
end main 
+0

關鍵字:'OMF',而不是'COFF'。看[這裏](http://stackoverflow.com/a/34403271/3512216)。 – rkhb

+0

的可能的複製[無法通過段寄存器訪問的標籤,在組裝誤差(http://stackoverflow.com/questions/1512734/cannot-access-label-through-segment-registers-error-in-assembly) – rkhb

回答

0

DGROUP是一個16位的概念,所以在PMOD的鏈接此話(這是16位代碼,DGROUP是一個16位的概念,請確保您使用的16位鏈接)是真實的。

如果不解決這個問題,發揮你的內存模型(.MODEL),多斯桑托斯是16年前的我,但IIRC一些片段只在某些內存模式存在。