8563-80 COLUMN CHIP by Bill Pytlovany There is 16K of memory in the 8563 chip which is not considered as part of the 128K of the C128 PC. This memory is intended to be used solely by the 8563 80-column chip. Much of it is relocatable areas but these are the default definitions. 0000 - 1999 Text screen $0000 - $07CF 2048 - 4047 Attributes $0800 - $0FCF 8192 - 16383 Character definitions $2000 - $3FFF TEXT SCREEN You'll notice that the text area and attribute area are but 2000 bytes. (80 columns x 25 rows = 2000) There is a 1 to 1 relationship between the text area and attribute area where as the location $0000 hold the character in row 1, column 1. Location $0800 holds the attributes of row 1, column 1. Definitions of text characters follow that of the screen display codes found in appendix D of your C128 system guide rather than sctrict ASCII codes. 0 = @, 1 = A, 2 = B etc..... SCREEN ATTRIBUTES Attributes are defined by the setting of bits within the attribute byte. Bit 7 0 = character set 1 1 = character set 2 (see appendix D ) Bit 6 1 = Reverse Bit 5 1 = Underline Bit 4 1 = Blink Bit 3 1 = Red Bit 2 1 = Green Bit 1 1 = Blue Bit 0 1 = Low intensity 0 = High intensity CHARACTER DEFINITION The default character definitions take 8K (512 characters). Each char- acter is defined by 8x16 bits yet only the 8x8 bits area is used under normal use. Upon system startup these character definitions are initialized by the Kernal routine DLCHAR whose Jmp is found at $FF62. This eventually jumps to the download character routine found at $C027 and continues to $CE48. This is a great routine to look at to see how writing to the 8563 is done. You'll notice that there is still some memory not used! This memory is available for various purposes. By changing the values of registers 12 and 13 you may alter which memory is used as the start of screen text or by changing registers 20 & 21 alter the beginning of the attribute definition memory. By reconfiguring these memory locations it is possible to store more than 1 screen in 8563 memory allowing you to swap back and forth between screens. 8563 REGISTER MAP Reg# Bits Reg# Bits 00 7-0 Horizontal total 23 4-0 Character displayed-vertic 01 7-0 Horizontal Displayed 24 7 Copy/Fill 02 7-0 Horizontal Sync Position 6 Reverse Screen 03 7-4 Vertical Sync Width 5 Chr Blink Rate 3-0 Horizontal Sync Width 4-0 Vertical Smooth Scroll 04 7-0 Vertical Total 25 7 Text/Graph 05 4-0 Vertical Total Adjust 6 Attribute Enable 06 7-0 Vertical Displayed 5 Semigraphic 07 7-0 Vertical Sync Position 4 Pixel Double 08 1-0 Interlace Mode 3-0 Horizontal Smooth Scroll 09 4-0 Character Total-vertical 26 7-4 Foreground Color 10 6-5 Cursor Mode 3-0 Background Color 4-0 Cursor Start Scan line 27 7-0 Address Increment per Row 11 4-0 Cursor End Scan line 28 7-5 Character Set Address 12 7-0 Display Address start high 4 4416/4164 13 7-0 Display Address start low 29 4-0 Underline Scan line 14 7-0 Cursor Position (high) 30 7-0 Word Count (count-1) 15 7-0 Cursor Position (low) 31 7-0 CPU READ/WRITE DATA 16 7-0 Light Pen Vertical 32 7-0 Blockcopy source addr high 17 7-0 Light Pen Horizontal 33 7-0 Blockcopy source addr low 18 7-0 Update Location (high) 34 7-0 Display Enable begin 19 7-0 Update Location (low) 35 7-0 Display Enable end 20 7-0 Attribute Start Addr high 36 3-0 DRAM Refresh per scan line 21 7-0 Attribute Start Addr low 22 7-4 Character total-horizontal 3-0 Character displayed-horiz 8563 Memory Write This routine is meant to be an example of how to write(poke) a byte into 8563 memory. I have used it in various programs and can be called from basic or from another machine language routine. The following registers need to be set; .A <- the value to write or poke .X <- memory location high .Y <- memory location low In basic you can use the Basic 7.0 SYS command to past the values of the .A, .X & .Y registers. I have placed it in locations $2000+. To reserve this area your basic program should begin as such: 10 GRAPHIC1:GRAPHIC0:FAST:GRAPHIC5 This will reserve space normally used by 40 column Hi-res graphics. 02000 PHA ;push .a -> stack 02001 TYA ; (y) -> .a 02002 PHA -> stack 02003 TXA ; (x) -> .a 02004 PHA -> stack 02005 LXA #$12 ;set R18 02007 PLA ;pop a. (x) 02008 JSR $2013 ;write to 8563 0200B INX ;set R19 0200C PLA ;pop a. (y) 0200D JSR $2013 02010 PLA ;pop a. (a) 02011 LDX #$1F ;set R31 02013 STX $D600 ;store 8563 reg # 02016 BIT $D600 ;wait till 02019 BPL $2016 ; status bit high 0201B STA $D601 ;store new value 0201E RTS ; in reg. The subroutine at $2013 is actually executed 3 times and uses the values of the A and X registers. Reg .X contains the 8563 register you wish to write to. Reg .A contains the value to write. $2013 You place the 8563 register number in location $D600. $2016 Next you wait till the 8563 $2019 chip clears the status bit (7). $201B At this time $D601 will logically BE that register. You can at this time read the value contained in $D601 or write a new value there as we have done here. In the above routine we actually write to 3 different registers in the 8563. Since we want to write to memory the first thing we must do is to set the Update Register(18 & 19) to contain the address we want. It must be done in order! 2005-2008 Sets the register 18 to the value passed in the X reg. 200B-200D Sets register 19 to the value passed in the Y reg. 2011- Sets register 31 and passes to it the value passed in .A As you'll note above, in the 8563 register map, R31 is the CPU Read/Write register and is used for data I/O between $D601 and 8563 memory. R18 and R19 are used as pointers to the memory location which is accessed. ======================================= I hope this helps clear some of the mysteries of the famed C128 80 column chip. More than anything it should open the door to new and exciting questions. If you have any questions or discover more about this chip contact me in the Commodore Information Network. Bill Pytlovany QLink: Bill P1 / PlayNET: Bill P1 / GEnie: BillP1 / DELPHI: P1 / CIS: 75506,110