Created
February 28, 2013 00:20
-
-
Save blondie7575/5053153 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ///////////////// | |
| // Plot a single character | |
| // | |
| // Parameter: The ASCII value to plot | |
| // | |
| renderPlotChar: | |
| // Take control of VRAM | |
| EnableVRAMWrite | |
| lds accum,CMDPARAM | |
| subi accum,0x41 // Offset from start of ASCII | |
| brcc plotCharASCII // A character we can render? | |
| rjmp plotCharDone | |
| plotCharASCII: | |
| // Compute pointer to desired character | |
| ldi XH,FONTADDR_H | |
| ldi XL,FONTADDR_L | |
| ldi regS,4 // Offset by 4 bytes per char | |
| mul regS,accum | |
| add XL,r0 | |
| adc XH,r1 | |
| // Compute high VRAM address for Y cursor position | |
| lds regT,CURSORY | |
| lsl regT | |
| lsl regT | |
| lsl regT | |
| out PORTC,regT | |
| ldi regT,CHARBYTES | |
| plotCharOuter: | |
| // Compute low VRAM address of X cursor position | |
| lds regS,CURSORX | |
| lsl regS | |
| lsl regS | |
| // Load two rows of character from font | |
| ld regU,X+ | |
| // 0 - Render odd row, leftmost pixel | |
| out PORTA,regS | |
| clr accum | |
| sbrc regU,7 | |
| lds accum,FONTCOLOR | |
| out PORTD,accum | |
| PulseVRAMWrite | |
| inc regS | |
| // 1 | |
| out PORTA,regS | |
| clr accum | |
| sbrc regU,6 | |
| lds accum,FONTCOLOR | |
| out PORTD,accum | |
| PulseVRAMWrite | |
| inc regS | |
| // 2 | |
| out PORTA,regS | |
| clr accum | |
| sbrc regU,5 | |
| lds accum,FONTCOLOR | |
| out PORTD,accum | |
| PulseVRAMWrite | |
| inc regS | |
| // 3 | |
| out PORTA,regS | |
| clr accum | |
| sbrc regU,4 | |
| lds accum,FONTCOLOR | |
| out PORTD,accum | |
| PulseVRAMWrite | |
| inc regS | |
| // Next line | |
| in accum,PORTC | |
| inc accum | |
| out PORTC,accum | |
| subi regS,0x4 | |
| // 0 - Render even row, leftmost pixel | |
| out PORTA,regS | |
| clr accum | |
| sbrc regU,3 | |
| lds accum,FONTCOLOR | |
| out PORTD,accum | |
| PulseVRAMWrite | |
| inc regS | |
| // 1 | |
| out PORTA,regS | |
| clr accum | |
| sbrc regU,2 | |
| lds accum,FONTCOLOR | |
| out PORTD,accum | |
| PulseVRAMWrite | |
| inc regS | |
| // 2 | |
| out PORTA,regS | |
| clr accum | |
| sbrc regU,1 | |
| lds accum,FONTCOLOR | |
| out PORTD,accum | |
| PulseVRAMWrite | |
| inc regS | |
| // 3 | |
| out PORTA,regS | |
| clr accum | |
| sbrc regU,0 | |
| lds accum,FONTCOLOR | |
| out PORTD,accum | |
| PulseVRAMWrite | |
| // Next pair of lines | |
| in accum,PORTC | |
| inc accum | |
| out PORTC,accum | |
| dec regT | |
| breq plotCharDone | |
| rjmp plotCharOuter | |
| plotCharDone: | |
| // Clean up and we're done | |
| DisableVRAMWrite | |
| ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment