Should also have mentioned:
it is possible to do serial transmission entirely in "polled mode". This is where you enable the IRQs on Pokey but disable them from the CPU side.
Then just sit in a wait loop and manually reset/set the enable bits in IRQEN as each byte goes in or out. Some fast-loader systems use this since very high bitrates can be too quick for the overhead of IRQ routines.
You might prefer to use polled mode during development, it might be easier to debug.
Ok, I've starting to tackle the SIO late this afternoon. I figured I would do a simple DriveWire printer driver. Easy enough. I've got sloopy's SIO adapter plugged in and the USB port selected on my Mac.
Early in VTIO initialization I do this:
In my printer driver, I am initializing the baud rate to 38,400bps (note I'm not sure if I need to byte swap this or not)
* initialize POKEY to ~38.4K
* exg a,b
In my printer driver's write routine I'm masking interrupts, loading the shadow register (which has the two high bits set by VTIO for keyboard and break). I am setting the "serial output done" interrupt bit, then writing the character in A to the SEROUT.
I'm then looping, reading the IRQ status until the "serial output done" interrupt status bit is cleared (meaning the interrupt has fired), then rewriting the shadow register to the real register to clear that interrupt.
The end result: no characters show up on my terminal window and the keyboard is dead after this. I cannot type anything.
Edited by boisy, Fri Feb 24, 2012 3:48 PM.