Hi, I'm currently working with some projects and I'm using Revolution FX for super fast graphics. The problem is that I would like to print some text, variables, etc. to screen, but I can't because CopyVRAM(); function gives me error. It does compile, but when I try to run the program it gives me system error.
Have any of you really used CopyVRAM(); function succesfully? If so, can you give me an example how to do it? Or is there an alternative way to print text to screen than SDK's print funktions?
Thanks for your help.
neur0n Team Kingdom
Joined: Mar 07, 2007
Posts: 101
Posted:
Sun Mar 30, 2008 8:47 am
You don't describe the problem well enough for us to give you a proper answer.
The problem is likely that revolution-fx does not take into account the different addresses for the VRAM in newer OSes.
SimonLothar Team Kingdom
Joined: Jan 19, 2008
Posts: 426
Location: Germany
Posted:
Sun Mar 30, 2008 1:29 pm
@neurON! Of course you are right. It's safer to fetch the VRAM_base with SysCall 0x0135, before using it. Even the original CASIO SDK-emulator uses another VRAM_base as V1.03 on a FX-9860G calc. After reading your post I just downloaded revolution-FX 0.3.2 to have a look.
revolution_asm.src contains following code for CopyVRAM:
is a branch instruction with delay slot. Wouldn't it execute
mov.l @r15+, r8
every time it branches?
Wouldn't that lead to a crash due to stack corruption?
(The above code actually leads to a crash in a little test program I tried.)
I cannot imagine this source to be used with the current version of revolution-FX binary (perhaps kucalc only has forgotten to update the source in 0.3.2).
_________________ IŽll be back!
neur0n Team Kingdom
Joined: Mar 07, 2007
Posts: 101
Posted:
Sun Mar 30, 2008 10:20 pm
Yup, SimonLothar, looks like a bug.
kelli: The CopyVRAM()-function is no more than a memcpy(), with the vram address and size predefined.
To get you going, you could use the system call SimonLothar mentioned to get the address;
...
char your_buffer[1024];
char *vram_address;
vram_address = syscall(0,0,0,0,0x135); // use syscall() to get vram address
memcpy(your_buffer, vram_address, 1024);
...
SimonLothar Team Kingdom
Joined: Jan 19, 2008
Posts: 426
Location: Germany
Posted:
Sun Mar 30, 2008 10:37 pm
Yeah! And if you don't like to do assembler, you can do it all inside C.
Code:
// definition of the syscall-port (usable for nearly every syscall)
int SysCallCode[] = {0xD201422B,0x60F20000,0x80010070};
int (*SysCall)( int R4, int R5, int R6, int R7, int FNo ) = (void*)&SysCallCode;
It doesn't work. I guess I'm doing something wrong.
This is my test program, tell me what's wrong with it. Compiler gives me " Type not compatible for "=" ". I tried to mess with those pointers and got it compiled, but then the program itself gave me an error.
Code:
int SysCallCode[] = {0xD201422B,0x60F20000,0x80010070};
int (*SysCall)( int R4, int R5, int R6, int R7, int FNo ) = (void*)&SysCallCode;
I solved the problem on my own way:
I deleted in Revolution Fx 1.0 the line
Code:
#define VRAM (unsigned char*)0x8800498D
and put this in:
Code:
int SysCallCode[] = {0xD201422B,0x60F20000,0x80010070};
int (*SysCall)( int R4, int R5, int R6, int R7, int FNo ) = (void*)&SysCallCode;
#define VRAM (unsigned char*)(*SysCall)( 0, 0, 0, 0, 0x0135 )
It works great! Now you can draw sprites, CoolText, etc. and use the normal Bdisp functions.
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum