[MSX-C] Q&A official thread

Page 18/57
11 | 12 | 13 | 14 | 15 | 16 | 17 | | 19 | 20 | 21 | 22 | 23

By AxelStone

Prophet (3064)

AxelStone's picture

13-09-2015, 14:39

I was confused with BIOS function:

RDVDP (013EH)		*1
  Function:	reads VDP status register
  Input:	none
  Output:	A for the value which was read
  Registers:	A

Since it don't receive any parameter, I supossed that recover all bits. With your solution is very clear how to read S#2, but using BIOS, how I pass S#2 as parameter?

By Grauw

Ascended (10329)

Grauw's picture

13-09-2015, 14:58

DarkSchneider wrote:

The problem is that using HMMM we have to manually copy line by line, waiting with the CPU to the line to be copied and then copy the next one.

That’s not correct… HMMM is just like LMMM except you can not use the logical operators and the copy must be byte-aligned (only even x dimensions in screen 5). With those limitations, it can copy more than twice as fast. It’s better to consult the V9938 application manual for details rather than the technical handbook.

It seems that cpyv2v() automatically picks the high speed move when possible, that’s nice.

By Grauw

Ascended (10329)

Grauw's picture

13-09-2015, 14:46

AxelStone wrote:

Since it don't receive any parameter, I supossed that recover all bits. With your solution is very clear how to read S#2, but using BIOS, how I pass S#2 as parameter?

RDVDP is an MSX1 BIOS function, the MSX1 VDP (TMS9918) only has one status register. There is a new subrom BIOS function VDPSTA for MSX2 where you can specify the status register number.

By AxelStone

Prophet (3064)

AxelStone's picture

13-09-2015, 14:54

@Grauw That was the key, VDPSTA , I was reading the wrong function Eek! . About HMMM, very impressive results, but I think that MSX-C don't implement it, so it should be necessary make an ASM function and integrate. Since JaviLM allready explained how to integrate MSX-C with ASM, it seems a good exercise make that function.

Thanks for the info.

By Grauw

Ascended (10329)

Grauw's picture

13-09-2015, 15:05

AxelStone wrote:

About HMMM, very impressive results, but I think that MSX-C don't implement it, so it should be necessary make an ASM function and integrate.

But it does, you posted earlier yourself:

AxelStone wrote:

By the way, very interesting this point of the function:

;
;	see if we can use high speed move
;
	ld	b,a			; set byte boundary flag in b
	pop	hl			; restore logical operation code in h
	pop	de			; restore source x start
	ld	a,h			; logical operation specified?
	and	a
	jr	nz,vv_logical		; yes, move logically
	ld	a,(SCRMOD)
	cp	8			; screen 8?
	jr	z,vv_hs 		; yes, always use high speed
	cp	6			; screen 6?
	jr	z,vv_check_4		; yes, check lower 2 bits
	ld	a,b			; on byte boundary?
	rrca
	jr	nc,vv_hs		; yes, use high speed move
	jr	vv_logical		; no, use logical move

It checks if can use high speed move Shocked!

That’s an excerpt from MSX-C’s cpyv2v() implementation in GLIB.MAC, right?

HMMM is an abbreviation for “High-speed Move to Memory from Memory” (where memory refers to the VDP’s memory), when they talk about high speed move that’s what they are referring to. The VDP command that allows logical operators and odd x pixel coordinates is called LMMM, “Logical Move to Memory From Memory”.

By DarkSchneider

Paladin (942)

DarkSchneider's picture

13-09-2015, 15:05

It seems the handbook is wrong, that's not good to have contradictory info about the same system Sad but good news for speed Smile

Could be that we are passing an 8bit value and it uses 4bits? What it does with the other 4?

By anonymous

incognito ergo sum (116)

anonymous's picture

13-09-2015, 15:08

AxelStone wrote:

About HMMM, very impressive results, but I think that MSX-C don't implement it, so it should be necessary make an ASM function and integrate. Since JaviLM allready explained how to integrate MSX-C with ASM, it seems a good exercise make that function.

Actually, cpyv2v() does use the HMMM op. Look at the source code of CPYV2V in GLIB.MAC. Near the end of the routine there's a check to see whether HMMM can be used or not. If it can be used then it does. If it can't, then cpyv2v() uses LMMM instead.

By AxelStone

Prophet (3064)

AxelStone's picture

13-09-2015, 15:24

Right, I suposse that 8 is no logop, so it uses HMMM.

By AxelStone

Prophet (3064)

AxelStone's picture

13-09-2015, 23:18

Here goes another question.

Question: Until now we have worked with lower 64Kb of VRAM (PAGE0 and PAGE1) but, what happens if we want to work with higher 64Kb of VRAM? I'm trying some operations and seems not to work. Let's recover the loading of image and add some copy:

#include<stdio.h>
#include<glib.h>

#define PAGE0 0x0000
#define PAGE1 0x8000
#define PAGE2 0x10000
#define PAGE3 0x18000
#define SCREEN5 (TINY)5
#define SCREEN0 (TINY)0
#define BUFSIZE 128
#define COUNT 1


NAT grbdat[16]={0x0442,0x0000,0x0400,0x0040,0x0200,0x0221,0x0231,0x0224,0x0346,0x0777,0x0436,0x0120,0x0555,0x0420,0x0250,0x0113};

loadimg() {
	FILE *fp;
	char buf[BUFSIZE];
	int i;
	int vrami=PAGE1;
	fp=fopen("arthur4.sc5","rb");
	if(fp==NULL) {
		printf("File read error!");
		return;
	}
	fread(buf,7,COUNT,fp);
	for(i=0; i<213; i++) {
		fread(buf,BUFSIZE,COUNT,fp);
		ldirvm(vrami,buf,BUFSIZE);
		vrami = vrami+BUFSIZE;
	}
	fclose(fp);
	cpyv2v(0,0,100,100,(TINY)1,0,0,(TINY)2,(TINY)0); 
	cpyv2v(0,0,100,100,(TINY)2,0,0,(TINY)0,(TINY)0); 
}

loadplt() {
	TINY pal;
	for(pal=0;pal<16;pal++) {
		setplt(pal,grbdat[pal]); 
	}
}

main(){
	screen(SCREEN5);
	loadplt();
	loadimg();
	getchar();
	screen(SCREEN0);
}

That works, this is, load image in PAGE1, transfer to PAGE2 and copy from 2 to 0. But can I load directly in PAGE2? It seems that not, if I make the following change:

	int vrami=PAGE2;

Then image loads on PAGE0 (display screen), this is, starts as 0 address. Really it's reasonable since max value of integer is 65.535 (16bit) so its supossed that trying to acces next value will loop to 0. Is this correct?

Thanks.

By Grauw

Ascended (10329)

Grauw's picture

14-09-2015, 00:32

Just a guess, but have you tried setpg()? I suspect the actpag will influence the base address offset for ldirvm().

Page 18/57
11 | 12 | 13 | 14 | 15 | 16 | 17 | | 19 | 20 | 21 | 22 | 23