[V9990] Q&A Official Thread

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

Par raymond

Hero (643)

Portrait de raymond

01-04-2022, 10:32

aoineko wrote:

Aoineko will work on it. ^^
I have to finish my scroller module, then add few more audio format and OPL4 support, then convert my build tool to Python.
Then V9990 will become a priority. Smile

A, good news! I will be waiting for it Smile

Par MaxMSX

Supporter (13)

Portrait de MaxMSX

15-05-2022, 18:42

I still don't get on how to use the commands for the name table on P1 (or P2). In other words, what is now the best way to fill the name table? Similar to screen 2/4, meaning set the vram address and start outing the data (but than you need to take into account the image space which can be 512). Or use one of the commands, like LMMC, but than with what parameters?

Par GhostwriterP

Paladin (683)

Portrait de GhostwriterP

15-05-2022, 21:16

Depends what you want to do.
In P1 the image space is always 512 x 512 pixels (64x64 tiles). For scrolling you do not need to update the whole name table each time, since the image space can wrap around. So in that case all you need to do is update just the 'borders' of the screen in the direction you are scrolling, this can be done with outing. Advantage then is that the command engine is free doing other stuff in the mean time.
Alternatively you can update the name table using the command engine. In that case you could have the complete level also stored in VRAM and use for example LMMM to update the borders. This will free up the CPU to do other things in the mean time.
You can also use LMMC which may be convenient for vertical borders, but then your using up both the command engine and CPU in that case.

Think the image space as 128 bytes wide, where every (16bit) tile is 4 'pixels' wide. The VRAM is 8 screens high and the image spaces start at y coordinate 1920 and 1984 for plane A and plane B respectively. So each plane (image space) is 256 pixels wide and 64 pixels high. Use the right write mask (R#46 0 R#47 255) and do not forget to set the high bit of x coordinate (SX9) to designate the destination to screen B (40000-7ffff). And you are good to go!
Now it is good to know the command engine works still with pixels (or nybles), for pset no problem, but keep that in mind if you think about using logic commands such as tpset,or, and etc Wink
Good luck!

PS: so basically keep the x coordinate and width aligned per 4 pixels

Par MaxMSX

Supporter (13)

Portrait de MaxMSX

15-05-2022, 23:07

Great! Thanks for this clear explanation Smile. Things start to make sense now, will continue with experimenting. In the end it looks like the V9990 is a lot 'cleaner' than the other VDP's, but of course it did not need to bother with backwards compatibility.

Par GhostwriterP

Paladin (683)

Portrait de GhostwriterP

16-05-2022, 10:25

For P2 it may also be possible to use commands on the name table but I doubt if it is as straight forward as for P1. This because for P2 the name table is suddenly not interleaved anymore (or actually it is but with spat, where spat = vram 0 & NT = vram 1). I imagine this will complicate things... maybe need to insert a dummy byte before each actual byte in source data... or something like that.

Par MaxMSX

Supporter (13)

Portrait de MaxMSX

16-05-2022, 23:48

I though I understood and have been trying a bit more but just can't get the commands to work for the name tables. Looking at the memory map in the programming guide, the name tables are all the way up at 7C000 (and 7E000).
You mention y coordinate 1920 ( and 1984 for plane b) as start of the image space (I thought btw the image space starts at 0, was the name table mend here?), but using this y coordinate as destination for LLMC to change the name table doesn't do anything (at least not visible). Directly outing to the address does work however. Using LLMC to y address 0 (the pattern table) also works fine.

Sorry for these basic questions, but really try to understand it oO . I've already been looking for example code to do this as well, but so far could not find anything.

Par MaxMSX

Supporter (13)

Portrait de MaxMSX

17-05-2022, 19:01

I found you answered already some of my questions in this thread as well, so an going to experiment further based on that :P

Par MaxMSX

Supporter (13)

Portrait de MaxMSX

18-05-2022, 21:21

I tried now with the following piece of code to just set the first tile in the name table to 0001 in mode P1 (yes far from optimal but just to get the basics Smile)

However, it looks like the data still ends up in the pattern data: I filled the pattern table upfront with 0000 (which is an empty pattern) using regular outs and see that after the code below some pixels are set in pattern 0000. Am I still missing something?

V9990_BASE_PORT = 0x60

V9990_VRAM_DATA       = V9990_BASE_PORT + 0x00        ; R/W
V9990_PALETTE_DATA    = V9990_BASE_PORT + 0x01        ; R/W
V9990_COMMAND_DATA    = V9990_BASE_PORT + 0x02        ; R/W
V9990_REGISTER_DATA   = V9990_BASE_PORT + 0x03        ; R/W
V9990_REGISTER_SELECT = V9990_BASE_PORT + 0x04        ; W
V9990_STATUS          = V9990_BASE_PORT + 0x05        ; R
V9990_INTERRUPT_FLAG  = V9990_BASE_PORT + 0x06        ; R/W
V9990_SYSTEM_CONTROL  = V9990_BASE_PORT + 0x07        ; W

v9990_OPERATION_CODE  = 52                            ; W

  ld   a, #36
  out  (V9990_REGISTER_SELECT), a

  ;DX
  ld   a,#0
  out  (V9990_REGISTER_DATA),a
  ld   a,#0
  out  (V9990_REGISTER_DATA),a

  ;DY: Start of name table
  ld   a,#128
  out  (V9990_REGISTER_DATA),a  
  ld   a,#7
  out  (V9990_REGISTER_DATA),a

  ;NX: since 16 bit = 4 dot, 4 dot = 1 tile
  ld   a,#4
  out  (V9990_REGISTER_DATA),a
  ld   a,#0
  out  (V9990_REGISTER_DATA),a

  ;NY: 1 tile high
  ld   a,#1
  out  (V9990_REGISTER_DATA),a
  ld   a,#0
  out  (V9990_REGISTER_DATA),a

  ;Argument
  ld   a,#0
  out  (V9990_REGISTER_DATA),a

  ;Opcode: LMMC
  ld   a, #v9990_OPERATION_CODE
  out  (V9990_REGISTER_SELECT), a
  ld   a,#0x10
  out  (V9990_REGISTER_DATA),a

  ;Data
  ld   a,#01
  out  (V9990_COMMAND_DATA),a
  ld   a,#00
  out  (V9990_COMMAND_DATA),a
  

Par GhostwriterP

Paladin (683)

Portrait de GhostwriterP

18-05-2022, 22:45

my guess:
R#37 = 2 ;dx9 = 1 to select screen "B" as destination (name tables are on screen "B") where screen"A" is VRAM 00000-3FFFF and screen "B" is VRAM 40000-7FFFF.
R#45 = 12 (pset)
R#46 = 0
R#47 = 255 did you set the write mask like this?

Par ToriHino

Paladin (857)

Portrait de ToriHino

18-05-2022, 23:21

That's indeed tricky, but also logical since the name table is at the end of the VRAM.

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