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

7 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments

Cleveland Furia on How to Clear Google Activity
Sid Wohlfarth on How to Clear Google Activity
Riley Magsayo on How to Clear Google Activity
สมัครรับเครดิตฟรี ทันที on How to improve Remote Desktop Protocol Performance
Neal Wangstad on How to Clear Google Activity
Slavcho Andov on How to install Ubuntu
Slavcho Andov on How to fix bad sectors
Sheraz Ali on How to Backup Android