Hi, First off let me apologize if this is not in the 16bit section , but I am trying to know how to Convert a com asm to a win32 asm , and I am not looking to Convert an already assembled .com to a .exe ....
Is there any body that knows a formula for this? or is really good at it .... I would not even know were to begin ....
But this is sooo Cool :bg
I saw this and I had to have it, Also is there a way to include The Unicode Macro so you can have other language characters like Oriental
16-bit code doesn't easily convert to 32-bit
in this program, he accesses the video buffer directly
that isn't very practical in 32-bit
also, it is full-screen graphics - that means the display dimensions are fixed
in a win32 environment, windows change sizes, as you know
that doesn't mean it can't be done
you have learned enough to make it happen in a back-buffer, then display it
Quote from: dedndave on July 18, 2011, 12:50:54 AM
he accesses the video buffer directly
that isn't very practical in 32-bit
also, it is full-screen graphics - that means the display dimensions are fixed
in a win32 environment, windows change sizes, as you know
Couple of the examples That I did did not work with windows change size , the window needed to be fixed, I don't mind that....
Quote from: dedndave on July 18, 2011, 12:50:54 AM
you have learned enough to make it happen in a back-buffer, then display it
What gets me is the use of 16 bit registers, how do Convert that? no experience with 16bit code ... "bl" = ? ...is it edi? what is "al" "es" ... is it esi?
I have some very very old tuts that I must find in order to figure this out....
At the risk of sounding stupid ....I guess If you do not ask ...you do not learn... I never compiled a .com before with MASM ... Link some TASM ans FASM( but they ere the examples that came with the program and I just ran the bat) I don't know much about com's at all ....
From a compile com bat that I have ... this is what it looks like :
@ECHO OFF
@CLS
@ECHO _
@SET MASMDIR=\MASM32
@SET INCL1=C:\PROGRA~1\MICROS~1\VC98\INCLUDE
@SET INCL2=C:\PROGRA~1\MICROS~1\VC98\MFC\INCLUDE
@SET FN=comasm
@IF EXIST "%FN%.exe" del "%FN%.exe"
@ECHO.
@ECHO þ Compiling resources "%FN%"
%MASMDIR%\BIN\rc.exe rc.rc
@ECHO.
@ECHO þ Compiling the program "%FN%"
%MASMDIR%\BIN\ml /c /coff /Cp /nologo %4 %5 "%FN%.asm"
@IF NOT EXIST "%FN%.obj" GOTO error
@ECHO.
@ECHO þ Linking Program "%FN%"
%MASMDIR%\BIN\Link /SUBSYSTEM:WINDOWS /nologo %3 "%FN%.obj" "rc.res"
@IF NOT EXIST "%FN%.exe" GOTO error
@GOTO end
:error
@ECHO _
@ECHO þ error "%FN%" !!!
@GOTO end
:end
@IF EXIST "rc.res" del "rc.res"
@IF EXIST "%FN%.obj" del "%FN%.obj"
Is this correct?
Also For the the 32 bit version I would like to add a flickering underscore in front of the text as it is typing ...I seen this done here on the MASM forum but I have no idea were, it must have been a console app...at the time I passed it ...I figured I will never use it LOL
Ever since I saw this Example, I wanted to know How it is Made .... See the cursor effect?
It's going to be difficult to convert because it's VGA-specific, runs the display in alphanumeric mode, loads a user-specified character set, etc.
hfheatherfox07,
This is not what you want to hear but the solution is not to convert it but to create a description of what it should do in 32 bit then simple write that code. The architecture and hardware differences make a close conversion impractical where a rewrite is the fastest and most successful way to get the result.
I have converted a couple of 16 bit programs to 32 bit & the many problems I came across are well documented in previous posts on this forum. As stated above you cannot address the video buffer directly & there are no interrupts, so all that code has to be rewritten. Some parts of the program can be used by changing register & data sizes (about 25%) the rest as I said is a rewrite. Knowing what I know now I would do as hutch says & start from scratch. I was converting to 32 bit console mode & that was bad enough, a GUI well..... forget it.
There is no necessity to convert 16 to 32, 16 is good work under 32 system (windows). You want do 32 application that do the same as 16 bit
Quote from: bomz on July 18, 2011, 07:36:30 AM
There is no necessity to convert 16 to 32, 16 is good work under 32 system (windows). You want do 32 application that do the same as 16 bit
Yes
Quote from: hutch-- on July 18, 2011, 03:36:08 AM
hfheatherfox07,
This is not what you want to hear but the solution is not to convert it but to create a description of what it should do in 32 bit then simple write that code. The architecture and hardware differences make a close conversion impractical where a rewrite is the fastest and most successful way to get the result.
LOL I spent 2 days with this straight and came to the same conclusion.... Although this looks like a console app...for sure
Although what I am trying to do is at least get a console app 32 version of this working so I can use
some of the procs , thanks to the consistently updated masm32 version I think I can do a way with the proc to wait and just use "invoke sleep , 1000" for example
Also I am very lucky in that I actually have an example that takes chars an prints it (with font and color if I want ) to a static in win32...
I also noticed that for example little things like the green color is "0A" for light green and "02" for the dark green, In a win32 console app it is "10" for light green although the "02" remains valid
how ever I had one problem that I could not solve on my own
How do I convert:
mov es:[di],bh
is it ->
mov esi,byte PTR [edi]
???
Also How do I easily add a blinking cursor in front of the text as it types? I have an example that replaces the cursor in an edit box with what ever you want and with icons...
Also just out of curiosity how do I make an MS DOS.pif short cut like this guy did to run console apps full screen? in 32bit?
I'd Love to know if some has an example of that please
This matrix com file runs full screen if you "send it" to desktop.
Tasm source included.
Quote from: Magnum on July 19, 2011, 11:09:50 PM
This matrix com file runs full screen if you "send it" to desktop.
Tasm source included.
Thanks but I am looking to create the com that I have in win32 , that one runs perfect too (nicer) ...don't want a com, I what to make a win32 not a console either ....don't know TASM
mov es:[di],bh this is a segment override with es pointing at the start of a memory block (Video buffer perhaps?), di is the offset from the start of that memory block.
You cannot convert this code to 32 bit as there are no segment overrides. Using console mode & the available API's you have complete control of what is displayed (position, colour etc).
Quote from: Neil on July 20, 2011, 08:01:51 AM
You cannot convert this code to 32 bit as there are no segment overrides.
There are segment overrides, but normally the only place they're used is with the FS segment register and exception handling. The problem is that you cannot create your own segments or selectors.
AFAIK doing this as a console app would require a special font. The source includes the bit patterns for the user-specified 9x16 character set. It should be possible to create a bitmap from the patterns, and use the bitmap to draw the characters on a window.
Quote from: hfheatherfox07 on July 18, 2011, 02:42:37 AM
What gets me is the use of 16 bit registers, how do Convert that? no experience with 16bit code ... "bl" = ? ...is it edi? what is "al" "es" ... is it esi?
... I don't know much about com's at all ....
Dot com files are the most simply,these files don't have a header. They fit only in one segment(like default win32 executables), so I'm saying they have a maximum lenght of 64kb(win32 uses 32 bits, so they can address more space). Dot com files starts every time in offset 100h in memory(one approach is some programs to win32 that have an entrypoint at 401000h).
When you run your .com file, the first line of code that you see are in the address:
XXXX:YYYY (or if you prefer segment:offset)(in ms-dos, offset is 16 bits, in win32, offset is 32 bits, so, in win64 you have offset of 64 bits)
where XXXX is pointed to CS(code segment)(ms-dos choose this value to your program, and put your code in this segment) and YYYY is 0100h(because is a .com file,here is the entrypoint of your program). What have betwen cs:0000 and cs:00ffh is some structure that ms-dos keep(PSP- prefix segment program).
In 16 bits world, eax doesn't exist. So you have to play with AX register. AX register (word = 16 bits) can be div into 2 parts. The higher part is "AH" and the lower part is "AL". So AX = AHAL, each ah and al holds 8 bits. These apply to general registers, like bx,cx,dx.
In ms-dos, you can control all the hardware, so to write something in screen, you can use a ms-dos interruption, but, if you don't like, you can use a bios interruption, but if you don't like, you can write direct in video memory address(you need know their address and actual resolution), but..., you can do your own IO(in/out) manipulation.
Win32 prevent you to write direct in video memory and do some IO instructions in user land.
I have looked the matrix and that code use some bios interruptions (int 10h). Interruptions you can assimilate like libraries(dll) in windows. They can perform functions, and one interruption can offer to you different related functions. So, if you like to call some function, you set up some registers and after do a "int ??h". The contents of registers(generally AX,ah or al) tell what code(function) the interruption will do.
To convert 16 bits code to win32 world, you need find one function inside some dll in windows that correlates with the interruption. Probably, int 10h(video) you can use textout in windows,. The delay you can use settimer... .But you need take care of what one interruption can return to you(it can differ from what one function in windows return to you).
The hard part is just because the program write direct to video memory and you don't have access in user mode. Old guys write in this way to get speed in their code, so, they only set the screen dimensions using interruption and after, deal with a array_screen (collumns x lines).
In the code matrix you have posted, have a line like:
mov es:[di],al
This tell that previously the programmer have put the video segment address in the es register, and used di(like edi, but 16 bits version) to hold some offset (the array of video).
In win32, you generaly don't change the es,cs,ds,ss,gs registers, some exceptions are if you code some SEH(you use fs segment register).
mov ax,0B800h
mov es,ax
Take a look, 0b800h is the video segment address, and the person is moving it to es(extra data segment). So to write something in screen you need only store some bytes in that address:offset, and magicaly, it appear on screen.
Why about segment registers? Well, a .com file can hold cs:0000h to cs:ffffh(16 bits), so if you program get bigger, you need put some data in another segment(not your case, this one is like .exe ms-dos files). If your code is bigger than 64 kb (the segment is fully filled), you start playing with segment registers, because it can hold only 64kb, and when this happens, you need know about memory addressing ways.
Some code can be easyly ported to win32 when they don't call interruptions, or uses some hardware addresses. When this matches, you need preserve the registers used by windows before call that procedure. Another point is when you have IO operations (like receive(in) of printer port some data or send(out) to that port some data). These codes can be ported to windows, but you need deal with device drivers.
Now you know why I said "rewrite it". produce a decent description of what the app is supposed to do and unless you have very good reason to make it a Win32 Console app, do it as a normal GUI application, the benefits are massive and the costs are low. Trying to do anything clewver in a console mode app is a pain in the arse, CMD.EXE has nothing like the power, speed or control of a full GUI app.
Yes you are right win32 is definitely the way to go ..... I think I will brake down the app into sections than work on every section on it's on ....
the autotyper -I am going to look at Vortex's example
the numbers with rows and columns (no idea how to begin that)
and the Matrix it self.....
I found another MATRIX example that is already 32bit but it is in TASM ... can any body write a "buildit.bat" for it taking into consideration that tlink.exe tlink32.exe are in the same folder as the asm , so are any of the includes and dll...
Sorry as it was pointed out .... this asm created some funky links and not the actual matrix in tasm so I removed the attachment
Sorry about that
the author puts the cl for TASM in the source:
; matrix.asm - source code for matrix.htm
; build:
; tasm matrix.asm /m2
; tlink matrix.obj, matrix.htm /t /3
You get a lot of your stuff from questionable sites! that is from an IE exploit? tsktsk
Quote from: Gunner on July 29, 2011, 09:43:07 PM
the author puts the cl for TASM in the source:
; matrix.asm - source code for matrix.htm
; build:
; tasm matrix.asm /m2
; tlink matrix.obj, matrix.htm /t /3
You get a lot of your stuff from questionable sites! that is from an IE exploit? tsktsk
Hi Gunner, I saw that and I tried that before I posted my question , that did not work! :(
As for were I get my stuff from .... All I did Was Google "Matrix", than "Matrix.asm", than "Matrix MASM" .... and so on until I found a few examples....
I have no idea what IE exploit is ::)
As Hutch has said, the easiest way is to write down your observations of the programs functions in the form of an algorithm, and then work through writing a program to create those effects.
Quote from: anunitu on July 30, 2011, 12:49:35 AM
As Hutch has said, the easiest way is to write down your observations of the programs functions in the form of an algorithm, and then work through writing a program to create those effects.
I agree... and I am still working on that;
I broke it down into sections , the typing ( which I have), the cursor( almost there) , the numbers(no idea how to do yet), and the matrix(no idea how to do yet)....
I just found this new matrix example in TASM which is 32bit , And all I wanted is to assemble it , to see it work and borrow from that...
The instructions say to build it like this:
; build:
; tasm matrix.asm /m2
; tlink matrix.obj, matrix.htm /t /3
But it does not work , and I have no idea how to use tasm, I was hoping someone with more tasm knowledge can show me a proper build it.bat
What doesn't work? What error are you getting when you assemble with tasm and link?
Quote from: Gunner on July 30, 2011, 12:57:18 AM
What doesn't work? What error are you getting when you assemble with tasm and link?
I am getting a 0 bytes exe but no errors....basically it is not a valid program when you double click on it to run it
I tried doing it several other ways , including putting TASM in my c drive and using RadASM but that gives me an error in the main code but no line number or any other info like MASM?
Like I said I have 0 knowledge in TASM ... I put "tlink" ,"tlink32" ,"imports.lib" and dll in a folder and ran the bat like the asm said to do , but all I got was a 0 byte app
I had no problems:
e:\tasm\bin\tasm.exe matrix.asm /m2
e:\tasm\bin\tlink.exe matrix.obj, matrix.htm /t /3
it creates the file matrix.htm. which is some code to expoit IE in some way. Do yourself a favor... write your program from scratch and don't download this crap please
Quote from: Gunner on July 30, 2011, 01:22:48 AM
I had no problems:
e:\tasm\bin\tasm.exe matrix.asm /m2
e:\tasm\bin\tlink.exe matrix.obj, matrix.htm /t /3
it creates the file matrix.htm. which is some code to expoit IE in some way. Do yourself a favor... write your program from scratch and don't download this crap please
LOL
I am laughing so hard now .... I thought this created an actual app.... I changed "matrix.htm" to "matrix.exe" and tried "matrix.res" I thought it was a typo
I had no idea all this does is create an htm ....
I am very sorry about that... Should I delete that attachment?
I deleted the attachments I think that is better