Ignore:
Timestamp:
Sep 15, 2010, 11:57:38 AM (9 years ago)
Author:
mulligan
Message:

ACALL implemented.

File:
1 edited

Legend:

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

    r76 r77  
    1515   high_internal_ram: byte Byte7Map.t;
    1616   external_ram: byte WordMap.t;
     17
     18   
    1719
    1820   pc: word;
     
    968970     let status = { status with sp = new_sp } in
    969971       { status with pc = (high_bits, low_bits) }
    970 (*
    971  | ACALL of addr11
    972  | LCALL of addr16
    973 *)
     972 | ACALL (`ADDR11 (b1,b2,b3,b)) ->
     973     let status = { status with pc = status.pc ++ 2 } in
     974     let status = { status with sp = byte_of_int ((int_of_byte status.sp) + 1) } in
     975     let (bh, bl) = status.pc in
     976     let lower_mem = Byte7Map.add (byte7_of_byte status.sp) bl status.low_internal_ram in
     977     let status = { status with low_internal_ram = lower_mem } in
     978     let status = { status with sp = byte_of_int ((int_of_byte status.sp) + 1) } in
     979     let lower_mem = Byte7Map.add (byte7_of_byte status.sp) bh status.low_internal_ram in
     980     let status = { status with low_internal_ram = lower_mem } in
     981     let ((p1,p2,p3,p4),(p5,_,_,_)),b = status.pc in
     982     let addr = (((p1,p2,p3,p4),(p5,b1,b2,b3)),b) in
     983       { status with pc = addr }
     984(* | LCALL (`ADDR16 addr) ->*)
    974985 | AJMP (`ADDR11 (b1,b2,b3,b)) ->
    975986     let status = { status with pc = status.pc ++ 2 } in
    976      let (((p1,p2,p3,p4),(p5,p6,p7,p8)),(_,_)) = status.pc in
     987     let (((p1,p2,p3,p4),(p5,_,_,_)),(_,_)) = status.pc in
    977988     let addr = (((p1,p2,p3,p4),(p5,b1,b2,b3)),b) in
    978989     let new_pc = word_of_int ((int_of_word status.pc) + (int_of_word addr)) in
Note: See TracChangeset for help on using the changeset viewer.