home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / KELAUG / KELAUG11.MSA / FREEBIES_CODING_ASSEMB_1.S < prev    next >
Text File  |  1998-09-27  |  813b  |  37 lines

  1. ***
  2. *** BEGINNER'S GUIDE TO ASSEMBLY - PART 1
  3. *** 
  4. ***   By Gary Pinkett
  5. ***
  6.  
  7.     MOVEQ    #20,d1    ;How many times to loop.
  8.     MOVEQ    #1,d2    ;Amount to add each time.
  9.  
  10. LOOP:
  11.     
  12.     CMP    d1,d3        ;Compare d1 with d3
  13.     BEQ    QUIT        ;If d1=d3 then goto QUIT label
  14.     JSR    PRINT_STRING    ;If it didn't BEQ goto PRINT_STRING label
  15.     ADD    d2,d3        ;Adds d2 to d3
  16.     BRA     LOOP        ;Goto LOOP label
  17.             
  18. PRINT_STRING:
  19.  
  20.     move.l    #txt,-(a7)    ;Puts txt into A7
  21.     move.w    #9,-(a7)    ;Put GemDos function 9 into A7
  22.     trap    #1        ;Call GemDos
  23.     addq.l    #6,a7        ;Add 6 to A7
  24.     rts            ;Return to LOOP 
  25.     
  26. QUIT:
  27.  
  28. *** The three lines below waits for a key ***
  29.     move.w    #8,-(a7)    ;Put GemDos function 8 into A7
  30.     trap    #1        ;Call GemDos
  31.     addq.l    #2,a7        ;Add 2 to A7
  32.  
  33.     clr.w    -(a7)        ;Clears A7
  34.     trap    #1        ;Call GemDos
  35.  
  36.  
  37. txt    dc.b    'A string of text',$0D,$0A,$0