Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language GNU Assembler

Date:04/20/05
Author:Laurent Vogel
URL:http://lvogel.free.fr/
Comments:2
Info:n/a
Score: (2.84 in 116 votes)
/*
 * GNU Assembler version of 99 bottles of beer
 * (architecture-independent as it uses assembler directives only)
 * Laurent Vogel  http://lvogel.free.fr
 *
 * execute with: gcc -c -o /dev/null -x assembler THIS_FILE
 */

.macro p n,s,w
.print "\n bottle\s of beer\w"
.endm

.macro ones a,b
.ifge \a\b-2
.ifnc \a\b,99
p \a\b,s," on the wall."
.print ""
.endif
p \a\b,s," on the wall,"
p \a\b,s,.
.else
p \a\b,," on the wall."
.print ""
p \a\b,," on the wall,"
p \a\b,,.
.endif
.print "Take one down, pass it around,"
.endm

.macro tens n
ones \n,9
ones \n,8
ones \n,7
ones \n,6
ones \n,5
ones \n,4
ones \n,3
ones \n,2
ones \n,1
.ifnc \n,
ones \n,0
.endif
.endm

tens 9
tens 8
tens 7
tens 6
tens 5
tens 4
tens 3
tens 2
tens 1
tens ""

p No,," on the wall."

Download Source | Write Comment

Alternative Versions

Comments

>>  fugdabug said on 06/14/05 05:08:25

fugdabug could not for all my efforts and reconfigs get this little critter to run... oh well on to the next...

>>  Stefan Scheler said on 06/16/05 10:58:41

Stefan Scheler Fixed. Should run cleanly now.

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: