o get varg printf working
This commit is contained in:
parent
6bab776497
commit
a64e9ebd7d
@ -7,7 +7,7 @@ ifeq ($(PLATFORM),Linux)
|
|||||||
# Linux Wine
|
# Linux Wine
|
||||||
SDK=/home/david/.wine/drive_c/65xx_FreeSDK
|
SDK=/home/david/.wine/drive_c/65xx_FreeSDK
|
||||||
WINE=wine
|
WINE=wine
|
||||||
EMU=zsnes
|
EMU=../../tools/bsnes/bsnes
|
||||||
EMU_DEBUG=/home/david/Devel/arch/snes/tools/zsnes_linux_debug151/src/zsnesd -d
|
EMU_DEBUG=/home/david/Devel/arch/snes/tools/zsnes_linux_debug151/src/zsnesd -d
|
||||||
else
|
else
|
||||||
# Mac Wine
|
# Mac Wine
|
||||||
@ -25,11 +25,7 @@ LD=$(WINE) $(SDK)/bin/WDCLN.exe
|
|||||||
|
|
||||||
INC=$(SDK)/include
|
INC=$(SDK)/include
|
||||||
LIBS=$(SDK)/lib/cc
|
LIBS=$(SDK)/lib/cc
|
||||||
<<<<<<< HEAD:snes/fatfstest/Makefile
|
|
||||||
OBJS=StartupSnes.obj pad.obj main.obj PPU.obj debug.obj ressource.obj
|
|
||||||
=======
|
|
||||||
OBJS=StartupSnes.obj main.obj pad.obj PPU.obj debug.obj ressource.obj diskio.obj ff.obj
|
OBJS=StartupSnes.obj main.obj pad.obj PPU.obj debug.obj ressource.obj diskio.obj ff.obj
|
||||||
>>>>>>> d69d2bf39842c032ea4660a10556e78b14b6d71c:snes/fatfstest/Makefile
|
|
||||||
APP=fatfs.smc
|
APP=fatfs.smc
|
||||||
GFX=debugfont
|
GFX=debugfont
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,15 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "pad.h"
|
#include "pad.h"
|
||||||
#include "PPU.h"
|
#include "PPU.h"
|
||||||
#include "ressource.h"
|
#include "ressource.h"
|
||||||
|
|
||||||
|
|
||||||
word debugMap[0x400];
|
word debugMap[0x400];
|
||||||
|
char debug_buffer[255];
|
||||||
|
|
||||||
|
|
||||||
void debug_init(void) {
|
void debug_init(void) {
|
||||||
@ -14,23 +19,7 @@ void debug_init(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char hex_chars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
void _print_screen(word y, char *buffer){
|
||||||
|
|
||||||
void int2hex(unsigned long number, char *buf,word size)
|
|
||||||
{
|
|
||||||
unsigned long n;
|
|
||||||
unsigned char i;
|
|
||||||
//unsigned char x;
|
|
||||||
for (i = 0; i < size; i++) {
|
|
||||||
n = number >> 4;
|
|
||||||
//x = (number - (n << 4));
|
|
||||||
buf[size-i-1] = hex_chars[(number - (n << 4))];
|
|
||||||
number = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_screen(char *buffer,word y){
|
|
||||||
char i;
|
char i;
|
||||||
char l;
|
char l;
|
||||||
l = strlen(buffer);
|
l = strlen(buffer);
|
||||||
@ -43,11 +32,28 @@ void print_screen(char *buffer,word y){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_console(char *buffer){
|
void _print_console(char *buffer){
|
||||||
while(*buffer)
|
while(*buffer)
|
||||||
*(byte*) 0x3000=*buffer++;
|
*(byte*) 0x3000=*buffer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printfc(char *fmt,...){
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap,fmt);
|
||||||
|
vsprintf(debug_buffer,fmt,ap);
|
||||||
|
va_end(ap);
|
||||||
|
_print_console(debug_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void printfs(word y,char *fmt,...){
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap,fmt);
|
||||||
|
vsprintf(debug_buffer,fmt,ap);
|
||||||
|
va_end(ap);
|
||||||
|
_print_screen(y,debug_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void debug_enable(void){
|
void debug_enable(void){
|
||||||
VRAMLoad((word) debugFont_pic, 0x5000, 2048);
|
VRAMLoad((word) debugFont_pic, 0x5000, 2048);
|
||||||
CGRAMLoad((word) debugFont_pal, (byte) 0x00, (word) 16);
|
CGRAMLoad((word) debugFont_pal, (byte) 0x00, (word) 16);
|
||||||
@ -55,4 +61,24 @@ void debug_enable(void){
|
|||||||
setTileMapLocation(0x4000, (byte) 0x00, (byte) 0);
|
setTileMapLocation(0x4000, (byte) 0x00, (byte) 0);
|
||||||
setCharacterLocation(0x5000, (byte) 0);
|
setCharacterLocation(0x5000, (byte) 0);
|
||||||
*(byte*) 0x2100 = 0x0f; // enable background
|
*(byte*) 0x2100 = 0x0f; // enable background
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int unlink(const char *name){
|
||||||
|
printfc("unlink called");
|
||||||
|
}
|
||||||
|
|
||||||
|
int close(int fd){
|
||||||
|
printfc("close called");
|
||||||
|
}
|
||||||
|
|
||||||
|
int isatty(int fd){
|
||||||
|
printfc("isatty called");
|
||||||
|
}
|
||||||
|
|
||||||
|
int write(int fd,void * buffer, size_t len){
|
||||||
|
printfc("write called");
|
||||||
|
}
|
||||||
|
|
||||||
|
long lseek(int fd,long offset, int whence){
|
||||||
|
printfc("lseek called");
|
||||||
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
void debug_init(void);
|
void debug_init(void);
|
||||||
void debug_enable(void);
|
void debug_enable(void);
|
||||||
void int2hex(unsigned long i, char *buf,word size);
|
void printfs(word y,char* fmt,...);
|
||||||
void print_screen(char* line,word y);
|
void printfc(char* fmt,...);
|
||||||
void print_console(char* line);
|
|
||||||
|
|||||||
@ -88,7 +88,7 @@ DRESULT disk_read (
|
|||||||
*(byte*) MMIO_SECTOR01 = (sector >> 24) & 0xff;
|
*(byte*) MMIO_SECTOR01 = (sector >> 24) & 0xff;
|
||||||
*(byte*) MMIO_SECTOR02 = (sector >> 16) & 0xff;
|
*(byte*) MMIO_SECTOR02 = (sector >> 16) & 0xff;
|
||||||
*(byte*) MMIO_SECTOR03 = (sector >> 8) & 0xff;
|
*(byte*) MMIO_SECTOR03 = (sector >> 8) & 0xff;
|
||||||
*(byte*) MMIO_SECTOR04 = (sector >> 8) & 0xff;
|
*(byte*) MMIO_SECTOR04 = (sector) & 0xff;
|
||||||
|
|
||||||
*(byte*) MMIO_COUNT = count;
|
*(byte*) MMIO_COUNT = count;
|
||||||
|
|
||||||
|
|||||||
@ -38,10 +38,11 @@ void main(void) {
|
|||||||
*(byte*) 0x2100 = 0x0f; // enable background
|
*(byte*) 0x2100 = 0x0f; // enable background
|
||||||
|
|
||||||
debug_enable();
|
debug_enable();
|
||||||
print_screen("FATFS TEST",0);
|
printfs(0,"FATFS TEST %i",10);
|
||||||
print_console("Debugging console test\n");
|
printfc("Test me\n");
|
||||||
print_console("test me\n");
|
printfc("Test me %i\n",10);
|
||||||
|
|
||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
while(!pad1.start) {
|
while(!pad1.start) {
|
||||||
waitForVBlank();
|
waitForVBlank();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user