# New Ticket Created by Simon Glover # Please include the string: [netlabs #758] # in the subject line of all future correspondence about this issue. # <URL: http://bugs6.perl.org/rt2/Ticket/Display.html?id=758 >
Fixes to various of the PASM examples in light of recent changes in the assembler. Simon --- examples/assembly/fact.pasm.old Tue Jul 2 20:19:08 2002 +++ examples/assembly/fact.pasm Tue Jul 2 20:19:30 2002 @@ -24,7 +24,7 @@ loop: bsr fact print I0 print "\n" - inc I1,1 + inc I1 eq I1,7,done branch loop done: @@ -35,7 +35,7 @@ fact: pushi lt I0,2,is_one set I1,I0 - dec I0,1 + dec I0 bsr fact mul I0,I0,I1 save I0 --- examples/assembly/hanoi.pasm.old Tue Jul 2 20:20:30 2002 +++ examples/assembly/hanoi.pasm Tue Jul 2 20:21:18 2002 @@ -79,7 +79,7 @@ loop_populate: set P1, I0, I1 #P0=[[1,2,3,...],[0,0,0...],[0,0,0...]] set P2, I0, 0 set P3, I0, 0 - inc I0, 1 + inc I0 lt I0, I5, loop_populate set I1, I5 # size set I2, 0 # start_col @@ -110,13 +110,13 @@ loop_cols: repeat S0, " ", I5 print S0 - inc I2, 1 # j++ + inc I2 # j++ eq I2, 3, done_loop print " | " if 1, loop_cols # j < 3 done_loop: print "\n" - inc I1, 1 # i++ + inc I1 # i++ lt I1, I0, loop_rows # i < size print "\n" ret @@ -132,7 +132,7 @@ MOVE: #vars used: I4, I5, I6, I7, I8, P1 loop_find_start_row: set I7, P1, I4 #I7 = array[start_col][i] ne I7, 0, found_start_row - inc I4, 1 # i++ + inc I4 # i++ lt I4, I0, loop_find_start_row # i < size found_start_row: set I5, I4 #I5 = start_row = i @@ -141,7 +141,7 @@ found_start_row: loop_find_dest_row: set I8, P2, I4 #I8 = array[dest_col][i] ne I8, 0, found_dest_row # if(array[dest_col][i]) - inc I4, 1 # i++ + inc I4 # i++ lt I4, I0, loop_find_dest_row # i < size found_dest_row: sub I6, I4, 1 #I6 = dest_row = i - 1 @@ -162,7 +162,7 @@ MOVE_STACK: ret move_multiple: save I1 - dec I1, 1 + dec I1 save I4 save I3 save I2 @@ -187,7 +187,7 @@ move_multiple: save I4 save I3 save I2 - dec I1, 1 + dec I1 set I5, I2 set I2, I4 set I4, I5 --- examples/assembly/jump.pasm.old Tue Jul 2 20:23:31 2002 +++ examples/assembly/jump.pasm Tue Jul 2 20:24:12 2002 @@ -12,13 +12,13 @@ MAIN: print "Jump test.\n" print "Jumping to subroutine...\n" - set I1, 5 + set_addr I1, SUB jump I1 RET: print "Returned from subroutine!\n" end SUB: print "Entered subroutine...\n" - set I2, -8 + set_addr I2, RET jump I2 --- examples/assembly/local_label.pasm.old Tue Jul 2 20:26:52 2002 +++ examples/assembly/local_label.pasm Tue Jul 2 20:38:55 2002 @@ -8,18 +8,28 @@ # $Id: local_label.pasm,v 1.1 2001/10/15 21:37:07 gregor Exp $ # -main: print "test 1\n" - branch $ok -$ng: print "ng 1\n" - branch test2 -$ok: print "ok 1\n" - -test2: print "test 2\n" - branch $ok -$ng: print "ng 2\n" - branch done -$ok: print "ok 2\n" +.macro MAIN () + print "test 1\n" + branch .$ok +.local $ng: print "ng 1\n" + branch test2 +.local $ok: print "ok 1\n" -done: end +.endm + +.macro TEST2 () +test2: + print "test 2\n" + branch .$ok +.local $ng: print "ng 2\n" + branch done +.local $ok: print "ok 2\n" + +.endm + + .MAIN () + .TEST2 () + +done: end