home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / books / 68k_book / arp_src / pc_vs_ab.s < prev    next >
Text File  |  1985-11-20  |  2KB  |  76 lines

  1.  ; Program Name: PC_VS_AB.S
  2.  ;      Version: 1.001
  3.  
  4.  ; Assembly Instructions:
  5.  
  6.  ;    Assemble in PC-relative mode and save with a TOS extension.
  7.  
  8.  ; Program Function:
  9.  
  10.  ;    Compares the relative speed and memory requirements of
  11.  
  12.  ;                     "move.b #6, $484" 
  13.  ; to that of
  14.  ;                     "lea $484, a0"
  15.  ;                     "move.b #6, (a0)".
  16.  
  17.  ; The execution time reported is for 50,000 executions of each algorithm.
  18.  
  19.  ; Execution Note:
  20.  
  21.  ;    Invokes traps that are installed by CUSTOM.PRG during boot.
  22.  
  23. calculate_program_size:
  24.  lea        -$102(pc), a1       ; Fetch basepage start address.
  25.  lea        program_end, a0     ; Fetch program end = array address.
  26.  trap       #6                  ; Return unused memory to op system.
  27.  
  28.  lea        stack, a7
  29.  
  30. initialize_registers_1:
  31.  lea        header_1, a0       
  32.  lea        header_2, a1
  33.  lea        move_start, a3
  34.  lea        move_end, a4
  35.  lea        heading, a5
  36.  move.w     #50000, d7
  37.  trap       #9
  38.  
  39. initialize_registers_2:
  40.  lea        header_3, a0       
  41.  lea        header_4, a1
  42.  lea        lea_start, a3
  43.  lea        lea_end, a4
  44.  lea        heading, a5
  45.  move.b     #0, (a5)            ; Store a NULL in first byte to create a
  46.  move.w     #50000, d7          ; null string so that heading gets printed
  47.  trap       #9                  ; only once.
  48.  
  49. terminate:
  50.  trap       #8
  51.  
  52. move_start:                  
  53.  move.b     #6, $484    
  54. move_end:
  55.  
  56. lea_start:              
  57.  lea        $484, a0
  58.  move.b     #6, (a0)
  59. lea_end:
  60.  
  61.  data
  62. heading:      dc.b       "PC_VS_AB Program Results",$D,$A,$D,$A,0
  63. header_1:     dc.b       "  Elapsed time for move.b #6, $484:     ",0
  64. header_2:     dc.b       "  Memory required for first algorithm:     ",0
  65. header_3:     dc.b $D,$A,"  Elapsed time for lea $484, a0",$D,$A
  66.               dc.b       "                   move.b #6, (a0):     ",0
  67. header_4:     dc.b       "  Memory required for second algorithm:    ",0
  68.  bss
  69.  align
  70. label:        ds.l  1
  71.               ds.l 96
  72. stack:        ds.l  0
  73. program_end:  ds.l  0 
  74.  end
  75.