Commodore 64= : Depacking colors anyone

BlitzMax Forums/BlitzMax Beginners Area/Commodore 64= : Depacking colors anyone

DannyD(Posted 2005) [#1]
Anyone got any ideas for implementing a routine similar to the decrunching/depacking colors that were used on the Commodore c=64 ? I've included a short quicktime movie for inspiration
http://www.dinneen.com/Power64001.mov


EOF(Posted 2005) [#2]
' c64 random color loading demo

Strict

Graphics 640,480,0,SOFTSYNC

Repeat
	C64Loading
	Flip
	FlushMem
Until KeyHit(KEY_ESCAPE)

End

Function C64Loading()
	Local y=0,h
	Repeat
		h=Rand(5,60)
		SetColor Rand(255),Rand(255),Rand(255)
		DrawRect 0,y,GraphicsWidth(),h
		y:+h
	Until y>=GraphicsHeight()
End Function



Well, since we are in C64 mode here is something which may interest you. I created program (for fun) which displays images using C64 graphics. Just choose a directory which contains a bunch of images (png/jpg/bmp/tga).




Download View64


DannyD(Posted 2005) [#3]
Really nice JB, thanks.I must examine your code as it appears to be identical to the c-64 code of old.

I wasn't able run your c-64 picture tga app as it's an .exe(no good on Mac os X) :(.


EOF(Posted 2005) [#4]
Danny - source now in the View64 zip. It should compile for Mac OSX just fine.


DannyD(Posted 2006) [#5]
I came across this BlitzBasic code which does a similar decrunching routine
AppTitle "Decrunch"

; Version 1.0
; April 2001
; Made by Einar Wedøe
; Programtype: 	Blast from the past :-)
;				Does nothing at all but simulate a decrunch routine from the C64 days !

Graphics 640,480,16,1

Global font1
font1=LoadFont ("verdana",20,False,False,False)		; Sett up font 
SetFont font1

SetBuffer BackBuffer()								; Start with the backbuffer()
Global frametimer=CreateTimer(75)					; Set up timer to make everything run nice on all PC's

;---------------------------
.start												; Mainloop

While Not KeyHit(1)									; Loop until ESC is pressed
WaitTimer(frametimer)								; Wait....
Cls													; Clean up
 flash												; Do the flash
  	Color 255,255,255								; Set color to white for the text
    Text 240,235,"Decrunching..."					; Set dumy-text
Flip												; Change buffer
Wend												; Next round please
End													; Tha's it !

;---------------------------
Function flash()									; Flashroutine
a=0													; Reset counter
.flashloop											
Color Rand(255),Rand(255),Rand(255)					; Set color randomly
 tmp=Rand(10)										; Set size of next line random
  Rect 0,a,640,tmp									; Draw the rect (the next flashline)
   a=a+tmp											; Increase counter with height of the rect
    If a > 480 Then Goto endflash					; Are we at the bottom yet ?
   Goto flashloop									; If not make another rectangle
.endflash											
End Function										; Thats it for this frame
;----------------------------


http://www.blitzbasic.no/decrunch.html


ashmantle(Posted 2006) [#6]
Cool stuff, Jim!


Grey Alien(Posted 2006) [#7]
A while ago I had a thread to find the exact C64 colours and it was quite interesting. Try searching for it in Bltiplus or General Discussion. Anyway here's some blitzplus code that has some C64 colours (to convert to BMax, the arrays must use [] not (), oh and don't use DIM:

;C64 colours
Const MAX_C64_COLOURS = 16
Dim C64Colours(MAX_C64_COLOURS-1)

;done by eye via monitors
C64Colours(2) = $880000
C64Colours(3) = $aaffee
C64Colours(4) = $cc44cc
C64Colours(5) = $00cc55
C64Colours(6) = $0000aa
C64Colours(7) = $eeee77
C64Colours(8) = $dd8855
C64Colours(9) = $664400
C64Colours(10) = $ff7777
C64Colours(11) = $333333
C64Colours(12) = $777777
C64Colours(13) = $aaff66
C64Colours(14) = $0088ff
C64Colours(15) = $bbbbbb

;non gamma correct
;C64Colours(2) = $744335
;C64Colours(3) = $7CACBA
;C64Colours(4) = $7B4890
;C64Colours(5) = $64974F
;C64Colours(6) = $403285
;C64Colours(7) = $BFCD7A
;C64Colours(8) = $7B5B2F
;C64Colours(9) = $4f4500
;C64Colours(10) = $a37265
;C64Colours(11) = $505050
;C64Colours(12) = $787878
;C64Colours(13) = $a4d78e
;C64Colours(14) = $786abd
;C64Colours(15) = $9f9f9f

C64Colours(0) = $000000
C64Colours(1) = $FFFFFF
;gamma corrected
;C64Colours(2) = $68372B
;C64Colours(3) = $70A4B2
;C64Colours(4) = $6F3D86
;C64Colours(5) = $588D43
;C64Colours(6) = $352879
;C64Colours(7) = $B8C76F
;C64Colours(8) = $6F4F25
;C64Colours(9) = $433900
;C64Colours(10) = $9A6759
;C64Colours(11) = $444444
;C64Colours(12) = $6C6C6C
;C64Colours(13) = $9AD284
;C64Colours(14) = $6C5EB5
;C64Colours(15) = $959595 


some are commented out as I found several sources and tried themall out. See which ones are best for you.