Karoshi MSX Community

Desarrollo MSX => Development (English/Ingles) => Mensaje iniciado por: nitrofurano en 27 de Junio de 2013, 05:19:51 pm



Título: v9990: help needed (like asm snippets for helping Boriel's ZX-Basic development)
Publicado por: nitrofurano en 27 de Junio de 2013, 05:19:51 pm
after the successful (imho) approach i got on msx2+ display modes, i'm now trying to implement v9990 libraries on Boriel's ZX-Basic Compiler, but i'm struggling on:

1- run by Bash script (command line, Linux) OpenMSX with v9990 (gfx9000 or video9000) enabled
2- check if i were using the exact v9990 ports, if some reset/initialization is needed, etc.
3- some snippets in assembly z80 that might be useful on the development

for now, i think the most essential is to be able to set the screen mode, palette, vpeek, vpoke, etc., and i think everything later is a bit easier

files are at https://drive.google.com/#folders/0B7Iw8X7IB4-nQkZFNmxXN2pxNkU - thanks!


Título: Re: v9990: help needed (like asm snippets for helping Boriel's ZX-Basic development)
Publicado por: assembler en 04 de Julio de 2013, 04:13:23 pm
Hi.

1. openmsx -ext gfx9000 romname.rom

2. You have all that information in the teambomba's g9klib, and searching v9990 in the internet: v9990 e-vdp-iii.
      Normally you will use ports 0x60-0x67

3. At first I recommend using openMSX-debugger for testing. You can write directly on the registers and go see how it behaves, and then fret the VRAM. When you are clear about how it works, start typing code.


vpoke:
;writes B value at DHL address
     di
     xor a
     out[0x64],a   ;register 0 selected

     ld a,l
     out [0x63],a  ;this will write L value to register 0. (Low byte)
     ld a,h
     out [0x63],a  ;this will write H value to register 1. (Med byte)
     ld a,d
     out [0x63],a  ;this will write D value to register 2. (High Byte)

     ;VRAM pointer points to DHL
     ld a,b
     out [0x60],a 
     ei
     ret
     




Título: Re: v9990: help needed (like asm snippets for helping Boriel's ZX-Basic development)
Publicado por: nitrofurano en 18 de Septiembre de 2013, 05:33:40 pm
in theory, this is what i have at http://nitrofurano.altervista.org/retrocoding/msx/ (those v9990 examples in the attachment, that i think none of them work) - and btw, if someone could post a small assembly snippet (compilable on asmsx would be awesome! ;) ) that can make use of that, and i could try opening the resulting .rom file on OpenMSX, would be amazing


Título: Re:v9990: help needed (like asm snippets for helping Boriel's ZX-Basic development)
Publicado por: nitrofurano en 15 de Julio de 2014, 09:36:43 am
i'm trying this now:

Código:
dim i as uinteger at $C000
dim a as uinteger at $C002
dim b as uinteger at $C004

out $64,6
out $63,%10100010
out $64,7
out $63,%00100110
out $67,1

for i=0 to 63
  out $64,14
  out $63,i*4
  out $61,int(i/2)
  out $61,int(i/2)
  out $61,int(i/2)
  next

for b=0 to 255
  for a=0 to 255
    out $64,0
    out $63,a
    out $63,b
    out $63,0
    out $60,a

    asm
      halt
      end asm

    next:next

loop01:
goto loop01

nothing happens, just a blank display when i enter "set videosource gfx9000" on the OpenMSX console

btw, how can i replace "set videosource gfx9000" with a command line, so i don’t need to go to the console for entering that console command?


Título: Re:v9990: help needed (like asm snippets for helping Boriel's ZX-Basic development)
Publicado por: assembler en 15 de Julio de 2014, 10:17:39 am
In the console, type:
Código:
bind f6 cycle videosource
F6 will swap between V9990 output and Standard VDP output.





Código:
dim i as uinteger at $C000
dim a as uinteger at $C002
dim b as uinteger at $C004

out $64,6
out $63,%10100010  ;register 6
;out $64,7:   not neccesary, as registers are incremented as you write to port 0x63   
out $63,%00100110  ;register 7
out $63,%10000000  ;register 8, set SCREEN DISPLAY ENABLE


out $64,14
out $63,0 ;Once Palete Pointer is set, each write to 0x61 port, increments that pointer
for i=0 to 63
  out $61,int(i/2)
  out $61,int(i/2)
  out $61,int(i/2)
next

out $64,0
out $63,a
out $63,b
out $63,0 ;the same to VRAM write address
for b=0 to 255
  for a=0 to 255
    out $60,a

    asm
      halt
      end asm

    next:next

loop01:
goto loop01


Título: Re:v9990: help needed (like asm snippets for helping Boriel's ZX-Basic development)
Publicado por: nitrofurano en 18 de Julio de 2014, 06:04:10 pm
it’s working! thanks! :)
and thanks a lot for the OpenMSX command for display switching, i didn’t know that! :)

and about the "not necessary", they actually were in my case, i was trying to create libraries for ZX-Basic:

example08.bas
Código:
#include "library/msxgfx9kvdp.bas"
#include "library/msxgfx9kpalette.bas"
#include "library/msxgfx9kvpoke.bas"

dim i as uinteger at $C000
dim a as uinteger at $C002
dim b as uinteger at $C004

msxgfx9kvdp(6,%10100010)
msxgfx9kvdp(7,%00100110)
msxgfx9kvdp(8,%10000000)
'out $64,6
'out $63,%10100010  ';register 6
'out $64,7
'out $63,%00100110  ';register 7
'out $64,8
'out $63,%10000000  ';register 8, set SCREEN DISPLAY ENABLE

for i=0 to 63
  msxgfx9kpalette(i,int(i/2),int(i/2),int(i/2))
  'out $64,14
  'out $63,i*4
  'out $61,int(i/2)
  'out $61,int(i/2)
  'out $61,int(i/2)
  next

for b=0 to 255
  for a=0 to 255
    msxgfx9kvpoke((b*256)+a,a)
    'out $64,0
    'out $63,a
    'out $63,b
    'out $63,0
    'out $60,a
    asm
      halt
      end asm
    next:next

loop01:
goto loop01

library/msxgfx9kvdp.bas:
Código:
sub msxgfx9kvdp(treg as ubyte, tvl as ubyte):
  out $64,treg
  out $63,tvl
  end sub

library/msxgfx9kpalette.bas:
Código:
sub msxgfx9kpalette(tidx as ubyte,tpr as ubyte,tpg as ubyte,tpb as ubyte):
  out $64,14
  out $63,(tidx mod 64)*4
  out $61,tpr
  out $61,tpg
  out $61,tpb
  end sub

library/msxgfx9kvpoke.bas:
Código:
sub msxgfx9kvpoke(tadr as ulong, tvl as ubyte):
  dim tadr2 as ulong at $E600:tadr2=tadr
  '- this code seems not acuraced yet
  out $64,0
  tvou=tadr2 band 255:tadr2=int(tadr2/256)
  out $63,tvou
  tvou=tadr2 band 255:tadr2=int(tadr2/256)
  out $63,tvou
  tvou=tadr2 band 255:tadr2=int(tadr2/256)
  out $63,tvou
  out $60,tvl
  end sub


Título: Re:v9990: help needed (like asm snippets for helping Boriel's ZX-Basic development)
Publicado por: nitrofurano en 19 de Julio de 2014, 12:04:21 pm
another question: from http://msxbanzai.tni.nl/v9990/manual.html , related to the display modes, i don’t know how with MCS and P#7 are accessed, like at "register setting values for each display mode", the difference between modes b0 and b1, b2 and b3, b4 and b7 - how can we access these modes b0, b2 and b4?


Título: Re:v9990: help needed (like asm snippets for helping Boriel's ZX-Basic development)
Publicado por: nitrofurano en 19 de Julio de 2014, 08:22:39 pm
another question: from http://msxbanzai.tni.nl/v9990/manual.html , related to the display modes, i don’t know how with MCS and P#7 are accessed, like at "register setting values for each display mode", the difference between modes b0 and b1, b2 and b3, b4 and b7 - how can we access these modes b0, b2 and b4?
nevermind, i found that, it is "out $67,1"


Título: Re:v9990: help needed (like asm snippets for helping Boriel's ZX-Basic development)
Publicado por: nitrofurano en 19 de Julio de 2014, 08:30:04 pm
at https://docs.google.com/file/d/0B7Iw8X7IB4-nMWpSYTEtR3hYRDQ i have a bunch of initial tests trying to cover all display modes summarily (i still didn't tried all combinations of laced, pal/ntsc, etc.), soon i hope having better ideas of examples using them -- (btw, the sources are there, if someone might want to start something)


Título: Re:v9990: help needed (like asm snippets for helping Boriel's ZX-Basic development)
Publicado por: assembler en 21 de Julio de 2014, 08:00:33 am
You should use the autoinc register feature, maybe creating another function:
Código:
sub msxgfx9kvdp_set_register(treg as ubyte):
  out $64,treg
  end sub

sub msxgfx9kvdp_write_register(tvl as ubyte):
  out $63,tvl
  end sub

sub msxgfx9kpalette_set_pointer(tidx as ubyte):
  out $64,14
  out $63,(tidx mod 64)*4
  end sub
sub msxgfx9kpalette_write_rgb(tpr as ubyte,tpg as ubyte,tpb as ubyte):
  out $61,tpr
  out $61,tpg
  out $61,tpb
  end sub


sub msxgfx9kvpoke_set_address(tadr as ulong):
  dim tadr2 as ulong at $E600:tadr2=tadr
  '- this code seems not acuraced yet
  out $64,0
  tvou=tadr2 band 255:tadr2=int(tadr2/256)
  out $63,tvou
  tvou=tadr2 band 255:tadr2=int(tadr2/256)
  out $63,tvou
  tvou=tadr2 band 255:tadr2=int(tadr2/256)
  out $63,tvou
  end sub

sub msxgfx9kvpoke_write_value(tvl as ubyte):
  out $60,tvl
  end sub


Título: Re:v9990: help needed (like asm snippets for helping Boriel's ZX-Basic development)
Publicado por: nitrofurano en 21 de Julio de 2014, 06:02:14 pm
thanks! :)