合法的数据段结构
Legal data segement constructions
我想就以下问题寻求帮助:
以下数据段的定义正确合法的是:
data segment
x db -23, 3 or 4, not -3, 9 xor 15, 129, $+x, SEG x, -128 LT 80h
db -129, x+1, b2h, 256, 7852h, byte ptr z
y dw z-2, -7852h, x[2], offset bx
z dd z-y, FAR PTR y
data ends
我认为以下错误:
- cant contain operations: 3 or 4, not -3, 9 xor 15, FAR PTR y, offset bx ...
- cant reference same varaible : $+x
正确:
- -23, 129, 7852h ...
- a db 'abc'
lengthOfa EQU ($-s)
我对这个事实是否正确?
为什么不让 assembler 回答? x
、y
、z
只是标签,不是变量。因此,您可以将值分开并将它们写在几行中。考虑保留声明 (db
、dw
、dd
)。构建一个程序集源文本,让它 assemble 并查看哪一行包含哪个错误:
data segment
x db -23
db 3 or 4
db not -3
db 9 xor 15
db 129
db $+x ; TASM: Can't add relative quantities - MASM: error A2101: cannot add two relocatable labels
db SEG x ; TASM: Not expecting group or segment quantity - MASM: error A2071: initializer magnitude too large for specified size
db -128 LT 80h
db -129
db x+1 ; TASM: Expecting scalar type - MASM: error A2071: initializer magnitude too large for specified size
db b2h ; TASM: Undefined symbol: B2H - MASM: error A2006: undefined symbol : b2h
db 256 ; TASM: Value out of range - MASM: error A2071: initializer magnitude too large for specified size
db 7852h ; TASM: Value out of range - MASM: error A2071: initializer magnitude too large for specified size
db byte ptr z ; TASM: Expecting scalar type - MASM: error A2071: initializer magnitude too large for specified size
y dw z-2
dw -7852h
dw x[2]
dw offset bx ; TASM: Illegal use of register - MASM: error A2032: invalid use of register
z dd z-y
dd FAR PTR y
data ends
code segment
start:
ret
code ends
end start
我想就以下问题寻求帮助: 以下数据段的定义正确合法的是:
data segment
x db -23, 3 or 4, not -3, 9 xor 15, 129, $+x, SEG x, -128 LT 80h
db -129, x+1, b2h, 256, 7852h, byte ptr z
y dw z-2, -7852h, x[2], offset bx
z dd z-y, FAR PTR y
data ends
我认为以下错误:
- cant contain operations: 3 or 4, not -3, 9 xor 15, FAR PTR y, offset bx ...
- cant reference same varaible : $+x
正确:
- -23, 129, 7852h ...
- a db 'abc'
lengthOfa EQU ($-s)
我对这个事实是否正确?
为什么不让 assembler 回答? x
、y
、z
只是标签,不是变量。因此,您可以将值分开并将它们写在几行中。考虑保留声明 (db
、dw
、dd
)。构建一个程序集源文本,让它 assemble 并查看哪一行包含哪个错误:
data segment
x db -23
db 3 or 4
db not -3
db 9 xor 15
db 129
db $+x ; TASM: Can't add relative quantities - MASM: error A2101: cannot add two relocatable labels
db SEG x ; TASM: Not expecting group or segment quantity - MASM: error A2071: initializer magnitude too large for specified size
db -128 LT 80h
db -129
db x+1 ; TASM: Expecting scalar type - MASM: error A2071: initializer magnitude too large for specified size
db b2h ; TASM: Undefined symbol: B2H - MASM: error A2006: undefined symbol : b2h
db 256 ; TASM: Value out of range - MASM: error A2071: initializer magnitude too large for specified size
db 7852h ; TASM: Value out of range - MASM: error A2071: initializer magnitude too large for specified size
db byte ptr z ; TASM: Expecting scalar type - MASM: error A2071: initializer magnitude too large for specified size
y dw z-2
dw -7852h
dw x[2]
dw offset bx ; TASM: Illegal use of register - MASM: error A2032: invalid use of register
z dd z-y
dd FAR PTR y
data ends
code segment
start:
ret
code ends
end start