Evenbit 52 Junior Poster

http://homepage.mac.com/randyhyde/webster.cs.ucr.edu/www.artofasm.com/Windows/HTML/AoATOC.html

Scroll down that page to the "Volumn 2" section. Gives lots of information about the architecture side.

Also, research Compilers, Linkers, and Loaders -- lots of learning involved in that. These should be a good start:
http://www.diku.dk/hjemmesider/ansatte/torbenm/Basics/
http://en.wikipedia.org/wiki/Compiler

And this should give you a start on conceptualizing what an Interpreter does:
http://en.wikipedia.org/wiki/Shunting-yard_algorithm

You may also want to look-up "small C", "miniBasic", and Forth.

Happy Learning!!

Evenbit 52 Junior Poster

It is my understanding that with over 115,000 signed-up, it constitutes the largest MOOC [ http://en.wikipedia.org/wiki/Massive_open_online_course ] ever. Certainly an historical experiment with possible future changes in delivery of University-level education: http://www.reddit.com/r/aiclass/comments/kp1wb/amazing_we_can_probably_offer_a_masters_degree_of/

I've decided to take the Basic track so that I only take the quizzes, but get to miss those frightening exams. :)

Thankfully, all of the pre-reqs are available as videos on Khan Academy.

http://www.ai-class.com/

Evenbit 52 Junior Poster

because as everyone knows, roman numerals are too hot of a topic these days

Actually, Roman Numerals are quite common in industrial settings. For instance, "25L" would mean 25 stacks of 50 items. You probably run into them quite often on a daily basis without realising it because you are simply not looking for them or simply unaware that that is what the letter means in that particular context.

Evenbit 52 Junior Poster

At one time (not sure if they're still in the current version), Randall Hyde had highly-efficient 'Roman Numeral' output/conversion functions in the Standard Library for his HLA compiler. You might find it interesting to dig through his source.

http://hla-stdlib.svn.sourceforge.net/viewvc/hla-stdlib/
http://hla-stdlib.sourceforge.net/

Evenbit 52 Junior Poster
Evenbit 52 Junior Poster

Your test page must also have 'session_start()' at the top before any output. For compatibility with old versions of IE, you'll also want to add the P3P header.

index.php

<?php header('P3P CP="CAO PSA OUR"');
session_start();
$_SESSION['gallery'] = 42;
?>
<!DOCTYPE html>
<html>
<h1>Setting cookie!</h1>
<a href="/test.php">test</a><br>
<html>

test.php

<?php header('P3P CP="CAO PSA OUR"');
session_start();
$value = $_SESSION['gallery'];
?>
<!DOCTYPE html>
<html>
<h1>Getting cookie!</h1>
<? echo($value); ?>
<br>
<html>
Evenbit 52 Junior Poster

Okay, Ancient Dragon, try this one: http://ismyipv6working.com/

I see a bear. Guess that means I can't surf to any IPv6-only sites, if any existed.

Evenbit 52 Junior Poster

Found a more detailed test: http://test-ipv6.com/

Evenbit 52 Junior Poster

Your first link said I do not have IPV6 but I should not have any problems either.

Well, true... that IS a good result. But, if you gander at the page source, you'll discover that it isn't the best result of the test.

<div class="test" id="ipv6test-test-unknown">
      <p>
        <strong>Sorry, we were unable to test your connection. Please try again, or see the
        <a href="http://ipv4.google.com/support/websearch/bin/answer.py?answer=1299266&amp;topic=8995&amp;hl=en">
        Google Help Center</a> for more information about how to prepare for IPv6.</strong>
      </p>

    </div>
    <div class="test" id="ipv6test-test-testing">
      <p>
        <strong>Just a moment, we’re testing your readiness for IPv6…</strong>
      </p>
    </div>
    <div class="test" id="ipv6test-test-passedipv6">
      <p>

        <strong>Yes, looks like you’re using IPv6 already.</strong>
      </p>
      <p>
        Welcome to the future of the Internet!
      </p>
    </div>
    <div class="test" id="ipv6test-test-passed">
      <p>
        <strong>No problems detected.</strong>

      </p>
      <p>
        You don’t have IPv6, but you shouldn’t have problems on websites that add IPv6 support.
      </p>
    </div>
    <div class="test" id="ipv6test-test-failed">
      <p>
        <strong>Looks like your connection isn’t ready for IPv6.</strong>
      </p>

      <p>
        This may be due to problems with your home router, operating system, or ISP. For help
        resolving these issues, visit the <a href=
        "http://ipv4.google.com/support/websearch/bin/answer.py?answer=1299266&amp;topic=8995&amp;hl=en">
        Google Help Center</a>.
      </p>
    </div>

A little piece of Javascript picks which one of those you see.

Evenbit 52 Junior Poster

You can test your connection here: http://ipv6test.google.com/

Apparently, Wednesday, June 8th is "World IPv6 Day" when major websites and CDNs will be sending their content over IPv6. For instance, if you cannot connect to Google on that day, you will need to surf to http://ipv4.google.com to do your searches.

My best guess is that most people will not experience any problems. Almost any computer / router purchased within the last 5 years should either be compatible / or easily upgradable. Most Internet Service Providers (ISPs) *should* already be compatible. In fact, you can obtain detailed information about your internet connection here: http://netalyzr.icsi.berkeley.edu/

Please let me know your thoughts on this. Is the current Internet infrastructure ready for the switch??

skilly commented: neat +0
Evenbit 52 Junior Poster

I happen to have a good memory for odd things, so, in the interest of holiday fun, allow me to add another log onto this conspiracy fire. Clever use of the Wayback Machine netted me this pseudo-confession: "I also enjoy studying interpersonal relations among online personalities, which is probably why I like to chat and spend so much time on forums. I experiment with various perspectives and try new things when interacting with others. As such, for each forum I visit, I tend to have a wildly different personality, which seems strange at first."

Happy sleuthing! :)

tux4life commented: Heavy stuff :P +0
sknake commented: zomg +0
Evenbit 52 Junior Poster

Hi,

I am just finishing up a semester at Uni that touched on Assembly with the LC-3 (Limited to around 16 instructions).

I would like to look more into assembly. Specifically getting a better grasp on assembly opcodes (their purpose), and how they map to HL processes. As opcodes like ROR etc (any many many more) were not covered in my studies.

I am interested in the Intel chips and also the ARM chips that are in iPhones.

My Question - Out of all the books out there, which ones do you guys recommend?

Ok,.. thanks in advance for the advice.

Nate

http://www.duntemann.com/assembly.htm

http://nostarch.com/assembly2.htm
http://webster.cs.ucr.edu/AsmTools/HLA/index.html

Also, see these forum stickies:

http://www.daniweb.com/forums/thread41309.html

http://www.daniweb.com/forums/thread67183.html

Nathan.

Evenbit 52 Junior Poster

Yes, DWORD alignment is always preferred. But check with the standard literature on optimization:

http://www.agner.org/optimize/

Evenbit 52 Junior Poster

Use: [msg]

Evenbit 52 Junior Poster

Try this:

MOV AL, DAY
CBW
DIV DIVISOR
Evenbit 52 Junior Poster

Now, I didn't argue about posting the link - I shouldn't have done that without first checking to see what the rules were. The discussion about modifying Windows was a side thought, and I think a legitimate topic of discussion. Can you legally hex edit your own copy?

As to where Daniweb is located, a little 'net searching can shed light on that. For instance, I found this Frugal Friday interview which is very interesting to listen to:
http://www.blogtalkradio.com/frugaltechshow/2009/01/16/Frugal-Friday-with-guest-Dani-Horowitz-from-DaniWebcom

Can you legally hex edit your own copy?

I'm sure that there exist attorneys who will point to recent reverse-engineering legislation as proof that it is illegal to do something like that in the country that *I* reside in. Same goes for most of the Daniweb participating audience. This is why such subjects are not considered "a legitimate topic of discussion" on most technical forums -- it is a safety precaution to protect all participants... including you.

Nathan.

Evenbit 52 Junior Poster

Just a quick note about this "unaurthaurised distribution" of a protected product: Microsoft has provided an authorized download (including a valid install key) of its OSs in certain instances.

For instance, for enterprise clients who purchase licenses in bulk, they provided a CD ISO of Windows XP at their website so that clients would not have to wait for the product to be shipped to them. The legal purchase of the license was handled separately from the actual attainment of the product.

Another example involves early versions of the Acer AspireOne netbook which were factory loaded with Linux. Enough users expressed an interest in running Windows that Acer negotiated with Microsoft to provide an official release of WinXP SP3 that has been tailored and tested to run on AspireOne machines. The only way to obtain a copy is via the link on the Acer blog post about the subject.

Just my 2-cents worth as a quick FYI. Back to your fun Windows vs. Linux discussion. Pretend I wasn't here... carry on...

Nathan.

Evenbit 52 Junior Poster
Evenbit 52 Junior Poster

Taking the "fright" out of Opcodes and Hex-numbers.

High Level Assembly (HLA) is a modern assembler + standard library package that allows a programmer to ease his way toward ASM coding by leveraging concepts already learned from typical high-level languages. By using HLA, one can investigate and play with a few ASM instructions at a time while coding the remainder of the application using built-in functions and flow-control constructs that one should already be accustomed to. As one gains confidence with traditional assembly coding, they can begin to eliminate the high-level parts of the application by re-coding them in straight ASM.

Here is an example to demonstrate how an HLA application looks very close to how one might write the same program in C or other traditional language.

// cross-platform:  Linux & Windows now; others in the works...
// get HLA here:  http://www.artofasm.com

program demo;
#include( "stdlib.hhf" )

const
    
    ITERATIONS		:uns32	:=	10000;
    MAX_VALUE		:uns32	:=	100;
    
static
    
    items	:uns32[ITERATIONS];
    freq		:uns32[MAX_VALUE+1];
    mixed	:file;
    sorted	:file;
    
begin demo;
    
    /* initialization
    */
    rand.randomize();
    mixed.create();  // these are file objects
    mixed.openNew( "sfalse.txt" );
    sorted.create();
    sorted.openNew( "strue.txt" );
    
    /* create the unsorted array
    */
    mov( 0, ecx );
    repeat
        
        rand.range( 0, MAX_VALUE );  // returns value in 'eax'
        mov( eax, items[ecx*4] );  // puts value into array
        mixed.put( (type uns32 ecx):5, ": ", (type uns32 eax), nl );
        // mirror to file
        add( 1, ecx );
        
    until ( ecx = ITERATIONS );

    /* record the frequencies of the numbers …
Evenbit 52 Junior Poster

{responding to Infarction's comments}

4. Why do you believe Microsoft would ever aim for standards compliance?? It has always been in their best interest to keep everything proprietary.

5. Many different versions of the Linux kernel exist, so if you are compiling your own, you get to choose the kernel that best suits your needs. Likewise, the 'distros' show a good deal of variance. Small distros like DSL and Puppy tend to use the older, smaller kernels to save space. Other distros try to keep more current. Also, why is it that Microsoft's embedded versions (Windows CE and the like) are *SO* different from the regular Windows that it is like programming for an entirely different OS? With Linux, you don't have that problem -- your existing products just work.

I don't "paint" the fanboys, those are simply the colors they show me.

Nathan.
PS - See also the comments here:
http://www.desktoplinux.com/cgi-bin/board/UltraBoard.pl?Action=ShowPost&Board=linvswin&Post=846&Idle=0&Sort=0&Order=Descend&Page=0&Session=

Evenbit 52 Junior Poster
Using 'common sense' to clear the Microsoft fog of illusion.

[[ ...Continued from previous post [url]http://www.daniweb.com/blogs/entry1527.html[/url] ]]

4. Unable to comprehend security issues.

Even when the United States government warns people to avoid using specific software for personal security reasons, the Microsoft sheep act like they don't understand the reasons. The U.S. Computer Emergency Readiness Team (CERT) [ www.kb.cert.org ] recommended that people stop using Internet Explorer. The advisory states that there are a "number of significant vulnerabilities in technologies relating to the Internet Explorer domain/zone security model, the DHTML object model, MIME type determination and ActiveX. It is possible to reduce exposure to these vulnerabilities by using a different Web browser, especially when browsing untrusted sites." In the eyes of CERT, Internet Explorer's architecture is at the heart of its security problem, not just that millions of copies are in use. The most compelling thing an alternative browser offers, therefore, is an alternative architecture, one less tightly integrated with Windows.

http://www.redmondmag.com/features/article.asp?editorialsid=439

"With a regular Web browser, a security vulnerability might let someone crash the browser. With an integrated Web browser they can crash the whole operating system. The tight ties to Windows means that the slightest IE security issue becomes an OS-wide panic. It's not just IE, either: Windows Media Player, Outlook Express, and even DirectX, are all, in my opinion, overly integrated and give hackers too much access to core PC functions."

5. Confuses commodity with quality.

Evenbit 52 Junior Poster

{responding to Infarction's comments}

1. Okay, you are on to my "game" here... ignorance is not limited to "Microsoft" people - there are plenty of green penquins too.

2. Well, I harped on the "standards" issue because the "fans" always claim they would NEVER be caught using non-standard languages like Java... that they use .NET because of its "certified standard" status -- of course, we all know that this isn't true.

3. Do you not recall the time that Microsoft was caught shipping the *exact same* binary image of NT ( I do not recall which version ) to home users and to businesses -- the _only_ difference was that the business version had the words "Enterprise Edition" stamped on it and they charged the firms 10 times the price of the home package?

"Just callin' the shots as I see 'em. Label me a fanboy if you will, you certainly won't be the first."

Nah... your responses are always insightful.. keep them coming...

Nathan.
PS - See also the responses in the forum thread here:
http://www.desktoplinux.com/cgi-bin/board/UltraBoard.pl?Action=ShowPost&Board=linvswin&Post=845&Idle=0&Sort=0&Order=Descend&Page=0&Session=[

Evenbit 52 Junior Poster
Addressing some of the typical arguments we hear from the "Microsoft fanboy" crowd.

One can debate until you turn blue in the face. It never fails that *some* concepts and facts just fly right over the heads of *some* people. But when the person doing the arguing is supposedly well-educated and has 15 plus years of programming experience, you would think he'd have better arguments than these. Feel free to add your own favorite "stupidities" to the list.

1. Claim that Buffer Overflows do not exist.

I start with the funniest one because when a Microsoft fanboy claims he "never read any reports from MS about 'buffer overflow' problems" you *know* that he is entirely clueless -- and probably entirely helpless too. Believe it or not, I have even been accused of "trying to sound technical" on this one. In this age of extensive media coverage and the ability to just "Google" a subject, one wonders why a programmer would deny the existence of "buffer overflows" when the subject is such a central component of the information security sector. One possibility is that the fanboy primarily programs in .NET (and other "managed code" environments) so he never needs to learn about or deal with "pointers" -- he is wrapped-up and laying in a baby crib. The other possibility is that to acknowledge the existence of "buffer overflows" entails admitting to a host of security issues involved with using Microsoft operating systems and software [just research the exploit holes …

Evenbit 52 Junior Poster

to help one's neighbor by distributing copies as he wishes, and finally to distribute modified code as he wishes.

Do you ever do any research on the subject of your blog posts? The GPL license applies specific *restrictions* to how one may distribute the software.

http://www.gnu.org/copyleft/gpl.html

Evenbit 52 Junior Poster

wildgoose -

Please consult the Narue tutorial that tomtetlaw was talking about:

http://www.daniweb.com/forums/thread41309.html

Pay attention to the discussion of the C calling convention.

Evenbit 52 Junior Poster

wildgoose -

What you are thinking of is the old '*.com' and '*.exe' formats for DOS which had a segmented memory model. Yes, the '*.com' files were restricted to the SMALL data model which combined all four segments into one -- so the author *did* have to be careful where he place data.

However, modern 32-bit code for modern 32-bit Operating System's do not have support for segments because they all use Virtual Memory.

Evenbit 52 Junior Poster

Assember is a two pass. If that doesn't work, move all the data in the .data section below the code in the .text section. In these simple configurations typically the Code Segment and Data Segment are shared and having data at the top of your code makes the data appear like opcodes (thus instructions) to the processor and it trys to run the data like code!

No, wildgoose. What you are saying simply can not happen.

The sections are separated in the object file. The linker may even choose to re-order them when it creates the executable file. The Operating System's loader will likely scatter them into widely-separated areas of memory. In general, the order of .data and .text sections has no effect. The code will start executing at the '_main' label no matter where it appears within the .text section.

However, in a Linux environment, on certain old kernel versions, the order DOES matter. A '.data' section is expected as the last section due to security device implemented by that kernel.

Evenbit 52 Junior Poster

Which gcc port are you using? If it is cygwin, then that might be your problem.

Try MingW -- I've always had success with it.

http://www.mingw.org/

Evenbit 52 Junior Poster

An alternative is to use the Alink downloads:

http://alink.sourceforge.net/download.html

; To assemble: nasm -f obj hw.asm 
; To link: alink -oPE hw .obj win32.lib 
 
extern MessageBoxA 
extern ExitProcess
 
segment .data USE32 
 
title db 'My First Win32 ASM Program', 0 
message db 'Hello, World!', 0 
 
segment .text USE32 
 
..start 
push dword 0Eh
push dword title 
push dword message 
push dword 0 
call MessageBoxA 
push dword 0
call ExitProcess
Evenbit 52 Junior Poster

Here is a wonderful resource to help you understand the proper use of FPU instructions:

http://webster.cs.ucr.edu/AoA/Windows/HTML/RealArithmetic.html#998833

Evenbit 52 Junior Poster
Evenbit 52 Junior Poster

Well, clock cycles certainly do not equate to execution time on modern processors. But, if you still think you need to know this information, then go directly to the source:

http://www.intel.com/design/corei7/documentation.htm
http://www.intel.com/products/processor/manuals/index.htm

Those are free downloads!

Evenbit 52 Junior Poster

Microsoft has good C code with excellent descriptions at its Win32 API reference library:

http://msdn.microsoft.com/en-us/library/aa373078(VS.85).aspx

Click on the "Performance Counters Functions" category.

Calling the Windows API functions from assembly language is a bit more work than doing it in either C or C++, but it certainly isn't impossible and modern assemblers/packages support features that make the task easier.

You might need to make your own headers {with constant definitions, macros, function prototypes, etc.} for the more obscure API functions; but first, -- depending on which assembler/library/package you decide to go with -- you should check out the associated forums to see if headers already exist for the functions you want to use:

http://www.masm32.com/board/index.php?
http://www.asmcommunity.net/board/
http://www.artofasm.com/
http://board.flatassembler.net/

Hope I've helped!

Evenbit 52 Junior Poster

To write text to the console, first use GetStdHandle:

http://msdn.microsoft.com/en-us/library/ms683231(VS.85).aspx

Use that to get the handle for the StdOut device. Then you can use this handle in a call to WriteFile:

http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx

There are some tutotials and examples:

http://www.deinmeister.de/wasmtute.htm

http://win32assembly.online.fr/index.html

Evenbit 52 Junior Poster
Evenbit 52 Junior Poster
Evenbit 52 Junior Poster

Hi to all,
I wrote a code, and it gives me divide overflow, but the issue here is that when I run the program trough the debugger it works fine, but when I run the program in the dos mode it gives me Divide overflow error. here the code:

tnx

Insert a CWD instruction right before the DIV instruction. This will sign-extend AX into the DX:AX pair needed for the ('dword' divided by 'word') division.

Nathan.

Evenbit 52 Junior Poster

You will need to tweak 'termios' to get non-buffered input to work. Read this thread for code and discussion of the issue:

http://sourceforge.net/mailarchive/forum.php?thread_name=814462.63171.qm%40web65510.mail.ac4.yahoo.com&forum_name=hla-stdlib-talk

Nathan.

Evenbit 52 Junior Poster
Evenbit 52 Junior Poster

These tutorials will show you how:

http://win32assembly.online.fr/tutorials.html

Evenbit 52 Junior Poster
Evenbit 52 Junior Poster

Some resources and existing code to learn from:

http://asm.sourceforge.net/

[note: the AsmUtils package has not been updated for years, so some of those examples will not work on modern kernels]

http://linuxasmtools.net/

Hope that helps.

Nathan.

Evenbit 52 Junior Poster

Interesting Nathan, however your example renders the computer redundant as you've already done the calculating, therefore a word processor would have been a better choice.

Ah, but my example stays within the specs. The question said *nothing* about the data being pre-computed or not:

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

I do agree with your points of optimization and size should be included in there somewhere too, but at the end of the day examples should always exemplify the computers underlying premise, in that it does the computing.

Oh, but it did do the computing. I simply used the output of my previous example (with a small bit of search-n-replace) to write the code for my last example. Making use of "code-writing tools" is also a good skill to possess.

I not beginning to suggest my code is the best or even better example, but rather optimization is far more encompassing and if I were to be in an interview and the recruiter was to evaluate my abilities based on "FIZZBUZZ", I would just simply get up and leave the room.

I imagine they wouldn't be interested in testing your code-optimization skills because they'd already know/expect you have them.

There doesn't seem to be much interest from others, but in the spirit …

Evenbit 52 Junior Poster

The first rule of code optimization is:

Eliminate conditional branches. Use lookup-tables instead.

The second rule of code optimization is:

If possible, remove any loops.

So, keeping to the KISS philosophy, here is my quick code:

; For Windows:
;  nasm -f win32 -o fizzbuzz.obj fizzbuzz.asm
;  gcc -o fizzbuzz.exe fizzbuzz.obj

; For Linux:  (remove all "_" underscores from this source)
;  nasm -f elf -o fizzbuzz.o fizzbuzz.asm
;  gcc -o fizzbuzz fizzbuzz.o

section .data

one:	db	'1',10,'2',10,'Fizz',10,'4',10,'Buzz',10,
	db	'Fizz',10,'7',10,'8',10,'Fizz',10,'Buzz',10,'',0
two:	db	'11',10,'Fizz',10,'13',10,'14',10,'FizzBuzz',10,
	db	'16',10,'17',10,'Fizz',10,'19',10,'Buzz',10,'',0
three:	db	'Fizz',10,'22',10,'23',10,'Fizz',10,'Buzz',10,
	db	'26',10,'Fizz',10,'28',10,'29',10,'FizzBuzz',10,'',0
four:	db	'31',10,'32',10,'Fizz',10,'34',10,'Buzz',10,
	db	'Fizz',10,'37',10,'38',10,'Fizz',10,'Buzz',10,'',0
five:	db	'41',10,'Fizz',10,'43',10,'44',10,'FizzBuzz',10,
	db	'46',10,'47',10,'Fizz',10,'49',10,'Buzz',10,'',0
six:	db	'Fizz',10,'52',10,'53',10,'Fizz',10,'Buzz',10,
	db	'56',10,'Fizz',10,'58',10,'59',10,'FizzBuzz',10,'',0
seven:	db	'61',10,'62',10,'Fizz',10,'64',10,'Buzz',10,
	db	'Fizz',10,'67',10,'68',10,'Fizz',10,'Buzz',10,'',0
eight:	db	'71',10,'Fizz',10,'73',10,'74',10,'FizzBuzz',10,
	db	'76',10,'77',10,'Fizz',10,'79',10,'Buzz',10,'',0
nine:	db	'Fizz',10,'82',10,'83',10,'Fizz',10,'Buzz',10,
	db	'86',10,'Fizz',10,'88',10,'89',10,'FizzBuzz',10,'',0
ten:	db	'91',10,'92',10,'Fizz',10,'94',10,'Buzz',10,
	db	'Fizz',10,'97',10,'98',10,'Fizz',10,'Buzz',10,'',0

section .text

	global _main
	extern _printf

_main:
	push one
	call _printf
	add esp, 4
	push two
	call _printf
	add esp, 4
	push three
	call _printf
	add esp, 4
	push four
	call _printf
	add esp, 4
	push five
	call _printf
	add esp, 4
	push six
	call _printf
	add esp, 4
	push seven
	call _printf
	add esp, 4
	push eight
	call _printf
	add esp, 4
	push nine
	call _printf
	add esp, 4
	push ten
	call _printf
	add esp, 4

	xor eax, eax
	ret

Nathan.

Evenbit 52 Junior Poster
Evenbit 52 Junior Poster

I posted this because I consider it a "trick question" to some extent. As we hone our "problem-solving" skills, it is natural for us to attempt a clever solution. All too often, however, clever means that we spend too much time on the issue and introduce more opportunities for bugs to creep into the code. Sometimes, we don't see the obvious, simple solution. And I believe that this question is really intended to test "basic skills" rather than discover brilliance.

Here is the FizzBuzz article:

http://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/

Notice that most of the comments at the bottom present solutions using the modulus operation and other tricks? If you attack the issue using the KISS (Keep It Simple Smarty) principle, you'll see that simple subtraction is all that is necessary.

In Ruby:

fizz = 3
buzz = 5
1.upto( 100 ) do |i|
  fizz -= 1
  buzz -= 1
  if fizz == 0 and buzz == 0
    puts "fizzbuzz"
    fizz = 3
    buzz = 5
  elsif fizz == 0
    puts "fizz"
    fizz = 3
  elsif buzz == 0
    puts "buzz"
    buzz = 5
  else
    puts i
  end
end

Nathan.

Evenbit 52 Junior Poster

An application programmer doesn't use interrupt (int) calls in Windows. Instead, one makes a call to a function in one of the DLLs supplied by the system. The reference for these functions can be found here:

http://msdn.microsoft.com/en-us/library/aa383749.aspx

It is a good idea to study the Iczelion tutorials first:

http://win32assembly.online.fr/tutorials.html

Nasm examples can be found here:

http://www.visual-assembler.pt.vu/

Nathan.

Evenbit 52 Junior Poster

It's a FizzBuzz question designed to "separate the men from the boys", so don't cheat. :)

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Nathan.

Evenbit 52 Junior Poster

Thank you! It looks nice.

BTW, I can confirm that if you remove the underscores ( change the "_main", "_printf", and "_scanf" symbols to just "main", "printf", and "scanf" ) it assembles ( using "-f elf" rather than "-f win32" option ) fine and runs under Linux.

Nathan.

Evenbit 52 Junior Poster

Yes. Please post the code. I would like to see it.

Nathan.