Ignore:
Timestamp:
Sep 23, 2010, 11:10:25 AM (9 years ago)
Author:
mulligan
Message:

RETs done.

File:
1 edited

Legend:

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

    r115 r116  
    10511051         else
    10521052           status
     1053  | `RET ->
     1054      (* DPM: What happens when we underflow? *)
     1055      let high_bits = Byte7Map.find (byte7_of_byte status.sp) status.low_internal_ram in
     1056      let new_sp,_,_,_ = subb8_with_c status.sp (vect_of_int 1 `Eight) false in
     1057      let status = { status with sp = new_sp } in
     1058      let low_bits = Byte7Map.find (byte7_of_byte status.sp) status.low_internal_ram in
     1059      let new_sp,_,_,_ = subb8_with_c status.sp (vect_of_int 1 `Eight) false in
     1060      let status = { status with sp = new_sp } in
     1061        { status with pc = mk_byte high_bits low_bits }
     1062  | `RETI ->
     1063      let high_bits = Byte7Map.find (byte7_of_byte status.sp) status.low_internal_ram in
     1064      let new_sp,_,_,_ = subb8_with_c status.sp (vect_of_int 1 `Eight) false in
     1065      let status = { status with sp = new_sp } in
     1066      let low_bits = Byte7Map.find (byte7_of_byte status.sp) status.low_internal_ram in
     1067      let new_sp,_,_,_ = subb8_with_c status.sp (vect_of_int 1 `Eight) false in
     1068      let status = { status with sp = new_sp } in
     1069        { status with pc = mk_byte high_bits low_bits }
    10531070(*
    1054  | RET ->
    1055      let high_bits = (Byte7Map.find (byte7_of_byte status.sp) status.low_internal_ram) in
    1056      let new_sp = byte_of_int ((int_of_byte status.sp) - 1) in
    1057      let status = { status with sp = new_sp } in
    1058      let low_bits = (Byte7Map.find (byte7_of_byte status.sp) status.low_internal_ram) in
    1059      let new_sp = byte_of_int ((int_of_byte status.sp) - 1) in
    1060      let status = { status with sp = new_sp } in
    1061        { status with pc = (high_bits, low_bits) }
    1062  | RETI ->
    1063      let high_bits = (Byte7Map.find (byte7_of_byte status.sp) status.low_internal_ram) in
    1064      let new_sp = byte_of_int ((int_of_byte status.sp) - 1) in
    1065      let status = { status with sp = new_sp } in
    1066      let low_bits = (Byte7Map.find (byte7_of_byte status.sp) status.low_internal_ram) in
    1067      let new_sp = byte_of_int ((int_of_byte status.sp) - 1) in
    1068      let status = { status with sp = new_sp } in
    1069        { status with pc = (high_bits, low_bits) }
    10701071 | ACALL (`ADDR11 (b1,b2,b3,b)) ->
    10711072     let status = { status with pc = status.pc ++ 2 } in
Note: See TracChangeset for help on using the changeset viewer.