News:

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

jwasm question

Started by bcddd214, December 06, 2011, 10:15:53 PM

Previous topic - Next topic

bcddd214

What am I forgetting to import?
I wrote this code for Irvine but just switched to jwasm AND, do I have to run the finished .exe in dosbox I assume?
I gcc compile the file.o in Linux as normal?
A couple of quick pointers will go a long way in making this change...   :)

./jwasm -elf Samples/myDos.asm
JWasm v2.06e, Jul 22 2011, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

myDos.asm(95) : Error A2102: Symbol not defined : DGROUP
myDos.asm: 104 lines, 2 passes, 0 ms, 0 warnings, 1 errors




TITLE The New DOS

.model      small
.stack      100h

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
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

putchar      PROC
         push         bp
         mov            bp, sp
         push         ax
         push         bx
         push         cx
         push         dx
         
; missing something here
         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
         exit
main      ENDP

         end            main

FORTRANS

Hi,

   This is a guess, so don't expect much.  But try replacing;

         mov            ax, @data

with

         mov            ax, SEG application

And see if that helps.

Cheers,

Steve N.

bcddd214

Quote from: FORTRANS on December 06, 2011, 10:48:04 PM
Hi,

   This is a guess, so don't expect much.  But try replacing;


Almost there!

./jwasm -elf Samples/myDos.asm
JWasm v2.06e, Jul 22 2011, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

myDos.asm(95) : Error A2197: Unsupported fixup type for ELF: application
myDos.asm: 105 lines, 2 passes, 0 ms, 0 warnings, 1 errors

mineiro

Hello bcddd214, try assemble with the command line below, it worked here, a blue screen appears:
jwasm -mz newdos.asm
MZ is a header of executable files to ms-dos and windows world. This name come from the creator of that structure, that was expanded to future generations of windows.
If you open any .exe/.dll file using a hexadecimal editor, you will see that the first 2 bytes are just "MZ".
Elf files are to linux world, so windows do not understand that file (structure). Bin files are to mbr,.com, raw, ... .
Now that you know these names, make a "jwasm /?", and some of the output will make sense.
When you install ms-dos in your computer, it install some interruptions to do hard work for you, most of then are int 21h. In linux, you deal with int 80h.
The bios interruptions are in your computer, even if your computer do not have an O.S. installed.

./jwasm -elf Samples/myDos.asm
Are you trying to assemble this example to run under linux? So, you need review your code, because have int 21h. Mov ax,4c00h and int 21 means ;"ms-dos, I (the program) have finished, now I give control back to you".

In resume, if you are trying to assemble your example in ms-dos or linux using jwasm, and your goal is create one code to ms-dos, you should use:
jwasm -mz newdos.asm
Depending of what O.S. you have installed, consider to use an ms-dos emulator.