BigEd wrote:
Nice - thanks for talking us through the facilities. Some questions...
- the red LED heartbeat is presumably interrupt driven in the Ruby OS?
That's connected to the CB2 output on the VIA. The VIA generates a 1000Hz interrupt to the CPU via T1. This maintains the Acorn MOS style 100Hz ticker and a separate system 1000Hz ticker (aka 'millis()' in other systems). And attached to this is a balanced PWM algorithm to blink the LED in a pulse/fade heartbeat fashion. It wastes a few CPU cycles, but I like it. I've been using that on my Arduino/ATmega projects for years and I figured that if it was OK to lose a few CPU there in a C routine, I can afford it here in '816 asm ...
It's also pretty and makes people ask how I did it
Quote:
- the blue LED seems to show waiting-for-input?
That's currently inverted, but it's connected to the BE line (via a spare GAL output) When Blue is ON, then CPU is stalled. So in this configuration off is good in that the '816 is doing 'work'. So you see it blinking when terminal and file IO happens (but not pure LCD output) . The other red LED isn't significant right now it's an output from the GAL I was using as a 'scope trigger when testing. It's intended to be on for IO access (ie. the VIA) but it's mostly off as it ends up being a 16th of a microsecond pulse which you can't really see unless doing a lot of back to back IO operations with the VIA.
Quote:
- is the LCD cursor flashing autonomous or a Ruby thing?
That's a function of the LCD. Most people disable the cursor which is why you never usually see it (it's the default to be off too) - but it can be static (and underline), or a flashing block.
Quote:
- is it taking about half a second to scroll a line on the LCD - is that due to the speed of bit-banging the I/O? Could it be faster if you took time to optimise or is it as fast as the LCD can go?
Yes, I could optimise it - one way would be to read the busy signal back from the VIA rather than just wait for 1mS after each command - the display is also being driven in 4-bit mode, so there's a few extra cycles wasted there. I could code it in ASM too, but I don't see much point here. I could be more clever and issue a clear screen then only print the characters that are not spaces, but I'm not sure it's worth the complexity.
Here is the scroll code:
Code:
AND lcdScroll () BE
{
LET x, y = cursorX, cursorY
// Move buffer up
FOR x = 0 TO (ROWS-1) * COLS DO
buffer%x := buffer%(x+COLS)
// Blank the bottom line
FOR x = COLS * (ROWS-1) TO ROWS * COLS - 1 DO
buffer%x := ' '
// Display it all
FOR r = 0 TO ROWS-1 DO
{
lcdXY (0, r)
FOR x = 0 TO COLS - 1 DO
lcdSendData (buffer%(x + r * COLS))
}
// Restore x,y
cursorX := x
cursorY := y
lcdUpdateXY ()
}
One thing on my to-do list is to rewrite some of the BCPL library code in ASM - there is a block-move function for instance. That would speed up the move loop if I needed to.
Cheers,
-Gordon
_________________
--
Gordon Henderson.
See my
Ruby 6502 and 65816 SBC projects here:
https://projects.drogon.net/ruby/