News:

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

Making the switch

Started by AiaKonai, September 13, 2010, 02:19:36 PM

Previous topic - Next topic

AiaKonai

Hello,
I am new to assembly, and I am trying to convert a 16 bit com program into a 32 bit exe.
I understand the basics decently well.
Here is one of the programs I need to convert to an exe.

  NAME 'rpause'
  PAGE 55,132
  TITLE 'rpause'

CSEG SEGMENT PARA PUBLIC 'CODE'
  ASSUME cs:CSEG,ds:CSEG,es:CSEG,ss:CSEG
  ORG 100h

_start:
  mov dx,offset msg
  mov ah,09h
  int 21h
  mov ax,0c08h
  int 21h
  int 21h
  mov ax,4c00h
  int 21h

msg   db 0dh,0ah,'Press any key to continue ...',0dh,0ah,'$'

CSEG ENDS

   END _start


This is a replacement for the pause command in a batch file.
Since the pause command does not clear the keyboard buffer before taking input.
This replacement works perfectly, but it is a com file.
It is not exactly easy to make com files work on 64 bit machines :(. (dosbox being the only way i've seen one work)

I am searching for a tutorial that will cover how to do this same thing as a 32 bit exe.

And if anyone happens to have the newer equivalant to choice.com, that is the other com file I need to replace.

Thank you for any help you provide.

bomz

in this code you no need any reason to use 32 bit registers.

AiaKonai

?? What are you talking about,
This is a 16 bit program.
I need a 32 bit equivalent.
So I'm trying to find a good guide on very basic input and output for a 32 bit exe made in assembler.


AiaKonai

What is that you posted?
Very confused now.

bomz

you may use 32 bit registers. You realy need it when use XMS memory
in this example using 32 bit registers make programe two time quickly

AiaKonai

why are you posting a 16 bit program in response to a question about
how to make a 32 bit program???


bomz

I understand you want the programe that do the same

oex

You could use:

inkey "Press any key to continue ..."

(see \masm32\macros\macros.asm)

Maybe also a bad answer I dont come from 16 bit
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv


AiaKonai

Quote from: oex on September 13, 2010, 02:48:38 PM
You could use:

inkey "Press any key to continue ..."

(see \masm32\macros\macros.asm)

Maybe also a bad answer I dont come from 16 bit

That's wonderful!!   I am trying to move towards making it 32 bit :D not 16 bit.
Do you have any examples of this inkey?

redskull

Here is strictly win32 version

.data?
hConsoleIn  HANDLE ?
hConsoleOut HANDLE ?
NumWritten  DWORD ?
NumRead     DWORD ?
InBuffer    DWORD ?

.data
msg   db 0dh,0ah,'Press any key to continue ...', 0dh, 0ah


.code
start:

    invoke GetStdHandle, STD_INPUT_HANDLE
    mov hConsoleIn, eax
   
    invoke GetStdHandle, STD_OUTPUT_HANDLE
    mov hConsoleOut, eax
   
    invoke WriteConsole, hConsoleOut, ADDR msg, SIZEOF msg, ADDR NumWritten, NULL
   
    invoke ReadConsole, hConsoleIn, ADDR InBuffer, 1, ADDR NumRead, NULL

    invoke ExitProcess, 0
   
end start


-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

AiaKonai


AiaKonai

@redskull

umm............. THANKS A TON!!!!
Even though I did want to learn how to do it myself, that should help
me  move towards making more complex stuff.
Thank you very much.

bomz

not only command line this is example of console programe.
batch to compile console program
ECHO OFF
COLOR 9F
CLS
C:\masm32\bin\ml.exe /c /coff current.asm
C:\masm32\bin\link.exe /subsystem:console current.obj
DEL current.obj
pause