[hatari-devel] New SCC 85C30 support for MegaSTE/TT/Falcon |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hi
over the latest months I spent some time (slowly) rewriting SCC 85C30
emulation in Hatari.
This chip is used in MegaSTE / TT / Falcon as a high speed serial
interface but also as a LAN interface.
It's a rather complex chip with 2 channels (each one can drive a
physical interface), with *lots* of registers to program it and a huge
doc (nearly 400 pages), so it was quite some work to understand its
inner working and emulate as much as possible for Hatari.
Most of the previous code was removed / rewritten. Some of the features
of the new code :
- handle all possible clock sources, no more hardcoded table of most
used baudrates (clock will be different depending on emulated machine)
- handle all registers (15 reads and 15 writes), except those related
to SDLC/HDLC
- handle all sources of interrupt, with pending registers for both
channels and latching of status bits
- "connected" to the CPU as a level 5 interrupt device
not supported yet, but later :
- different baud rate for tx and rx
- handle lan
One of the reason for rewriting this was trying to run Freemint as it
was reported to stale due to missing SCC functionalities.
A good thing about freemint is that the sources are available here
https://github.com/freemint/freemint/blob/master/sys/xdd/scc/scc.c which
makes it much simpler to follow the code logic compared to tracing the
resulting assembly code :)
Freemint is using the SCC's baud rate generator to run a timer and to
measure the time it takes (compared to the 200 Hz MFP timer). It then
use the result to determine the SCC's clock freq.
Freemint will now start without any change, for example running the
following command :
hatari -s 4 --tos tos206fr.img --machine megaste -d '' -m --acsi
~/st_mint-1.4.img
But so far I didn't test any program using the SCC's serial port to
check it still works compared to Hatari 2.4.1.
It's quite possible I broke some things when rewriting SCC code, but
just booting Freemint is already using channels A and B interrupt as
well as many registers so hopefully there should not be too many things
to fix :)
Does someone know some programs that will use the SCC for serial
transfer ? If so, does it still work ?
When serial transfer is confirmed to work, we can add support for more
physical interfaces, as they were used on MegaSTE / TT /Falcon
Nicolas