News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

raw error???

Started by bcddd214, November 27, 2011, 12:28:42 AM

Previous topic - Next topic

bcddd214

In a nutshell, you are trying to take me higher and I am trying to go lower.  :)

bcddd214

Can someone kindly assist me with this last compile error?

Assembling: newDOS1.asm
newDOS1.asm(150) : error A2114: INVOKE argument type mismatch : argument : 2
newDOS1.asm(150) : error A2114: INVOKE argument type mismatch : argument : 1
newDOS1.asm(151) : error A2114: INVOKE argument type mismatch : argument : 1
newDOS1.asm(74) : error A2006: undefined symbol : WriteString
newDOS1.asm(77) : error A2006: undefined symbol : ReadString
newDOS1.asm(99) : error A2006: undefined symbol : WriteString
newDOS1.asm(143) : error A2006: undefined symbol : DGROUP
newDOS1.asm(153) : error A2006: undefined symbol : Crlf


**********************************************************


TITLE The New DOS

.model      small, STDCALL
.stack      100h
.686p
.mmx
.xmm

GetInput     PROTO :DWORD, :DWORD, :DWORD
SwapIt       PROTO :DWORD
askUser      PROTO :DWORD, :DWORD, :DWORD

WINDESC      STRUCT
         upperRow   BYTE   ?
         leftCol      BYTE   ?
         lowerRow   BYTE   ?
         rightCol   BYTE   ?
         foreColor   BYTE   ?
         backColor   BYTE   ?
WINDESC      ENDS


exit      MACRO
         mov         ax, 4C00h
         int         21h
         ENDM
         
.data
Mes1    BYTE "Enter a 5 digit string: ", 0
InName  BYTE 6 dup(0)

application   WINDESC      <05h, 05h, 15h, 45h, 07h, 10h>

.code


curpos      PROC
         push      bp
         mov         bp, sp
         push      ax
         push      bx
         push      dx
         
         mov         ax, 0200h
         mov         bh, 0
         mov         dx, [bp+4]
; interrupt
         int         10h
         
         pop         dx
         pop         bx
         pop         ax
         pop         bp
         ret         2
curpos      ENDP

        OPTION  PROLOGUE:None
        OPTION  EPILOGUE:None


GetInput PROC   lpszString:DWORD, lpBuffer:DWORD, uLength:DWORD

;Call With: lpszString = pointer to message string
;             lpBuffer = pointer to input buffer
;              uLength = length of input buffer
;
;  Returns: buffer is filled with user input
;           ECX, EDX are destroyed

        push    ebp
      call   askUser
        mov     ebp, esp
        mov     edx, [ebp+8]          ;lpszString
        call    WriteString
        mov     edx, [ebp+12]         ;lpBuffer
        mov     ecx, [ebp+16]         ;uLength
        call    ReadString
        pop     ebp
        ret     12                    ;return and discard 3 dwords

GetInput ENDP

        OPTION  PROLOGUE:PrologueDef
        OPTION  EPILOGUE:EpilogueDef

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

        OPTION  PROLOGUE:None
        OPTION  EPILOGUE:None

putchar      PROC      lpszString:DWORD
         push      bp
         mov         bp, sp
         push      ax
         push      bx
         push      cx
         push      dx
         
         call      WriteString
         
         pop         dx
         pop         cx
         pop         bx
         pop         ax
         pop         bp
         ret         2
putchar      ENDP

makewin      PROC
         push      bp
         mov         bp, sp
         push      ax
         push      bx
         push      cx
         push      dx
         push      si
         
         mov         si, [bp+4]
         
         mov         ax, 0600h
         mov         bh, (WINDESC PTR[si]) .backColor
         mov         ch, (WINDESC PTR[si]) .upperRow
         mov         cl, (WINDESC PTR[si]) .leftCol
         mov         dh, (WINDESC PTR[si]) .lowerRow
         mov         dl, (WINDESC PTR[si]) .rightCol
;interrupt
         int         10h
         
         push      cx
         call      curpos
         
         pop         si
         pop         dx
         pop         cx
         pop         bx
         pop         ax
         pop         bp
         ret         2
makewin      ENDP

main      PROC
         mov         ax, @data
         mov         ds, ax
         
         mov         ax, OFFSET application
         
         push      ax
         call      makewin
         call      putchar
         INVOKE  GetInput, offset Mes1, offset InName, sizeof InName
         INVOKE  SwapIt, offset InName
;         call    WriteString
         call    Crlf         
         
         exit
main      ENDP

         end         main

jj2007

Quote from: bcddd214 on November 28, 2011, 06:30:29 AM
In a nutshell, you are trying to take me higher and I am trying to go lower.  :)
Quote
I have trouble compiling my first hello world program using the software on that website you sent me too. So I haven't been able to read a lot of the help file...
Also there is no need to refer me to the masmbasic. For this instructional I am pure masm and don't what additional libraries

Before going anywhere, you should learn how to walk. To understand what your code does, you need either a debugging macro (deb) or Olly. Without, you are just "flying blind", getting crashes or error messages.

Only very advanced programmes gain something from fumbling with esp and ebp, all others just get headaches.

No programmer, even very advanced ones, can code without libraries. Even a simple int 21h calls a library.

By the way, the last code you posted is 16-bit (obsolete), and you get the error because you have a bad combination of commandline switches and ml.exe version.

mineiro

#18
Quote from: bcddd214 on November 27, 2011, 01:58:14 AM
I know the readstring and writestring error are from me 'not' calling on the Irvine32 libraries. I am trying not to use them. How do I read and write without them?
Using interruptions, or acessing the IO ports direct, or some location in memory. You can use ms-dos interruptions(more easy to start) , do a search in 16 bit DOS Programming section of this board, I'm supposing this because you are using "4C00h, int 21h", so this makes me think that you are building an .exe to ms-dos 16 bits, instead of .com (int 20h).
The code below was found inside this board.
.model small
.stack 100h
.data
message db "Hello World", 13, 10, "$"
.code
start:           
mov   ax, @data
mov   ds, ax
mov   dx, offset message      ; copy address of message to dx
mov   ah, 9h                  ; subprogram for string output
int   21h                     ; call ms-dos to display string
mov   ax, 4c00h
int   21h
end   start

ml /Bllink16.exe hello.asm
Remember, that you need put yourself in time. To easy starting code to ms-dos, do not work with dword's(for a while), in that era, we deal with "word". So, edx mean dx, eax mean ax, ... .
The challenge is: rewrite this example to output strings using bios interruptions (int 10h), after, memory location, after, IO (you will learn about in/out instructions, and addresses of corresponding ports/machine architecture)(Ralph Brown list). Start again the same way but now, getting user input.
When you reach the last step, you are able to write bcddd214 O.S (a simple one, that only show "welcome to bcddd214 O.S. v0.0"). Now, you are able to create your own interruptions to you O.S (learn about cli/sti instructions). So, after, you read ml laws and discover that you cannot create your O.S using ml :/ . Time to change of assembler.

bcddd214

Not for what this project entails my friend.
I need/have too stay CLEAR of anything high level.
I am and have been hooked on asm since I started to learn it but, knuckle busting through the really LOW level (like manipulating the stack frame pointer to your advantage or at least control it) is REALLY important right now.

All task I have assigned to myself involve manipulation of the registers mainly esp and ebp to develop a clear understanding of how they work. This task is a tiny bit high than just learning asm. (most will view this as a waste of time, but it is not).

Thank you kindly for your perspective though and your support.
Making the changes now...   :)

bcddd214

Thank you!
On it!
This is wonderful!

Quote from: mineiro on November 28, 2011, 06:05:57 PM
Quote from: bcddd214 on November 27, 2011, 01:58:14 AM
I know the readstring and writestring error are from me 'not' calling on the Irvine32 libraries. I am trying not to use them. How do I read and write without them?
Using interruptions, or acessing the IO ports direct, or some location in memory. You can use ms-dos interruptions(more easy to start) , do a search in 16 bit DOS Programming section of this board, I'm supposing this because you are using "4C00h, int 21h", so this makes me think that you are building an .exe to ms-dos 16 bits, instead of .com (int 20h).
The code below was found inside this board.
.model small
.stack 100h
.data
message db "Hello World", 13, 10, "$"
.code
start:           
mov   ax, @data
mov   ds, ax
mov   dx, offset message      ; copy address of message to dx
mov   ah, 9h                  ; subprogram for string output
int   21h                     ; call ms-dos to display string
mov   ax, 4c00h
int   21h
end   start

ml /Bllink16.exe hello.asm
Remember, that you need put yourself in time. To easy starting code to ms-dos, do not work with dword's(for a while), in that era, we deal with "word". So, edx mean dx, eax mean ax, ... .
The challenge is: rewrite this example to output strings using bios interruptions (int 10h), after, memory location, after, IO (you will learn about in/out instructions, and addresses of corresponding ports/machine architecture)(Ralph Brown list). Start again the same way but now, getting user input.
When you reach the last step, you are able to write bcddd214 O.S (a simple one, that only show "welcome to bcddd214 O.S. v0.0"). Now, you are able to create your own interruptions to you O.S (learn about cli/sti instructions). So, after, you read ml laws and discover that you cannot create your O.S using ml :/ . Time to change of assembler.


Don57

I think that he is telling you that you have to define the STDCALL for the assembler, so that it knows your calling convention.