Assembly: DUP command (MASM/TASM)

Contributor Icon Contributed by William_Wilson  
Tag Icon Tagged: Computer programming  

how to use the DUP – duplicate command, nested or un-nested


As it sounds, 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’))

reserves 40 bytes in total, initialized to: lll||IIIIIlll||IIIIIlll||IIIIIlll||IIIII
each pass through creates lll||IIIII then this is repeated 4 times as it is nested within another DUP command.

Questions/Comments: william_a_wilson@hotmail.com
-William. § (marvin_gohan)

 

4 Comments -


  1. ghoxt47 said on March 4, 2009

    very odd

  2. Dl said on June 16, 2009

    Why my program(for Dos) work with sf db 80 dup 80(?) and doesn’t work with db 80 dup 80(1) ?

  3. Yami_san said on November 22, 2010

    cuz you need more space to store length?

  4. braix said on October 2, 2011

    can you make a program of sipher code
    using assembly language
    output:
    input letters:abcde

    cipher text: pqrst
    reverse form:edcba

    quit:[y/q]

    input will accept only small letters if it is capital the program should not accept the input, also numbers should not be accepted…

    quit: press y to continue, then q to exit…..thats all
    please..help me to make this..project :)

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -