Jump to content
IGNORED

GET PAPI ! Collision TILE/SPRITE in 8 directions problem.


Vetea

Recommended Posts

Hello here !

 

I've started the Intybasic & Intellivision since few days and it's a wonderful SDK.

Actually I have a problem with my collision engine TILE/SPRITE.

 

Here the complete listing :

	REM ====================================
	REM ====        GET PAPI !!         ====
	REM ====           V1.1             ====
	REM ====  (c) 2018 STUDIO VETEA     ====
	REM ====================================
	
	
	' Type de Robot : 1 - Black, 2 - Jaune, 3 - ROuge, 4 - Rose.
	

	INCLUDE "constants.bas"
	INCLUDE "title.bas"
	
	'Fond Vert
	MODE SCREEN_CS, CS_GREEN, GREEN, GREEN,GREEN
	
	'On déclare toutes les variableS.
	Option Explicit
	
	
	'Déclaration Sprites/TILE
	WAIT
	DEFINE DEF00,4,SpritePapiDROITE_0
	WAIT
	DEFINE DEF04,3,SpriteIADroite
	WAIT
	DEFINE DEF07,3,SpriteIABAS
	WAIT
	DEFINE DEF10,3,SpriteIAHAUT
	wait
	DEFINE 13,10,TilesDecor
	WAIT
	DEFINE 23,1,AnimationPorte0
	
	'Constantes
	CONST MUR_H=$0800+13*8 'Adresse Ecran $0800 + Couleur. Ici NOIR = 0 + Position GRAM * 8 ( TILE 8x8)
	CONST MUR_B=$0800+14*8
	CONST MUR_D=$0800+15*8
	CONST MUR_G=$0800+16*8
	CONST SOL = $0804+17*8	
	CONST MUR = $0800+18*8
	CONST SOL1= $0804+19*8
	CONST PORT= $800+23*8
	
	'Constante Collision Objets
	CONST COL_MURH=BG13+FG_BLACK 
	CONST COL_MURB=BG14+FG_BLACK 
	CONST COL_MURD=BG16+FG_BLACK 
	CONST COL_MURG=BG15+FG_BLACK 
	CONST COL_MUR= BG18+FG_BLACK 

	'Variables
	DIM LVL(5)				'DIF IA sur la durée
	DIM #TEMP(5)			'Tempo DIF IA
	DIM X1(5)				'POSX IA
	DIM Y1(5)				'POSY IA
	DIM INT(5)				'INT IA
	DIM TYPE(5)				'TYPE ROBOT IA
	DIM Sens(5)				'DIRECTION IA
	DIM Chemin(5)			'DISTANCE PARCOURUE IA
	DIM CheminMAX(5)		'DISTANCE MAX IA
	DIM TempoAnimation(5)	'TEMPO ANIMATION IA
	DIM TempoIA(5)			'VITESSE IA
	DIM TempoIA_MAX(5)		'VITESSE MAXI IA
	DIM ModeHunt(5)			'Mode Chasse ?
	DIM i,Direction,VitessePapi,TempoPapi,VitessePapiMax,X,Y,PhaseJeu,Value,Temps,TempoTile,FR,XiA,YiA,COLI,OY,OX,T_IA,BX,UNIT,OPENPORTE
	DIM #C,#C1,#C2,#C3,#MIROIR,#SPR,#MIROIR1,#COLOR,#OFFSET,#BESTIME,#TEMPS,#EYE
	

Debut:
	CLS
	'Position/Config Sprites
	for i=1 to 4
		X1(i)=80
		Y1(i)=16
		if i>1 then sens(i)=4 else sens(i)=1 ' Au démarrage les robots suivants attendent leur tour.
		CheminMAX(i)=(RAND % 75)+25
		TempoIA(i)=0
		INT(i)=RAND % 50
		TempoIA_MAX(i)=15
		#TEMP(i)=0
		TempoAnimation(i)=0
		ModeHunt(i)=0
		TYPE(i)=i
		LVL(i)=0
	next
	
	'Variables JEU/Joueur
	Direction=1 '0 HAUT, 1 BAS, 2 DROITE, 3 GAUCHE
	VitessePapi=3
	TempoPapi=0
	VitessePapiMax=3
	if #temps>#Bestime then #Bestime=#Temps
	#Temps=0
	X=80
	Y=56
	PhaseJeu=0
	OPENPORTE=0
	
	'Tableau de jeu
	restore Map
	for i=0 to 239
		read value
		if value=9 then #backtab(i)=0
		if value=17 then #backtab(i)=SOL
		if value=13 then #backtab(i)=MUR_H 
		if value=14 then #backtab(i)=MUR_B 
		if value=15 then #backtab(i)=MUR_D 
		if value=16 then #backtab(i)=MUR_G 
		if value=18 then #backtab(i)=MUR 
	next
	
	
	'Affichage du Temps
	print at (SCREENPOS(0,0)) color CS_WHITE, "TIME :"
	print at (SCREENPOS(7,0)) color CS_WHITE, <3>temps
	print at (SCREENPOS(11,0)) color CS_WHITE, "BEST :"
	print at (SCREENPOS(17,0)) color CS_WHITE, <3>#Bestime
	
	'#########################
	'### Boucle principale ###
	'#########################
	while 1 
		'Animation Tile
		Gosub AnimationTile
		'Gestion temps
		gosub gestionTime
		'Affichage Sprite
		gosub AffSprite
		'Gestion Collision Sprites
		gosub GestionCollision 
		wait
	wend
	
'Animation Tile Tableau
AnimationTile: PROCEDURE
	TempoTile=TempoTile+1
	'Sol
	if TempoTile=32 then DEFINE 17,1,SOL2:wait
	if TempoTile=64 then  DEFINE 17,1,SOL1:wait
	if TempoTile>64 then TempoTile=0
	'Porte
	if PhaseJeu=0 then
		#backtab(29)=PORT
		if OPENPORTE=0 then
			if TempoTile=4 then DEFINE 23,1,AnimationPorte1 :wait
			if TempoTile=8 then DEFINE 23,1,AnimationPorte2 :wait
			if TempoTile=12 then DEFINE 23,1,AnimationPorte3 :wait
			if TempoTile=16 then DEFINE 23,1,AnimationPorte4 :wait
			if TempoTile=20 then DEFINE 23,1,AnimationPorte5 :wait
			if TempoTile=24 then DEFINE 23,1,AnimationPorte6 :wait:OPENPORTE=2
		ELSEIF OPENPORTE=1 then
			if TempoTile=4 then DEFINE 23,1,AnimationPorte6 :wait
			if TempoTile=8 then DEFINE 23,1,AnimationPorte5 :wait
			if TempoTile=12 then DEFINE 23,1,AnimationPorte4 :wait
			if TempoTile=16 then DEFINE 23,1,AnimationPorte3 :wait
			if TempoTile=20 then DEFINE 23,1,AnimationPorte2 :wait
			if TempoTile=24 then DEFINE 23,1,AnimationPorte1 :wait
			if TempoTile=28 then DEFINE 23,1,AnimationPorte0 :wait
			if TempoTile=32 then DEFINE 23,1,AnimationPorte7 :wait:PhaseJeu=1:#backtab(29)=MUR_H
		end if
	end if


	end
	
'Gestion Collision Sprites
GestionCollision: PROCEDURE

	if FRAME then
		'Detection de Papi COL0 avec les 4 autres Sprites Ennemis après une FRAME
		IF COL0 AND HIT_SPRITE4+HIT_SPRITE5+HIT_SPRITE6+HIT_SPRITE7 THEN gosub CollisionSPRITE
		'Detection entre IA/Ralentissement de l'IA.
		if COL4 then if INT(1)>50 then if HIT_SPRITE5+HIT_SPRITE6+HIT_SPRITE7 then
			TempoIA_MAX(1)=15
			INT(1)=0
			LVL(1)=0
			#TEMP(1)=0
		end if
		if COL5 and INT(2)>50 and HIT_SPRITE4+HIT_SPRITE6+HIT_SPRITE7 then
			TempoIA_MAX(2)=15
			INT(2)=0
			LVL(2)=0
			#TEMP(2)=0
		end if
		if COL6 and INT(3)>50 and HIT_SPRITE4+HIT_SPRITE5+HIT_SPRITE7 then
			TempoIA_MAX(3)=15
			INT(3)=0
			LVL(3)=0
			#TEMP(3)=0
		end if
		if COL7 and INT(4)>50 and HIT_SPRITE4+HIT_SPRITE5+HIT_SPRITE6 then
			TempoIA_MAX(4)=15
			INT(4)=0
			LVL(4)=0
			#TEMP(4)=0
		end if
	end if

	return
	end
	
'Gestion du temps
GestionTime: PROCEDURE
	FR=FR+1
	if FR=96 then
		#temps=#temps+1:FR=0
	end if
	print at (SCREENPOS(7,0)) color CS_WHITE, <3>#temps
	return
	end
	
'Procedure de Collision Sprite
CollisionSPRITE: PROCEDURE
	FOR i = 0 TO 31
	WAIT
	SPRITE 0,X+HIT+VISIBLE,Y+ZOOMY2,SPR00+(i AND SPR_WHITE) 
	SPRITE 1,X+HIT+VISIBLE,Y+ZOOMY2,SPR01+(i AND SPR_RED) 
	SPRITE 2,X+HIT+VISIBLE,Y+ZOOMY2,SPR02+(i AND SPR_PINK) 
	SPRITE 3,X+HIT+VISIBLE,Y+ZOOMY2,SPR03+(i AND SPR_BLACK) 
	
	SOUND 0,(i and 7)*32+32,15
	SOUND 1,(i and 7)*36+32,15
	SOUND 2,(i and 7)*40+32,15
	NEXT
	SOUND 0,,0
	SOUND 1,,0
	SOUND 2,,0

	FOR i = 0 to 100
	WAIT
	NEXT
	
	'INIT Sprite
	SPRITE 0,0,0
	SPRITE 1,0,0
	SPRITE 2,0,0
	SPRITE 3,0,0
	SPRITE 4,0,0
	SPRITE 5,0,0
	SPRITE 6,0,0
	SPRITE 7,0,0
	
	goto debut
	return
	end
	
'Offset PAPI
Test_Collision: PROCEDURE
	'Offset Coordonnée
	if UNIT=0 then #offset = x/8+y/8*20 else #offset = xIA/8+yIA/8*20
	COLI=0
	'Test au 4 coins des objets.
	#c  = PEEK($01FF+#offset)
	#c1 = PEEK($0200+#offset)
	#c2 = PEEK($01EC+#offset)
	#c3 = PEEK($01EB+#offset)
	
	'Bord de la MAP
	'Mur Haut ?
	if #c2 =COL_MURH then COLI=1:return
	'Mur Bas ?
	if #c1 =COL_MURB then COLI=1:return
	'Mur Droite
	if #c3 =COL_MURG then COLI=1:return
	'Mur Gauche
	if #c1=COL_MURD then COLI=1:return
	
	'Obstacle
	if #c=COL_MUR then COLI=1:return
	if #c1=COL_MUR then COLI=1:return
	if #c2=COL_MUR then COLI=1:return
	if #c3=COL_MUR then COLI=1:return

	end
	
'Procedure de Gestion de Sprite
 AffSprite: PROCEDURE
	'Gestion Vitesse/Active sur si PAD Actif.
	if CONT then 
		VitessePapi=VitessePapi+1
	else
	'Animation quand PAD inactif
		#Miroir=0
		if Direction=0 then DEFINE DEF00, 4, SpritePapiHAUT_1
		if Direction=1 then DEFINE DEF00, 4, SpritePapiBAS_1
		if Direction=2 then DEFINE DEF00, 4, SpritePapiDROITE_1
		if Direction=3 then DEFINE DEF00, 4, SpritePapiDROITE_1:#miroir=FLIPX
	end if

	'On peut fixer la vitesse de Papi dans la condition.
	if VitessePapi>VitessePapiMax then 
		VitessePapi=0
		TempoPapi=TempoPapi+1
		if TempoPapi>4 then TempoPapi=0
		'Papi Commando !
		'Commandes
		'PAD Actif !
		IF CONT1.UP THEN 
			OY=Y
			Y=Y-1 
			UNIT=0
			gosub Test_Collision
			IF COLI then Y=OY
			Direction=0
			SOUND 1,15,10
			
			if TempoPapi=1 then DEFINE DEF00, 4, SpritePapiHAUT_0
			if TempoPapi=2 then DEFINE DEF00, 4, SpritePapiHAUT_1
			if TempoPapi=3 then DEFINE DEF00, 4, SpritePapiHAUT_2
			if TempoPapi=4 then DEFINE DEF00, 4, SpritePapiHAUT_1
			#miroir=0
		end if
		IF CONT1.DOWN THEN 
			OY=Y
			Y=Y+1
			UNIT=0
			gosub Test_Collision
			if COLI then Y=OY
			Direction=1
			SOUND 1,15,10
			if TempoPapi=1 then DEFINE DEF00, 4, SpritePapiBAS_0
			if TempoPapi=2 then DEFINE DEF00, 4, SpritePapiBAS_1
			if TempoPapi=3 then DEFINE DEF00, 4, SpritePapiBAS_2
			if TempoPapi=4 then DEFINE DEF00, 4, SpritePapiBAS_1
			#miroir=0
		end if
		IF CONT1.LEFT THEN 
			OX=X
			X=X-1 
			UNIT=0
			gosub Test_Collision
			IF COLI then X=OX
			Direction=3
			SOUND 1,15,10
			#miroir=FLIPX
			if TempoPapi=1 then DEFINE DEF00, 4, SpritePapiDROITE_0
			if TempoPapi=2 then DEFINE DEF00, 4, SpritePapiDROITE_1
			if TempoPapi=3 then DEFINE DEF00, 4, SpritePapiDROITE_2
			if TempoPapi=4 then DEFINE DEF00, 4, SpritePapiDROITE_1
		end if
		IF CONT1.RIGHT THEN 
			OX=X
			X=X+1
			UNIT=0
			gosub Test_Collision
			if COLI then X=OX
			Direction=2
			SOUND 1,15,10
			if TempoPapi=1 then DEFINE DEF00, 4, SpritePapiDROITE_0
			if TempoPapi=2 then DEFINE DEF00, 4, SpritePapiDROITE_1
			if TempoPapi=3 then DEFINE DEF00, 4, SpritePapiDROITE_2
			if TempoPapi=4 then DEFINE DEF00, 4, SpritePapiDROITE_1
			#miroir=0
		end if
	end if

	'Affiche les sprites de Papi
	SPRITE 0,X+VISIBLE+HIT,Y+ZOOMY2+#miroir,SPR00+SPR_WHITE
	SPRITE 1,X+VISIBLE+HIT,Y+ZOOMY2+#miroir,SPR01+SPR_RED
	SPRITE 2,X+VISIBLE+HIT,Y+ZOOMY2+#miroir,SPR02+SPR_PINK
	SPRITE 3,X+VISIBLE+HIT,Y+ZOOMY2+#miroir,SPR03+SPR_BLACK 
	
	'Zap de l'IA

	'Sprites Ennemis
	for i=1 to 4
		'Si démarrage partie, alors les robots apparaissent les uns après les autres.
		if OPENPORTE=2 then
			sens(1)=1
			if chemin(i)>128*i then sens(i)=1
			if chemin(1)>128 then sens(2)=1
			if chemin(2)>128 then sens(3)=1
			if chemin(3)>128 then sens(4)=1
			if Chemin(4)>128 then OPENPORTE=1
			if sens(i)=1 then chemin(i)=chemin(i)+1
		else
			#TEMP(I)=#TEMP(I)+1
			if #TEMP(i)>30000 then #TEMP(i)=30000
		end if	
		
		'Au fur et a mesure que le temps passe, les choses se corsent ... ^^
		LVL(i)=#TEMP(I)/128
		if LVL(i)>48 then LVL(i)=48
		if TempoIA_MAX(i)>=LVL(i) then
			T_IA=TempoIA_MAX(i)-LVL(i)
			if T_IA<2 then T_IA=2
		end if
		INT(i)=INT(i)+(LVL(i)*i)
		TempoIA(i)=TempoIA(i)+1
		
		'Gestion Sprite
		if TempoIA(i)>T_IA then 
			'Son
			SOUND 2,500,10
			'Tempo Animation
			TempoAnimation(i)=TempoAnimation(i)+1
			if TempoAnimation(i)>4 then TempoAnimation(i)=1
			TempoIA(i)=0
			
			'Gestion IA/Chemin - Pathfinding
			if PhaseJeu=1 then
				'Test Collision
				xIA=x1(i)
				yIA=y1(i)
				UNIT=1
				gosub Test_Collision
				'Mode Chasse ?
				if int(i)>55 then if ModeHunt(i)=0 then ModeHunt(i)=0 
				'Mode Chasse Activé ?
				if ModeHunt(i)=0 then
					Chemin(i)=Chemin(i)+1
					if Chemin(i)>(CheminMAX(i)) or COLI=1 then
						IF COLI=1 then
							if sens(i)=0 then sens(i)=1:goto fini
							if sens(i)=1 then sens(i)=0:goto fini
							if sens(i)=2 then sens(i)=3:goto fini
							if sens(i)=3 then sens(i)=2:goto fini
						end if
						sens(i)=rand % 4
						Chemin(i)=0
Fini:
					end if
				else
					'Mode Chasse actif !
				end if			
			end if
			'FLIP ?
			#miroir1=0
			#Eye=VISIBLE
PathIA:
			On sens(i) goto ANIM_H,ANIM_B,ANIM_D,ANIM_G
			'Déplacement IA
ANIM_H:
			#SPR=SPR09
			gosub ChoixSprite
			goto suite
ANIM_B:
			#SPR=SPR06
			gosub ChoixSprite
			goto suite
ANIM_D:
			#SPR=SPR03
			gosub ChoixSprite
			goto suite
ANIM_G:
			#miroir1=FLIPX
			#SPR=SPR03
			gosub ChoixSprite
			
Suite:
			'Couleur Sprites
			if i=1 then #Color=SPR_BLACK
			if i=2 then #Color=SPR_YELLOW
			if i=3 then #Color=SPR_RED
			if i=4 then #Color=SPR_PINK
			'Déplacement
			on sens(i) goto HAUTIA,BASIA,DROITEIA,GAUCHEIA,NULL
			
HAUTIA:
			y1(i)=y1(i)-1:goto AFF
BASIA:
			y1(i)=y1(i)+1:goto AFF
DROITEIA:
			x1(i)=x1(i)+1:goto AFF
GAUCHEIA:
			x1(i)=x1(i)-1:goto AFF
NULL:
			#Eye=0
AFF:
			'Affichage ennemis
			SPRITE 3+i,x1(i)+HIT+#Eye,y1(i)+ZOOMY2+#miroir1,#SPR+#Color
		end if
		SOUND 2,,0
	next
Fin:
	SOUND 1,,0
	END

'Selection Sprite IA	
ChoixSprite: Procedure
	if TempoAnimation(i)<4 then
	 #SPR = #SPR +TempoAnimation(i)*8
	else
	 #SPR = #SPR + 2*8
	end if
	End
	

	
'########################
'#### MAP Principale ####
'########################
Map:
	Data 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9 ' HUD
	Data 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13
	Data 15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16
	Data 15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16
	Data 15,17,17,18,18,18,17,17,18,17,17,18,17,17,18,18,18,17,17,16
	Data 15,17,17,17,17,18,17,17,17,17,17,17,17,17,18,17,17,17,17,16
	Data 15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16
	Data 15,17,17,17,17,18,17,17,17,17,17,17,17,17,18,17,17,17,17,16
	Data 15,17,17,18,18,18,17,17,18,17,17,18,17,17,18,18,18,17,17,16
	Data 15,17,18,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16
	Data 15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16
	Data 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14


'########################
'### Ressources TILES ###
'########################
AnimationPorte0:
	BITMAP "#......#"
	BITMAP "########"
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"
	
AnimationPorte1:
	BITMAP "########"
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"	
	BITMAP "########"	

AnimationPorte2:
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	
AnimationPorte3:
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"

AnimationPorte4:
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	
AnimationPorte5:
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"

AnimationPorte6:
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	
AnimationPorte7:
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "########"
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	
TilesDecor:
	REM MUR FACE - ID 13
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "########"
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	
	REM MUR FOND - ID 14
	BITMAP "******#*"
	BITMAP "#.*..*.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.*..*.#"
	BITMAP "#******#"
	BITMAP "#......#"
	BITMAP "#......#"
	
	REM MUR COTE DROIT - ID 15
	BITMAP "########"
	BITMAP "...#...#"
	BITMAP "...##.*#"
	BITMAP "...#...#"
	BITMAP "...#...#"
	BITMAP "...##.*#"
	BITMAP "...#...#"
	BITMAP "########"
	
	REM MUR COTE GAUCHE - ID 16
	BITMAP "########"
	BITMAP "*...*..."
	BITMAP "**.**..."
	BITMAP "*...*..."
	BITMAP "*...*..."
	BITMAP "**.**..."
	BITMAP "*...*..."
	BITMAP "########"
	
	REM SOL - ID 17
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	BITMAP ".#....#."
	BITMAP ".#....#."
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	
	REM MUR SALON - ID 18
	BITMAP "########"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "########"
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	
SOL2:
	REM SOL2 
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	BITMAP "#.####.#"
	BITMAP "#.####.#"
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	
SOL1:
	REM SOL - ID 17
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	BITMAP ".#....#."
	BITMAP ".#....#."
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	
	
'##########################
'### Ressources SPRITES ###
'##########################
	
'Sprite Papi
SpritePapiHaut_0:
	'WHITE
	BITMAP ".#....#."
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "#######."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "...##..."
	BITMAP "..#....."
	BITMAP ".#...#.."
	BITMAP "......#."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "...###.."
	BITMAP "..###..."
	BITMAP ".##.##.."
	BITMAP ".....##."
	
SpritePapiHaut_1:
	'WHITE
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "........"
	BITMAP ".######."
	BITMAP "#......."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "...##..."
	BITMAP "..#..#.."
	BITMAP ".#....#."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "...##..."
	BITMAP "..####.."
	BITMAP "..####.."
	
SpritePapiHaut_2:
	'WHITE
	BITMAP ".#....#."
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "#######."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "...##..."
	BITMAP ".....#.."
	BITMAP "...#..#."
	BITMAP "..#....."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "..###..."
	BITMAP "...###.."
	BITMAP "..##.##."
	BITMAP ".##....."
	
SpritePapiBAS_0:
	'WHITE
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP ".#....#."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "##.##.#."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "...##..."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP ".#......"
	BITMAP "......#."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "..####.."
	BITMAP ".##.##.."
	BITMAP ".....##."
	
SpritePapiBAS_1:
	'WHITE
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP ".#....#."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "........"
	BITMAP ".#.##.#."
	BITMAP "#......."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "...##..."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "..####.."
	
SpritePapiBAS_2:
	'WHITE
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP ".#....#."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "##.##.#."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "...##..."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "......#."
	BITMAP ".#......"
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "..##.##."
	BITMAP ".##....."

SpritePapiDROITE_0:
	'WHITE
	BITMAP ".#......"
	BITMAP "..##.##."
	BITMAP ".#......"
	BITMAP ".##.#.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "##..#..."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..#####."
	BITMAP "........"
	BITMAP "..#.#.#."
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP ".##...#."
	BITMAP ".#......"
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "...###.."
	BITMAP "..####.."
	BITMAP "..#..##."
	
SpritePapiDROITE_1:
	'WHITE
	BITMAP "........"
	BITMAP ".#......"
	BITMAP "..##.##."
	BITMAP ".#......"
	BITMAP ".##.#.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "........"
	BITMAP ".#..#..."
	BITMAP "#......."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "........"
	BITMAP "..#####."
	BITMAP "........"
	BITMAP "..#.#.#."
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP "..#...#."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "...###.."
	BITMAP "..####.."
	
SpritePapiDROITE_2:
	'WHITE
	BITMAP ".#......"
	BITMAP "..##.##."
	BITMAP ".#......"
	BITMAP ".##.#.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "##..#..."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..#####."
	BITMAP "........"
	BITMAP "..#.#.#."
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP "...#...."
	BITMAP ".#..#..."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "..#.##.."
	BITMAP "..##.##."
	BITMAP ".#...#.."

'Sprite IA	
SpriteIAHAUT:
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".######."
	BITMAP "..####.."
	BITMAP ".#####.."
	BITMAP "..#####."
	BITMAP ".##.##.."
	BITMAP ".....##."
	
	BITMAP "........"
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".######."
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP "..####.."
	BITMAP ".##..##."

	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".######."
	BITMAP "..####.."
	BITMAP "..#####."
	BITMAP ".#####.."
	BITMAP "..##.##."
	BITMAP ".##....."
	
SpriteIABAS:
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP ".#####.."
	BITMAP "..#####."
	BITMAP ".##.##.."
	BITMAP ".....##."
	
	BITMAP "........"
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP "..####.."
	BITMAP ".##..##."
	
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP "..#####."
	BITMAP ".#####.."
	BITMAP "..##.##."
	BITMAP ".##....."
	
SpriteIADroite:
	BITMAP "..####.."
	BITMAP ".####.#."
	BITMAP ".###.##."
	BITMAP "..####.."
	BITMAP "...####."
	BITMAP "...###.."
	BITMAP "..##.##."
	BITMAP "..#....."

	BITMAP "........"
	BITMAP "..####.."
	BITMAP ".####.#."
	BITMAP ".###.##."
	BITMAP "..####.."
	BITMAP "...##..."
	BITMAP "...##..."
	BITMAP "...###.."

	BITMAP "..####.."
	BITMAP ".####.#."
	BITMAP ".###.##."
	BITMAP "..####.."
	BITMAP "...##..."
	BITMAP "..####.."
	BITMAP "...#.##."
	BITMAP "..#....."

The ROM is attached.

 

If you test/Compile the code, you cant walk trough 2 TILE ( 8 px space ), here is the problem !

 

I pass many hours to find a way, but without success ...

IF you have an idea, it will be great ! :)

 

Many thanks !

Cheers,

Vetea

 

PapiCommando.rom

Link to comment
Share on other sites

CheckWall:procedure


lx=vmX
ly=vmY

while vmsY>=200:vmY=vmY-1:vmsY=vmsY+8:wend
while vmsY>=8:vmY=vmY+1:vmsY=vmsY-8:wend
while vmsX>=200:vmX=vmX-1:vmsX=vmsX+8:wend
while vmsX>=8:vmX=vmX+1:vmsX=vmsX-8:wend


charx=(vmX-4)/8
chary=(vmY-4)/8
if debug<>0 then
print at 236 color 6,<2> charx
print at 238 color 7,<2> chary
end if
Mcard=PEEK($200+charx+chary*20)
Mcard=Mcard/8
'print at 233 color 7,<3> Mcard

if Mcard>3 AND Mcard<23 then vmY=ly:vmX=lx
if Mcard=23 AND inv=0 then inv=30:HP=HP-1:gosub DrawHP:#SP=47:#SL=3:if level=0 then gosub Tutorial
if Mcard=3 then game=2:if level=0 then gosub Tutorial
if Mcard=24 then #SP=151:#SL=27:poke ($200+charx+chary*20),0:chary=chary+1:poke ($200+charx+chary*20),0:poke ($200+winx+winy*20),$081f:sc(4)=sc(4)+50:gosub AddScore:if level=0 then gosub tutorial
if Mcard=25 then #SP=151:#SL=27:poke ($200+charx+chary*20),0:chary=chary-1:poke ($200+charx+chary*20),0:poke ($200+winx+winy*20),$081f:sc(4)=sc(4)+50:gosub AddScore:if level=0 then gosub tutorial
if Mcard=26 then #SP=105:#SL=8:HP=HP+1:gosub DrawHP:poke ($200+charx+chary*20),0:sc(4)=sc(4)+15:gosub AddScore:if level=0 then gosub tutorial
if Mcard=30 then #SP=55:#SL=50:poke ($200+charx+chary*20),0:watertank=watertank+25:gosub drawTANK:sc(4)=sc(4)+10:gosub AddScore:if level=0 then gosub tutorial
if Mcard=31 then #SP=117:#SL=20:poke ($200+charx+chary*20),0:poke ($200+unlockx+unlocky*20),$0:sc(4)=sc(4)+20:gosub AddScore:if level=0 then gosub tutorial
return
end

This is my solution for 8 direction bg vs sprite collision. It stores your character previous position into lx ly. So when there's collision with the wall, it restore your character position and won't let you pass. The downside, it makes your character sticky and not able to slide against the wall.

 

And

 

Mcard=PEEK($200+charx+chary*20)

Mcard=Mcard/8

 

This get the backtab RAM value where your character is on screen and store it into 8 bit value. Why 8-bit, so it will trim the 8 high bytes. Dividing that by 8 will delete the color data of that tiles so it'll leave you 32 possible tiles with collision routine.

  • Like 1
Link to comment
Share on other sites

Sorry, I missed this thread last night. Duplicating my posts from the other thread below.

I'll continue posting here.

 

-dZ.

Edited by DZ-Jay
Link to comment
Share on other sites

Hi, Vetea,

I am so sorry, but I still do not understand the collision problem. I thought I could experience it from the updated ROM, but there do not seem to be any sprite "blocked" in it.

Do you mean that if you have two BACKTAB tiles with 8 pixels of empty space in between, the sprite cannot move into the empty space?

For example, if you have the following background tiles,

+........+          +........+
.        .          .        .
.        .          .        .
.        .          .        .
.  TILE  .          .  TILE  .
.   1    .          .   2    .
.        .          .        .
.        .  \   /   .        .
.        .   \ /    .        .
+........+    X     +........+
             / \
            /   \
              .
             /|\
              | 
              | 
            ______
           /      \
          |  PAPI  |
          |        |
           \______/

Papi is not able to move in between them.

Is that the problem?

I will have to analyse your collision code to see how it works and determine what could be the flaw.

At first glance, it looks to me that you are taking the sprite coordinates, converting them into a BACKTAB address, and comparing the type of card underneath. Take into consideration that the sprite's origin is on the top-left corner of the object. Since its position is based on its origin, then it means that the BACKTAB card you are getting is the one where the top-left corner of the sprite resides.

So consider this:

+........+         +........+
.        .         .        .
.        .         .        .
.        .         .        .
.  TILE  .         .  TILE  .
.   1    .         .   2    .
.        .         .        .
.        .         .        .
.        .         .        .
+........+         +........+
          ^
          .
          .
          .
          ########
          ########
          ########
          ########
          ########
          ########
          ########
          ########

If the sprite top-left corner happens to fall on the blocked card, then the collision will be triggered, even though the sprite should have space to go between them.

To address this, you may need to change your formula to account for the center-point of the sprite, and not its origin. Perhaps use an offset of four pixels from the origin, like this:

  if UNIT=0 then #offset = (x + 4)/8+(y + 4)/8*20 else #offset = (xIA +4)/8+(yIA + 4)/8*20

The other thing to account for is "off-by-one" errors: make sure that all your units are zero-based, so that you don't end up getting the wrong card.


Hey again,
During my pause, I've read some tips with Intybasic/Compilation/ASM ...

There is no "OR" .. Oooops, I've use it a lot .. ! :D
Try to don't use ( .. AND ... AND ... AND ... ), prefer to use IF THEN IF THEN IF THEN ...

Well I have to see my code tonight to change this.
I've code in VB, C, Basic and a little 68000 ASM, ... And now, Intellivision. OMG .. :D


There is no OR instruction in the CPU, so it is implemented in terms of AND and XOR instructions, and therefore it is expensive. It is fine to use it once in a while, but not in critical statements, such as conditional blocks in the critical path.

The point about avoiding too many AND operators is because each one requires the evaluation of both sides (there is no short-circuit evaluation at the moment). Therefore, it is faster to just "nest" the conditions like instead of this:

  if COL5 and INT(2)>50 and HIT_SPRITE4+HIT_SPRITE6+HIT_SPRITE7 then

do this:

  if COL5 then
    if HIT_SPRITE4+HIT_SPRITE6+HIT_SPRITE7 then
      ' Your code here
    end if
  end if

That way, if the first condition tests false, the second one will not be evaluated.


I hope this helps.

-dZ.

  • Like 1
Link to comment
Share on other sites

One more suggestion I will make: The WAIT instruction in IntyBASIC blocks the program in a "busy-loop" waiting for the next Vertical Blanking interrupt, which occurs at 60 Hz on NTSC hardware and 50 Hz on PAL hardware. You normally only have to use it under the following situations:

  • To gain access to the GRAM (Graphics RAM) and the STIC (video chip) registers, which includes MOB attributes and video mode.
  • To synchronize your game loop to the raster trace, so that as soon as your game loop frame is complete, you wait for the next boundary to compose the next one.

The first one is important because in the Intellivision you cannot access the graphics bus except during a brief window right after the Vertical Blanking interrupt occurs. The second one is typical because it keeps your game engine's pace.

The typical game engine on the Intellivision (in IntyBASIC or else) is like this:

  • Critical stuff that needs to happen first during a very short window (VBLANK 1):
    • WAIT for the next VBLANK interrupt
    • Read collision registers
    • Update MOB positions and attributes
  • Secondary stuff that has a little more time to access bus (VBLANK 2):
    • Update GRAM cards
  • Tertiary stuff that needs to occur on every frame but is not limited to VBLANK window:
    • Update timers music tracker and sound effects
    • Read hand-controller information
    • Update sprite animation state
  • Game engine:
    • Test for collisions
    • Apply AI
    • Update logical sprites positions and state
    • everything else

Because of the dependency on VBLANK to access the STIC, game engines are typically one frame behind. That is, after WAIT, your game is updating the STIC and GRAM from its computed game state of the previous frame. Then when it finishes that, it starts computing the next frame, until the next WAIT iteration, and it repeats.

This is important to understand because your collisions are not been tested against the new values you are computing, but against the values your sprites had in the previous frame and were copied to the STIC now.

I hope this makes sense.

-dZ.

  • Like 2
Link to comment
Share on other sites

Also, I just saw the updated ROM and can see the problem you are talking about now.

 

There is definitely something wrong with your computation of the BACKTAB card because the sprite is blocked even when there is open space and a couple of pixels from the edge of the card.

 

-dZ.

Edited by DZ-Jay
  • Like 2
Link to comment
Share on other sites

Both modes can display 16 colors, but here are some general restrictions:

  • Color Stack Mode (Mode #0 in IntyBASIC):
    • Supports 64 GRAM cards or all 320 GROM cards.
    • When using GROM cards, you can specify one of the first 8 colors in the palette as foreground. When using GRAM cards, all 16 colors are available.
    • The color "stack" is a 4-value circular array that determines the background color of cards. It starts at index #0 and advances every time you set the "Advance Color Stack" flag on the BACKTAB word.
    • The BACKTAB is treated as a continues string of tiles (in the order of their memory address). Setting the "Advance Color Stack" flag on a card, updates the background color of all the following cards in the BACKTAB as well, until you set it on another card again. Thus, it works like a "flood fill" where the background color continues on all tiles until changed again.
  • Foreground/Background Mode (Mode #1 in IntyBASIC):
    • Supports 64 GRAM cards, but only the first 64 cards of GROM, which are basically the standard font character set for letters, numbers, and symbols.
    • The foreground colour can be one of the first 8 in the palette, regardless of GRAM or GROM.
    • The background colour can be any of the 16 colours, regardless of GRAM or GROM.

Both modes have their strengths and compromises, and both can be versatile in their own way when used expertly. Most people starting use FG/BG Mode because it is much simpler to work. However, if you get to know the Color Stack Mode, you'll discover that it can be very, very powerful indeed, in spite of what seem to be serious limitations.

Personally, I use Color Stack mode mostly. I find that the ability to use all the graphical GROM cards (which include the solid 8x8 block, and many geometric figures) allows for more interesting detail than just 64 custom GRAM cards. With some clever tricks and a hard work you can exploit the Color Stack to make very colourful pictures.

Finally, you can find some technical information on the screen modes in the documentation included with the IntyBASIC SDK. Take a look at the file "stick.txt" in the "Documents/Tech" folder. ;)

-dZ.

 

Great ! Thanks for your help so. We continue technical question here. :D

I shall see this details tonight.

 

I use the CS MODE !! :)

The 16 colors FG for the 64 GRAM is really great !!! I see in the Nanochess Book, I can def it with $1000 .. ( I precise I've read the FREE portion of the Ebook ! :D )

The GROM, I don't use and see who I can define char with for now.

 

Cheers,

Vetea

Edited by Vetea
Link to comment
Share on other sites

 

Both modes can display 16 colors, but here are some general restrictions:

  • Color Stack Mode (Mode #0 in IntyBASIC):
    • Supports 64 GRAM cards or all 320 GROM cards.
    • When using GROM cards, you can specify one of the first 8 colors in the palette as foreground. When using GRAM cards, all 16 colors are available.
    • The color "stack" is a 4-value circular array that determines the background color of cards. It starts at index #0 and advances every time you set the "Advance Color Stack" flag on the BACKTAB word.
    • The BACKTAB is treated as a continues string of tiles (in the order of their memory address). Setting the "Advance Color Stack" flag on a card, updates the background color of all the following cards in the BACKTAB as well, until you set it on another card again. Thus, it works like a "flood fill" where the background color continues on all tiles until changed again.
  • Foreground/Background Mode (Mode #1 in IntyBASIC):
    • Supports 64 GRAM cards, but only the first 64 cards of GROM, which are basically the standard font character set for letters, numbers, and symbols.
    • The foreground colour can be one of the first 8 in the palette, regardless of GRAM or GROM.
    • The background colour can be any of the 16 colours, regardless of GRAM or GROM.

Both modes have their strengths and compromises, and both can be versatile in their own way when used expertly. Most people starting use FG/BG Mode because it is much simpler to work. However, if you get to know the Color Stack Mode, you'll discover that it can be very, very powerful indeed, in spite of what seem to be serious limitations.

Personally, I use Color Stack mode mostly. I find that the ability to use all the graphical GROM cards (which include the solid 8x8 block, and many geometric figures) allows for more interesting detail than just 64 custom GRAM cards. With some clever tricks and a hard work you can exploit the Color Stack to make very colourful pictures.

Finally, you can find some technical information on the screen modes in the documentation included with the IntyBASIC SDK. Take a look at the file "stick.txt" in the "Documents/Tech" folder. ;)

-dZ.

 

Great ! Thanks for your help so. We continue technical question here. :D

I shall see this details tonight.

 

I use the CS MODE !! :)

The 16 colors FG for the 64 GRAM is really great !!! I see in the Nanochess Book, I can def it with $1000 .. ( I precise I've read the FREE portion of the Ebook ! :D )

The GROM, I don't use and see who I can define char with for now.

 

Cheers,

Vetea

 

 

You can also use the color constants in the "constants.bas" file:

REM -------------------------------------------------------------------------
REM Foreground.
REM -------------------------------------------------------------------------
REM Notes:
REM - For use with "peek/poke" commands that access BACKTAB.
REM - Only one foreground colour permitted per background card.
REM -------------------------------------------------------------------------
CONST CS_BLACK                      = $0000
CONST CS_BLUE                       = $0001
CONST CS_RED                        = $0002
CONST CS_TAN                        = $0003
CONST CS_DARKGREEN                  = $0004
CONST CS_GREEN                      = $0005
CONST CS_YELLOW                     = $0006
CONST CS_WHITE                      = $0007
CONST CS_GREY                       = $1000
CONST CS_CYAN                       = $1001
CONST CS_ORANGE                     = $1002
CONST CS_BROWN                      = $1003
CONST CS_PINK                       = $1004
CONST CS_LIGHTBLUE                  = $1005
CONST CS_YELLOWGREEN                = $1006
CONST CS_PURPLE                     = $1007

CONST CS_CARD_DATA_MASK             = $07F8     ' Mask to get the background card's data.

CONST CS_ADVANCE                    = $2000     ' Advance the colour stack by one position.

nanochess has the tendency of using "magic numbers" instead of meaningful constants, and this permeated in his book. You may want to review the "constants.bas" file in the "lib" folder of the SDK to see what else is there, and ask any questions that you may have.

 

Also, do not dismiss the GROM so quickly. Most people think it's just fonts (which I do not use, by the way), but it is full of interesting geometric and graphical elements. Sure, if you use them to draw shapes, then it will all look like silly "programmer art" patterns, but they are very useful for composing complex scenes.

 

For example, the following scene which looks somewhat organic and freehand, uses many GROM shapes to leave the GRAM for more intricate detail.

 

post-27318-0-49957700-1541677871.gif

 

Take a look at the "A" in "Carol" and the "T" in "Presents." Those little serif "tails" on the bottom strokes are actually the apostrophe ( ' ) character of GROM. The solid areas are also full of the "solid 8x8 block" ($5F) in GROM, which is not available in FG/BG mode, and allows me to conveniently advance the stack colors in "reverse video" during long solid stretches. ;)

 

If you align your artwork to card boundaries, and with some creative thinking, you can use GROM effectively to take the place of what would normally be custom cards in GRAM. This is why I love Color Stack mode. :)

 

-dZ.

Edited by DZ-Jay
  • Like 2
Link to comment
Share on other sites

Great !

I dont use GROM yet, because i dont know how to use it for now ... ;)

But I think I rework again my pixel art for the Tile/Background. 2 colors/Tiles is really nice ... ( Like the MD ... just joking ! :D )

 

I see this informations in the constant.bas yes. :)

 

Cheers,

Vetea

Link to comment
Share on other sites

Great !

I dont use GROM yet, because i dont know how to use it for now ... ;)

But I think I rework again my pixel art for the Tile/Background. 2 colors/Tiles is really nice ... ( Like the MD ... just joking ! :D )

 

I see this informations in the constant.bas yes. :)

 

Cheers,

Vetea

 

 

The GROM has the following cards:

 CARD   0 CARD   1 CARD   2 CARD   3 CARD   4 CARD   5 CARD   6 CARD   7
 ........ ..##.... .##..##. ........ ...#.... ........ ...#.... ...#....
 ........ ..##.... .##..##. ...#.#.. #######. .##...#. .#####.. ..#.....
 ........ ..##.... ........ ..#####. ##.#.... .##..#.. .##..... .#......
 ........ ..##.... ........ ...#.#.. #######. ....#... ..###... ........
 ........ ..##.... ........ ..#####. ...#.##. ...#.... .##..... ........
 ........ ........ ........ ...#.#.. ##.#.##. ..#..##. .#####.. ........
 ........ ..##.... ........ ........ #######. .#...##. ...#.... ........
 ........ ........ ........ ........ ...#.... ........ ........ ........

 CARD   8 CARD   9 CARD  10 CARD  11 CARD  12 CARD  13 CARD  14 CARD  15
 ....###. .###.... ...#.... ........ ........ ........ ........ .......#
 ....#... ...#.... ..###... ...##... ........ ........ ........ ......#.
 ....#... ...#.... .##.##.. ...##... ........ ........ ........ .....#..
 ....#... ...#.... ..###... .######. ........ .######. ........ ....#...
 ....#... ...#.... ...#.... ...##... ........ ........ ........ ...#....
 ....#... ...#.... ........ ...##... ...##... ........ ...##... ..#.....
 ....#... ...#.... ........ ........ ...##... ........ ...##... .#......
 ....###. .###.... ........ ........ ....#... ........ ........ #.......

 CARD  16 CARD  17 CARD  18 CARD  19 CARD  20 CARD  21 CARD  22 CARD  23
 ........ ........ ........ ........ ........ ........ ........ ........
 #######. ..###... .######. .######. .##..##. .######. .######. .######.
 ##...##. ...##... .##..##. .....##. .##..##. .##..... .##..... .....##.
 ##.#.##. ...##... .....##. ..####.. .##..##. .######. .######. ....##..
 ##.#.##. ...##... .######. .....##. .######. .....##. .##..##. ...##...
 ##...##. ...##... .##..... .....##. .....##. .##..##. .##..##. ..##....
 #######. .######. .######. .######. .....##. .######. .######. ..##....
 ........ ........ ........ ........ ........ ........ ........ ........

 CARD  24 CARD  25 CARD  26 CARD  27 CARD  28 CARD  29 CARD  30 CARD  31
 ........ ........ ........ ........ ........ ........ ........ .######.
 .######. .######. ........ ........ .....##. ........ .##..... .##..##.
 .##..##. .##..##. ...##... ...##... ...##... .######. ...##... .....##.
 ..####.. .##..##. ...##... ...##... .##..... ........ .....##. ...####.
 .##..##. .######. ........ ........ ...##... .######. ...##... ...##...
 .##..##. .....##. ...##... ...##... .....##. ........ .##..... ........
 .######. .######. ...##... ...##... ........ ........ ........ ...##...
 ........ ........ ........ ....#... ........ ........ ........ ........

 CARD  32 CARD  33 CARD  34 CARD  35 CARD  36 CARD  37 CARD  38 CARD  39
 #######. .######. .######. .######. .#####.. .######. .######. .######.
 #.....#. .##..##. .##..##. .##..##. .##..##. .##..... .##..... .##..##.
 #.###.#. .##..##. .##..##. .##..... .##..##. .##..... .##..... .##.....
 #.#.#.#. .##..##. .#####.. .##..... .##..##. .#####.. .#####.. .##.###.
 #.#####. .######. .##..##. .##..... .##..##. .##..... .##..... .##..##.
 #....... .##..##. .##..##. .##..##. .##..##. .##..... .##..... .##..##.
 #######. .##..##. .######. .######. .#####.. .######. .##..... .######.
 ........ ........ ........ ........ ........ ........ ........ ........

 CARD  40 CARD  41 CARD  42 CARD  43 CARD  44 CARD  45 CARD  46 CARD  47
 .##..##. .######. .....##. .##..##. .##..... #.....#. .#...##. .######.
 .##..##. ...##... .....##. .##..##. .##..... ##...##. .##..##. .##..##.
 .##..##. ...##... .....##. .##.##.. .##..... ###.###. .###.##. .##..##.
 .######. ...##... .....##. .####... .##..... #######. .######. .##..##.
 .##..##. ...##... .##..##. .##..##. .##..... ##.#.##. .##.###. .##..##.
 .##..##. ...##... .##..##. .##..##. .##..... ##.#.##. .##..##. .##..##.
 .##..##. .######. .######. .##..##. .######. ##...##. .##...#. .######.
 ........ ........ ........ ........ ........ ........ ........ ........

 CARD  48 CARD  49 CARD  50 CARD  51 CARD  52 CARD  53 CARD  54 CARD  55
 .######. .######. .######. .######. .######. .##..##. .##..##. ##...##.
 .##..##. .##..##. .##..##. .##..##. ...##... .##..##. .##..##. ##...##.
 .##..##. .##..##. .##..##. .##..... ...##... .##..##. .##..##. ##.#.##.
 .##..##. .##..##. .##..##. .######. ...##... .##..##. ..#..#.. ##.#.##.
 .######. .##..##. .#####.. .....##. ...##... .##..##. ..####.. #######.
 .##..... .##.###. .##..##. .##..##. ...##... .##..##. ...##... .##.##..
 .##..... .######. .##..##. .######. ...##... .######. ...##... .##.##..
 ........ ......## ........ ........ ........ ........ ........ ........

 CARD  56 CARD  57 CARD  58 CARD  59 CARD  60 CARD  61 CARD  62 CARD  63
 .##..##. .##..##. .######. ...####. #....... .####... ...#.... ....#...
 .##..##. .##..##. .....##. ...##... .#...... ...##... ..###... ...#....
 ..####.. .##..##. ....##.. ...##... ..#..... ...##... .#.#.#.. ..#.....
 ...##... .##..##. ...##... ...##... ...#.... ...##... #..#..#. .######.
 ..####.. .######. ..##.... ...##... ....#... ...##... ...#.... ..#.....
 .##..##. ...##... .##..... ...##... .....#.. ...##... ...#.... ...#....
 .##..##. ...##... .######. ...##... ......#. ...##... ...#.... ....#...
 ........ ........ ........ ...####. .......# .####... ........ ........

 CARD  64 CARD  65 CARD  66 CARD  67 CARD  68 CARD  69 CARD  70 CARD  71
 ....#... ........ .###.... ........ ....###. ........ ........ ........
 .....#.. ........ ..##.... ........ ....##.. ........ ..#####. ........
 ......#. .#####.. ..#####. .######. .#####.. .######. ..##.... .######.
 ........ ....##.. ..##.##. .##..##. .##.##.. .##..##. .#####.. .##.##..
 ........ .#####.. ..##.##. .##..... .##.##.. .######. ..##.... .##.##..
 ........ .##.##.. ..##.##. .##..... .##.##.. .##..... ..##.... .#####..
 ........ .######. ..#####. .######. .#####.. .######. ..##.... ....##..
 ........ ........ ........ ........ ........ ........ ........ .#####..

 CARD  72 CARD  73 CARD  74 CARD  75 CARD  76 CARD  77 CARD  78 CARD  79
 .##..... ...##... .....##. .##..... ..###... ........ ........ ........
 .##..... ........ ........ .##..... ...##... ........ ........ ........
 .#####.. ..###... .....##. .##..##. ...##... #######. .######. .######.
 .##.##.. ...##... .....##. .##.##.. ...##... ##.#.##. ..##.##. .##..##.
 .##.##.. ...##... .....##. .####... ...##... ##.#.##. ..##.##. .##..##.
 .##.##.. ...##... ..##.##. .##..##. ...##... ##.#.##. ..##.##. .##..##.
 .##.###. .######. ..##.##. .##..##. .######. ##.#.##. ..##.##. .######.
 ........ ........ ..#####. ........ ........ ........ ........ ........

 CARD  80 CARD  81 CARD  82 CARD  83 CARD  84 CARD  85 CARD  86 CARD  87
 ........ ........ ........ ........ ........ ........ ........ ........
 ........ ........ ........ ........ ..##.... ........ ........ ........
 .######. .#####.. .######. .######. .######. .##.##.. .##..##. ##.#.##.
 ..##.##. .##.##.. ..##.##. .##..... ..##.... .##.##.. .##..##. ##.#.##.
 ..##.##. .##.##.. ..##.... .######. ..##.... .##.##.. .##..##. ##.#.##.
 ..#####. .#####.. ..##.... .....##. ..##.... .##.##.. ..####.. #######.
 ..##.... ....##.. ..##.... .######. ..#####. .######. ...##... .##.##..
 ..##.... ....###. ........ ........ ........ ........ ........ ........

 CARD  88 CARD  89 CARD  90 CARD  91 CARD  92 CARD  93 CARD  94 CARD  95
 ........ ........ ........ ....###. ...##... .###.... ........ ########
 ........ ........ ........ ....#... ...##... ...#.... ........ ########
 .##..##. .###.##. .######. ....#... ...##... ...#.... ........ ########
 ..####.. ..##.##. .....##. ..##.... ...##... ....##.. .####... ########
 ...##... ..##.##. ...##... ....#... ...##... ...#.... ...####. ########
 ..####.. ..#####. .##..... ....#... ...##... ...#.... ........ ########
 .##..##. .....##. .######. ....###. ...##... .###.... ........ ########
 ........ ..#####. ........ ........ ...##... ........ ........ ########

 CARD  96 CARD  97 CARD  98 CARD  99 CARD 100 CARD 101 CARD 102 CARD 103
 ........ ........ ######## ######## ........ ........ ######## ########
 ........ ........ ...##### #####... ........ ........ ######## ########
 ........ ........ ......## ##...... .......# #....... ######## ########
 ........ ........ ........ ........ ....#### ####.... .####### #######.
 ........ ........ ........ ........ .####### #######. ....#### ####....
 ......## ##...... ........ ........ ######## ######## .......# #.......
 ...##### #####... ........ ........ ######## ######## ........ ........
 ######## ######## ........ ........ ######## ######## ........ ........

 CARD 104 CARD 105 CARD 106 CARD 107 CARD 108 CARD 109 CARD 110 CARD 111
 .....### ###..... ######## ######## ........ ........ ######## ########
 ..###### ######.. ######## ######## ........ ........ ..###### ######..
 ######## ######## ######## ######## ........ ........ ....#### ####....
 ######## ######## ######## ######## ........ ........ ......## ##......
 ######## ######## ######## ######## ......## ##...... ........ ........
 ######## ######## ######## ######## ....#### ####.... ........ ........
 ######## ######## ..###### ######.. ..###### ######.. ........ ........
 ######## ######## .....### ###..... ######## ######## ........ ........

 CARD 112 CARD 113 CARD 114 CARD 115 CARD 116 CARD 117 CARD 118 CARD 119
 ......## ##...... ######## ######## .......# #....... ######## ########
 ....#### ####.... ######## ######## ......## ##...... .####### #######.
 ..###### ######.. ######## ######## .....### ###..... ..###### ######..
 ######## ######## ######## ######## ....#### ####.... ...##### #####...
 ######## ######## ######## ######## ...##### #####... ....#### ####....
 ######## ######## ..###### ######.. ..###### ######.. .....### ###.....
 ######## ######## ....#### ####.... .####### #######. ......## ##......
 ######## ######## ......## ##...... ######## ######## .......# #.......

 CARD 120 CARD 121 CARD 122 CARD 123 CARD 124 CARD 125 CARD 126 CARD 127
 ........ ........ ....#### ####.... ...##### #####... ######## ########
 ........ ........ .....### ###..... ..###### ######.. ######## ########
 ........ ........ ......## ##...... .####### #######. ######## ########
 ........ ........ .......# #....... ######## ######## ######## ########
 .......# #....... ........ ........ ######## ######## ######## ########
 ......## ##...... ........ ........ ######## ######## .####### #######.
 .....### ###..... ........ ........ ######## ######## ..###### ######..
 ....#### ####.... ........ ........ ######## ######## ...##### #####...

 CARD 128 CARD 129 CARD 130 CARD 131 CARD 132 CARD 133 CARD 134 CARD 135
 ...##### #####... ######## ######## .......# #....... ....#### ####....
 ...##### #####... ######## ######## .......# #....... ....#### ####....
 ..###### ######.. .####### #######. ......## ##...... .....### ###.....
 ..###### ######.. .####### #######. ......## ##...... .....### ###.....
 .####### #######. ..###### ######.. .....### ###..... ......## ##......
 .####### #######. ..###### ######.. .....### ###..... ......## ##......
 ######## ######## ...##### #####... ....#### ####.... .......# #.......
 ######## ######## ...##### #####... ....#### ####.... .......# #.......

 CARD 136 CARD 137 CARD 138 CARD 139 CARD 140 CARD 141 CARD 142 CARD 143
 ..###### ######.. ######## ######## .....### ###..... ..###### ######..
 ..###### ######.. ######## ######## ....#### ####.... ...##### #####...
 .####### #######. ######## ######## ....#### ####.... ...##### #####...
 .####### #######. .####### #######. ....#### ####.... ...##### #####...
 .####### #######. .####### #######. ...##### #####... ....#### ####....
 ######## ######## .####### #######. ...##### #####... ....#### ####....
 ######## ######## ..###### ######.. ...##### #####... ....#### ####....
 ######## ######## ..###### ######.. ..###### ######.. .....### ###.....

 CARD 144 CARD 145 CARD 146 CARD 147 CARD 148 CARD 149 CARD 150 CARD 151
 .......# #....... .....### ###..... ........ ........ ........ ........
 .......# #....... .....### ###..... ........ ........ ........ ........
 .......# #....... ......## ##...... ........ ........ ........ ........
 ......## ##...... ......## ##...... ........ ........ ........ ........
 ......## ##...... ......## ##...... ........ ........ ....#### ####....
 ......## ##...... .......# #....... ........ ........ ######## ########
 .....### ###..... .......# #....... ....#### ####.... ######## ########
 .....### ###..... .......# #....... ######## ######## ######## ########

 CARD 152 CARD 153 CARD 154 CARD 155 CARD 156 CARD 157 CARD 158 CARD 159
 ........ ........ ....#### ####.... .......# #....... .....### ###.....
 ........ ........ ######## ######## .......# #....... .....### ###.....
 ....#### ####.... ######## ######## .......# #....... .....### ###.....
 ######## ######## ######## ######## .......# #....... .....### ###.....
 ######## ######## ######## ######## ......## ##...... ....#### ####....
 ######## ######## ######## ######## ......## ##...... ....#### ####....
 ######## ######## ######## ######## ......## ##...... ....#### ####....
 ######## ######## ######## ######## ......## ##...... ....#### ####....

 CARD 160 CARD 161 CARD 162 CARD 163 CARD 164 CARD 165 CARD 166 CARD 167
 ...##### #####... .####### #######. ....#### ####.... ........ ........
 ...##### #####... .####### #######. ....#### ####.... ........ ........
 ...##### #####... .####### #######. ....#### ####.... ........ ........
 ...##### #####... .####### #######. ....#### ####.... ........ ........
 ..###### ######.. ######## ######## ....#### ####.... ........ ........
 ..###### ######.. ######## ######## ....#### ####.... ........ ........
 ..###### ######.. ######## ######## ....#### ####.... ....#### ####....
 ..###### ######.. ######## ######## ....#### ####.... ####.... ....####

 CARD 168 CARD 169 CARD 170 CARD 171 CARD 172 CARD 173 CARD 174 CARD 175
 ........ ........ ........ ........ ....#### ####.... ........ ........
 ........ ........ ........ ........ ####.... ....#### ........ ........
 ........ ........ ....#### ####.... ........ ........ ........ ........
 ........ ........ ####.... ....#### ........ ........ ........ ........
 ....#### ####.... ........ ........ ........ ........ ........ ........
 ####.... ....#### ........ ........ ........ ........ ......## ##......
 ........ ........ ........ ........ ........ ........ ...###.. ..###...
 ........ ........ ........ ........ ........ ........ ###..... .....###

 CARD 176 CARD 177 CARD 178 CARD 179 CARD 180 CARD 181 CARD 182 CARD 183
 ........ ........ .....### ###..... ........ ........ ......## ##......
 ........ ........ ..###... ...###.. ........ ........ ....##.. ..##....
 .......# #....... ##...... ......## ........ ........ ..##.... ....##..
 ....###. .###.... ........ ........ ........ ........ ##...... ......##
 .###.... ....###. ........ ........ ......## ##...... ........ ........
 #....... .......# ........ ........ ....##.. ..##.... ........ ........
 ........ ........ ........ ........ ..##.... ....##.. ........ ........
 ........ ........ ........ ........ ##...... ......## ........ ........

 CARD 184 CARD 185 CARD 186 CARD 187 CARD 188 CARD 189 CARD 190 CARD 191
 ...#.... ....#... ........ ........ ##...... ......## ..##.... ....##..
 ..#..... .....#.. ........ ........ ##...... ......## ..##.... ....##..
 .#...... ......#. ........ ........ ##...... ......## ..##.... ....##..
 #....... .......# ........ ........ ##...... ......## ..##.... ....##..
 ........ ........ #....... .......# ##...... ......## ..##.... ....##..
 ........ ........ .#...... ......#. ##...... ......## ..##.... ....##..
 ........ ........ ..#..... .....#.. ##...... ......## ..##.... ....##..
 ........ ........ ...#.... ....#... ##...... ......## ..##.... ....##..

 CARD 192 CARD 193 CARD 194 CARD 195 CARD 196 CARD 197 CARD 198 CARD 199
 #....... .......# ...#.... ....#... ####.... ....#### ........ ........
 #....... .......# ...#.... ....#... ####.... ....#### ........ ........
 #....... .......# ...#.... ....#... ####.... ....#### ........ ........
 #....... .......# ...#.... ....#... ####.... ....#### ........ ........
 #....... .......# ...#.... ....#... ........ ........ ####.... ....####
 #....... .......# ...#.... ....#... ........ ........ ####.... ....####
 #....... .......# ...#.... ....#... ........ ........ ####.... ....####
 #....... .......# ...#.... ....#... ........ ........ ####.... ....####

 CARD 200 CARD 201 CARD 202 CARD 203 CARD 204 CARD 205 CARD 206 CARD 207
 ######## ........ ........ ........ ######## ........ ........ ........
 ######## ........ ........ ........ ........ ........ ........ ........
 ........ ######## ........ ........ ........ ........ ........ ........
 ........ ######## ........ ........ ........ ######## ........ ........
 ........ ........ ######## ........ ........ ........ ######## ........
 ........ ........ ######## ........ ........ ........ ........ ........
 ........ ........ ........ ######## ........ ........ ........ ........
 ........ ........ ........ ######## ........ ........ ........ ########

 CARD 208 CARD 209 CARD 210 CARD 211 CARD 212 CARD 213 CARD 214 CARD 215
 ######## ........ .######. ........ ........ .#..##.# .##.##.. .##...##
 ######## ........ .######. ........ ######## .##....# .##..#.# .###..##
 ######## ........ .######. ........ ######## .###.#.. .##...## ..#.....
 ######## ........ .######. ######## ######## .###.#.. .###.#.. ..#.....
 ........ ######## .######. ######## ######## .##..#.# .###..#. ..#.....
 ........ ######## .######. ........ ######## .##.##.. .##.#### ..#.....
 ........ ######## .######. ........ ######## ..#..... .##.###. ..#.....
 ........ ######## .######. ........ ........ .#...#.# .##.#..# ..#.....

 CARD 216 CARD 217 CARD 218 CARD 219 CARD 220 CARD 221 CARD 222 CARD 223
 ..#..... .###..## ..#..... .###.#.. ........ #..#...# ....#... #.....#.
 .###.... ........ ..##...# .###.#.. #.....#. ....#... ..#..... ..#.#...
 .###..#. .#....## ..###..# .##..#.# #.#.###. .#....#. #...#.#. ....#.#.
 .##..#.# .##.#### ..###... .##.##.. ....#... ..#...#. ..#...## ..#.....
 .###..## .###.... ..##.#.. ........ ##..#..# ......#. ......#. #.#.###.
 .##..#.# .###..#. ..#..... ######## ...#.... #.....#. ......#. ..#.....
 .##.###. ..#..... .#..##.# ######## ...#.#.. ...##... ..#..... #...#.#.
 .###.#.. .#...... .##....# ..#..#.. #...#... #...#..# #.###... #.#.#.#.

 CARD 224 CARD 225 CARD 226 CARD 227 CARD 228 CARD 229 CARD 230 CARD 231
 #..#..#. #.....#. #.#.###. ....#.#. ...#.... ..#.##.. #.###... ...#.#..
 ..#..... #...#... ....##.. .#..#.#. ..#.##.. ....###. .....#.. .##.....
 #...#.#. ###.#.#. ..#..### ##.#...# .....#.# ........ ##...... ....##..
 #.###... #...#.#. ...#...# #.###... .#....#. ..##.#.. ##....## ......#.
 #.....#. #.#.#.#. ...##### .....#.. .##...#. .....#.. .#....#. #.###...
 #...#... #.#.###. ........ .#.#...# .##...#. ........ .#..##.# ........
 ..#...#. #...#... ..#.#.## .###..#. .#####.. ##....## ##.#...# .....#..
 #.###... .##.#... ..##..#. .##.#.#. ####.... #..##... ##...... ........

 CARD 232 CARD 233 CARD 234 CARD 235 CARD 236 CARD 237 CARD 238 CARD 239
 ##.###.. ........ .##..... .....#.. .#..#### #.#....# .###...# ......##
 .#.##..# ##.###.. ....##.. ........ .#....## #.###..# ..#.#..# .#.....#
 ..#.#..# .#.##..# .....#.# ##.###.. .#.##### ######## ......## .##.#..#
 ....#.#. ..#.#..# #...#..# .#.##..# ....#.#. .....#.. .###...# .#####.#
 .#.##..# .....#.# .....#.. ..#.#..# ...##.#. ....##.# ....#### ####....
 ....#..# ..#..... ....#.#. ....###. #.####.. #.###... .##.#..# ..#.##..
 ....#... ...#.#.# #.###... ..#..... ###.#... ....#... ...#.... ...#.##.
 .....#.. ...#.#.. ........ ..#..##. #.#..#.# ...#.... ..#...## .#.##.##

 CARD 240 CARD 241 CARD 242 CARD 243 CARD 244 CARD 245 CARD 246 CARD 247
 ....#..# .#####.# ..#.##.. #.###.#. ..#.###. #.#....# ....#..# .####..#
 ...#.... .#.#.##. ....##.. ###.#### .....### ...##..# ...##.#. .###..#.
 #.####.. ...#.... .#.##.## #.#..... .#.##.## .##.#..# #.###... .##.#..#
 ###.#... ..#.##.. ....#..# #..#...# ....#..# .#####.# ....#... .#####.#
 #.#..#.# .....#.. ....##.# .##.#..# ....#.#. ####.... #.####.. ####....
 #.#....# .##.#.#. #.####.. .#.#.... #.####.. ..#.##.. ###.#... ..#.##..
 #.###... .#####.# ###.#... ...#..#. ###.#... .....##. #.#..#.# .....###
 .....#.. ####.... #.#..#.# .##...#. #.#..#.# .#.##.## #.#....# .#....#.

 CARD 248 CARD 249 CARD 250 CARD 251 CARD 252 CARD 253 CARD 254 CARD 255
 .###..#. .#####.. #.#..... ....##.. ..#.##.. ......## .#..#### #..##...
 ...#.... ####.... .##.#... .......# .....#.. ##.##..# .#....## .###.#.#
 ..#.##.. ..#.##.. .#####.. #.##.#.# ..####.. .#..#.## .####.#. #....#.#
 ....#### .....#.# ####.... #.##.### ....#... ##.##..# .#.#..## ###..#.#
 #.####.. #.##..## ..#.##.. ##...... #...#.## #...#.## #.#.#### ...#.#..
 ###.#... #.####.. .....#.# .##..... #.###.## #.###.## .#####.. .##..#.#
 #.##...# ###.#... #.##.... .#####.. ........ ##...... ####.... #.##.###
 .##....# #.##.#.# ...#.... ####.... .....#.. ##.##..# ..#..#.. ........

 

You use it just like you use GRAM, except that you do not have to copy the graphics into memory. In other words, you set the index of the GROM card that you want in the BACKTAB word (or MOB Attribute register).

 

In the BACKTAB word, bit #11 sets the index to be in GRAM (1) or GROM (0). This means that the index is 0x00 .. 0xFF for GROM and add 0x800 for GRAM (0x800 .. 0x83F).

 

In the "constants.bas" file, you add the constant GRAM to the card number for GRAM cards, or use the BG00 .. BG63 constants to select on of the 64 GRAM cards. For GROM cards, you just use the card index number. That's it.

 

This information is better explained in the "stic.txt" document in the "Documents/Tech" folder of the SDK installation.

 

Let us know if you need additional help. Good luck! :thumbsup:

 

-dZ.

Edited by DZ-Jay
  • Like 1
Link to comment
Share on other sites

Are the cards 213-255 deterministic, or unusued ROM space that might be different for each chip/system? Is that perhaps some form of executable code?

It's part of the EXEC rom code. I think it never changes along Intellivision revisions. Except in minigrom.bin provided with jzintv

  • Like 1
Link to comment
Share on other sites

Are the cards 213-255 deterministic, or unusued ROM space that might be different for each chip/system? Is that perhaps some form of executable code?

Like nanochess said, it is overflow code of the EXEC and will never change (it is ROM after all). The code is different between the Mattel stock EXEC.ROM and the "miniexec.rom" included with the SDK, but it is consistent to the ROM.

 

It is just visual "noise," since it represents binary object code. In fact, "B-17 Bomber" famously uses it as the "FLAK" explosions, because they ran out of GRAM cards to make a custom one.

 

dZ.

  • Like 1
Link to comment
Share on other sites

Hello again,

 

I have a question ( Admin have to change the name of this topic ! :D ), I try to set the FG & GB color of a GRAM's TILE, I'm in CS mode.

 

Here it is :

 

CONST MUR = $0800+18*8

 

- So FG is Black, position 18 GRAM, ok.

But I want to change the BG color, by .. Grey for example.

 

- So we are in CS Mode, we can use 16 colors for the BG for the 64 GRAM Cards.

 

- In the book/doc, the Grey Colors code is : $1000

- I try to add with my const, but it changes the FG again ( CONST MUR = $0800+18*8 + $1000 ).

 

How can I manage that ? And can I ?

 

Thanks, and sorry for this Noobs question ...

Cheers,

Vetea

Link to comment
Share on other sites

That is a very good question, Vetea, so don't feel sorry for asking it. The Color Stack mode can be a bit confusing.

 

I have explained this in the past, so rather than do it again, I'll try to find my earlier post and offer a link. If I can't find it, I'll create a topic for it, because it is a common question.

 

dZ.

  • Like 1
Link to comment
Share on other sites

No worries! :)

 

Here's a description I wrote several years ago:

http://atariage.com/forums/topic/176675-intellivision-tutorials/?p=2202128

 

It was for a newbie, so it includes a lot of basic stuff about Intellivision graphics, so please forgive me if some of it is just too basic.

 

I promise to review it tonight and post it in a blog or something to make it available and more clear. In the meantime, I hope it helps.

 

dZ.

Link to comment
Share on other sites

Here is a description presented via an example of the Christmas Carol title screen shown before.

http://atariage.com/forums/topic/222570-intybasic-compiler-v05/page-6?do=findComment&comment=3060995

 

Like I said, I'll clean up all the descriptions and create an entry that walks through the Color Stack Mode in all it's gory details. :)

 

dZ

Link to comment
Share on other sites

And yet another attempt to describe it. This may be the simplest description yet, since it only describes the Color Stack without code, just in simple words and examples.

 

http://atariage.com/forums/topic/249565-more-colors-per-card/?p=3452443&do=findComment&comment=3452443

 

Imagine an array of four colours. Now consider an imaginary cursor moving across the background, from the top-left corner, all the way to the right edge, then over to the next row, and so on. As the cursor moves, it will "paint" the background of the card using the first colour in the array. It will continue painting cards the same colour until it finds a card that has the "Advance" bit set, at which point, it will start using the next colour in the array.

 

I hope it helps.

 

dZ.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...