Converting To NASM And Compiling
Posted by: jcarlock
Date: March 31, 2013 01:09PM

I am prepared to convert the C++ code to NASM as I lost my Visual Studio 98 (Microsoft Windows, VS6). I'm still trying to get Visual Studio to install off of a VS98-SP6 install, but that might take a lot more effort than converting the code to NASM. Who knows? I'm willing to dive into NASM some more. Is anyone out there willing to help? I know it ends up aimed at Windows computer systems, but NASM runs and compiles for other OS too.

I am getting ready to do quite a bit of programming with NASM, and I can point out some similarities to the C environment as far as the programming structures go. NASM supports a high level MACRO language and I work ONLY with I86+ processors, so while I hold some knowledge of processors and the language, I no longer have a MASM compiler and the other compilers that came with the VS98 package. And while I downloaded the Windows 7 SDK, I currently work on a system with a Dual Core Pentium, and lean quite a lot to the NASM software.

Those of you who work in assembly language should get the drift I imply.

I hope for others to smile and join and help. Cheers!

--
James and Imelda Carlock
MicroCosmoTalk

Re: Converting To NASM And Compiling
Posted by: jcarlock
Date: March 31, 2013 01:11PM

Just for others interested, "https://www.facebook.com/jim.carlock" represents my page on FACEBOOK.



Edited 1 time(s). Last edit at 07/13/2013 03:18AM by desga2.

Re: Converting To NASM And Compiling
Posted by: jcarlock
Date: April 01, 2013 09:19PM

OK, it looks like I need to start reading things about C/C++ again. Anyone willing to help me out and explain how the MACRO #PRAGMA gets put into use?

Here's the deal:

All the following conversions end up coming into play:

"sC_Source","sNASM_Source","iSpacing"
"#define","%define",0
"#else", "%else",0
"#include","%include",0
""","'",0
".h",".inc",0
".cpp",".nas",0
"// ",";// ",0
"  ","\t",8

NOTE

I use the ".nas" extension out of habit because at one time I used MASM instead of NASM. I like the things the guys at the NASM foundation provided alot! The NASMX extensions provide a great deal of comfort as well with complete (almost, it just requires some extra details as far as the HELP behind it goes) Windows (and Linux, et al) libraries and such.

--
James and Imelda Carlock
MicroCosmoTalk

Re: Converting To NASM And Compiling
Posted by: falsomail
Date: April 02, 2013 10:23AM

Hello!
Not sure, because I do not speak English well completely.
Before giving my doubts, I want to be sure of this. These converting C code to MASM K-Meleon?
For desert, I'm no programmer but it seems very interesting topic tongue sticking out smiley
Greetings.

Re: Converting To NASM And Compiling
Posted by: jcarlock
Date: April 02, 2013 09:36PM

Quote
date="2013.04.01"
Hello!
Not sure, because I do not speak English well completely.
Before giving my doubts, I want to be sure of this. These converting C code to MASM K-Meleon?
For desert, I'm no programmer but it seems very interesting topic

First, the conversion ends up as a project currently only supported by one individual, myself.

Second, the conversion ends up going from the GNU C++ (or GCC, they call it G instead of C because they are GNU http://www.gnu.org/software/software.html) to NASM (another open source, free language, but assembly language ends up a bit harder to understand, thus providing the reasons that the C/G languages came into play, http://www.nasm.us/). NASM seems relatively easy to download and get a hold of but the GCC language requires a little searching for when you get the GNU page above (just search for "GCC" or go here, http://www.gnu.org/software/gcc/).

I suspect not much help comes into play, as the high-tech guys that work on this try to avoid ASSEMBLY LANGUAGE as much as possible. That's OK, though, I want to work on it to LEARN more about the NASM language and directives. I'm starting out by converting the "About.cpp" and the "About.h" files to "About.nas" and "About.inc" respectively. If you'd like some direct links to the NASM versions I use, feel free to ask. I do not use GNU much at all, and hold no intentions on compiling with GNU GCC at all, everything gets converted and compiled with NASM-X.

http://www.asmcommunity.net/projects/nasmx/
http://sourceforge.net/projects/nasmx/

NOTE

The developers of NASMX are tired of the SOURCEFORGE.NET problems that started happening in 2011 or earlier and the changes within SOURCEFORGE so they set up their own really nicely laid out site but still depend upon SOURCEFORGE to provide the files for downloading. They supposedly want to move away and out of SOURCEFORGE but I do not see that happening this year, yet.

The programmers at NASMX all come from the NASM family and represent a really great bunch of individuals, as I personally know at least two of the original developers. I personally know Randall Hyde as well who at one time asked me to take over a newsgroup (nntp alt.lang.asm (???)). It's been awhile since I looked at the newsgroup stuff because the UNITED STATES GOVERNMENT tried to destroy the protocols for some reason, as I started as a co-moderator for the "comp.lang.asm.x86" newsgroup and when Charles Crayne passed away I ended up learning about the nntp protocol (all of which ends up as getting sent and received as SMTP and POP3 protocols and served by a server that waits for approvals from a moderator or co-moderator before posting the messages).

It's been a few years, but I now live again in Saint Petersburg, FL and am starting to get back into NASM. I see that Randall Hyde still provides his HLA (High Level Assembly) language and I know Nathan Baker, also, who helps/helped with the "comp.lang.asm.x86" newsgroup for a long time. I shall send some messages to Randall Hyde and Nathan Baker and see if I can get them to help in this project and I imagine some more enthusi_asm_ soon.

I suspect that Randall might want to see some help or provide some interest for the conversions into HLA. Cheers!!! I hope to see more enthusi_asm_!!! And remember, the language ends up as NASM, not _Micro_ASM.

If anyone wants to help out, feel free to post and provide some support. I moved to Montana a few years ago. I plan on getting married soon, in July or August, when my wife flies to me as I LOST everything I owned in February in my car and I now must start all over again.

Anyways, cheers!!! I hope to get more support on this project and currently hope to re-learn the NASM language, which includes getting to know the C language all over again, as my only "TRUE" grips and understandings currently reside with HTML and CSS (I used to run web-servers, mail-servers).

--
James and Imelda Carlock
MicroCosmoTalk



Edited 1 time(s). Last edit at 04/03/2013 06:37AM by jcarlock.

Re: Converting To NASM And Compiling
Posted by: jcarlock
Date: April 02, 2013 11:22PM

Quote
jcarlock
Quote
date="2013.04.01"
Hello!
Not sure, because I do not speak English well completely.
Before giving my doubts, I want to be sure of this. These converting C code to MASM K-Meleon?
For desert, I'm no programmer but it seems very interesting topic

It looks like I need to learn a lot more than just the NASM language.

This Phorum language seems easy enough, but forgive me, please, as I start to learn it IF I mistakenly post something improperly... Nathan Baker made a comment at the following link providing some useful information about NNTP and it requires some research, not only on my behalf, but others I suspect too, so I post the information here as it ends up very helpful.

http://sourceforge.net/projects/nasmx/files/
http://groups.google.com/group/alt.lang.asm/browse_thread/thread/e57944a4667b8815

The following code comes from a file named demo1.asm or demo1.nas and it comes from the NASMX compiler collection. I changed some of the spacing to 8-character count tabs instead of 2-character count spacings. I provide it for

;// DEMO1.ASM
;//
;// Copyright (C)2005-2011 The NASMX Project
;//
;// This is a fully UNICODE aware, type-defined demo that demonstrates
;// using NASMX typedef system to help make your code portable between
;// 32 and 64-bit systems using either ASCII or UNICODE
;//
;// Contributors:
;//	Bryant Keller
;//	Rob Neff
;// Edited_By:
;//	James W. Carlock (2013.03.13, Wednesday)
;// STILL_WORKING_ON_CONVERTING_PHORUM_TO_DISPLAY_USE_TABS
;//	Demonstration of using a message-box inside MS-WINDOWS.
;//
%include '\nasm\021007\demos\windem01.inc'

entry	demo1

[section .text]

;// Define our function procedure expecting 2 arguments of ptrdiff_t size.
;// Google size_t and ptrdiff_t to understand why these typedefs were chosen.
;// If we wanted to make this function global we would use the PROTO macro
;// which would also allow us to define the procedure later in the source
;// instead of requiring it here before invoke'ing it in proc demo1
proc   my_p, ptrdiff_t szContent, ptrdiff_t szTitle
locals none

	;// note that even though the formal parameter names are identical to the data section names
	;// they are referenced differently as the following line shows. Make sure you don't forget
	;// to include the leading dot when referencing procedure parameters and local variables.
	;// The dot notation is used to distinguish between local and global vars.
	invoke    MessageBox, NULL, ptrdiff_t [argv(.szContent)], ptrdiff_t [argv(.szTitle)], MB_OK

endproc  ;// return from procedure happens automatically here

;// the start of our program as defined with the ENTRY macro
proc   demo1, ptrdiff_t argcount, ptrdiff_t cmdline
locals none

	invoke    my_p, szContentTwo, szTitleTwo
	invoke    MessageBox, NULL, szContent, szTitle, MB_OK
	invoke    ExitProcess, NULL

endproc

[section .data]
	szTitle:      declare(NASMX_TCHAR) NASMX_TEXT('Demo1'), 0x0
	szTitleTwo:   declare(NASMX_TCHAR) NASMX_TEXT('Demo1 Procedure'), 0x0
	szContent:    declare(NASMX_TCHAR) NASMX_TEXT('Hello from the Application!'), 0x0
	szContentTwo: declare(NASMX_TCHAR) NASMX_TEXT('Hello from the Procedure!'), 0x0

BATCH/CMD_FILE_TO_COMPILE_WITH_NASM

@echo off
REM
REM demo1.bat or demo1.cmd
REM
set file="DEMO1"
if not exist %file%.asm goto errasm
if exist %file%.obj del %file%.obj

nasm.exe -f win32 %file%.asm -o %file%.obj -l %file%.lst
if errorlevel 1 goto errasm

GoLink.exe /entry _main DEMO1.obj kernel32.dll user32.dll
if errorlevel 1 goto errlink

goto TheEnd

:errlink
echo _
echo Link error
pause
goto TheEnd

:errasm
echo _
echo Assembly Error
pause
goto TheEnd

:TheEnd
echo _

Please, NOTE, that these files were originally downloaded with the NASMX compiler collection for Microsoft Windows. They built the compiler and added a bunch of Microsoft Windows MACROS to the ORIGINAL NASM compiler for Windows. And they use % directives instead of the C # directive stuff. Those that compile with C and later know this, but these details get provided to help those out that do not know much. I hope it helps.

Please, NOTE, also, recently, while in Montana I witnessed DEAD people walking around and while I found it hard to believe, I researched the names of the individuals that died and because at least FOUR people wrote about the resurrection of Jesus, I believe in the truth and know the truth about life after death. People may call me crazy, but forget CRAZY. I tell you the truth.

Doctors keep telling me, "You should be dead." But here I live, sitting in front of a computer posting the truth, that Jesus "lives" as I type these words, even though I possibly never witnessed "Jesus". I believe he lives, whether in a sleep or awake, the fact that more than four people wrote about seeing Jesus means something, and I now write about him too.

May we all witness the love of "Jesus" and if not, may we all walk and work with the love that he showed and provide a true presentation of proper ways to act. Tears mean more than truth and honesty. Love means truth, honesty and a persisting to helping others. We do not need to see HIM to act properly and we hold no need to witness a miracle to know the truth, although it greatly helps. Life means, "Show the love, demonstrate the love, know the love."

Again, cheers!

--
James and Imelda Carlock
MicroCosmoTalk

K-Meleon forum is powered by Phorum.