reading sc5 file in C

Page 2/2
1 |

By Wolverine_nl

Paragon (1037)

Wolverine_nl's picture

04-06-2014, 20:58

It seems I cheered too soon, a previous test in basic I did was still in vram, so it doesnt quite work Tongue
Will get back on this tomorrow.

By hit9918

Prophet (2868)

hit9918's picture

04-06-2014, 22:54

"filvrm(0x0000,bsize,*gbuf);", the "*" looks wrong, passing first element of array.
Did compiler not warn like function wants pointer.

I think its "filvrm(0x0000,bsize-7,gbuf+7);"
I dont know about order of parameters.

What is "TINY"? It sounds like a 8086 address model, not like size of array elements.
What about the good old char.

By Wolverine_nl

Paragon (1037)

Wolverine_nl's picture

04-06-2014, 23:01

Ah yes, ascii msx c doesnt have long, double etc
Tiny is also something that is explained in japanese manual, maybe someone knows its exact function, i only put it where its needed to function properly.
Tomorrow the code will be changed, probably go with char.

By MsxKun

Paladin (922)

MsxKun's picture

04-06-2014, 23:11

Wolverine_nl wrote:

(oh and BTW it is not meant for PC, it is to be executed on MSX-DOS2)

Oh, i though it was for PC Big smile
Then Assembler is ultra-easy, but I guess I can't convince you Smile

By Wolverine_nl

Paragon (1037)

Wolverine_nl's picture

04-06-2014, 23:25

Haha asm isnt my cup of tea, know little bit.

By Wolverine_nl

Paragon (1037)

Wolverine_nl's picture

04-06-2014, 23:29

hit9918 wrote:

"filvrm(0x0000,bsize,*gbuf);", the "*" looks wrong, passing first element of array.
Did compiler not warn like function wants pointer.

I will have a look in the functionlist about this function, i remember it said 'data' so i guess you re right Wink

By Wolverine_nl

Paragon (1037)

Wolverine_nl's picture

05-06-2014, 10:33

well the manual gives the following info about it:
filvrm:
VOID filvrm(adr, len, data)
NAT adr, len;
TINY data;

By Grauw

Ascended (8457)

Grauw's picture

05-06-2014, 12:41

You should use ldirvm to copy data. Filvrm just fills an entire region with a single value.

See the BIOS reference here and here.

By Wolverine_nl

Paragon (1037)

Wolverine_nl's picture

05-06-2014, 12:41

ah thanks Grauw Big smile Filling the screen it did perfectly, only with a pattern Smile I feel hope for me now!! Big smile

By Wolverine_nl

Paragon (1037)

Wolverine_nl's picture

05-06-2014, 13:51

the following works, I use this for my own purposes, so I deleted the first 7 bytes with a hex editor, just to get the basics right, it loads into page 1 of screen 5, very simple. Loading the palette is next.

gfile()
{
FILE *gdata;
static TINY gbuf[30375];
int x;
int i;
int bsize;
bsize = 30375; 
x = 1;

gdata = fopen("titles.sr5","rb");
if(!gdata) { exit(1); }

fread(gbuf,bsize,x,gdata);

ldirvm(0x0000, gbuf, bsize); 
fclose(gdata);
}
Page 2/2
1 |