[FT32] sim: character input port

Message ID CA9BBF0458F83C4F9051448B941B57D119614F7E@glaexch1
State Superseded
Headers

Commit Message

James Bowman Sept. 21, 2015, 11:28 p.m. UTC
  The FT32 simulator has character output, of course. This patch
adds character input, which lets the simulator run interactive
FT32 applications, e.g. language interpreters.

OK to apply?

sim/Changelog:

2015-09-21  James Bowman  <james.bowman@ftdichip.com>

	* ft32/interp.c: reading from IO address 10000 gives
	character input.
  

Comments

Mike Frysinger Sept. 22, 2015, 1:28 p.m. UTC | #1
On 21 Sep 2015 23:28, James Bowman wrote:
> 	* ft32/interp.c: reading from IO address 10000 gives
> 	character input.

should read like:
	* ft32/interp.c (cpu_mem_read): Call getchar when ea is 0x10000.

> +       case 0x10000:
> +         return getchar();

needs a space before the (
-mike
  

Patch

diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c
index 404683d..b0f3a49 100644
--- a/sim/ft32/interp.c
+++ b/sim/ft32/interp.c
@@ -169,6 +169,8 @@  static uint32_t cpu_mem_read (SIM_DESC sd, uint32_t dw, uint32_t ea)
       /* Simulate some IO devices */
       switch (ea)
        {
+       case 0x10000:
+         return getchar();
        case 0x1fff4:
          /* Read the simulator cycle timer.  */
          return cpu->state.cycles / 100;