Advertisement

Strange Assembly Error

Started by September 29, 2019 10:37 PM
7 comments, last by bzt 5 years ago

I am trying to make a map editor with Assembly and C...

 

Everything used to work, but now, I get these errors:

 


cd C:\Editor
wmake -f C:\Editor\Editor.mk -h -e C:\Editor\Editor.exe
wasm SOURCE\MEASM.ASM -i="C:\WATCOM/h" -mf -6r -d1 -w4 -e25 -zq
SOURCE\MEASM.ASM(2): Error! E032: Syntax error
SOURCE\MEASM.ASM(3): Error! E032: Syntax error
SOURCE\prologue.mac(1): Error! E032: Syntax error
SOURCE\prologue.mac(1): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(4): Error! E535: Procedure must have a name
SOURCE\prologue.mac(4): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(6): Error! E523: Segment name is missing
SOURCE\prologue.mac(6): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(11): Error! E535: Procedure must have a name
SOURCE\prologue.mac(11): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(14): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(14): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(15): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(15): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(19): Error! E506: Block nesting error
SOURCE\prologue.mac(19): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(22): Error! E535: Procedure must have a name
SOURCE\prologue.mac(22): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(24): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(24): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(25): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(25): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(28): Error! E535: Procedure must have a name
SOURCE\prologue.mac(28): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(30): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(30): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(31): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(31): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(32): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(32): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(33): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(33): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(34): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(34): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(37): Error! E535: Procedure must have a name
SOURCE\prologue.mac(37): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(39): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(39): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(40): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(40): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(41): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(41): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\prologue.mac(42): Error! E525: Data emitted with no segment
SOURCE\prologue.mac(42): Note! N591: included by file SOURCE\MEASM.ASM(4)
SOURCE\MEASM.ASM(5): Error! E032: Syntax error
SOURCE\MEASM.ASM(6): Error! E032: Syntax error
SOURCE\MEASM.ASM(9):  
Error(E42): Last command making (C:\Editor\MEASM.obj) returned a bad status
Error(E02): Make execution terminated
Execution complete

 

 

I haven't used assembly for a while, and I don't really remember how to fix these errors.

Here is the main assembly file:

 


        IDEAL
        JUMPS
        include "prologue.mac"
        P386            ; 386 specific opcodes and allows all the necessary crap...
        P387            ; Allow 386 processor


        MASM
        .MODEL FLAT     ;32-bit OS/2 model
        .CODE
        IDEAL

        PUBLIC          SetPalette2_
        PUBLIC          SetVGAmode_
        PUBLIC          SetTextMode_
        PUBLIC          inkey_
        PUBLIC          PutHex_

;==============================================================================
; void SetPalette2(unsigned char *PalBuf,short count);
;==============================================================================

Proc    SetPalette2_ near
        push    esi

        mov     esi,eax
        mov     cx,dx
        mov     bx,0
        cld
        mov     dx,3C8H
sp210:
        mov     al,bl
        out     dx,al
        inc     dx
        lodsb
        out     dx,al
        lodsb
        out     dx,al
        lodsb
        out     dx,al
        dec     dx
        inc     bx
        loop    sp210

        pop     esi
        ret
        endp


;==============================================================================
; void SetVGAmode(void);
;==============================================================================
Proc    SetVGAmode_  near
        push    ebp
        mov     ax,13h
        int     10h             ; Set 320x200x256
        pop     ebp
        ret
        endp

;==============================================================================
;
;==============================================================================
Proc    SetTextMode_ near
        push    ebp
        mov     ax,3
        int     10h
        pop     ebp
        ret
        endp

;==============================================================================
;
;==============================================================================
Proc  inkey_ near
        xor     eax,eax
        mov     ah,1            ;see if key available
        int     16h
        jz      ink080          ;nope
        xor     ax,ax
        int     16h
        jmp     short ink090

ink080:
        xor     ax,ax
ink090:
        ret
        endp

;==============================================================================
;
;==============================================================================
Proc    HexOut_ near
        and     al,15
        cmp     al,10
        jb      short hex010
        add     al,7

hex010:
        add     al,'0'
        stosb
        ret
        endp

;==============================================================================
; void PutHex(char *buf,UINT mCode);
;==============================================================================
Proc    PutHex_ near
        push    edi
        mov     edi,eax
        mov     eax,edx
        shr     al,4
        call    HexOut_
        mov     eax,edx
        call    HexOut_
        xor     al,al
        stosb
        pop     edi
        ret
        endp
        end

 

This file includes another file that I found on the Internet a while ago called "Prologue.MAC"

 

Here is the code for it:

 


P386


Macro	 SETUPSEGMENT

SEGMENT _TEXT	PARA PUBLIC 'CODE'
	ASSUME	CS:_TEXT

	Endm

macro   PENTER  STORAGE
;; 17 - Enter a procedue with storage space
;; Procedure enter, uses the 286/386 ENTER opcode
	push	ebp
	mov	ebp,esp
        IF      STORAGE
	sub	esp,STORAGE
        ENDIF
ENDIF
        endm

macro   PLEAVE
;; 18 - Exit a procedure with stack correction.
	mov	esp,ebp
	pop	ebp
        endm

macro   PushCREGS
;; 19 - Save registers for C
        push    es
	push	ds   ;The Kernel is responsible for maintaining DS
	push	esi
	push	edi
        cld
        endm

macro   PopCREGS
;; 20 - Restore registers for C
	pop	edi
	pop	esi
	pop	ds ;The Kernel is responsible for maintaining DS
        pop     es
        endm

 

 

Can I have an Idea of what I could do to fix these errors?

 

 

I am using OpenWatcom compiler. I *have* gotten Watcom to work before. In fact, this is one of the first few times it has not worked with me... 

 

 

Thanks in advance!

 

 

-yaboiryan

Pretty sure this is nothing to do with Graphics / GPU Programming. Try https://www.gamedev.net/forums/forum/9-general-and-gameplay-programming/

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

Advertisement

@Adam Miles thanks, man!

It seems there's an ENDIF too many!

.:vinterberg:.

Hi,

I seriously doubt this could ever work.

First, your assembly is for real mode. Just because you changed the header to "32 bit OS", doesn't make the code valid in protected mode, hence the syntax errors most likely.

Second, even if you fix the syntax errors, that code is calling real mode BIOS functions, which are not and never were available in protected mode.

Third, if you have a new machine, chances are good there's no BIOS at all, as it's using UEFI. Unless you configure a legacy CSM, then even if you switch the CPU mode back to real mode you couldn't use those interrupts.

Fourth, if you could fix everything I've listed so far, even then that assembly code is using VGA IO registers directly, something that modern video cards won't like or respect. Chances are good that this code would simply crash unless you have an old VGA-compatible video card.

To help you understand the situation:

real mode: 16 bit operation mode of the CPU, which allows accessing 64K of memory at once, and 1M tops with segmentation.

protected mode: 32 bit operation mode of the CPU, which allows access to 4G of memory, and provides memory protecion (hence the name). The CPU's internal operation is fundamentally incompatible with real mode (different stack alignment, existence of interrupt descriptor table, existence of privilege levels etc. etc. etc.)

BIOS: a program stored in a ROM which was compiled for real mode. It provides so called interrupt services, like int 0x10 and int 0x16 you try to use.

UEFI: successor to BIOS, which does not provide any real mode services of any kind. New machines have only this, and maybe, if you're lucky, they have a special CSM module installed, which provides a legacy compatibility mode for BIOS.

IO registers: special address space in the CPU, independent to the memory, in which all peripherals has an address (or more addresses) and which is accessible regardless to the CPU mode. A certain video card standard, the Video Graphics Array used the port 0x3C8. Other newer standards, like SVGA, XGA or XWGA however does not. Some cards emulated the VGA modes and IO ports to retain compatibility, but that's long gone by now. Modern cards doesn't even support "teletype output mode" any more, which you try to set with SetTextMode_near, only linear frame buffers.

Cheers,
bzt

@bzt, I was trying to recreate a MS-DOS game engine from the 1990s (1993). This source code is riddled with assembly. I was trying to make sort of a Wolfenstein 3D remake which I could have an easy map editor for. Using Unity or Unreal Engine is COMPLETELY out of the picture for me... Thank you for acknowledging my question, though. 

 

I do not really understand, however, what you are getting at...

Advertisement
12 hours ago, yaboiryan said:

@bzt, I was trying to recreate a MS-DOS game engine from the 1990s (1993). This source code is riddled with assembly. I was trying to make sort of a Wolfenstein 3D remake which I could have an easy map editor for. Using Unity or Unreal Engine is COMPLETELY out of the picture for me... Thank you for acknowledging my question, though. 

 

I do not really understand, however, what you are getting at...

I think the best course of action is for you to define your target platform as explicitly as possible. It’s OK if it’s a completely emulated/virtual platform, but let’s try to define it so folks on the forum have some context.

My understanding is your target platform is pure 16-bit real mode DOS using Intel BIOS, leveraging a DPMI extender for 32-bit advantages. I think DOSBOX can emulate this environment 

@Steve_Segreto: you are totally right, now that I know it's for W3D it makes a lot more sense. Also DOSBOX is the best chance for running that, I agree. However "push ebp" is not a valid 16 bit instruction, and mixing "push ebp" and a real-mode BIOS "int 10h" in the same function is clearly a mistake, and it won't work.

@yaboiryan: don't use that engine imho. Back then it was hard to make a 3Dish game, so there are lot of tricks and quirks in the code tied strongly with the running environment and the hardware to make it happen. Use an engine that separates execution environment and game logic more clearly (like Duke Nukem 3D for example, or Quake 1). I'd also suggest to switch to a more sophisticated OS than DOS+DPMI, which takes the heavy burden off your shoulders, like Linux for example.
But if you insists, there's already a great and easy map editor for W3D (http://www.wolfenstein3d.co.uk/utilities.htm), suprisingly it's called MAPEDIT.EXE and runs in DOSBOX too.

Cheers,
bzt

This topic is closed to new replies.

Advertisement