Ignore:
Timestamp:
Oct 18, 2010, 11:54:23 AM (9 years ago)
Author:
mulligan
Message:

Changed way we handle I/O due to assert false bug on first serial I/O
attempt.

File:
1 edited

Legend:

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

    r168 r191  
    2222type continuation =
    2323  [`In of time * line * continuation] option *
    24   [`Out of (time -> line -> time * continuation) ]
     24  [`Out of (time -> line -> time * continuation)] option
    2525
    2626(* no differentiation between internal and external code memory *)
     
    195195  expected_out_time = `None;
    196196
    197   io = (None, `Out (fun t l -> assert false)) (* a real assert false: unprepared for i/o *)
     197  io = (None, None) (* a real assert false: unprepared for i/o *)
    198198}
    199199
     
    14211421                status) in
    14221422       (* Serial port code now follows *)
    1423          let in_cont, `Out out_cont = status.io in
     1423         let in_cont, out_cont = status.io in
    14241424         let status =
    14251425           (* Serial port input *)
     
    14621462           (* Serial port output, part two *)
    14631463           if status.expected_out_time = `Now then
    1464              if get_bit status.scon 7 then
    1465                let exp_time, new_cont = out_cont status.clock (`SerialBuff (`Nine ((get_bit status.scon 3), status.sbuf))) in
    1466                  { status with expected_out_time = `At exp_time; io = new_cont }
    1467              else
    1468                let exp_time, new_cont = out_cont status.clock (`SerialBuff (`Eight status.sbuf)) in
    1469                  { status with expected_out_time = `At exp_time; io = new_cont }               
     1464               match out_cont with
     1465                 None -> assert false
     1466               | Some (`Out out_cont') ->
     1467                   if get_bit status.scon 7 then
     1468                     let exp_time, new_cont = out_cont' status.clock (`SerialBuff (`Nine ((get_bit status.scon 3), status.sbuf))) in
     1469                       { status with expected_out_time = `At exp_time; io = new_cont }
     1470                   else
     1471                     let exp_time, new_cont = out_cont' status.clock (`SerialBuff (`Eight status.sbuf)) in
     1472                       { status with expected_out_time = `At exp_time; io = new_cont }               
    14701473           else
    14711474             status
Note: See TracChangeset for help on using the changeset viewer.