Changeset 115


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

Various jumps refactored.

File:
1 edited

Legend:

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

    r114 r115  
    10081008         status
    10091009  | `XCH(`A, arg) ->
    1010       let old_arg = get_arg_8 status arg in
    1011       let old_acc = status.acc in
    1012       let status = set_arg8 status old_acc arg in
    1013         { status with acc = old_arg }
     1010       let old_arg = get_arg_8 status arg in
     1011       let old_acc = status.acc in
     1012       let status = set_arg8 status old_acc arg in
     1013         { status with acc = old_arg }
    10141014  | `XCHD(`A, i) ->
    1015       let acc_upper_nibble, acc_lower_nibble = from_byte $ get_arg_8 status `A in
    1016       let ind_upper_nibble, ind_lower_nibble = from_byte $ get_arg_8 status i in
    1017       let new_acc = mk_byte acc_upper_nibble ind_lower_nibble in
    1018       let new_reg = mk_byte ind_upper_nibble acc_lower_nibble in
    1019       let status = { status with acc = new_acc } in
    1020         set_arg8 status new_reg i
     1015       let acc_upper_nibble, acc_lower_nibble = from_byte $ get_arg_8 status `A in
     1016       let ind_upper_nibble, ind_lower_nibble = from_byte $ get_arg_8 status i in
     1017       let new_acc = mk_byte acc_upper_nibble ind_lower_nibble in
     1018       let new_reg = mk_byte ind_upper_nibble acc_lower_nibble in
     1019       let status = { status with acc = new_acc } in
     1020         set_arg8 status new_reg i
    10211021 (* program branching *)
    10221022  | `JC (`REL rel) ->
    1023       if get_cy_flag status then
    1024         let cry, new_pc = half_add status.pc rel in
    1025           { status with pc = new_pc }
    1026       else
    1027         status
     1023       if get_cy_flag status then
     1024         let cry, new_pc = half_add status.pc rel in
     1025           { status with pc = new_pc }
     1026       else
     1027         status
    10281028  | `JNC (`REL rel) ->
    1029       if not (get_cy_flag status) then
    1030         let cry, new_pc = half_add status.pc rel in
    1031           { status with pc = new_pc }
    1032       else
    1033         status
     1029       if not $ get_cy_flag status then
     1030         let cry, new_pc = half_add status.pc rel in
     1031           { status with pc = new_pc }
     1032       else
     1033         status
    10341034  | `JB (b, (`REL rel)) ->
    1035       if get_arg_1 status b then
    1036         let cry, new_pc = half_add status.pc rel in
    1037           { status with pc = new_pc }
    1038       else
    1039         status
     1035       if get_arg_1 status b then
     1036         let cry, new_pc = half_add status.pc rel in
     1037           { status with pc = new_pc }
     1038       else
     1039         status
    10401040  | `JNB (b, (`REL rel)) ->
    1041       if not $ get_arg_1 status b then
    1042         let cry, new_pc = half_add status.pc rel in
    1043           { status with pc = new_pc }
    1044       else
    1045         status
     1041       if not $ get_arg_1 status b then
     1042         let cry, new_pc = half_add status.pc rel in
     1043           { status with pc = new_pc }
     1044       else
     1045         status
     1046  | `JBC (b, (`REL rel)) ->
     1047       let status = set_arg1 status false b in
     1048         if get_arg_1 status b then
     1049           let cry, new_pc = half_add status.pc rel in
     1050             { status with pc = new_pc }
     1051         else
     1052           status
    10461053(*
    1047  | JBC ((`BIT b1), (`REL rel)) ->
    1048     let val_bit = get_arg_1 status (`BIT b1) in
    1049     let new_status = set_arg1 status false (`BIT b1) in
    1050        if val_bit = true then
    1051          { new_status with pc = status.pc ++ (int_of_byte rel) }
    1052        else
    1053          new_status
    10541054 | RET ->
    10551055     let high_bits = (Byte7Map.find (byte7_of_byte status.sp) status.low_internal_ram) in
Note: See TracChangeset for help on using the changeset viewer.