I now have serial working on this project.
It's the third major piece in the puzzle. I had procrastinated on this part because I'm a little scared of serial on the RC2014.
I know how it all works, I've dealt with it in other projects, notably my TMSEMU and my MIDI module (the latter handles serial in and out from the MIDI ports as well as the usual terminal connections). But I still find it confusing.
I needn't have been worried. I've already done the work in my MIDI mk2 module and so it was more of a copy / paste exercise.
It sets up interrupts on the 6850 (SCM, the monitor I use on this 32k RC2014, doesn't use interrupts) and installs an interrupt handler that buffers the incoming data.
Now the keyboard scanning routine, which is just done in the main loop, sends a character out to the serial chip when one is typed.
Half the battle is working out how you're going to develop/test this stuff.
I've been working with this RC2014 hooked up to my Mac's Terminal as usual (that's necessary to load the program - eventually it'll be in ROM but while I'm developing I'm loading each new build of the program into RAM in the usual way).
So with this running, I now have the world's worst messenger. Anything I type into my Terminal emulator on the big computer comes out of the Alphacom (after a carriage return) and anything I type on the MSX keyboard appears in the terminal emulator.
The title of this log is 'Working serial' and what that means is that 20% of the work is done and now we're embarking on the harder 80% - finding and fixing all of the problems or things that haven't been taken into account ...

... such as line-wrapping; the printer needs to print a line and clear the line buffer after 32 characters if no carriage return has been received. (We won't get into word-wrapping at this point, although that shouldn't be too tricky).

That's better! As you can see it took a few tries!
The printing routine disables interrupts (for timing reasons). So when you reach 32 characters in the line buffer, the printer's going to fire up and print the line - ignoring interrupts from the 6850 while it's working. I expected this to mean the odd lost character or two, but so far that doesn't seem to happen. If it does, then I may have to make calls to the interrupt service routine during those delays in the printer code.
I guess after a little more testing, it'll be time to build this for a ROM and connect this to a (nother) RC2014 to see it actually working as intended.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.