Changeset 58


Ignore:
Timestamp:
Sep 10, 2010, 3:37:44 PM (8 years ago)
Author:
mulligan
Message:

Bug fixed in CJNE instruction. More jump instructions implemented.

Location:
Deliverables/D4.1
Files:
3 edited

Legend:

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

    r57 r58  
    803803 | CLR ((`BIT b) as a) ->
    804804     set_arg1 status false a
     805 | CPL `A ->
     806     let acc_val = fetch_arg8 status `A in
     807       { status with acc = complement acc_val }
     808 | CPL `C ->
     809     let ag_val = fetch_arg1 status `C in
     810       set_arg1 status (not ag_val) `C
     811 | CPL (`BIT b) ->
     812     let ag_val = fetch_arg1 status (`BIT b) in
     813       set_arg1 status (not ag_val) (`BIT b)
    805814(*
    806815 | CPL of [ acc | carry | bit ]
     
    860869     let old_acc = status.acc in
    861870     let new_status = set_arg8 status old_acc arg in
    862        { status with acc = old_arg }
     871       { new_status with acc = old_arg }
    863872(*
    864873 | XCHD of acc * indirect
     
    906915     let ag_val = fetch_arg8 status ag in
    907916     let acc_val = status.acc in
     917     let (b1,b2,b3,b4),n2 = status.psw in
    908918     let new_carry = acc_val < ag_val in
    909919       if ag_val <> acc_val then
    910          { status with pc = status.pc ++ (int_of_byte rel) }
     920         { status with pc = status.pc ++ (int_of_byte rel); psw = (new_carry, b2, b3, b4),n2 }
    911921       else
    912          status
     922         { status with psw = (new_carry, b2, b3, b4),n2 }
    913923 | CJNE ((`U2 (ag, `DATA d)), `REL rel) ->
    914924     let ag_val = fetch_arg8 status ag in
     925     let (b1,b2,b3,b4),n2 = status.psw in
    915926     let new_carry = ag_val < d in
    916927       if ag_val <> d then
    917          { status with pc = status.pc ++ (int_of_byte rel) }
     928         { status with pc = status.pc ++ (int_of_byte rel); psw = (new_carry, b2, b3, b4),n2 }
    918929       else
    919          status
     930         { status with psw = (new_carry, b2, b3, b4),n2 }
    920931(*
    921932 | DJNZ of [ reg | direct ] * rel
  • Deliverables/D4.1/physical.ml

    r46 r58  
    7070;;
    7171
     72let complement ((b1,b2,b3,b4),(b5,b6,b7,b8)) =
     73  (not b1,not b2,not b3,not b4),(not b5,not b6,not b7,not b8)
     74
    7275let (++) w n = word_of_int (int_of_word w + n);;
    7376
  • Deliverables/D4.1/physical.mli

    r46 r58  
    2323val byte_of_byte7: byte7 -> byte
    2424
     25val complement: byte -> byte
     26
    2527val (++): word -> int -> word
    2628
Note: See TracChangeset for help on using the changeset viewer.