Assembly: DUP Command (MASM/TASM)

Posted March 9, 2006 by William_Wilson in Computer programming

Last Updated on

The following tech recipe covers how to use the DUP (duplicate) command, nested or un-nested,

Just as its name implies, DUP duplicates text.

Straight Example:

text DB 10 DUP (’W’) ;initializes 20 bytes to W

The number after DB defines how many bytes to repeat for, and then the ‘W’ defines what to repeat.


barCode DB 4 DUP(3 DUP (’l’),2 DUP (’|’),5 DUP (’I’))

This reserves 40 bytes in total which are initialized to: lll||IIIIIlll||IIIIIlll||IIIIIlll||IIIII.
Each pass through creates lll||IIIII, and then this is repeated four times as it is nested within another DUP command.

Questions/Comments: [email protected]
-William. § (marvin_gohan)

The Conversation

Follow the reactions below and share your own thoughts.

Leave a Reply