Ignore:
Timestamp:
Sep 22, 2010, 5:19:04 PM (9 years ago)
Author:
mulligan
Message:

MOVC instructions refactored.

File:
1 edited

Legend:

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

    r110 r111  
    978978  | `MOV(`U5(b1,b2)) -> set_arg1 status (get_arg_1 status b2) b1
    979979  | `MOV(`U6(b1,b2)) -> set_arg1 status (get_arg_1 status b2) b1
    980 (*
    981  | MOVC (`A, `A_DPTR) ->
    982      let acc_int_val = int_of_byte status.acc in
    983      let dptr_int_val = int_of_word (status.dph, status.dpl) in
    984      let addr = word_of_int (dptr_int_val + acc_int_val) in
     980  | `MOVC (`A, `A_DPTR) ->
     981     let big_acc = mk_word (zero `Eight) status.acc in
     982     let dptr = mk_word status.dph status.dpl in
     983     let cry, addr = half_add dptr big_acc in
    985984     let lookup = WordMap.find addr status.code_memory in
    986985       { status with acc = lookup }
    987  | MOVC (`A, `A_PC) ->
    988      let acc_int_val = int_of_byte status.acc in
    989      let new_pc_int_val = (int_of_word status.pc) + 1 in
    990      let addr = word_of_int (new_pc_int_val + acc_int_val) in
     986  | `MOVC (`A, `A_PC) ->
     987     let big_acc = mk_word (zero `Eight) status.acc in
     988     (* DPM: Under specified: does the carry from PC incrementation affect the *)
     989     (*      addition of the PC with the DPTR? At the moment, no.              *)
     990     let cry,inc_pc = half_add status.pc (vect_of_int 1 `Sixteen) in
     991     let status = { status with pc = inc_pc } in
     992     let cry,addr = half_add inc_pc big_acc in
    991993     let lookup = WordMap.find addr status.code_memory in
    992        { status with acc = lookup; pc = word_of_int new_pc_int_val }
     994       { status with acc = lookup }
     995(*
    993996 (* data transfer *)
    994997(*
Note: See TracChangeset for help on using the changeset viewer.