Rybags, on Thu Feb 23, 2012 12:33 PM, said:
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:
lda #$03
sta SKCTL
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
ldd #$1000
* exg a,b
std AUDF3
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.
Write
pshs cc
orcc #IntMasks
ldb D.IRQENSHDW
orb #%00001000
stb IRQEN
sta SEROUT
loop@
ldb IRQST
bitb #%00001000
bne loop@
ldb D.IRQENSHDW
stb IRQEN
clrb
puls cc,pc
The end result: no characters show up on my terminal window and the keyboard is dead after this. I cannot type anything.
Any ideas?
Edited by boisy, Fri Feb 24, 2012 3:48 PM.













