DIGITS
;Understanding assembler, by Henrik Stolpe ;Computes the maximum value represented by a certain number of bits ;and stores every bit value in a block of words ;the maximum value is returned in d0 (in hex!) s: moveq #2,d0 ;mulu base of 2 moveq #8,d1 ;8 bits, counter lea digits,a0 ;load effective adress digits into a0 subq #2,d1 ;correct value for loop loop: mulu #2,d0 ;multiply d0 by 2 move d0,(a0)+ ;store number in d0 in a0 and increase a0 cmp #0,d1 ;check if counter is zero dbeq d1,loop ;if not decrease counter and continue rts ;when the loop have executed 8 times ;the maximum value will be located ;8 words down in the area digits digits: blk.w 8 ;room for 8 bits