WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
Pages (3) 1 2 [3]   ( Go to first unread post )

C++ OpenGl tutorial translated to Assembly, the prototypes from masm32 includes conflict with the ones in C++ and my program runs but it crashes on CreateWindowEx.

Savage
Quote Post


Very Very Active Member
*****

Group: Members
Posts: 88
Member No.: 1048
Joined: 27-February 05


Thanks for the feedback, Ice.
If only I could make fConst work with negative signs... I was successful at changing the decimal point to an underscore, but can't seem to work out the negative sign =/
PMEmail PosterUsers Website
Top
Savage
Quote Post


Very Very Active Member
*****

Group: Members
Posts: 88
Member No.: 1048
Joined: 27-February 05


This just in: When I try to draw things, the screen stays black. Lol.

my updated file is attached.

Note that I couldn't get my $fConst macro to account for negative signs, so I had to just fall back to having it use non-unique constants. In other words, each time I make a float with a value "-1.0", it is going to take up more space. So I end up having hundreds of them.

Right now I have it so $fConst(12.345) turns into
CODE
c_REAL4_12_345      REAL4     12.345


And $dConst(12.345) turns into
CODE
c_REAL8_12_345      REAL8     12.345


And I would like it if I could get negatives to work properly. (Right now it incorrectly changes $fConst(-12.345) into c_REAL4_-12_345 or something like that.

Ideally, I would love for $fConst(-12.345) to turn into something like
CODE
c_REAL4_neg_12_345      REAL4      -12.345


If anyone wants to help me out, just fiddle with the macro and use %echo to see what the variable ends up as. That's what I've been doing. I have no expertise whatsoever with doing macros, mine are all by trial and error. For example, I turned the decimal point into a "_" by searching for its position in the string, and then using @CatStr to take everything before and after the decimal opint, and just placing a "_" in the middle. It's pretty much brute force, since, ironically, efficiency is not relevant in macros, lol. The only thing we care about is the end result.

The negative signs are a big problem. Hmm well I guess I didnt think of this before, for the time being, I could just make a macro specifically for negative values, like $fConstNeg().

Attached File ( Number of downloads: 13 )
 Login or Register to download
PMEmail PosterUsers Website
Top
Savage
Quote Post


Very Very Active Member
*****

Group: Members
Posts: 88
Member No.: 1048
Joined: 27-February 05


Blood, sweat, and tears, my friends.

CODE
$fConst MACRO Num

  dotposition equ @InStr(2,<Num>,<.>)
  IFIDN @SubStr(<Num>,1,1),<->
  formatted textequ @CatStr(<_c_REAL4_>,@SubStr(<Num>,1,dotposition-1),<_>,@SubStr(<Num>,dotposition+1))  
   sgnlocation equ @InStr(1,%formatted,<->)
   formatted textequ @CatStr(<_>,@SubStr(%formatted,1,sgnlocation-1),@SubStr(%formatted,sgnlocation+1))  
  ELSE
  formatted textequ @CatStr(<c_REAL4_>,@SubStr(<Num>,1,dotposition-1),<_>,@SubStr(<Num>,dotposition+1))  
  ENDIF
 
 %IFNDEF formatted
   .const
     formatted REAL4 Num
   .code
  ENDIF
 
 EXITM <formatted>
ENDM


Finally got the little devil to work.

Lol.

It works. It ain't pretty. But it works.

Just made it start with another underscore, for example, $fConst(-100.65) = __c_REAL4_100_65, I will prettify the macro soon. Anyone have any suggestions to be more efficient, I would appreciate it.

Anyway, it turns out this not only made it easier to do the code, but it also fixed whatever was wrong with the program!

Here is myfinal (for now...) working template for OpenGL!
All that's left is translating dozens of functions over, which really isn't that hard.

Attached File ( Number of downloads: 57 )
 Login or Register to download
PMEmail PosterUsers Website
Top
icehole
Quote Post


Extremely Active Member
******

Group: Members
Posts: 168
Member No.: 1938
Joined: 12-January 06


blink.gif
Bravo!
PMEmail Poster
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Pages (3) 1 2 [3]  Reply to this topicStart new topicStart Poll

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google