xemu icon indicating copy to clipboard operation
xemu copied to clipboard

MEGA65: ethernet emulation update and fixes (tap interface)

Open lgblgblgb opened this issue 3 years ago • 0 comments

Xemu/MEGA65 has ethernet emulation (using TAP driver in Linux, so it's kinda Linux specific) however:

  1. It emulates an older behaviour of MEGA65 which has changed since then, and does not work this way any more
  2. It had bugs, since it was not thread-safe
  3. No IRQ was emulated
  4. Since it uses Linux TAP driver, it's Linux specific (it's possible that some other UNIX-like system works, even MacOS, but surely not Windows, for example)
  5. It would be nice to have a "fake" DHCP server in Xemu, so if a MEGA65 software uses DHCP to get its IP, it will get one. it would greatly decrease the network setup complexity needed for Xemu without the requirement of a real DHCP server bound to the tap interface which Xemu can use

This issue is intended to remedy at least point 1 from the list above, ideally point 2 as well. For point three, a totally different approach should be used (or "as well"), what I have no idea about, yet (what can use on Windows for similar purpose, if it's possible at all).

Currently mega65-core has some issues with ethernet: https://github.com/MEGA65/mega65-core/issues/523 It's wise to see it being "perfect" then trying to refactor my ethernet emulation to match that (so it can be compared) with the changes. Maybe already resolved?

Tip: the MEGA65 "browser" project using a modified WeeIP stack can be useful to learn how the new eth ctrl works in mega65-core: https://github.com/MEGA65/mega65-weeip especially this file: https://github.com/MEGA65/mega65-weeip/blob/master/src/eth.c However the DHCP implementation can be also useful to learn how an "average" MEGA65 program asks IP (see above the "fake DHCP server" idea): https://github.com/MEGA65/mega65-weeip/blob/master/src/dhcp.c

lgblgblgb avatar Apr 19 '21 20:04 lgblgblgb