Hello,
When I discovered that the VRAM access timing given on the MSX Assembly Page website that I used as a reference to build my MSXgl library, did not match what I observed on my real MSX, I wanted to know more.
So I created a tool to test a series of VRAM copy functions with different speed that I tested on the different display modes of the MSX.
The results confirm that the reference does not seem to be correct under certain conditions.
Example with FS-A1 emualted on openMSX (this emulator and Emulicious are not totally accurate, but this is an other story):
Before sharing the tool with the community so that we can test it on as many real MSX as possible, I would like to confirm the method with you to verify that the numbers are correct.
The method is simple:
- Write to a fixed address in VRAM a series of 256 characters (empty circle) with a slow copy function (29 t-states).
- Then copy to the same address a series of 256 characters (filled circle) with the speed function to test. For example, the fastest function is just a sequence of 256 out (n),a
which is supposed to take 12 t-states.
- Count (with slow reading function) the number of filled circle compare to the number of empty circle and compute a percentage.
- (optional) Repeat this test 16 times and keep the min/max and the average values.
Here are the different functions that can be tested with their corresponding speed (I would like to check this point):
;--------------------------------- ; Function Fill_12 ; --------------------------------- _Fill_12:: .rept 256 out (0x98), a .endm ret ;--------------------------------- ; Function Fill_14 ; --------------------------------- _Fill_14:: ld c, #0x98 .rept 256 out (c), a .endm ret ;--------------------------------- ; Function Fill_17 ; --------------------------------- _Fill_17:: .rept 256 out (0x98), a nop .endm ret ;--------------------------------- ; Function Fill_19 ; --------------------------------- _Fill_19:: ld c, #0x98 .rept 256 out (c), a nop .endm ret ;--------------------------------- ; Function Fill_20 ; --------------------------------- _Fill_20:: .rept 256 out (0x98), a or #0 .endm ret ;--------------------------------- ; Function Fill_22 ; --------------------------------- _Fill_22:: .rept 256 out (0x98), a nop nop .endm ret ;--------------------------------- ; Function Fill_29 ; --------------------------------- _Fill_29:: ld b, #0 fill29: out (0x98), a or #0 djnz fill29 ret
Does this sound right to you?
The idea was to have speeds below and above the different timings given on MSX Assembly Page:
// Screen VDP MSX1 MSX2/2+ // mode mode cycles cycles //-------------------------------------------------------------------------- // 0,W40 T1 12 20 // 0,W80 T2 20 // 1 G1 29 15 // 2 G2 29 15 // 3 MC 13 15 // 4 G3 15 // 5 G4 15 // 6 G5 15 // 7 G6 15 // 8 G7 15
Some questions:
- How should we arrange the sprites to be in the worst case of VDP resources usage?
- Is testing only VRAM filling relevant for testing access times or do we risk missing other problems?
I just thought I should make sure we're out of the V-Blank when testing. I'll fix that tonight...