Problems with string definitions....

I'm trying to compile following code with Microsoft's Macro Assembler 6.11:
[code]
.386
.model small
.stack 1024
.data
NoXMS db 'No XMS detected!',$
Period db '.'
Detected db ' detected!',$
InternalRevision db 0dh,0ah,'Driver internal revision: ',$
XMSControl dw ?
MajorVersion dw 0
MinorVersion dw 0
Revision dw 0
HMAExists db 'HMA exists!',$
HMANoExists db 'HMA doesn''t exist!',$
.code
mov ax, @Data
mov ds, ax
mov ax, @Code
mov cs, ax
mov ax, @Stack
mov ss, ax
; Is an XMS driver installed?
mov ax,4300h
int 2Fh
cmp al,80h
jne NoXMSDriver
; Get the address of the driver's control function
mov ax,4310h
int 2Fh
mov word ptr [XMSControl],bx ; XMSControl is a DWORD
mov word ptr [XMSControl+2],es

; Get the XMS driver's version number
mov ah,00h
call [XMSControl] ; Get XMS Version Number
mov MajorVersion, ax
shr MajorVersion, 8
mov MinorVersion, ax
and MinorVersion, 15
mov Revision, bx
add MajorVersion, '0'
add MinorVersion, '0'
add Revision, '0'
mov ah, 09h
mov dx, MajorVersion
int 21h
lea dx, Period
int 21h
mov dx, MinorVersion
int 21h
lea dx, Detected
int 21h
lea dx, InternalRevision
int 21h
mov dx, Revision
int 21h
jmp short ExitProgram
NoXMSDriver:
lea dx, NoXMS
mov ah,09h
int 21h
ExitProgram:
mov ah,4Ch
mov al,00h
int 21h
end
[/code]
With every string definition, MASM gives me following error:
[italic]XMS.asm(5): error A2071: initializer magnitude too large for specified size.[/italic]
Can someone tell me what's wrong?
[italic][blue]
wAre
Beginner Programmmer
[/blue][/italic]

Comments

  • : I'm trying to compile following code with Microsoft's Macro Assembler 6.11:
    : [code]
    : .386
    : .model small
    : .stack 1024
    : .data
    : NoXMS db 'No XMS detected!',$
    : Period db '.'
    : Detected db ' detected!',$
    : InternalRevision db 0dh,0ah,'Driver internal revision: ',$
    : XMSControl dw ?
    : MajorVersion dw 0
    : MinorVersion dw 0
    : Revision dw 0
    : HMAExists db 'HMA exists!',$
    : HMANoExists db 'HMA doesn''t exist!',$
    : .code
    : mov ax, @Data
    : mov ds, ax
    : mov ax, @Code
    : mov cs, ax
    : mov ax, @Stack
    : mov ss, ax
    : ; Is an XMS driver installed?
    : mov ax,4300h
    : int 2Fh
    : cmp al,80h
    : jne NoXMSDriver
    : ; Get the address of the driver's control function
    : mov ax,4310h
    : int 2Fh
    : mov word ptr [XMSControl],bx ; XMSControl is a DWORD
    : mov word ptr [XMSControl+2],es
    :
    : ; Get the XMS driver's version number
    : mov ah,00h
    : call [XMSControl] ; Get XMS Version Number
    : mov MajorVersion, ax
    : shr MajorVersion, 8
    : mov MinorVersion, ax
    : and MinorVersion, 15
    : mov Revision, bx
    : add MajorVersion, '0'
    : add MinorVersion, '0'
    : add Revision, '0'
    : mov ah, 09h
    : mov dx, MajorVersion
    : int 21h
    : lea dx, Period
    : int 21h
    : mov dx, MinorVersion
    : int 21h
    : lea dx, Detected
    : int 21h
    : lea dx, InternalRevision
    : int 21h
    : mov dx, Revision
    : int 21h
    : jmp short ExitProgram
    : NoXMSDriver:
    : lea dx, NoXMS
    : mov ah,09h
    : int 21h
    : ExitProgram:
    : mov ah,4Ch
    : mov al,00h
    : int 21h
    : end
    : [/code]
    : With every string definition, MASM gives me following error:
    : [italic]XMS.asm(5): error A2071: initializer magnitude too large for specified size.[/italic]
    : Can someone tell me what's wrong?
    : [italic][blue]
    : wAre
    : Beginner Programmmer
    : [/blue][/italic]
    :
    :
    [blue]To terminate a string with a $ - you do not simply use it, because when using it without single quotes - it is a current instruction offset. You should use it like '$', so your strings:

    str db 'text.',$

    MUST be:

    str db 'text.$' ; INSIDE the quotes!
    [/blue]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion