Voting

Category

assembly language

Bookmarking

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

Language Assembler x86 (TASM Flavour)

(Demonstration of metaprogramming in TASM)

Date:07/05/06
Author:Vladimir V. Kalashnikov
URL:http://www.admin.ksue.edu.ua/
Comments:2
Info:http://info.borland.com/borlandcpp/cppcomp/tasmfact.html
Score: (3.31 in 13 votes)
;
; "99 Stanzas on how to drink beer ;-)" TASM v3.0 (x86 assembler)
;

        .model  tiny

        .code
        org     100h

start:  call    print

stanza  macro   howmany,what
        db      '&howmany','&what',13,10
        display '&howmany&&what'
        endm

bottles =       99
        rept    99
        stanza  %bottles,< bottles of beer on the wall>
        stanza  %bottles,< bottles of beer>
        stanza  ,<take one down, pass it around>
bottles =       bottles-1
        stanza  %bottles,< bottles of beer on the wall>
        endm
        stanza  0,< bottles of beer>
        stanza  ,<go to the store and buy some more>
        db      '$'

print:  pop     dx
        mov     ah,9
        int     21h
        ret

        end     start

Download Source | Write Comment

Alternative Versions

Comments

>>  toss said on 07/09/06 03:16:59

toss very clean and pretty code! :)

>>  SinisterBen said on 08/22/07 02:14:28

SinisterBen Very nice sire. I couldn't have done better myself! Great stuff.

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: