simon       01/09/13 00:27:47

  Modified:    .        assemble.pl basic_opcodes.ops opcode_table
  Log:
  Bitwise ops, from Brian Wheeler.
  
  Revision  Changes    Path
  1.10      +5 -2      parrot/assemble.pl
  
  Index: assemble.pl
  ===================================================================
  RCS file: /home/perlcvs/parrot/assemble.pl,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -w -r1.9 -r1.10
  --- assemble.pl       2001/09/13 07:21:37     1.9
  +++ assemble.pl       2001/09/13 07:27:46     1.10
  @@ -70,9 +70,10 @@
   # Now assemble
   $pc = 0;
   my $line = 0;
  -while ($_ = shift @code) {
  +foreach (@code) {
       $line++;
       chomp;
  +    next if(m/^\s*$/); # blank lines
       s/,/ /g;
   
       my ($opcode, @args) = split /\s+/, $_;
  @@ -93,6 +94,8 @@
          } elsif($rtype eq "D") {
              # a destination
              $args[$_]=fixup($args[$_]);
  +       } else {
  +        $args[$_]=oct($args[$_]) if($args[$_]=~/^0/);
          }
          $output .= pack $type, $args[$_];
       }
  
  
  
  1.11      +31 -1     parrot/basic_opcodes.ops
  
  Index: basic_opcodes.ops
  ===================================================================
  RCS file: /home/perlcvs/parrot/basic_opcodes.ops,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -w -r1.10 -r1.11
  --- basic_opcodes.ops 2001/09/13 07:21:37     1.10
  +++ basic_opcodes.ops 2001/09/13 07:27:46     1.11
  @@ -538,3 +538,33 @@
   AUTO_OP pow_n_i_n {
      NUM_REG(P1) = pow(INT_REG(P2), NUM_REG(P3));
   }
  \ No newline at end of file
  +
  +// AND_i
  +AUTO_OP and_i {
  +  INT_REG(P1) = INT_REG(P2) & INT_REG(P3);
  +}
  +
  +// NOT_i
  +AUTO_OP not_i {
  +  INT_REG(P1) = ! INT_REG(P2);
  +}
  +
  +// OR_i
  +AUTO_OP or_i {
  +  INT_REG(P1) = INT_REG(P2) | INT_REG(P3);
  +}
  +
  +// SHL_i_ic
  +AUTO_OP shl_i_ic {
  +  INT_REG(P1) = INT_REG(P2) << P3;
  +}
  +
  +// SHR_i_ic
  +AUTO_OP shr_i_ic {
  +  INT_REG(P1) = INT_REG(P2) >> P3;
  +}
  +
  +// XOR_i
  +AUTO_OP xor_i {
  +  INT_REG(P1) = INT_REG(P2) ^ INT_REG(P3);
  +}
  
  
  
  1.12      +11 -1     parrot/opcode_table
  
  Index: opcode_table
  ===================================================================
  RCS file: /home/perlcvs/parrot/opcode_table,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -w -r1.11 -r1.12
  --- opcode_table      2001/09/13 07:21:38     1.11
  +++ opcode_table      2001/09/13 07:27:46     1.12
  @@ -88,8 +88,8 @@
   print_n        1       N
   noop 0
   
  -
   # Register ops
  +
   push_i       0
   push_s       0
   push_n       0
  @@ -145,3 +145,13 @@
   pow_n_n_i      3       N N I
   pow_n_i_i      3       N I I
   pow_n_i_n      3       N I N
  +
  +# Bitwise Ops
  +
  +and_i 3   I I I
  +not_i 2   I I
  +or_i  3   I I I
  +shl_i_ic 3    I I i
  +shr_i_ic 3    I I i
  +xor_i 3   I I I
  +
  
  
  

Reply via email to