v9958 problem - how much different sprite colors possible?

Page 1/2
| 2

By vossi

Rookie (25)

vossi's picture

09-03-2019, 07:28

Hi, I have some msx-machines here.
But now I built a v9958-graphics-card for cbm2-computer (610, 710, B128, B256).
I'm coding a nice intro with 16 16x16 sprites in graphics mode 3.
The sprite have different colors defined in the sprite color table.
But the sprites 8-15 have the same colorline on the screen as sprite 0-7 ???
Is there a limitation?

On the pic C and B are sprites 0-7 - M and II are sprites 8-15:

Greets
Christian

Login or register to post comments

By ghost_jp

Master (136)

ghost_jp's picture

09-03-2019, 08:14

I wonder that was caused by a well-known mis-introduction of VDP specification. To conclusion, the 9th bit of the sprite attribute table address must be 1. As the result, the actual address of the table is 0200h elder than you intended.

By vossi

Rookie (25)

vossi's picture

09-03-2019, 09:16

Hi, thanks for the answer.
My reg 5 is $3f - this results in $1e00 for the attribute table and the color table should be automatically at $1c00 ($200 below).
The attributes works perfectly at this address. But the color is repeated after sprite 8 ...???

By ghost_jp

Master (136)

ghost_jp's picture

09-03-2019, 10:03

vossi wrote:

My reg 5 is $3f - this results in $1e00 for the attribute table and the color table should be automatically at $1c00 ($200 below).

I'm sure that is correct. To make sure, could you show us the contents of your sprite color table, or the logic to fill values there?

By Metalion

Paragon (1628)

Metalion's picture

09-03-2019, 10:13

Beware (it happened to me ...) that, though it does not seem logical because of the SPAT size, that the first 3 bits of R#5 must be set to 1 and that the bit 2 (for A9) IS INDEED used for the address.

By Grauw

Ascended (10819)

Grauw's picture

09-03-2019, 10:41

If bits 0-2 of r#5 are not 1, it will introduce mirroring. If the colours repeat after sprite 8, this sounds like bit 0 (A7) is zero, causing it to mirror after the first 128 bytes of the table. Are you absolutely sure that r#5 is 3FH and not 3EH or 3CH?

By vossi

Rookie (25)

vossi's picture

09-03-2019, 10:43

On the picture that was a test. But I want cbm in blue colors and II in red colors.
But all sprites are in blue colors wis this table:

15 is white, 1-7 are blue tones, 8-14 are red tones

SpriteColorData:
!byte 15,1,1,2,2,3,3,3,4,4,4,4,4,4,4,4
!byte 15,1,1,2,2,3,3,3,4,4,4,4,4,4,4,4
!byte 5,5,5,5,5,5,5,5,5,5,5,6,6,6,7,7
!byte 5,5,5,5,5,5,5,5,5,5,5,6,6,6,7,7
!byte 15,1,1,2,2,3,3,3,4,4,4,4,4,4,4,4
!byte 15,1,1,2,2,3,3,3,4,4,4,4,4,4,4,4
!byte 5,5,5,5,5,5,5,5,5,5,5,6,6,6,7,7
!byte 5,5,5,5,5,5,5,5,5,5,5,6,6,6,7,7
!byte 15,1,1,2,2,3,3,3,4,4,4,4,4,4,4,4
!byte 15,1,1,2,2,3,3,3,4,4,4,4,4,4,4,4
!byte 5,5,5,5,5,5,5,5,5,5,5,6,6,6,7,7
!byte 5,5,5,5,5,5,5,5,5,5,5,6,6,6,7,7
!byte 15,8,8,9,9,9,10,10,10,10,10,10,11,11,11,11
!byte 15,8,8,9,9,9,10,10,10,10,10,10,11,11,11,11
!byte 11,11,11,11,11,12,12,12,12,12,12,13,13,13,14,14
!byte 11,11,11,11,11,12,12,12,12,12,12,13,13,13,14,14
SpriteColorDataEnd:

By vossi

Rookie (25)

vossi's picture

09-03-2019, 10:47

The code is 6502/6509 assembler with macros:
The copy code works with other usage (font copy e.g.)

MACROS:
!macro ldax16i .v{ ; *** loads 16bit immidiate to XXAA
lda # <.v
ldx # >.v
}
!macro st16i .a, .v{ ; *** store 16bit immidiate to address
lda # <.v
sta .a
lda # >.v
sta .a+1
}

!addr vdpcopy16_data = VdpCopy16CodePointer+1 ; 16bit pointer to LDA-address in VdpCopy16

; * copy sprite data to sprite pattern table
+st16i vdpcopy16_data, SpriteData
+st16i vdp_size, SpriteDataEnd - SpriteData
+ldax16i SpritePatternTable ; VRAM address in XXAA
jsr VdpCopy16

SUBROUTINE:
VdpCopy16: ; *** copy vdp_size bytes from pointer to VRAM at $XXAA ***
ldy #$00
+VdpWriteAddress64
inc vdp_size+1 ; add 1 to count-highbyte because nessasary dec count+1
ldx vdp_size
VdpCopy16CodePointer: ; +1,+2 = data address in memory
- lda DUMMYADDRESS ; load data
sta(VDPRamWrite),y
+inc16 VdpCopy16CodePointer+1 ; increase lda address
dex
bne -
dec vdp_size+1
bne -
rts

By vossi

Rookie (25)

vossi's picture

09-03-2019, 10:51

Grauw wrote:

If bits 0-2 of r#5 are not 1, it will introduce mirroring. If the colours repeat after sprite 8, this sounds like bit 0 (A7) is zero, causing it to mirror after the first 128 bytes of the table. Are you absolutely sure that r#5 is 3FH and not 3EH or 3CH?

THANKS - that was ist!!!

At first I had $3C (A9=1 correct) and I recently changed to $3F - but only in the comments and not in the real vdp-init-data-table!
Why to hell must bit 0+1 = 1 ???

By vossi

Rookie (25)

vossi's picture

09-03-2019, 10:54

If someone is interested in my CBM2 - v9958-card project:

gitub.com/vossi1

In pictures folder are some nice 256 color pics.
I wrote a C-tool that converts a 24bit-BMP file to 256 color-8bit-RGB-file for the V9958 mode 7!

By Manuel

Ascended (19676)

Manuel's picture

09-03-2019, 12:43

Any example pics online?

Page 1/2
| 2