Unable to access label through segment registers, build error

INCLUDE Irvine16.inc

.data
    byteArray   BYTE 6 DUP(?)
    listSize = ($ - byteArray)
    aSum        WORD 0
    soffset = 0
.code
main PROC
    mov     ax, @data
    mov     ds, ax
    mov     cx, listSize
Loop1:
    mov     ax, 0
    movzx   ax, [byteArray + soffset]
    add     aSum, ax
    soffset = soffset + 1
    loop Loop1
    exit
main ENDP
END main

The error I get is the error "A2074: Cannot access the label through segment registers"

I am trying to use soffset for loop through byteArray.

+3
source share
2 answers

I'm not sure about Irvine16.inc, but I'm sure he is talking .model small,...at some point.

If you add

ASSUME DS:_DATA

then your error messages will disappear, although I doubt that this is enough to run the program.


, . , 32- . , . irvine, , , , 32-, .

wierd twisted world, x86, 16- , 32- , , .

+2

DOS (.model!= flat) COFF.obj. , ML.EXE error A2006:undefined symbol : DGROUP. OMF. :

ml.exe /omf hello.asm
link16.exe hello.obj, hello.exe;

ml.exe Visual Studio. link16.exe Irvine library suite ( " ..." ).

+1

Source: https://habr.com/ru/post/1719146/


All Articles