Ignore:
Timestamp:
Sep 20, 2010, 1:45:10 PM (9 years ago)
Author:
mulligan
Message:

Ported physical.ml to be compatible with new bitvector code, started
porting ASMInterpret.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D4.1/physical.ml

    r88 r90  
    1 open Bit_vectors
     1open BitVectors;;
    22
    33exception Byte7_conversion
     
    1414
    1515let add8_with_c b1 b2 c =
    16  let n1 = int_of_byte b1 in
    17  let n2 = int_of_byte b2 in
    18  let c = int_of_bit c in
     16 let n1 = int_of_vect b1 in
     17 let n2 = int_of_vect b2 in
     18 let c = int_of_vect c in
    1919 let res = n1 + n2 + c in
    2020 let ac = n1 mod 16 + n2 mod 16 + c >= 16 in
     
    2222 let res,c = res mod 256, res >= 256 in
    2323 let ov = c <> c6 in
    24   byte_of_int res,c,ac,ov
     24   vect_of_int res,c,ac,ov
    2525;;
    2626
    2727let subb8_with_c b1 b2 c =
    28  let n1 = int_of_byte b1 in
    29  let n2 = int_of_byte b2 in
    30  let c = int_of_bit c in
     28 let n1 = int_of_vect b1 in
     29 let n2 = int_of_vect b2 in
     30 let c = int_of_vect c in
    3131 let res = n1 - n2 - c in
    3232 let ac = n1 mod 16 - n2 mod 16 - c < 0 in
     
    3636  else n1 + 256 - n2 - c, true in
    3737 let ov = c <> c6 in
    38   byte_of_int res,c,ac,ov
     38  (vect_of_int res `Eight,c,ac,ov)
    3939;;
    4040
    4141let dec b =
    42  let res = int_of_byte b - 1 in
    43   if res < 0 then byte_of_int 255
    44   else byte_of_int res
     42 let res = int_of_vect b - 1 in
     43  if res < 0 then vect_of_int 255 `Eight
     44  else vect_of_int res `Eight
    4545;;
    4646
    4747let inc b =
    48  let res = int_of_byte b + 1 in
    49   if res > 255 then byte_of_int 0
    50   else byte_of_int res
     48 let res = int_of_vect b + 1 in
     49  if res > 255 then vect_of_int 0 `Eight
     50  else vect_of_int res `Eight
    5151;;
    5252
Note: See TracChangeset for help on using the changeset viewer.