PVsneslib - SNES Learning path

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
RedScorpion
Posts: 40
Joined: Mon Mar 15, 2010 4:15 pm

PVsneslib - SNES Learning path

Post by RedScorpion » Mon Sep 12, 2016 3:15 am

Hi guys,

iam starting to use the PVsneslib for my smart project and work with the most examples of this toolchain.

Until now, i know how it works and how i can create and use tiles, fonts and so on.

Now, i want to combine the Mode 1 function with the textfunction.

I want create a background and a text in the front, but in my current case, the emualtor shows either the background or the text.

Could you give me a hint?

Code: Select all

#include <snes.h>

extern char snesfont;
extern char patterns, patterns_end;
extern char palette, palette_end;
extern char map, map_end;


//---------------------------------------------------------------------------------
int main(void) {
    // Initialize SNES 
	consoleInit();
	consoleInitText(0, 1, &snesfont);	
	
	bgInitTileSet(0, &patterns, &palette, 0, (&patterns_end - &patterns), (&palette_end - &palette), BG_16COLORS, 0x4000);
	bgInitMapSet(0, &map, (&map_end - &map),SC_32x32, 0x0000);
	setMode(BG_MODE2,0);  bgSetDisable(1); bgSetDisable(2);
	
	consoleSetTextCol(RGB15(31,31,31),  RGB15(31,31,31));
	consoleDrawText(10,10,"Hello World !");
	
	// Wait for nothing :P
		
	while(1) {
		WaitForVBlank();
	}
	return 0;
}
My data.asm
.include "hdr.asm"

.section ".rodata1" superfree

snesfont:
.incbin "pvsneslibfont.pic"

.ends

.section ".rodata2" superfree
patterns:
.incbin "Back.pic"
patterns_end:

map:
.incbin "Back.map"
map_end:

palette:
.incbin "Back.pal"
palette_end

.ends
With this code, the rom shows the background. No textmessages.

Thanks in advance

red

Post Reply