News:

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

SVGA or VGA initialization

Started by nrdev, May 24, 2009, 02:25:46 PM

Previous topic - Next topic

nrdev

how can I make my masm32 to compile a 16-bit app?

dedndave

let me see
i did it once to see if i could....
first - get the 16-bit linker (LINK563.EXE) - place it in the masm32\bin folder
then make a little batch file to assemble 16-bit code - i named it a16.bat and placed it in the same folder

@echo off
if "x%1"=="x" goto ascusage
if exist %1.asm goto ascasm
:ascusage
echo Usage: a16 asmfile
echo "asmfile" = asmfile.asm
goto batchexit
:ascasm
if exist %1.obj del %1.obj
c:\masm32\bin\ml /c %1.asm >c:\masm32\bin\asmbl.txt
if errorlevel 1 goto showtxt
if exist %1.exe del %1.exe
c:\masm32\bin\Link563 %1.obj >>c:\masm32\bin\asmbl.txt
:showtxt
if exist %1.obj del %1.obj
type c:\masm32\bin\asmbl.txt
:batchexit
dir %1.*


then - to assemble a 16-bit program type (at the prompt)
a16 MyAsmFile   (the batch file is written to assume .asm extension)

now - let me see if i can dig up an example 16-bit program for you
then - you should post in the 16-bit forum rather than here


dedndave

ok
i had to modify one line in the batch file.... (added the semicolon)


c:\masm32\bin\ml /c %1.asm; >c:\masm32\bin\asmbl.txt


then - here is a program.....


        .model small

        .dosseg

        .stack 512

        .data

messag  db      'Hello World',0Dh,0Ah,24h

        .code

_main   proc

        mov     ax,_data          ;data segment
        mov     ds,ax

        mov     dx,offset messag
        mov     ah,9              ;function
        int     21h               ;DOS call

        mov     ax,4C00h          ;terminate - exit code = 0
        int     21h               ;DOS call

_main   endp

        end     _main

dedndave

nope - that semicolon isn't working either
the assembler is looking for more filenames
give me a few minutes...

nrdev

c:\masm32\bin\Link563 %1.obj >>c:\masm32\bin\asmbl.txt
in this line should be writen lnk563 instead of Link563. But in both ways it doesn't give any errors, and also don't give an exe file

dedndave

i named the linker link563.exe - so it works - lol
also - it helps if c:\masm32\bin is in the PATH environment variable (mine is already set up like that)

try this batch file.....

@echo off
if "x%1"=="x" goto ascusage
if exist %1.asm goto ascasm
:ascusage
echo Usage: asc asmfile
echo "asmfile" = asmfile.asm
goto batchexit
:ascasm
if exist %1.obj del %1.obj
c:\masm32\bin\ml /c %1.asm >c:\masm32\bin\asmbl.txt
if errorlevel 1 goto showtxt
if exist %1.exe del %1.exe
c:\masm32\bin\Link563 %1.obj; >>c:\masm32\bin\asmbl.txt
:showtxt
if exist %1.obj del %1.obj
type c:\masm32\bin\asmbl.txt
:batchexit
dir %1.*


EDIT the semicolon was needed on the linker line - not the assembler line

dedndave

if c:\masm32\bin is not in the PATH variable, type this at the command prompt...

\masm32\bin\a16 MyAsmFile

nrdev

it still have the same effect, dosn't report any error, and doesn't make the exe file.

my paths are

D:\masm32\bin\
D:\projects\16bit\16bit.asm

dedndave

ohhhhhhhhh - lol
then you will want d:\masm32\bin to be in the path (or use d:\masm32\bin\a16 MyAsmFile at the prompt)
and modify the batch file as follows....


@echo off
if "x%1"=="x" goto ascusage
if exist %1.asm goto ascasm
:ascusage
echo Usage: a16 asmfile
echo "asmfile" = asmfile.asm
goto batchexit
:ascasm
if exist %1.obj del %1.obj
d:\masm32\bin\ml /c %1.asm >d:\masm32\bin\asmbl.txt
if errorlevel 1 goto showtxt
if exist %1.exe del %1.exe
d:\masm32\bin\Link563 %1.obj; >>d:\masm32\bin\asmbl.txt
:showtxt
if exist %1.obj del %1.obj
type d:\masm32\bin\asmbl.txt
:batchexit
dir %1.*

dedndave

the basic commands are....

ml /c MyAsmFile.asm

link563 MyAsmFile.obj;

you can do it without a batch file

nrdev

still doesn't work. This time I have moved my *.asm file to my bin folder and, run command ml /c 16bit.asm, and get lots of errors, that I couldnt get when runing the batch file.

dedndave

ouch
it runs on mine
can you copy/paste the errors in here ?

it may not be great form for 16-bit - lol
i am used to a much older assembler for 16-bit code
this was my first attempt at a 16-bit program for this assembler

it may be best if you refer to the 16-bit forum or one of the
sites for a better example of how to write a 16-bit program

but - like i say - it assembled on mine

nrdev

here is the process and the errors


dedndave

let me find my glasses

here - let me send you the file.....
(see attached zip)

i got the full-size pic
it looks like you are missing a period before the word model

   .model small

you also need it before

   .dosseg

   .data

   .code


[attachment deleted by admin]

nrdev

ok it compiled, but how can I make this program run in fullscreen?

turns out I didn't need lin563.exe becouse i had link16.exe to make it done.