Posted By
   SukkoPera on 2022-09-22 05:45:46
  |   Re: External User Port for the C16: Let's make it!
  @MMS: Well, you design the protocol, I implement it  . I have no programming experience on 8-bit machines, so I can't help much. I can work on the "other side" (whatever must be done in my adapter) but someone else will have to write the C16/+4 driver. I can add that this is the basic data all USB mice report:
 
 struct MouseReport { 	uint8_t buttons; /**< buttons mask for currently pressed buttons in the mouse. */ 	int8_t  x;       /**< Current delta x movement of the mouse. */ 	int8_t  y;	   /**< Current delta y movement on the mouse. */ };
  USB reports are generally sent at 100-125 Hz. The C16/+4 would sample data at 50/60 Hz, I imagine, so some "accumulation" will be needed, right?
  BTW, my adapter is based on a Raspberry Pico and is very cheap to make (~5€), so I think this is worth pursuing  .
  Just an idea: I think it would be good to base the protocol on the parallel part of the userport, without using the ACIA if possible. I have no idea if the following will work, it's just the first thing that materialized into my mind: if two buttons are enough, we only nee to transfer 18 bits of data. So maybe we could use bits 0 and 1 of as "data selector" outputs to the board, and bits 2...7 as an input from the board:
 
 Sel Bits | Data    00    | y[5:0]    01    | x[3:0] + y[7:6]    10    | LMB + RMB + x[7:4]    11    | Spare for MMB or wheel data? 
  This would need 3 "pokes" and 3 "peeks" every time mouse data must be read. Again, no idea if that would be feasible, but hopefully it'll be food for thought :).
  Maybe we should open a dedicated thread for this?
  |