Just a hotfix for dimage()... fxSDK's a bit late...

This commit is contained in:
lephe 2017-04-17 12:56:27 +02:00
parent acc0e5fcc1
commit a529a8236b
12 changed files with 53 additions and 31 deletions

View File

@ -133,20 +133,21 @@ endef
#---
# Retrieve version information.
version_string := $(shell cat version | sed 's/[-.]/ /g')
version_type := $(word 1,$(version_string))
version_major := $(word 2,$(version_string))
version_minor := $(word 3,$(version_string))
version_build := $(word 4,$(version_string))
version_string = $(shell cat version | sed 's/[-.]/ /g')
version_type = $(word 1,$(version_string))
version_major = $(word 2,$(version_string))
version_minor = $(word 3,$(version_string))
version_build = $(word 4,$(version_string))
# Bump build number and make up the new version integer.
version_build := $(shell echo $$(($(version_build) + 1)))
version_letter := $(shell echo -n $(version_type) | sed -r 's/^(.).*/\1/')
version_symbol := $(shell printf '0x%02x%01x%01x%04x' "'$(version_letter)'" \
# Make up the new version integer.
version_build_n = $(shell echo $$(($(version_build) + 1)))
version_letter = $(shell echo -n $(version_type) | sed -r 's/^(.).*/\1/')
version_symbol = $(shell printf '0x%02x%01x%01x%04x' "'$(version_letter)'" \
$(version_major) $(version_minor) $(version_build))
# Tell the linker to define the version symbol.
ldflags += -Wl,--defsym,GINT_VERSION=$(version_symbol)
demo-ldflags += -Wl,--defsym,_GINT_VERSION=$(version_symbol)
debug-ldflags += -Wl,--defsym,_GINT_VERSION=$(version_symbol)
@ -165,7 +166,7 @@ build:
$(if $(VERBOSE),,@) mkdir -p $@
version: $(obj-std) $(obj-lib)
@ echo '$(version_type)-$(version_major).$(version_minor)-$(version_build)' > $@
@ echo '$(version_type)-$(version_major).$(version_minor)-$(version_build_n)' > $@
$(obj-std) $(obj-lib) $(demo-obj): | build
@ -231,6 +232,10 @@ build/demo_%.c.o: demo/%.c $(hdr-dep) $(demo-dep) $(config)
$(if $(VERBOSE),,@ printf '\e[34;1msrc \u00bb\e[0m cc $<\n')
$(if $(VERBOSE),,@) $(cc) -c $< -o $@ $(demo-cflags)
build/demo_%.s.o: demo/%.s $(config)
$(if $(VERBOSE),,@ printf '\e[34;1msrc \u00bb\e[0m as $<\n')
$(if $(VERBOSE),,@) $(as) -c $< -o $@
build/demo_font_%.bmp.o: demo/resources/font_%.bmp
$(if $(VERBOSE),,@ printf '\e[36;1mres \u00bb\e[0m fxconv $<\n')
$(if $(VERBOSE),,@) fxconv $< -o $@ --font -n $(patsubst demo/resources/%.bmp,res_%,$<)

View File

@ -7,6 +7,7 @@
#include <gray.h>
#include <internals/stdio.h>
#include <stdio.h>
@ -324,7 +325,13 @@ void main_menu(int *category, int *app)
extern unsigned int romdata;
int gint_size = (char *)&egint - (char *)&bgint;
// Building a version string.
char gint_version[20];
uint32_t v = (uint32_t)&GINT_VERSION;
sprintf(gint_version, "%s-%d.%d-%d",
(v >> 24 == 'a') ? "alpha" : (v >> 24 == 'b') ? "beta" :
(v >> 24 == 'd') ? "dev" : (v >> 24 == 'r') ? "release" : "?",
(v >> 20) & 0x0f, (v >> 16) & 0x0f, v & 0xffff);
static int tab = 0, index = 0, scroll = 0;
// Set to 1 when interface has to be redrawn.
@ -345,8 +352,7 @@ void main_menu(int *category, int *app)
switch(tab)
{
case 0:
print(1, 1, "Demo application");
// print(2, 3, "gint version: %5s", GINT_VERSION_STR);
print(1, 1, "gint %s", gint_version);
print(2, 4, "handler size: %5d", gint_size);
print(2, 5, "mpu type: %7s", mpu);
print(2, 6, "romdata: %08x", &romdata);

View File

@ -113,8 +113,10 @@ void test_tales(void)
for(int j = 0; j < 16; j++) str[j] = 32 + (i << 4) + j;
str[16] = 0;
gtext(2, 2 + i * height, str);
gtext(-3, -3 + i * height, str);
}
gtext(120, 60, "Hello, World!");
gtext(-40, 2, "Try");
gimage(0, 56, &res_opt_tales);

View File

@ -15,6 +15,13 @@
#include <stdint.h>
#include <stddef.h>
// This one is defined by the linked and consists in four fields:
// - Version type, an ascii char ('a'lpha, 'b'eta, 'd'ev, 'r'elease), 8 bits
// - Major version number, 4 bits
// - Minor version numer, 4 bits
// - Build number, 16 bits
extern uint32_t GINT_VERSION;
//---
// System info provided by the library
//---

View File

@ -10,7 +10,7 @@
void dimage_part(int x, int y, image_t *img, int left, int top, int width,
int height)
{
if(!img || img->magic != 0x01) return;
if(!img || img->magic != 0xb7) return;
structure_t s;
command_t command;

View File

@ -11,7 +11,7 @@
void gimage_part(int x, int y, image_t *img, int left, int top, int width,
int height)
{
if(!img || img->magic != 0x01) return;
if(!img || img->magic != 0xb7) return;
structure_t s;
command_t command;

View File

@ -55,7 +55,7 @@ __attribute__((section(".pretext.entry"))) int start(void)
dg->magic = GINT_DIAGNOSTICS_MAGIC;
dg->counter = dg->counter + 1;
dg->mpu = mpu_unknown;
dg->version = GINT_VERSION;
dg->version = (uint32_t)&GINT_VERSION;
dg->stage = stage_startup;
// Exception records: what kind of exceptions / TLB faults / interrupts

View File

@ -7,6 +7,7 @@
//---
#include <mpu.h>
#include <stdint.h>
const mpu_t MPU_CURRENT;
@ -29,15 +30,14 @@ const mpu_t MPU_CURRENT;
mpu_t getMPU(void)
{
// Processor version register.
volatile unsigned int *pvr = (unsigned int *)0xff000030;
volatile uint32_t *pvr = (void *)0xff000030;
// Product version register.
volatile unsigned int *prr = (unsigned int *)0xff000044;
volatile uint32_t *prr = (void *)0xff000044;
// Port L control register.
volatile unsigned short *plcr = (unsigned short *)0xa4000114;
volatile uint16_t *plcr = (void *)0xa4000114;
// Saved value for PLCR.
unsigned short saved_plcr;
unsigned int tested_plcr;
uint16_t saved_plcr;
uint16_t tested_plcr;
// Looking for SH-3-based MPUs by testing PLCR writing access.
saved_plcr = *plcr;
@ -50,12 +50,12 @@ mpu_t getMPU(void)
if(tested_plcr == 0x0fff) return mpu_sh7355;
// Looking for SH-4-based MPUs by testing the version registers. This
// needs to have the three upper bytes of the processor version
// register match 0x10300b :
// needs the three upper bytes of the processor version register to
// match 0x10300b :
if((*pvr & 0xffffff00) != 0x10300b00) return mpu_unknown;
// Now that we have an SH-4-based MPU, checking whether it is SH7305 or
// SH7724.
// SH7724, just for reference.
switch(*prr & 0xfffffff0)
{
case 0x00002c00:

View File

@ -1,7 +1,7 @@
#include <ctype.h>
// Let's save up some space and readability (That's Cake's idea, its a bit of a
// preprocessor trick but a rather nice trick).
// Let's save up some space and readability (that's Cake's idea, it's a bit of
// a preprocessor trick - but a rather nice trick).
#define r4(x) (x), (x), (x), (x)
#define r5(x) r4(x), (x)
#define r6(x) r5(x), (x)

View File

@ -7,7 +7,7 @@
- x1 < x2
- y1 < y2
which is needed when working with screen rectangles.
Returns non-zero if the rectangle is outside the screen.
Returns non-zero if the rectangle is entirely outside the screen.
*/
int adjustRectangle(int *x1, int *y1, int *x2, int *y2)
{

View File

@ -234,6 +234,8 @@ void render(int x, int y, const char *str, void (*op)(OPERATE_ARGS))
// Computing the initial operator offset to have 32-aligned operators.
// This allows to write directly video ram longs instead of having to
// shift operators, and do all the vram operation twice.
// I double-checked that this operation is still valid when x is
// negative.
available = 32 - (x & 31);
x &= ~31;

View File

@ -1 +1 @@
beta-0.9-289
beta-0.9-302