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

LCALL reimplemented.

File:
1 edited

Legend:

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

    r117 r118  
    10851085       let addr = mk_word (mk_byte (mk_nibble p1 p2 p3 p4) (mk_nibble p5 b1 b2 b3)) pc_lower_byte in
    10861086         { status with pc = addr }
     1087  | `LCALL (`ADDR16 addr) ->
     1088       let cry, new_pc = half_add status.pc (vect_of_int 3 `Sixteen) in
     1089       let status = { status with pc = new_pc } in
     1090       let cry, new_sp = half_add status.sp (vect_of_int 1 `Eight) in
     1091       let status = { status with sp = new_sp } in
     1092       let pc_upper_byte, pc_lower_byte = from_byte status.pc in
     1093       let lower_mem = Byte7Map.add (byte7_of_byte status.sp) pc_upper_byte status.low_internal_ram in
     1094       let status = { status with low_internal_ram = lower_mem } in
     1095       let cry, new_sp = half_add status.sp (vect_of_int 1 `Eight) in
     1096       let status = { status with sp = new_sp } in
     1097       let lower_mem = Byte7Map.add (byte7_of_byte status.sp) pc_lower_byte status.low_internal_ram in
     1098       let status = { status with low_internal_ram = lower_mem } in
     1099         { status with pc = addr }
    10871100(*
    1088  | LCALL (`ADDR16 addr) ->
    1089      let status = { status with pc = status.pc ++ 3 } in
    1090      let status = { status with sp = byte_of_int ((int_of_byte status.sp) + 1) } in
    1091      let (bh, bl) = status.pc in
    1092      let lower_mem = Byte7Map.add (byte7_of_byte status.sp) bl status.low_internal_ram in
    1093      let status = { status with low_internal_ram = lower_mem } in
    1094      let status = { status with sp = byte_of_int ((int_of_byte status.sp) + 1) } in
    1095      let lower_mem = Byte7Map.add (byte7_of_byte status.sp) bh status.low_internal_ram in
    1096      let status = { status with low_internal_ram = lower_mem } in
    1097      let ((p1,p2,p3,p4),(p5,_,_,_)),b = status.pc in
    1098        { status with pc = addr }
    10991101 | AJMP (`ADDR11 (b1,b2,b3,b)) ->
    11001102     let status = { status with pc = status.pc ++ 2 } in
Note: See TracChangeset for help on using the changeset viewer.