# HG changeset patch # User Michael Pavone # Date 1458921989 25200 # Node ID 08b69e3f9f177496547dc00e19b5add291159b74 # Parent 6204c81e29334720340227a8a46957101eb94395 Fleshed out the video hardware design somewhat diff -r 6204c81e2933 -r 08b69e3f9f17 simple_console.txt --- a/simple_console.txt Wed Mar 23 19:19:29 2016 -0700 +++ b/simple_console.txt Fri Mar 25 09:06:29 2016 -0700 @@ -83,6 +83,12 @@ r14 : PC r15 : status register +Special Registers +epc - Exception PC - Stores PC value to resume to when entering an exception handler +esr - Exception SR - same as above, but for SR +eur - Exceptuion User Reg - reg for temporary storage of a reg in a handler, intended to be used for the stack pointer +enum - Exception Number - holds the number of the most recent exception + IO: Ports 0: Controller 1 @@ -105,11 +111,87 @@ A: Timer Freq B: "Serial" Debug Port -D: Write Pallette Address : Read Vertical Position -E: Write Name Table Address : Read Horizontal Position -F: Write Sprite Table Address : Read Status? +C: Write Vertical Scroll : Read Vertical Position + MMMM MCCC CCCC CFFF + C = coarse scroll bit + F = fine scroll bit + M = mask bit + controls which bits come directly from register + and which bits come from the sum of the register + and the current line number + +D: Write Horizontal Scroll : Read Horizontal Position + xxxx xxxC CCCC CFFF + C = coarse scroll bit + F = fine scroll bit + x = unused +E: Write Dest Address : Read Status +F: Write Data : Read Data + + +Name Table Start Address: + 0VVV VVVV VHHH HHH0 + + V = Coarse scroll bit from vertical scroll value + H = Coarse scroll bit from horizontal scroll value + +VDP Memory Map +0000 - 7FFF = Pattern/Name Table RAM +8000 - FDFF = unused, returns $FFFF +FE00 - FEFF = Sprite RAM +FF00 - FF7F = Palette RAM +FF80 - FFFF = Palette RAM (mirror) + +Another View - + MSB determines whether destination is main RAM + For MSB 1 + Next 7 MSB determines which special RAM is the destination + Only values of 7E and 7F are valid for these bits at present + 8 LSB determine offset (1 LSB ignored) + +Writing to Data port puts word into FIFO +Offset within memory type is increment when word is pulled from FIFO + +Pattern Format: +4bpp in an 8x8 tile arrangement + + +Sprite Table Entry: + +XXXXXXXX YYYYYYYY +IXPVHSNN NNNNNNNN + +S: size -- 0 = 8x8, 1 = 16x16 +P: Palette selector +H: Horizontal flip +V: Vertical flip +I: Priority +N: Name +X: X position (left of screen = 16, right of screen = ?) +Y: Y position (top of screen = 16, bottom of screen = 240) + + +Name Table Entry: + +IPPVHxNN NNNNNNNN + +P: Palette selector +H: Horizontal flip +V: Vertical flip +I: Priority +N: Name +x: Unused, should be set to 0 + +26.112 MHZ Clock +Dot Clock Divider 4 +CPU Clock Divider 20 (assuming 1 cycle/instruction, 5 for 4 cycles/instruction) +Audio Timer Divider 34 +Audio Output Divider 544 + +Alternatively 13.056 Mhz clock and cut the dividers in half - - +H-Counter goes from 0-415 and then wraps back to zero +V-Counter goes from 0-261 and then wraps back to zero +V-Counter increments when H-Counter wraps