PAL color video with Atmel controllers


December 10, 2007

The past couple of weeks i have not been getting to update the website, but i have made progress.

I've successfully ported the source to the Mega32. Video size is 32x24 characters resulting in 768 bytes for character data and another 768 bytes for color data; total SRAM required for screen data is 1.5kB, leaving 512 bytes free RAM. Some of the 'free' RAM had already been taken up by system variables, like cursor position, border color, system timer, etc..

I've added several subroutines to the kernel. Here's a list of all current subroutines:
div1616-bit division; returns both the quotient and the remainder. No division by zero checking; should be done by calling routine
div88-bit division (conditions same as above)
mul1616-bit multiplication
XYtoCursorCalculates the memory location from an (x,y) format
CursorXYReturns the cursor position in (x,y) format
GetColorPointerCalculates the color memory location at cursor position
CursorNewLineMoves the cursor to the beginning of the next line
CursorStorePointerStores the cursor memory pointer
ScrollUpScrolls the entire screen 1 row up, adding spaces on the bottom row
PrintStringPrints a null-terminated string to the screen, starting at the current cursor position
PrintFlashStringSame as above, but the string is stored in the ATMega program flash
PrintCharPrints a single character to the screen at the current cursor position. The cursor is moved one spot to the right. This subroutine does NOT handle control characters like CR
HandleCharPrints a single character to the screen and handles all control codes (used internally for handling keyboard interface)
PrintIntPrints a 16 bit signed decimal number
ClrScreenClears the screen (fills screen with spaces)
FillScreenFills the screen with a specific character
RandomGenerates a 16-bit random number (C64 RND function clone)
SeedSets a new seed for the random subroutine





December 15, 2007

I've completed my cursor handling routines: the Console 32 now handles the 4 arrow keys, backspace, delete, insert, pageup, pagedown, home, end.
Total code size is now 748 words, including jumptables and interrupt vector table.




December 21, 2007

Shortest day of the year. In the northern hemisphere anyway.
With freezing temperatures outside, there's nothing else to do then work on my Console-32 project.

I've readjusted my goal again; i want to get a bit closer to the original idea: a Commodore 64-like mini computer. To that end, i have started building my BASIC interpreter. So far, i've worked on the PRINT subroutine. It can currently print quoted strings, (signed 16-bit) numbers and simple calculations with the add and subtract operators, as well as logical operators and, or, exor. The next step will be to include multiplication and division to the list which are a bit more elaborate.




December 22, 2007

After adding the 16bit versions of multiply and divide, i had my Console 32 perform this commandline:
PRINT "Result=" 16384/12*6+2
The console answers with Result=8192 which is correct, since the integer division looses the fractional part.
I've also added the PEEK function along with the RUN and POKE commands to the Console and started testing with variables. For now, the Mega32 Console will have 32 user-definable variables, out of which one can access the A through Z variables directly. Additionally i've added stored program capability.

I've tested this small program:
A=24
B=12
PRINT "A+B=" A+B
END
The result is a simple "A+B=36" output. The program takes up 23 bytes of EEPROM.




BASIC Building blocks