HomeComputer programmingAssembly: DUP Command (MASM/TASM)

Assembly: DUP Command (MASM/TASM)

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.

Nested:

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)

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

LATEST REVIEWS

Recent Comments

error: Content is protected !!