assembly combined with basic (Development MSX Fora)MSX Resource Center MSX Info Update - Finnish MSX madness at its best           
            
English Nederlands Español Português Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 123 gasten en 5 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - assembly combined with basic

Ga naar pagina ( Vorige pagina 1 | 2 )
Schrijver

assembly combined with basic

Grauw
msx professional
Berichten: 1002
Geplaatst: 04 April 2005, 22:11   
Quote:

and how can I make my sprites automaticly jump to page 1 when I select page 1, and vice versa?


The VDP has a separate register for the sprite table. So when I change the page in assembly, I change the start address of the screen display, but the sprite table address remains the same.

However in Basic it apparantly not only sets the address of the page, but also the address of the sprite table. I think you might be able to set the BASE address of the sprite table to the same value in both pages? Perhaps. Otherwise you will have to set it to the same address manually each time.

Quote:

The copy worked !! (also with a logical like tpset)
And i figured out how to make a pset
Im undoubtfully gonna be a machine linguist !!
jaja !!


Way to go! . Assembly isn’t that hard, if you know how the VDP works then the rest is pretty much just a couple of very simple calculations ^_^.


~Grauw
Grauw
msx professional
Berichten: 1002
Geplaatst: 04 April 2005, 22:20   
Quote:


EX DE,HL ; Check if there’s a picture
LD B,65 ´check if there is a picture in page 1
CALL SETVDP
IN A,(98H)

; Name : SETVDP
; Function : Set the VDP to writing or to reading
; Input : HL = VRAM-address, B = >bit 0 page >bit 6 write(0) or read(1)
; Output : C = data read- or write-port
; Changes: AF,BC
SETVDP: LD C,99H
LD A,H
AND 0C0H
PUSH BC
RES 6,B
OR B
RLCA
RLCA
OUT (C),A
LD A,14 OR 128
OUT (C),A
LD A,H
OUT (C),L
POP BC
RES 0,B
AND 3FH
OR B
XOR 64
OUT (C),A
DEC C
RET


I translated the Dutch lines above.

The equivalent routines on the MAP are SetVdp_Write and SetVdp_Read at http://map.tni.nl/sources/vdp_rout.php

With regard to ‘checking for pictures’ - I’m not entirely sure what you mean. There is no reliable way to tell that there ‘is something there’ or not. You just gotta remember in your program where you loaded your images.

About the sprites, you can disable them with the SPD bit, and also by writing - if I remember correctly - the value 216 to the Y-address of the first sprite.


~Grauw
Sonic_aka_T

msx guru
Berichten: 2261
Geplaatst: 05 April 2005, 00:16   
Quote:

Quote:

Curious, I never gave much thought to this one because my code was usually so full of screensplits that it always came out right. ?

could you tell me abit more about how you did this so it always came out right, maybe with a little example?

Hmm... We could explain, but then screen splitting involves a far greater understanding of the VDP than you currently have. Try to first get the hang of Z80 assembly in general, and the basic workings of the VDP. Perhaps, as a little side and practice project you could write a good-old-scroll in assembly? I remember that was my first 'big' assembly project after I learned VDP commands, and I learned a lot from it...
Edwin
msx professional
Berichten: 593
Geplaatst: 05 April 2005, 00:43   
Sonic is right about the practise, it's the only way to really understand everything. It takes a bit of time and you'll almost certainly mess up a few times.

About the "pages", this is somewhat of a basic concept and not really what direct VDP access is about. Basically you have 128kb of video memory. A page is nothing more than a specification of the address where the top of the screen starts. However, you don't have free choice of this address which practically only leaves you four option in screen 5 (R#2 = $1F, $3F, $5F, $7F, just see what happens for different values ).
For all other operations there are no restrictions! A video memory read is therefore nothing more than a read from a 17bit address. Because of MSX1 compatibility, specifying this is a bit odd. The lower 14 bits are written to port $99 (see docs for how), the highest 3 bits are set in R#14 of the VDP. The "page" is then nothing more than the two highest bits of the address (the single highest bit for sc7 and higher).
For VDP commands something similar happens, basically the y coordinate ranges 0-1023 (0-511). With pages having a their boundaries on 256 pixels, they get conveniently specified in the second byte though. However, the "page boundaries" don't really exist and you can use the draw commands over the entire vertical region in one go.

So the conclusion is that you should let go of the basic concept of pages, but see it as a large amount of memory that you have at your disposal to work in. The start of the screen is pointed somewhere in that space, the location of sprite data is pointed somewhere in there as well. So, as long as you don't change the sprite data address, sprites remain unaffected.
Grauw
msx professional
Berichten: 1002
Geplaatst: 05 April 2005, 13:56   
Well, they are pages insofar that this ‘start of the screen pointed somewhere in that space’ can only be pointing at 4 different locations (which we refer to as pages), so even when viewing it as a large contigious space you still gotta think in pages a little.

p.s. a tip: making the start address of the screen point inbetween pages yields nice effects, also in Basic .

~Grauw
norakomi
msx professional
Berichten: 861
Geplaatst: 08 April 2005, 23:37   
EX DE,HL ; Check if there’s a picture
LD B,65 ´check if there is a picture in page 1
CALL SETVDP
IN A,(98H)
Quote:


With regard to ‘checking for pictures’ - I’m not entirely sure what you mean.
~Grauw



EX DE,HL ; Check if there’s a picture
LD B,64 ´check if there is a picture in page 0
CALL SETVDP
IN A,(98H)

then page 0 is checked for a picture.
However I cant seem to figure out how to check page 0 and page 1.
Ánd, the entire program stars.asm, is originally in screen 8.
I changed it to screen 5, adapting al the addresses, like sprite patterns, color addresses etc. but after I changed it to screen 5, it seems like the ´checking for a picture in page 1 or page 0´ doesn´t work anymore......

how could this be?
norakomi
msx professional
Berichten: 861
Geplaatst: 08 April 2005, 23:38   
Quote:

p.s. a tip: making the start address of the screen point inbetween pages yields nice effects, also in Basic .


i will !!!
norakomi
msx professional
Berichten: 861
Geplaatst: 09 April 2005, 00:06   
haha replying myself in a quote !!!??? doh !
Quote:

However I cant seem to figure out how to check page 0 and page 1.



how could I do this?



[D-Tail]

msx guru
Berichten: 2994
Geplaatst: 09 April 2005, 00:17   
That's why there's the edit function
Edwin
msx professional
Berichten: 593
Geplaatst: 09 April 2005, 00:43   
Quote:

but after I changed it to screen 5, it seems like the ´checking for a picture in page 1 or page 0´ doesn´t work anymore......

how could this be?



In screen 8, page one starts at address $10000, in screen 5 page 1 starts at $8000.
norakomi
msx professional
Berichten: 861
Geplaatst: 11 April 2005, 21:13   
great !!!

Thanx,
(some info i cannot seem to find !!!)
norakomi
msx professional
Berichten: 861
Geplaatst: 11 April 2005, 21:38   
another question

at the beginning of this forumtopic I´m talking about the file stars.asm

This file has a loop which makes it possible to show stars in screen and at the same time you can do other things.

It works independantly like an ´on interval´ kinda thing in basic.

I guess I can also use this for a background scroll, can´t I ???

Let´s say I have made a assembly file which scrolls a certain background.
How can I make this loop infinitely in an ´on interval´ kinda way?

I checked the stars.asm file, but I cannot seem to find the code which creates this effect.

(this is also what is used with music right?)
(eventualy I can make my game in little parts which all work independantly,
like a music file, a backgroundscroll file, a scoreboard file etc. etc., and all of them work without affecting the other)
Edwin
msx professional
Berichten: 593
Geplaatst: 11 April 2005, 23:03   
Not entirely. The z80 only has one interrupt line. Which means that whenever a device generates an interrupt, it always call the same handler. It's up to the coder to check whether the interrupt was actually generated by correct device.

It's up to you to choose how to use this single interrupt handler and your main routine to get everything done.
norakomi
msx professional
Berichten: 861
Geplaatst: 15 April 2005, 01:55   
Quote:

Not entirely. The z80 only has one interrupt line. Which means that whenever a device generates an interrupt, it always call the same handler. It's up to the coder to check whether the interrupt was actually generated by correct device.

It's up to you to choose how to use this single interrupt handler and your main routine to get everything done.


how should one use this interupt ??
 
Ga naar pagina ( Vorige pagina 1 | 2 )
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.