News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Meaning of error messages

Started by Terpsichore, August 18, 2013, 12:43:55 AM

Previous topic - Next topic

Terpsichore

I'm using Quick Editor 4.0. and I'm writing my first experimental files with MASM, so I don't know much. After using a "Console Assemble and Link" command I keep getting this error message on the output screen:

C:\masm32\myprogs\vidtest.asm <68> :error A2206 : missing operator in expression

It doesn't tell me where the error is. I thought <68> might be a reference to a line number, but inserting new dummy lines in the text doesn't make any difference. So obviously it doesn't mean that. I've tried clicking the "help" button but I can find very little about error messages. Those help files seem pretty perfunctory.

I guess that I'm violating mnemonic conventions somewhere, probably where I'm specifying a hex operand. I've tried every variation I can think of:
mov edi,0B8000
mov edi,0xB8000
mov edi,B8000h
.....

Help?

Update: I've just realized my mistake. The assembler wasn't processing the file I was working on, but the one that is saved on disc. I should have saved before clicking on the command. Cancel the question. Sorry.

jj2007

None of these will work...
mov edi,0B8000
mov edi,0xB8000
mov edi,B8000h

Correct is
mov edi, 0B8000h
Leading zero if the first digit is a..f, h at the end.

dedndave

mov edi,0B800h

hex values should end with "h"
also, hex values that begin with a letter (a-f), should be prepended with a 0 (zero)
otherwise, MASM will try to treat it as the name of a label, EQUate, etc

that looks like a video segment
in protected mode win32, directly accessing video memory won't work   :P

i see good ole' Jochen beat me to the post   :biggrin:

Terpsichore

No, it didn't work. I got an access violation.

I didn't know there was a difference between a win32 program and any other 32-bit program.

1. Does this  mean that if I opt to use Windows at all, I have to use all its APIs instead of my own routines?

2. If I wanted to write a 32-bit program that wasn't win32, how would I make the distinction in the text file?

dedndave

for question 1, that is essentially correct
learning to write graphics code for windows is a bit involved
but - well worth the effort
you can however, write 16-bit programs that will run under win32 OS's (not so much for 64-bit OS's)

for question 2, as i mentioned above, you can write 16-bit programs
you can also write 16-bit programs and use 32-bit registers for math, etc
of course, addresses are still 16-bit values

dedndave

here is a 16-bit EXE program
notice the ".386" directive
you can use 32-bit registers, if you like
        .MODEL  Small
        .STACK  2048
        .DOSSEG
        .386
        OPTION  CaseMap:None

;####################################################################################

        .DATA

s$Msg   db 'Hello World !',24h

;************************************************************************************

        .DATA?

label2  dw ?

;####################################################################################

        .CODE

;************************************************************************************

_main   PROC    FAR

        mov     ax,@data
        mov     ds,ax

        mov     dx,offset s$Msg
        mov     ah,9
        int     21h

        mov     ax,4C00h
        int     21h

_main   ENDP

;####################################################################################

        END     _main

dedndave

here is an example of what you can do in a graphics-intensive win32 program   :biggrin:


Terpsichore

Hmm, that's nice for those who are into graphics, but far beyond what I wanted to do.

The routine in your previous message is an old style DOS program, complete with interrupts. I can do that already in my FreeDos partition. I can even use big registers by shoving a 67h byte in front of the opcode. Not what I wanted. I have to have 32-bit memory.

So it looks like I'm stuck with Win32. The reason I wanted to write direct to the screen was due my experience with DOS, where the screen-writing interrupts were cumbersome and slow. Hopefully, Windows will be better.

What I'm looking for is a screen something like the Quick Editor screen, 128 characters wide, no proportional spacing. On DOS, displays like that meant text-mode routines, not graphics. Is the same true with Windows? I'd like to avoid graphics for the moment.

dedndave

dealing with text is a little different than dealing with graphics
particularly in the scroll-bar department
and the fonts you select will make a difference, too

but, there is a simple example in Masm32\Tools\Tview
also, the infamous Iczelion tutorials takes you through all the steps of creating something similar

Terpsichore

Quote from: dedndave on August 18, 2013, 02:09:54 AM
but, there is a simple example in Masm32\Tools\Tview
also, the infamous Iczelion tutorials takes you through all the steps of creating something similar

Ah, now you're talking. That will keep me busy for a while. Thanks.