Schrijver
| assembly combined with basic
| norakomi msx professional Berichten: 861 | Geplaatst: 28 Maart 2005, 03:42   | Hi there, Here I am again, on my vacation in sunny Mexico,
however, I am still working every now and then on my game.
There is a new issue, and that is machine language, which I have been
studying for some bits now !
there is however a question,
I´ve checked http://map.tni.nl/
and learned a lot, I say ´ A LOT ´
Right now Im focusing on the VDP, however the tutorial (info) about it, is very difficult for me (too big steps), and wondering if anybody can give me an example of how to put a single pset in screen 5 (at lets say 50,50)
With this example I can experiment and expand my knowledge !!!
thanx
Another thing, I found the example below (moving stars in screen 8),
and used it with succes in basic !!! So the first step of assembly combined with basic has been completed.
My question though...... what should I shange to make this stars.asm file work in screen 5..... and..... the stars (which are sprites) are not printed (so to say) when in page 1 of screen 8 the background is not color 0.......
the stars themselves appear in page 0.
how can i change this? so the stars are printed in page 1 or when in page 0 of screen 8 the background is not color 0 the stars are not printed???
I´ll just dump the entire stars.asm file here...... Thanx for the help
stars.asm
Quote:
| ORG 0C200H
LD HL,0F3E9H ; Ini screen 8
XOR A
LD (HL),A
INC HL
LD (HL),A
INC HL
LD (HL),A
LD A,8
CALL 5FH
LD A,63 ; Page 1
OUT (99H),A ; (Sprite-tabellen staan wel op page 0)
LD A,2+128
OUT (99H),A
CALL AAN ; Ini sprites en zet hook
JOOP: LD A,(0FBEDH) ; Wacht op spatie
BIT 0,A
JR NZ,JOOP
CALL UIT
LD HL,0F3E9H
LD (HL),15
INC HL
LD (HL),4
INC HL
LD (HL),4
XOR A
CALL 5FH
RET
AAN: CALL 69H ; Initialisatie sterrenhemel
DI
LD A,(0F3E0H) ; Sprites 8*8, niet vergroot
AND 252
LD (0F3E0H),A
OUT (99H),A
LD A,129
OUT (99H),A
; Zet VRAM-adres &HFA00 (sprite-kleurtabel)
LD HL,0FA00H
LD B,0
CALL SETVDP
LD A,15 ; (Alleen kleur van bovenste lijn is nodig)
OUT (98H),A
LD HL,0F000H ; Vul patroon van spritenr. 0 (1 puntje)
LD B,0
CALL SETVDP ; (de volgende 9 bytes zijn al 0, call &H69)
LD A,128
OUT (98H),A
XOR A
LD B,15
LOOP2: OUT (98H),A
DJNZ LOOP2
LD HL,0F800H ; Vul kleurtabel
LD B,0
CALL SETVDP
LD C,32
LOOP0: LD A,15
OUT (98H),A
XOR A
LD B,15
LOOP1: OUT (98H),A
DJNZ LOOP1
DEC C
JR NZ,LOOP0
LD HL,0FD9FH
LD DE,OLDHOO
LD BC,5
LDIR
LD A,0C3H
LD (0FD9FH),A
LD HL,STARS
LD (0FDA0H),HL
EI
RET
UIT: DI ; Reset hook
LD HL,OLDHOO
LD DE,0FD9FH
LD BC,5
LDIR
EI
RET
STARS: DI ; Zet sprites neer
LD B,32
LD HL,DATSP2
LOOP!!: PUSH BC
INC HL ; Tel X-waarde op
LD A,(HL)
INC HL
INC HL
ADD A,(HL)
DEC HL
DEC HL
LD (HL),A
DEC HL
LD D,(HL) ; Bereken VRAM-adres waar sprite komt
INC D ; ( (Y+1)*256+X )
LD E,A
EX DE,HL ; Kijk of er plaatje staat
LD B,65
CALL SETVDP
IN A,(98H)
PUSH AF
EX DE,HL
LD DE,0FA00H-DATSP2
ADD HL,DE ; Zet VRAM-adres van attribuut-tabel
LD B,0
CALL SETVDP
POP AF
OR A
JR Z,PUTSTR
SBC HL,DE
LD A,220 ; Plaatje op voorgrond: zet sprite weg.
OUT (98H),A
LD DE,4
ADD HL,DE
JR VERDER
PUTSTR: SBC HL,DE ; Geen plaatje: zet sprite neer.
LD BC,0498H
OTIR
VERDER: POP BC
DJNZ LOOP!!
EI
OLDHOO: DEFB 0,0,0,0,0
; Sprite-info-tabel: Y-coord / X-coord / spritenummer / X-snelheid
; (4e byte was kleurnr op MSX1, maar wordt toch niet gebruikt)
DATSP2: DEFB 15,230,0,5,20,237,0,5,25,136,0,6,30,46,0,4
DEFB 35,66,0,5,40,216,0,6,45,206,0,3,50,1,0,4
DEFB 55,154,0,2,60,61,0,5,65,41,0,6,70,212,0,4
DEFB 75,10,0,3,80,229,0,4,85,124,0,6,90,128,0,3
DEFB 95,184,0,4,100,152,0,7,105,167,0,2,110,50,0,2
DEFB 115,118,0,2,120,234,0,6,125,68,0,7,120,169,0,3
DEFB 135,80,0,4,140,111,0,5,145,24,0,7,150,152,0,7
DEFB 155,147,0,6,160,44,0,6,165,235,0,3,170,10,0,5
; Naam : SETVDP
; Funktie : Zet de VDP op schrijven of lezen
; Invoer : HL = VRAM-adres, B = >bit 0 pagina >bit 6 schrijven(0) of lezen(1)
; Uitvoer : C = datalees of dataschrijfpoort
; Verandert: 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
RES 0,B
AND
| | | Sonic_aka_T
 msx guru Berichten: 2260 | Geplaatst: 28 Maart 2005, 04:05   | Hmmm.... Lots of questions...  Let's see... Well, as far as the sprites are concerned, basically all you need to do is change the addresses the sprites are located. The sprite color issue you were describing btw, could be 'caused' by the fact that the VDP doesn't use the palette colors for sprites in SCREEN8, but some lame pre-defined palette instead... Not all emulators emulate this correctly though.
On screen 5 sprites do use the normal palette though, so there's no problem there. I think the default values for the sprite addresses were 7400, 7600 and 7800, respectively color, attribute and pattern tables. Not sure though, but you can always check this in BASIC with the awkward BASE command.
PSET is not something you do often in ASM by the way. Mainly, because it's incredibly slow. You'll want to use a different command whenever possible. There's two ways to go about it. The first is to use a SETWRT and then OUT the data needed to set the point. The problem is that a BYTE in SCREEN5 corresponds to two pixels, and not to one. You can solve this by first reading, then masking out the pixel you are going to modify, and then writing back to VRAM. This also explains why PSET is so incredibly slow.
The second way would be to use the PSET VDP command. If you don't know how to use VDP commands yet, I suggest you go back to MAP and read the article about them. VDP commands are pretty much the only way to go on MSX2 systems. If you do know how to use them, just fill DX, DY and COLOR in your command table and use command code %0101LLLL where LLLL is the logical operator. For a normal PSET that would be zero, making the command code %01010000 or $50.
The last part of your question I don't fully understand I think... What I think you want is to ONLY show the stars if the background color on page 1 is color 0, correct? Well, in that case you would need to use the POINT command (VDP command %01000000) to check for the color of the pixel on page 1, and then either set the sprite or not, depending on the color.
The best thing you can do is download the VDP data book and look both commands up. After some experimenting you should be able to find out how they all work... One thing though, I noticed you sometimes forget to disable the interrupts before writing to the VDP. This can cause the strangest problems when running a program, so ALWAYS (well, for now at least) make sure you DI before outing to the VDP! Don't forget to EI afterwards tho
Good luck  | | norakomi msx professional Berichten: 861 | Geplaatst: 29 Maart 2005, 01:49   | hmmmm.......
I´ve been browsing the vdp data book as you suggested.....
and experimented with it, so far without succes.
Quote:
| If you do know how to use them, just fill DX, DY and COLOR in your command table and use command code %0101LLLL where LLLL is the logical operator. For a normal PSET that would be zero, making the command code %01010000 or $50.
|
filling DX, DY and COLOR worked, but making the command code is unclear.
How exactly should this be done?
Let me tell you first what I DO KNOW, maybe this will clarify my question
This is to write to a register
ld a,value
di
out (#99),a
ld A,regnr+128
ei
out (#99),a
I experimented with r23, for example to change the vertical scroll..... and this worked...
Writing to and reading from the VRAM
set the address counter bits 14-16 in register 14
set the address counter bits 0-7
set the address counter bits 8-13 and specify whether to read or to write
this example is in map.tni.nl
but i don´t see how this sets all the bits in #14
And should I give h and l a value???????????
SetVdp_Write:
rlc h
rla
rlc h
rla
srl h
srl h
di
out (#99),a
ld a,14+128
out (#99),a
ld a,l
nop
out (#99),a
ld a,h
or 64
ei
out (#99),a
ret
| | norakomi msx professional Berichten: 861 | Geplaatst: 29 Maart 2005, 01:51   | And Fast DoCopy, by Grauw
If I set the vdp to write (which is not 100% clear) and then assemble this file below.... nothing works.....
How Can I copy let´s say (10,10)-(20,20) in page 2 of screen 5 to (30,30) of page 0......
for example.......
;Fast DoCopy, by Grauw
;In: HL = pointer to 15-byte VDP command data
;Out: HL = updated
;
DoCopy: ld a,32
di
out (#99),a
ld a,17+128
out (#99),a
ld c,#9B
VDPready:
ld a,2
di
out (#99),a ;select s#2
ld a,15+128
out (#99),a
in a,(#99)
rra
ld a,0 ;back to s#0, enable ints
out (#99),a
ld a,15+128
ei
out (#99),a ;loop if vdp not ready (CE)
jp c,VDPready
DW #A3ED,#A3ED,#A3ED,#A3ED ;15x OUTI
DW #A3ED,#A3ED,#A3ED,#A3ED ; (faster than OTIR)
DW #A3ED,#A3ED,#A3ED,#A3ED
DW #A3ED,#A3ED,#A3ED
ret
| | norakomi msx professional Berichten: 861 | Geplaatst: 29 Maart 2005, 02:05   | last question.........
the example above ...... the stars.asm file
What do I change in the listing to make this work in screen 5 ?????
| | Sonic_aka_T
 msx guru Berichten: 2260 | Geplaatst: 29 Maart 2005, 04:00   | For SCREEN5 read my original post. All you really need to do is change the addresses from the SCREEN8 values to the SCREEN5 values. If you don't yet fully understand how sprites work, read up on the subject-matter in the VDP databook...
SetWrite is indeed a bit difficult to understand. The beauty of it is, you don't really need to understand how it works...  All you need to know is that after calling SetWrite with the VRAM address in AHL, you'll be ready to write data to that position in the VRAM. AHL is used like it were one big 24 bits register. In reality though, only 17 bits are used, since the VRAM of the MSX2 is only 128kB. This means that when A = 0 the first 64kB (as set in HL, $0000 - $FFFF) are used. When A = 1 the second 64kB are used.
The fast DoCopy by Grauw isn't really a copy routine, but a routine that sends a VDP command to the VDP. The command doesn't have to be a copy, but can be any VDP command. The routine uses a command table, which is the 15 bytes of data that tell the VDP what to do. What the routine does is set all the VDP registers so that the command can be executed. This then happens automatically, the VDP will do it's thing while the Z80 can continue processing code.
Anyhow, what you do is prepare a COMMAND by filling in (or defining) a table. Then you have HL point to that table, and call the command routine. After that, the VDP starts executing the command. You cannot start another command if the VDP is still busy, but the first part of the routine already makes sure that it doesn't 'overwrite' a command. I'll start by explaining just basic commands, I won't handle arguments nor the more difficult commands.
The Command Table
; SXL SXH SYL SYH DXL DXH DYL DYH NXL NXH NYL NYH CLR ARG CMD
DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 With those 15 bytes you can control any VDP command. The values in the table are: source x, source y, destination x, destination y, number x, number y, color, argument and finally the command code. As you can see, all the coordinates are 16 bit values, low byte first. This is done, because VDP commands don't use pages. The screen is treated as if it were one big giant screen, so in screen 5 the size of the whole screen is 256 x 1024 pixels. On screen 7 for example, this would be 512 x 512 pixels. Since each page is really 256 pixels high though, you can pretty much treat the high byte of the Y coordinates as if they were page numbers. But anyhoo, back to your example. Quote:
| How Can I copy let´s say (10,10)-(20,20) in page 2 of screen 5 to (30,30) of page 0...
|
Well, what we do is fill in the command table: COPY01:
DB 10 ; SXL
DB 0 ; SXH
DB 10 ; SYL
DB 2 ; SYH (from page 2)
DB 30 ; DXL
DB 0 ; DXH
DB 30 ; DYL
DB 0 ; DYH (to page 0)
DB 10 ; NXL
DB 0 ; NXH
DB 10 ; NYL
DB 0 ; NYH
DB 0 ; ARG
DB 0 ; CLR
DB $D0 ; CMD (HMMM command code)Copy in ASM works a little different that in BASIC. Instead of giving the (x,y)-(x,y) coordinates you only give the source coordinates of the copy, and the amount of pixels to copy. So in this case, your copy would be 10 x 10 pixel, and NX and NY need to be 10. When you're still starting to get used to commands it's best to leave the table like this. Later though, you'll prolly want to keep your sources smaller (lots of copies) and put each VDP command on one line. Anyhow, by doing a LD HL,COPY01 and then a call to grauw's copy routine you would execute the copy you mentioned. Ofcourse you'd have to be in screen 5 for this to work, and there have to be graphics on (10,10) of page 2 if you want to see something  The command code $D0 is the command code for a highspeed copy. High speed copies only work in bytes, so in SCREEN5 this means the X coordinates have to be even, since one byte holds the colors of two pixels. Another much used copy is the LOGICAL copy. You need logical copies ($9x, where x is the logical operator) whenever you want to do a copy that is not a byte copy (i.e. 3 pixels wide) or when you want to do a TIMP copy for example (command code $98).
Anyhoo, I'm getting tired, so read all the info in the VDP databook about VDP commands, any try to experiment a little with the routines... I hope I didn't make any mistakes here, but I'm not exactly in the Mexico time-zone
Good luck,
Toby | | norakomi msx professional Berichten: 861 | Geplaatst: 31 Maart 2005, 22:14   | cool,
I experimented and figured out how to pset.
I wanted to copy block (50,50)-(150,70),0 to (50,90),0
in screen 5..... and tried it this way
what's wrong with the listing given below?
org #c000
;Set VDP address counter to write from address AHL (17-bit)
;Enables the interrupts
;
SetVdp_Write:
rlc h
rla
rlc h
rla
srl h
srl h
di
out (#99),a
ld a,14+128
out (#99),a
ld a,l
nop
out (#99),a
ld a,h
or 64
ei
out (#99),a
ret
;argument register (r#46) has MXD in bit 5 which needs
;to be 0 according to the vdp manual(v9938.pdf manual)
ld a,%00000000 ;this is the only doubt
di ;I have. Whether or not
out (#99),a ;I should set entire
ld a,45+128 ;register 45 to 0 or not
ei ;But it seems there is
out (#99),a ;no harm, so I don't
;think this is the problem
;next we set the x+y source, lenght of x+y block, and
;y destination, and THEN we give the COPY COMMAND.FINISHED!
ld a,50 ;source x
di
out (#99),a
ld a,32+128
ei
out (#99),a
ld a,50 ;source y
di
out (#99),a
ld a,34+128
ei
out (#99),a
ld a,100 ;number of dots x direction
di ;or call it:lenght x block
out (#99),a
ld a,40+128
ei
out (#99),a
ld a,20 ;number of dots y direction
di ;or call it:lenght y block
out (#99),a
ld a,42+128
ei
out (#99),a
ld a,90 ;destination y coordinate
di
out (#99),a
ld a,38+128
ei
out (#99),a
;and now give the command... the vdp manual says clearly
;to put %11110000 in reg 46 !!!, so *however I tried %11100000 and %11010000 also
ld a,%11110000 ;EXECUTE !!!
di
out (#99),a
ld a,46+128
ei
out (#99),a
ret
I assemble this
bsave "copybloc.bin",#c000,#c046
go to basic and make this short test program:
10 screen 5
20 line (0,0)-(255,211),15
30 bload "copybloc.bin",r
40 goto 40
I run it, see the line from (0,0)-(255,211),
and then see one more pset at about (0,50),
and my file 'hangs'
(one question more: Could the problem have something to do
with the MSX-VIDEO Palette registers p#0 to p15, because
I have no clue what this is or what they do????)
what is a palette register anyway?
| | norakomi msx professional Berichten: 861 | Geplaatst: 31 Maart 2005, 22:16   | Thanx for the tips !!!!
I apreciate it very much !
| | Sonic_aka_T
 msx guru Berichten: 2260 | Geplaatst: 01 April 2005, 03:18   | Well, while that method probably works (I have never tried it, nor did I check if you correctly set all the variables) the 'standard' VDP command routine does the same thing, in much less space, and much faster. That's mainly why I suggested the method in which you use the table and the CALL VDPCMD. Anyhow, here's more or less what I use in my sources... VDP_01: EQU $F3E0
VDP_08: EQU $FFE7
VDP_09: EQU $FFE8
SETPAG: ; SETPAG [A]
RRCA
RRCA
RRCA
OR %00011111
DI
OUT ($99),A
LD A,$80+2
EI
OUT ($99),A
RET
SET_WR: ; SET_WR [AHL]
RLC H
RLA
RLC H
RLA
SRL H
SRL H
DI
OUT ($99),A
LD A,$80+14
OUT ($99),A
LD A,L
; NOP ; MSX2+
OUT ($99),A
LD A,H
OR 64
OUT ($99),A
EI
RET
SET_RD: ; SET_RD [AHL]
RLC H
RLA
RLC H
RLA
SRL H
SRL H
DI
OUT ($99),A
LD A,$80+14
OUT ($99),A
LD A,L
; NOP ; MSX2+
OUT ($99),A
LD A,H
; NOP ; MSX2+
OUT ($99),A
EI
RET
VDPCMD: ; VDPCMD [HL]->[CMDTABLE]
CALL WAITCE
DI
LD A,$20
OUT ($99),A
LD A,$80+17
OUT ($99),A
EI
LD BC,$0F9B
OTIR
RET
WAITCE: ; WAITCE
LD A,$02
DI
OUT ($99),A
LD A,$80+15
OUT ($99),A
IN A,($99)
RRA
LD A,$00
OUT ($99),A
LD A,$80+15
EI
OUT ($99),A
JR C,WAITCE
RET
ENASCR: ; Enable Screen
LD A,(VDP_01)
OR %01000000
JR DISSCR.OUT
DISSCR: ; Disable Screen
LD A,(VDP_01)
AND %10111111
.OUT: LD (VDP_01),A
DI
OUT ($99),A
LD A,$80+1
EI
OUT ($99),A
RET
ENASPR: ; Enable Sprites
LD A,(VDP_08)
AND %11111101
JR DISSPR.OUT
DISSPR: ; Disable Sprites
LD A,(VDP_08)
OR %00000010
.OUT: LD (VDP_08),A
DI
OUT ($99),A
LD A,$80+8
EI
OUT ($99),A
RET
LIN192: ; Set 192 lines
LD A,(VDP_09)
OR %10000000
JR LIN212.OUT
LIN212: ; Set 212 lines
LD A,(VDP_09)
AND %01111111
.OUT: LD (VDP_09),A
DI
OUT ($99),A
LD A,$80+9
EI
OUT ($99),A
RET Most of these routines were made for the Turbo-R. If you're going to use them on MSX2/MSX2+ computers you'll probably need to uncomment the NOP's in the SetRead and SetWrite routines. I also use OTIR instead of 15x OUTI since OTIR is faster on the Turbo-R. To 'fix' this, you can change the line that reads LD BC,$0F9B into LD C,$9B and replace the OTIR command by 15 OUTI commands. If you're using tniASM by the way, you can place them all on the same line, separated by a space.
First off, I noticed you use BASIC to make the entire screen white. This is great, but if you're then going to copy from one place of page 0 to another place on page 0 you're really not going to see the difference  Anyhow, let's assume you want to use the same coordinates, but this time we copy from page 1 to page 0. You can then easily check the routine by loading a picture on page 1 and then executing your program file.
COPY (50,50)-(150,70),0 TO (50,90),0
Well, the first two are easy, SX = 50 and SY = 50, page 1. The next two are easy too, DX = 50, DY - 90, page 0. Now we calculate NX and NY. NX = 150-50 = 100, NY = 70-50 = 20. Now, we check the command type we need. Since you're not doing a copy with a logical operation (like TIMP) and all the X coordinates are even, we can use a High Speed, or HMMM copy. The command code for this VDP Command is $D0, as you can find in the VDPs databook.
Let's fill our table: COPY01:
DW 50 ; SX
DB 50 ; SYL
DB 1 ; SYH (i.e. source page)
DW 50 ; DX
DB 90 ; DYL
DB 0 ; DYH (i.e. destination page)
DW 100 ; NX
DW 20 ; NY
DB 0 ; CLR
DB 0 ; ARG
DB $D0 ; CMD Which defines all the aspects of the command we are about to execute. After this, all you would need to do to actually do the copy command is LD HL,COPY01 and then CALL VDPCMD. And that's it! Well, to be complete, I'll also include a little test for you. Put this part in front of all the other crap I gave you, and assemble the whole lot. After saving the result, a simple BLOAD "CMDTST.BIN",R should go to screen 5, do the copy, wait for a keystroke and return to screen 0. Make sure there's a picture on page 1 though, if not you won't see this copy either  ORG $C000
CMDTST:
LD A,$05 ; Screen 5
CALL $005F ; BIOS Change Screen Mode
LD HL,COPY01 ; Command Data
CALL VDPCMD ; Send command to VDP
CALL $9F ; Wait for a keystroke
XOR A ; faster version of LD A,$00
JP $005F ; Back to SCREEN0, and return Happy Experimenting  | | Sonic_aka_T
 msx guru Berichten: 2260 | Geplaatst: 01 April 2005, 03:32   | Whoops, I just noticed you didn't fill the screen, but just drew a line across it  Silly me, you're not that dumb... I am  Anyhoo, it's still a lot better to use the command tables instead of setting each register one at a time. That way you're sure you're setting all the required variables. It also takes up a lot less space, and it's a great deal faster.
Palette registers are the registers that control what color each of the 16 colors have. Normally, COLOR 0 would be black, but you can also change this to for instance red, like you would in BASIC by doing COLOR=(0,7,0,0). The actual pallet of the 16 colors is stored in the VDPs palette registers. For each color two bytes are used, RB 0G. This means that setting color 0 to palette value $36 $04 would set it to Red 3, Blue 6 and Green 4. Notice the order in which you need to write those colors is different than in BASIC. In assembly you write RBG instead of the usual RGB. Anyhow, by setting up the pointer first, and then writing the actual color values to the palette port you can change these colors. Just read the technical databook closely, iirc it's explained pretty clearly. If I'm not mistaken MAP also has a Set Palette routine which you can use. Use it by defining your palette in a table with a bunch of DB's. Since there are 16 colors, and each color uses 2 bytes your total palette table should be 32 bytes long. You can then set HL to point to this table, by doing a LD HL,PALTBL and calling the set palette routine to actually set the color palette. Be sure not to change your palette in such a way that you can't see the text anymore when you return to BASIC though  | | norakomi msx professional Berichten: 861 | Geplaatst: 03 April 2005, 05:23   | 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 !!
is it possible to view both page 0 and page 1 at the same time in screen 5, where color one
on page 0 is transparent or something?
and how can I make my sprites automaticly jump to page 1 when I select page 1, and vice versa?
how can the sprites in stars.asm (look at the bottom of this page for stars.asm)be displayed on page 1 instead of page 0
or simultaneously on 0 and 1.
or or page 2 of screen 5 ?
| | Edwin msx professional Berichten: 591 | Geplaatst: 03 April 2005, 12:45   | Quote:
| is it possible to view both page 0 and page 1 at the same time in screen 5, where color one on page 0 is transparent or something?
|
That'd be really nice, but it's not possible.
Quote:
| and how can I make my sprites automaticly jump to page 1 when I select page 1, and vice versa?
|
Curious, I never gave much thought to this one because my code was usually so full of screensplits that it always came out right. My guess would be that the page number and sprites are separate to begin with, so that would you want would be automatic. I think this because sprites are basically read from the address locations specified in the VDP registers. Same goes for the page number, this is nothing more than the changing of the start address of the screen (with some mirroring hidden in there). So if my guess is right, then basically sprites should be visible no matter what page you're in. I have no clue about basic though.
| | Sonic_aka_T
 msx guru Berichten: 2260 | Geplaatst: 03 April 2005, 13:32   | Quote:
| Quote:
| is it possible to view both page 0 and page 1 at the same time in screen 5, where color one on page 0 is transparent or something?
|
That'd be really nice, but it's not possible.
|
Yeah, that Multilayer On bit has proven quite illusive. My best guess is that it's in the same register as the Command Mode Fast bit and the Alpha Blending On bit  | | norakomi msx professional Berichten: 861 | Geplaatst: 04 April 2005, 20:44   | these are 2 parts of the file: stars.asm
I figured out that when I change the 2nd sentence to LD B,64
that page 0 is checked for a picture.
and if there is a picture in page 0 or page 1 the sprite in not printed to screen.
however if I change this whole file to work in screen 5(changing all the adresses, like sprite pattern, sprite color etc) the sprite is allllways put to screen, no matter if there is a picture in page 0 or page 1.
how can this be changed?
and how can I check in both page 0 and page 1 for pictures (which is usefull when I use pageswitching p=1-p)??
EX DE,HL ; Kijk of er plaatje staat
LD B,65 ´check if there is a picture in page 1
CALL SETVDP
IN A,(98H)
; Naam : SETVDP
; Funktie : Zet de VDP op schrijven of lezen
; Invoer : HL = VRAM-adres, B = >bit 0 pagina >bit 6 schrijven(0) of lezen(1)
; Uitvoer : C = datalees of dataschrijfpoort
; Verandert: 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
| | norakomi msx professional Berichten: 861 | Geplaatst: 04 April 2005, 20:46   | 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? | |
| |
| |