VERA PALLETTE UPDATE USING VPOKE.

All aspects of programming on the Commander X16.
User avatar
ahenry3068
Posts: 1132
Joined: Tue Apr 04, 2023 9:57 pm

Re: VERA PALLETTE UPDATE USING VPOKE.

Post by ahenry3068 »

Maybe just fill in 50 to 100 pallette values and just use those.
User avatar
ahenry3068
Posts: 1132
Joined: Tue Apr 04, 2023 9:57 pm

Re: VERA PALLETTE UPDATE USING VPOKE.

Post by ahenry3068 »

Ok... In the progress of putting ALL OF THE VERA DEFAULT PALLETTE in BASIC DATA Statements.

I'm 1/3rd through and hoping I don't make a typo. I'm going to write a routine to VPOKE the entire thing.
I'll check it with my BASIC Pallette chart to make sure I'm actually loading a correct Default Pallette.

Because the default values aren't actually in VERA RAM unless you put them there and VPOKE in the Pallette
area returns undefined values unless previously written. Calling this will allow my Pallette Swap GOSUB
to operate correctly.. Swapping Pallette entrys can be very useful for color and animation effects.

whens its done I'm going to redo MY DEADFACE routine in HANGMAN to use Pallette animation.
Last edited by ahenry3068 on Fri Jul 28, 2023 9:04 am, edited 1 time in total.
User avatar
ahenry3068
Posts: 1132
Joined: Tue Apr 04, 2023 9:57 pm

Re: VERA PALLETTE UPDATE USING VPOKE.

Post by ahenry3068 »

And ALSO. I'm learning the VERA... It will be useful to me later.
Ender
Posts: 220
Joined: Sat May 09, 2020 9:32 pm

Re: VERA PALLETTE UPDATE USING VPOKE.

Post by Ender »

It might be easier to just have it in a file and load it in.
User avatar
ahenry3068
Posts: 1132
Joined: Tue Apr 04, 2023 9:57 pm

Re: VERA PALLETTE UPDATE USING VPOKE.

Post by ahenry3068 »

It probabyly would. but I just now finished it as DATA


It took a minute .... I'm still not sure its correct..
User avatar
ahenry3068
Posts: 1132
Joined: Tue Apr 04, 2023 9:57 pm

Re: VERA PALLETTE UPDATE USING VPOKE.

Post by ahenry3068 »

I've been out of the programming World for a minute before I got into David's project..

But I have some personal lesson's I've brought.


One of my lessons is ALWAYS... ALWAYS... abstract your code so
its easier to use in this project and the Next project
Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Re: VERA PALLETTE UPDATE USING VPOKE.

Post by Ed Minchau »

I made a file a while ago that holds the default palette. Here you go.
DPAL.BIN
(514 Bytes) Downloaded 423 times
User avatar
ahenry3068
Posts: 1132
Joined: Tue Apr 04, 2023 9:57 pm

Re: VERA PALLETTE UPDATE USING VPOKE.

Post by ahenry3068 »

Thanks. I'll use that to check my work. and BVLOAD to FA00 is probably faster than READ...VPOKE
which was what I was going to do.
User avatar
ahenry3068
Posts: 1132
Joined: Tue Apr 04, 2023 9:57 pm

Re: VERA PALLETTE UPDATE USING VPOKE.

Post by ahenry3068 »

OK Some funny eye candy. Draws a VERA Color chart then starts swapping the Pallette Colors

Hitting ESC during the Pallette Animation restores the Default Pallette then waits for another
Key before ending. Has Entire VERA Default in BASIC DATA Statements.

Code: Select all

10 SCREEN $80 
15 C = 0
20 FOR Y = 0 TO 225 STEP 15
30     FOR X = 0 TO 300 STEP 20
40         RECT X, Y, X+19, Y + 14, C
45         TC = 1
50         IF C=$01 OR C=$1D OR C=$1E OR C=$1F OR C=$26 OR C=$41 THEN TC=$10 
55         IF C=$42 OR C=$49 OR C=$50 OR C=$5D OR C=$5E OR C=$65 THEN TC=$10
60         IF C=$6B OR C=$6C OR C=$73 OR C=$79 OR C=$7A OR C=$81 THEN TC=$10
65         IF C=$88 OR C=$8F OR C=$95 OR C=$96 OR C=$9D OR C=$A4 THEN TC=$10
70         IF C=$03 OR C=$07 OR C=$0D OR C=$AB OR C=$B2 OR C=$CE THEN TC=$10
75         IF C=$B1 OR C=$B9 OR C=$EA OR C=$F1 OR C=$F8 OR C=$CE THEN TC=$10
85         CHAR X+4,Y+9,TC,HEX$(C)
90         C = C + 1
95     NEXT X
100 NEXT Y
110 SLEEP 120
110 COLOR 5:PRINT TI
120 GOSUB 45000
130 PRINT TI

150 P1 = 0
160 IF P1 = 0 THEN P2=$FF:GOTO 180
170 P2 = P1 - 1
180 GOSUB 20750
190 P1 = P1 + 1:IF P1>$FF THEN P1=0
200 GET X$:IF X$=CHR$(27) THEN GOSUB 45000:GOTO 8000
240 GOTO 160

8000 GET X$:IF X$<>"" THEN GOTO 8000 : REM FLUSH KEYBOARD BUFFER
8010 GET X$:IF X$="" THEN GOTO 8010 : REM WAIT FOR KEY 
8020 SCREEN 0:END

20749 REM SWAP PALLETTE COLORS AT P1 & P2
20750 A1 = $FA00+(P1*2)
20760 A2 = $FA00+(P2*2)
20770 B1 = VPEEK (1,A1)
20780 B2 = VPEEK (1,A1+1)
20790 B3 = VPEEK (1,A2)
20800 B4 = VPEEK (1,A2+1)
20810 VPOKE 1, A1, B3
20820 VPOKE 1, A1+1, B4
20830 VPOKE 1, A2, B1
20840 VPOKE 1, A2+1, B2
20850 RETURN 

45000 RESTORE 50000
45010 BA = $FA00:REM PALLETTE BASE ADDRESS IN VERA RAM
45020 FOR PE = 0 TO 255
45025     READ R:READ GB
45030     VPOKE 1,BA+(PE*2),GB
45035     VPOKE 1,BA+(PE*2)+1, R
45040 NEXT PE
45050 RETURN

49999 REM DEFAULT VERA PALLETTE AS DATA. FROM 0 TO 255 (2 BYTES EACH ENTRY)RGB
50000 DATA $00,$00,$0F,$FF,$08,$00,$0A,$FE,$0C,$4C,$00,$C5,$00,$0A,$0E,$E7,$0D
50005 DATA $85,$06,$40,$0F,$77,$03,$33,$07,$77,$0A,$F6,$00,$8F,$0B,$BB,$00,$00
50010 DATA $01,$11,$02,$22,$03,$33,$04,$44,$05,$55,$06,$66,$07,$77,$08,$88,$09
50015 DATA $99,$0A,$AA,$0B,$BB,$0C,$CC,$0D,$DD,$0E,$EE,$0F,$FF,$02,$11,$04,$33
50020 DATA $06,$44,$08,$66,$0A,$88,$0C,$99,$0F,$BB,$02,$11,$04,$22,$06,$33,$08
50025 DATA $44,$0A,$55,$0C,$66,$0F,$77,$02,$00,$04,$11,$06,$11,$08,$22,$0A,$22
50030 DATA $0C,$33,$0F,$33,$02,$00,$04,$00,$06,$00,$08,$00,$0A,$00,$0C,$00,$0F
50035 DATA $00,$02,$21,$04,$43,$06,$64,$08,$86,$0A,$A8,$0C,$C9,$0F,$EB,$02,$11
50040 DATA $04,$32,$06,$53,$08,$74,$0A,$95,$0C,$B6,$0F,$D7,$02,$10,$04,$31,$06
50045 DATA $51,$08,$62,$0A,$82,$0C,$A3,$0F,$C3,$02,$10,$04,$30,$06,$40,$08,$60
50050 DATA $0A,$80,$0C,$90,$0F,$B0,$01,$21,$03,$43,$05,$64,$07,$86,$09,$A8,$0B
50055 DATA $C9,$0D,$FB,$01,$21,$03,$42,$04,$63,$06,$84,$08,$A5,$09,$C6,$0B,$F7
50060 DATA $01,$20,$02,$41,$04,$61,$05,$82,$06,$A2,$08,$C3,$09,$F3,$01,$20,$02
50065 DATA $40,$03,$60,$04,$80,$05,$A0,$06,$C0,$07,$F0,$01,$21,$03,$43,$04,$65
50070 DATA $06,$86,$08,$A8,$09,$CA,$0B,$FC,$01,$21,$02,$42,$03,$64,$04,$85,$05
50075 DATA $A6,$06,$C8,$07,$F9,$00,$20,$01,$41,$01,$62,$02,$83,$02,$A4,$03,$C5
50080 DATA $03,$F6,$00,$20,$00,$41,$00,$61,$00,$82,$00,$A2,$00,$C3,$00,$F3,$01
50085 DATA $22,$03,$44,$04,$66,$06,$88,$08,$AA,$09,$CC,$0B,$FF,$01,$22,$02,$44
50090 DATA $03,$66,$04,$88,$05,$AA,$06,$CC,$07,$FF,$00,$22,$01,$44,$01,$66,$02
50095 DATA $88,$02,$AA,$03,$CC,$03,$FF,$00,$22,$00,$44,$00,$66,$00,$88,$00,$AA
50100 DATA $00,$CC,$00,$FF,$01,$12,$03,$34,$04,$56,$06,$68,$08,$8A,$09,$AC,$0B
50105 DATA $CF,$01,$12,$02,$24,$03,$46,$04,$58,$05,$6A,$06,$8C,$07,$9F,$00,$02
50110 DATA $01,$14,$01,$26,$02,$38,$02,$4A,$03,$5C,$03,$6F,$00,$02,$00,$14,$00
50115 DATA $16,$00,$28,$00,$2A,$00,$3C,$00,$3F,$01,$12,$03,$34,$05,$46,$07,$68
50120 DATA $09,$8A,$0B,$9C,$0D,$BF,$01,$12,$03,$24,$04,$36,$06,$48,$08,$5A,$09
50125 DATA $6C,$0B,$7F,$01,$02,$02,$14,$04,$16,$05,$28,$06,$2A,$08,$3C,$09,$3F
50130 DATA $01,$02,$02,$04,$03,$06,$04,$08,$05,$0A,$06,$0C,$07,$0F,$02,$12,$04
50135 DATA $34,$06,$46,$08,$68,$0A,$8A,$0C,$9C,$0F,$BE,$02,$11,$04,$23,$06,$35
50140 DATA $08,$47,$0A,$59,$0C,$6B,$0F,$7D,$02,$01,$04,$13,$06,$15,$08,$26,$0A
50145 DATA $28,$0C,$3A,$0F,$3C,$02,$01,$04,$03,$06,$04,$08,$06,$0A,$08,$0C,$09
50150 DATA $0F,$0B

Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Re: VERA PALLETTE UPDATE USING VPOKE.

Post by Ed Minchau »

ahenry3068 wrote: Fri Jul 28, 2023 9:03 am BVLOAD to FA00 is probably faster ...
There's a two byte header, so use VLOAD.
Post Reply