Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-17-2008, 05:38 PM
RobotGymnast RobotGymnast is offline
Learning Programmer
 
Join Date: Apr 2008
Posts: 48
Rep Power: 3
RobotGymnast is on a distinguished road
Default ASM w/ C++ problems

Alright so I decided to start dabbling in x86 ASM a bit because I'm new to the field (being 15).

My code was simply as follows:

Code:
void outputstuff()
{
     WORD i = 0;

     __asm{pop i}
     printf("%u",i);
}
int main(int nArgs,char*sArgs[])
{
     WORD i = 0;
     
     __asm
     {
          jmp looping
          looping:
               cmp i,256
               je breaker
               push i
               call outputstuff
               add i,1
               jmp looping
          breaker:
     }
}
but it doesn't run properly (but compiles fine)
I also tried putting WORD i as an argument:

Code:
void outputstuff(WORD i)
...

push i
call outputstuff
....
but that didn't work either. Any idea?

Also, the conditional jump gave me some trouble. It works fine now, but I want to say if i is greater than or equal to 256, quit, but jge just quit right away and jle quit at 129. what's with that?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Do you like solving programming problems? Rhiever The Lounge 10 03-28-2008 03:06 AM
OPENFILENAME struct (win32) - problems shariath C and C++ 1 02-14-2008 11:07 PM
Quad Core - Heating Problems TcM Computer Hardware 2 11-28-2007 11:09 AM
Problems in compiling D-ITG MietitoreDAnime C and C++ 2 02-15-2007 12:18 PM


All times are GMT -5. The time now is 02:09 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads