-- Newsgroups: comp.sys.cbm Subject: c65 Vic iii From: tpug.sysop@canrem.com (Tpug Sysop) Date: Sat, 30 Apr 94 04:25:00 -0400 Well I am back, sort of.. I moved! ..and my SwiftLink blew, right in the middle of a call with R.Alphy's friend! [Australia to Canada!] Now I am limping along at 96oo again. [ewW!] :) Just when I was finaly getting the various bits of the VIC iii sorted out ..I got some documentation! ..darn! So much work out the tubes.. :< ..so with previous experiance and some more clues from the documentation we have; [===] VIC iii [============================================================] $d030 ;control reg' a [default $20] bit 0 ;CRAM @ DC00 this will knock out IO stuff so you can get at the second 1,ooo bytes of Colour RAM in the _logical_ area. 1 ;External Sync, GenLock related, also so you can use the sync in yer VCR 2 ;Pallette enable. Custom colour is turned on. 3 ;ROM @ 8000 [like c64 basic extentionz] 4 ;ROM @ A000 [basic replacement] 5 ;ROM @ C000 Magic c65 O/S inter-bank-interupt handler, alwayz set!! 6 ;CROM @ 9000 Alternate Charset! [mostly just lower case shortend] 7 ;ROM @ E000 $d031 ;control reg' b bit 0 ;Interlace enable, can be used w/out v400 bit to take out dots between the pixels. 1 ;Mono, turnz off crominance in NTSC/PAL output for B&W TV.. 2 ;H1280, each pixel on screen is split into two BIT PLANEz! 3 ;V400, needs BitPlane and Interlace bitz 4 ;BitPlane enable, over ridez c64 type grafix modez 5 ;Attribute enable, yes you can even have a BitPlane FLASH! 6 ;FAST.. :) 7 ;H640, 40/80 bit switch Some pretty funky combinations can be had, like a separate MONO screen on your composite output, a 320 and 640 BitPlanes on screen together. $d032 ;Bit Plane # enable. Like the Sprite enable, one bit per. [0-7] [Sprite collision detected on BP2] $d033-d03A ;BitPlane Adress's. [BP0-BP7] If you just look at the lower nyble, then EVEN BP is in EVEN RAM Bank. [odd BP in odd RAM] BP0 in RAM0, BP1 in RAM1 and BP2 in RAM0 ..etc. If you put the offset adress in the upper nyble its in the other bank! To confuse us further the lowest bit of each nyble is un-used. To set matterz clear the number reflects the block! [4=$4000 !!] $d03b ;Complimentary bit for each BP ..uh, reverse. Also sets an offset into the Pallette RAM. If you have 4 BitPlanes enabled, you have 16 colours [0-15], if you then set the 5th bit [bit 4] your colour pallette is from 16 to 31! Thus if you have 4 BitPlanes you can have 16 pallette sub-mix'z! [see $d100 for definition of what colour *IS*] $d03c/3d ;DAT Control, BitPlane Coordinatez X/Y Asuming you have BP's enabled and thier adress's set, you then write the x/y coordinates you want here. Column and Line. [0 to 39 or 79 columnz, 0 to 199 linez [400 lines = 2 BitPlanes interlaced]] The bytes at those coordinates will appear in the registers $d040-d047. [DAT=Direct Adress Translator] $d03e/3f ;Horizontal and Verticle Position of Screen Map area. The bit values here are just like the "old" single byte BRANCHing values. Zero being center, then offsetting up to +128 to -127. [slick..] $d040-d047 ;DAT Portz The bytes at the coordinates you specified in DAT Control [d03c/3d] will be visable here. [Not a copy] Read and write to them as you please! [see note on Screen Updates] Only the BP's enabled will have valid bytes, of course. $d080 Drive Controler [later!] Pallette RAM Pages $d100, d200 and d300 [red, green and blue] The c64[or text] colours are the first 16 in each page. The bits of the BitPlanes stacked up form an Offset into the pallette. The standard 16 colourz are also an Offset into the Pallette. ** $d100 is 5 bitz wide! With this 5th being the Fore/Background bit, it also ties into MONO somehow. Colour/Attribute RAM $d800-dfff or 1f800-1ffff! Bitz 0-3 ;colour index into Pallette. 4 ;Blink [FLASH!] 5 ;Reverse, if you use this directly then the "reversed part" of the character set is not needed and can be used for a second set! [the c128 also has this PLUS a cset bit alowing 4 setz!] 6 ;Highlight! A +16 offset into Pallette, not sure where the background colour offset is. [prolly +32!] Try while typing on screen! 7 ;UnderLine Flash+UnderLine=Flashing Underline ..etc, many combinationz! [===] Bit Planes [==========================================================] First off they are layed out like we all love and hate on the c64, non-linear. Some call'em Cardz or Cellz. With the Colour number being stacked across the BitPlanes, verticaly if you will alow me that refferance point! Letz configure 4 Bit Planes, 640x200. I put each at 08000, 14000, 0c000 and 18000. This keeps them out of the way of thingz, mostly. [I did not move or alter Basic Text or Variable pointerz, so these could mess thingz up] Now letz get the idea we want to set a couple of pixels to a colour in the top left of the screen. Just think of the gyrations we have to go through to get hold of one byte at each of 08000, 14000, 0c000 and 18000! Stagger'd across banks! ..roll in the DAT! Write in the coordinates we want instead! [0,0 into d03c/3d!] Now we can read in the bytes from the 4 BitPlanes in $d040-d043 and copy them to here, translating them to binary just to make them easily readable; 76543210 ;bit number 01010101 ;BP0, [real adr @ 08000] 00110011 ; 1 @ 14000 00001101 ; 2 @ 0c000 00000011 ; 3 @ 18000 ..to get our colour index number we need to look at them verticaly! Bit 7 is our pixel on the top left of the screen. All the bit 0'z in the four bytes are a 0 so our index is combinded to give us 0 or Black using the default colourz. Bit 6 has 1, bit 4 has 1 and bit 1 has 0 0 1 1 0 0 0 0 0 1 ..etc. These would be values 1, 3 and 10 [$a], respectively. ..so our first 8 pixels will be black, white, red, cyan, purple, green, light red and light gray. Setting them to a colour *WE* want is going to be a real pain! [==] **** [===============================================================] Programming challenge #1: Set a pixel to a colour. $400 =bitplanez ;number of bitplanes enabled. LDA colour ;0-255 LDX column ;0-639 LDZ line ;0-199 JSR set_pixel_colour ..anybody have a spirograph type plotter to go before this subroutine? Please!! [640x200x4_bit_colour or 320x200x8_bit_colour!] [===] VIC iii Notes [=====================================================] If VIC iii Modes are changed, they will only occur at the end of the current CHARACTER ROW. [every eighth raster line!] DAT registers/ports will not be valid until this time as well. All c64 grafix modes are valid with "logical" 80 column/640 pixel extentions! [40/80, Screen RAM 1000/2000 with Sprite pointerz at the respective 1k/2k ends, Colour RAM $d800-dbff/d800-dfff] Need to set CROM @ dc00 in Control A Register to access second half in I/O map, or directly in physical location $1f800-1ffff. 320 pixel Multi-Colour mode on 80 column screen is valid. Sprite proportions do not change in *any* mode. [x/y expanded as normal] Valid Sprite coordinates are 320x200. In BitPlane Modes spritez colide with bit plane 2. [Best not invert it with Complimentary register!] Bit 4 of $d018, is invalid in 80 column mode. [Locate charset] [8 valid locations for 80colz, 16 for 40colz] [Similar limit with 640 bit-MAP, lower bit invalid] The 24 Text Line mode can be used in even 640x400 to give you 640x384! [quick flip of calculator, hrmm you will need to as 640x400 leaves only 5 sprite blocks! Some could be the same I guess] Mixing 1280 and 640 pixel bitplanes is possible, not sure HOW I did it though.. :) In text mode turns on Highlight Attribute, the colours can be anything with and offset of 16 to 31 in Pallette RAM. so.. PRINT"s"+a$ ..will print a$ in colour 1+16=17. Poke $d111, d211 and d311 with whatever R.G.B. values you want! Special Note, VIC ii modes only have 0-15 valid colours. [Spites ..etc] VIC ii modes can have interlace turned on but image is the same on both. It does help smooth out the image though.. No 400 line versions of VIC ii modes. [===] Opcode Tease! [=====================================================] Zero Page can be moved *anywhere* in Memory. LDA page# TAB ;ding..! Bring it back.. TBA ;ding..! ;Now you can check A to see *where* it was, in case you didn't know ..haR! [==- Stack pointer is 16 bit. TSX ;sp-lo to x TSY ;sp-hi to y TXS ;x to sp-lo TYS ;y to sp-lo If NMI or IRQ are liable to happen do not place other codes between these pairs of opcodes. [If next opcode is not one of these, interupt can occur] [==- SEE ;set stack Extend disable bit CLE ;clear stack Extend disable bit [==- RTS #xx ;RTS plus ..pull off and discard xx # of bytes from stack! [===] Finale [============================================================] Please do try the programming challenge! I am looking for some Bit Planes I can play with! I don't have FTP access. Some simple 640x200 or 320x200 split into thier planes would be a great start. A decent description of what they *should* look like might be helpful too. :) A colour table too I'd guess. I have yet to see the CBM c65 "demo" disk yet. Who has this? Has *anybody* come up with anything else as yet or should I give this up as a lost cause..? ..next post, converting some c64 bit-Maps. ]>ug.. __________________________________________________________________________ 416+588+9071 voice [Toronto, Canada] 416+588+0922 ]-[ighlander BBS [c65 dir] [Image/NISSA Net] 905+273+6300 TPUG BBS [PC Punter Net] -- Newsgroups: comp.sys.cbm Subject: c65 Pix Fun..! From: tpug.sysop@canrem.com (Tpug Sysop) Date: Sat, 30 Apr 94 04:27:00 -0400 [====] Bit-Map to Bit-Plane [=============================================] The following prg will rip out the Bit-Map of a Doodle pic and turn it into a doubled up version for use as a single Bit-Plane. Basicaly it takes a 40 col pic and doubles each line and makes it 80 col. from; 11111 to 1111111111 22222 2222222222 33333 3333333333 Written in Basic 2 for c64. You will need to fill in the file names as I didn't bother adding an input for these. I will have a ML version shortly, this basic just makes it easily to understand. [delete lines 13 and 20 if NOT run on a c128 in 64 mode..] 1 rem save "@:bm2bp dupe+",dv 10 if dv then12 11 dv=peek(186):load"doodle",dv,dv 12 a=.:x=.:b=8192:c=24576:d=40*25*8*2+8192:z=40*8 13 poke53296,1 14 : 15 forx=.toz-1:a=peek(c+x):pokeb+x,a:pokeb+x+z,a:next 16 : 17 c=c+z:b=b+(z*2):ifb=>dthen 19 18 goto15 19 rem done converting 20 poke53296,. 21 : 22 opendv,dv,dv,"bp.filename,p,w" 23 print#dv,chr$(0);chr$(64); :rem $4000 load adr for "slider" 24 forx=8192to40*25*8*2+8192:print#dv,chr$(peek(x));:next:closedv [====] BM/BP [============================================================] The real differance between Bit-Map mode and Bit-Plane mode is; "Not wether the pixel is on or off but rather which colour is it?!" A single bit-plane does look like a bit map, the similarity ends when there is more than one. [====] Slider [===========================================================] Now that you kin make a simulated Bit-Plane above this prg will let you view them on the c65 in 640x200x2. 1rem save "@:slider",10 10 poke53280,2,0 :rem boarder red, background black 20 a=dec("d031") :rem control b 30 b=dec("d032") :rem bit-plane enable 40 poke a,128+64+00+16+8+0+2+0 50 poke b,1 :rem one bit-plane 55 poke b+1,4 :rem at $04000 60 forx=1to8:ready$,c:poke53307,c:bload"bmd"+y$:next 70 geta$:ifa$=""then70 :rem wait for a key 80 poke53297,224 :rem back to normal 90 end 100 data "1",2,"2",3,"3",1,"4",6,"5",6,"6",7,"7",9,"8",10 In the above I set up the file names so that I could NAME them but never did, I just used numberz. So the filenames are "bmd" plus a number-$tring in the data statements. c is for the complimentary register and just changes the colour for each, and/or sets reverse. The final version will have a proper filename. [====] 4 Bit Planes [=====================================================] My very first attempt sux rox! It does give us _something_ to look at though, even if it is just pretty junk! First step was to dig up a resonable bit-map. I then imported it into "GAS.64". [Graffic Assault System] GAS is a util for pictures, alowing you to do thingz paint prg's won't. There is also a c128 version with the last one called "GAS.NOW". I then made 3 more bit-map'z with each one shifted one pixel over and one pixel down from the last. This gave me a total of 4 bit-mapz offset from each other by one pixel in two directionz. Thirdly, I then ran all four through "bp2bm dupe". Next is memory mapping of four 65 block bit planes. The Vic3 wants even/odd bit-planes in even/odd RAM banks. With Basic Text in RAM 0 I put the Bit-Planes at $8000 and $c000, Planes 0 and 2. In RAM 1 with drive stuff at the bottom and physical_colour_mem at the top ..I used $14000 and $18000 for Planes 1 and 3.. Now mod' slider with; 50 poke b,15 :rem four bit-planez 55 poke b+1, 8,4,12,8 :rem $08000, 14000, 0c000, 18000 60 forx=.to255:poke dec("d03b"),x:fory=.to400:nE:nE ..now that it works I save them out as two files, one for each bank. s "bank0" 8 08000 0ffff s "bank1" 8 14000 1bfff [if you are counting, that is two 130 block filez/64k!!] Now we kin further mod' slider with; 57 bload"bank0",d0,u8,b0 58 bload"bank1",d0,u8,b1 I put them after the enabling pokes so that I could watch them load.. :) ]>ug.. __________________________________________________________________________ 416+588+9071 voice [Toronto, Canada] 416+588+0922 ]-[ighlander BBS [c65 dir] [Image/NISSA Net] 905+273+6300 TPUG BBS [PC Punter Net] -