|
| | Hay 48 invitados y 1 miembro en línea
Eres un usuario anónimo.
|
| |
Autor
| HELP WITH VPEEK,VPOKE..
| Msx-Basic msx friend Mensajes: 10 | Publicado: Enero 09 2005, 16:12   | CAN SOMEONE WRITE A FILE OR A NEW POST (IN DETAILS WITH SMALL EXAMPLES) ABOUT COMMANDS,VPOKE,VPEEK,USR,DEFUSR,POKE,PEEK
EXAMPLE:
WHEN :
VPOKE 5999,10
WHAT IS THE NO. 10 MEANS
OR
DEFUSR=6000  EFUSR1=6010!
WHAT IS THIS NUMBER 6000?????????
OR
F=VPEEK (5999,10)
WHAT WILL BE THE VALUE OF F AND WHAT IS IT DEPEND OF??
PLEASE WRITE THE FILE IN DETAILS
THANKS VERY MUCH | | cax
 msx master Mensajes: 1051 | Publicado: Enero 09 2005, 16:17   | What you are asking us is very complex and can't be covered by small article.
In order to understand VPEEK/VPOKE start reading VDP manual.
For USR,DEFUSR,POKE,PEEK you need at least some document describing BIOS/MSX-BASIC subroutines and their entry addresses.
In order to make something meaningful yourself, start learning Z80 machine coding and assembler.
In other words:
using the mentioned BASIC commands usually assumes you-know-what-you-are-doing, and, in fact, has very little in common with other BASIC commands. The mentioned commands are not so basic and are not simple at all.
| | Sonic_aka_T
 msx guru Mensajes: 2269 | Publicado: Enero 09 2005, 16:56   | Hmm... I'll give it a try... I don't know anything about MSX1 computers, but I'll just assume it works in the exact same way as it does on MSX2.
VPOKE writes a byte to VIDEO RAM. The first number is the address in the video RAM. Basically this is WHERE you want to write a value in Video RAM. If I remember correctly you can only specify the first 64kB of the VRAM here, but since an MSX1 only has 16kB of VRAM that shouldn't matter for you. The second value is the value of the BYTE you want to write to that address. That's all really. VPOKE ADRESS,VALUE
Example: VPOKE 0,255 (writes the value of 255 (&HFF) to VRAM address 0)
VPEEK does the opposite, it reads from video RAM. Here however, the address must be specified between parenthesis. In your example of F=VPEEK(6000) it would store the value of address 6000 of the VRAM in the variable F. Forget the whole ,10 part by the way, the adress is a single 16bit value. VAR=VPEEK(ADDRESS)
Example: V=VPEEK(0) ; (reads the value of video RAM address 0 to variable V)
DEFUSR defines a machine code routine already present in memory. This allows you to execute a machine code program from the BASIC environment. DEFUSR specifies the address of the routine. VAR=USR(0) then starts this machine code. This is only useful if you've made some machine code yourself, or have just loaded some machine code in to memory. There is also a few BIOS routines present in ROM memory which you can use like that. DEFUSR can also pass and retreive values from and to machine code programs, but at this time I would think that that's a little over your head. Other than that it is probably not very useful until you have a better understanding of the MSX system. DEFUSR=ADDRESS: A=USR(0)
Example: DEFUSR=&H41: A=USR(0); Disables screen display
Example: DEFUSR=&H44: A=USR(0); Enables screen display | | viejo_archivero msx addict Mensajes: 470 | Publicado: Enero 09 2005, 18:19   | Quote:
| Hmm... I'll give it a try... I don't know anything about MSX1 computers, but I'll just assume it works in the exact same way as it does on MSX2.
|
Yes, it works in the same way  | | Msx-Basic msx friend Mensajes: 10 | Publicado: Enero 09 2005, 19:29   | Thank you MSX MASTER
| | MäSäXi msx professional Mensajes: 547 | Publicado: Enero 09 2005, 21:22   | Hello our msx friend, Msx-Basic!
Don´t give so complicated picture of inner mind of MSX to our new friend, I personally think that VPOKEing is not always SO complicated stuff.. please free your mind, remember time when you all were joyous when you learned that you can alter ink and paper colours by just typing COLOR 13,10.
write this little program to your MSX, Msx-Basic, I´ll think you get some fun from it! And learn something too!
10 SCREEN 1
20 FOR S=78*8 TO 78 *8+31
30 READ MD$
40 VPOKE S,VAL("&h"+MD$)
50 NEXT
60 PRINT" NO"
70 PRINT" PQ"
100 DATA 1,1,1,3,7,3,7,f
110 DATA 0,0,80,c0,c0,80,e0,e0
120 DATA 7,f,1f,3f,f,3f,7f,3
130 DATA f0,c0,e0,f0,f8,f0,fe,80
I typed this program from finnish book called "HUVIA JA HYÖTYÄ MSX".
And what it does is that it redefines characters N, O, P and Q and you get nice little spruce tree!  | | MäSäXi msx professional Mensajes: 547 | Publicado: Enero 09 2005, 21:30   | Here´s lil homework for you all:
Write here how you can alter colour of that spruce tree
and answers using COLOR command are not allowed, expert users who use COLOR will be spanked harder than they hope. Beginners can use COLOR of course, don´t worry! And then explain why you should use VPOKE instead of COLOR.
I know answer, but do YOU still remember it?  (tip: use VPOKE) | | NYYRIKKI msx master Mensajes: 1533 | Publicado: Enero 10 2005, 09:09   | VPOKE BASE(6)+9,192:VPOKE BASE(6)+10,192
You need 2 VPOKEs, because in this example the letter blocks to be replaced are not thought well. COLOR command has a nasty habit to replace all the colors of all blocks.
Your turn... now explain me, why I used BASE-command?
| | [D-Tail]
 msx guru Mensajes: 3026 | Publicado: Enero 10 2005, 10:05   | BASE is a function which gives you the start location of e.g. a sprite attribute/generator table in SCREEN 5 (though I prefer to calculate that one myself with VDP(5), VDP(6) & VDP(12)  ), or a pattern color table in SCREEN 1. In other words, you wrote it down for compatibility reasons, so that it will work in any MSX  | | NYYRIKKI msx master Mensajes: 1533 | Publicado: Enero 10 2005, 14:27   | Well... This is not quite exact... It is because of compatibility, but the addresses after boot are always same in any MSX. You can anyway alter the addresses, that BASIC uses.
If you for example write: BASE(6)=&H2800
BASIC will use the color table from address &H2800 in SCREEN 1 always after that. If screen memory layout has been altered before you start your program, that uses direct addresses and does not set BASE addresses back to default values, it will not work.
BASE number can be calulated like this:
SCREEN mode * 5 + X
X:
0 = Tile map
1 = Tile colors
2 = Tile outlook
3 = Sprite attributes
4 = Sprite outlook
Pseudo explanation of MSX2 and up return values of BASE command:
screenmode = PEEK(&HFCAF)
If screenmode >4 AND X<3 THEN RETURNVALUE=0
This means, that for example in SCREEN 5 there is no tile colors, so BASE(26)=0
In practice this has no meaning, but I think, it is nice to know anyway.
| | Msx-Basic msx friend Mensajes: 10 | Publicado: Enero 10 2005, 14:58   | Thanks for tour help
but i want to ask a question,I have the MSX GAMES BOOK BY Andrew Lacey
there is something that i am not understanding,,why in the first game(ASTRIAL ATTACK)using the defusr twice,and why using the statement
poke 5999!,10
i mean why we are enterng no. 10 in the memory,,or what is the purpose of that
and about vpoke,he used in his book vpoke to draw graphs,but why he must use vpeek,(i know to return the value of vpoke in vram) but why all that,,i mean why needing to return that value,,,and if possible i want to ask an other question ..is the a=usr(0) store the case of the screen with all it contains (graphs or anything),,and why in that book (msx games book) used it twice
defusr=6000:defusr1=6010
thanks for paying attention to this post
Msx-Basic
| | Sonic_aka_T
 msx guru Mensajes: 2269 | Publicado: Enero 10 2005, 15:16   | Well, POKE just writes a value to memory. I don't quite understand the address you give though, since POKE 5999,10 would write something to an address where the BIOS ROM is located. (and therefore impossible to write to)
The DEFUSR things are specific to this game, so it's impossible for us to tell what kind of machine code is at that address. It's clear however that the listing generates some machine code program, and then defines the start positions of the routines. The poke before that is probably used to pass a variable to that machine code program. But, since we don't know what that machine code program does, there's really not much we can tell you about it. From what I can see:
DEFUSR=6000 defines the first machine code routine
DEFUSR1=6010 defines a second machine code routine
POKE 5999,10 probably passes a variable to those routines
the program would then probably do a A=USR(0) to call the first routine and A=USR1(0) to call the second routine. If there are other pokes to address around 6000 they're probably also used to pass variables to those machine code routines... It's hard to tell all this without having the listing though...
Mind you, all those POKEs, DEFUSRs and PEEKs are not really BASIC commands. You can use them ofcourse, but especially DEFUSR is really only used to integrate machine code programs in MSX-BASIC.
| | NYYRIKKI msx master Mensajes: 1533 | Publicado: Enero 10 2005, 15:57   | Quote:
| ..is the a=usr(0) store the case of the screen with all it contains (graphs or anything),,and why in that book (msx games book) used it twice
defusr=6000:defusr1=6010
|
Maybe... or then it is used to play music or something else.
I don't know this book, but as this sounds like BASIC book, I think, that if you read pages before this listing, there is a listing with lots of DATA lines, that you have to type in first and save the result with BSAVE to get this game working. There is propably also good explanations, what these routines are used for.
About those defusr commands, are you sure, you are not forgetting one number? It would sound more reasonable like this: DEFUSR=60000: DEFUSR1=60010
Note, that DEFUSR command it self does not do anything. That line with A=USR(0) starts the routine from address defined by DEFUSR. It is possible to define up to 10 (0-9) USR commands, that points to machine language routines.
| | Msx-Basic msx friend Mensajes: 10 | Publicado: Enero 10 2005, 18:53   | Well,guys thanks again for your attention
NYYRIKKI,you said that i have to write some programs and save them with BSAVE but a have a disk .DSK file in emulator BLUE MSX..contains some games ..they are used vpoke and defusr and other statements but there is no .BIN files..and no oter files........... just .BAS file (GAME'S file) and note that i listed the program and run it and it run successfully ..so if i want to program a game..shall i know each vram address,,and i think that no one exactly answered my question ..what is the purpose of putting bytes in memory
thanks for paying attention
| | Sonic_aka_T
 msx guru Mensajes: 2269 | Publicado: Enero 10 2005, 20:48   | Putting bytes in memory has no fixed purpose. MSX is not like the C=64 in that sense that you peek and poke everything. There is a few tricks you can obtain by poking some specific system variables, but other than that you normally wouldn't use POKE or PEEK for a simple BASIC program.
Like I said in my previous post, POKE is being used in the listing you have to first write some machine code (specifically for that game) to memory and then to pass some variables to that piece of machine code. Those pokes will only work in that specific listing and have nothing to do with the MSX system on a whole.
VPOKEs on the other hand, can be useful to modify the contents of the video RAM and thus (often) change the data that is displayed on the screen. VPOKE can indeed be useful at times and can prove easier/faster than for example PRINT in some circumstances. To understand what a VPOKE will result in you would need a more proper understanding of the Video Display Processor though, which cannot be covered in a quick text here. Look on this site for lots of info on the MSX system, including the VDPs...
Example: LOCATE 0,10: FOR L=0 TO 255: VPOKE L,L: NEXT L
| |
| |
| |
| |