The MASM Forum

General => The Campus => Topic started by: Terpsichore on August 18, 2013, 12:43:55 AM

Title: Meaning of error messages
Post by: Terpsichore on August 18, 2013, 12:43:55 AM
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.
Title: Re: Meaning of error messages
Post by: jj2007 on August 18, 2013, 01:14:27 AM
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.
Title: Re: Meaning of error messages
Post by: dedndave on August 18, 2013, 01:14:59 AM
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:
Title: Re: Meaning of error messages
Post by: Terpsichore on August 18, 2013, 01:31:00 AM
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?
Title: Re: Meaning of error messages
Post by: dedndave on August 18, 2013, 01:34:52 AM
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
Title: Re: Meaning of error messages
Post by: dedndave on August 18, 2013, 01:36:32 AM
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
Title: Re: Meaning of error messages
Post by: dedndave on August 18, 2013, 01:45:45 AM
here is an example of what you can do in a graphics-intensive win32 program   :biggrin:

(http://img838.imageshack.us/img838/9528/t77t.png)
Title: Re: Meaning of error messages
Post by: Terpsichore on August 18, 2013, 02:05:13 AM
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.
Title: Re: Meaning of error messages
Post by: dedndave on August 18, 2013, 02:09:54 AM
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
Title: Re: Meaning of error messages
Post by: Terpsichore on August 18, 2013, 02:30:59 AM
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.