[V9990] Q&A Official Thread

Pagina 9/19
2 | 3 | 4 | 5 | 6 | 7 | 8 | | 10 | 11 | 12 | 13 | 14

Van Kai Magazine

Paragon (1418)

afbeelding van Kai Magazine

04-03-2016, 23:44

We are forgetting there is not a correct answer here, since what is best for one person, it can be the worst for another coder depending on several factors such as: his mentality, his priorities, his paciencie, his creative skills, his mathematical skills, wether if he wants to do something fast and simple, or elaborated and optimized to the maximum's msx capabilities, etc.
So, there is no really a BEST universal language.
Each individual will have to find the language that is best suited for his habilities and objectives, so, while entertaining, this thread has become something different than it's original pruppose.
May I suggest we continue as we were a copule of days ago, and we continue experimenting and sharing our advances?
I hope I will be able to show you something on Sunday Night.
Lat's keep working and sharing, and we will move forward Running Naked in a Field of Flowers

Van hit9918

Prophet (2911)

afbeelding van hit9918

05-03-2016, 19:09

EDIT: snip! bug found.

Van hit9918

Prophet (2911)

afbeelding van hit9918

05-03-2016, 18:46

anyone knows an app with source that blits on truecolor?
in the g9k package seems to be a viewer that blits from RAM, but vram to vram is needed.

Van hit9918

Prophet (2911)

afbeelding van hit9918

05-03-2016, 19:54

ok, now blitting on truecolor Big smile
the point of this is. using 9990 in any language.

1 out &h6f,0 'init superimpose

10 for i = 0 to 24 : read a
12 out &h64,i			'write register i
14 out &h63,a
16 next

60 for i = 0 to 15		'palette
61 out (&h64),128+14 : out (&h63),i*4
70 out (&h61),i*2 : out (&h61),i*2 : out (&h61),i*1 + 13
80 next

90 'CLS beta
92 nx = 256 : ny = 256 : sx = 0 : sy = 0 : dx = s0 : dy = 0
94 ar = 0 : lo = 0 : op = &h40
96 gosub 11000

100 				'16bit bitmap
110 for y = 0 to 31
115 p = 0 : a = y * 512 * 2 : gosub 10000
120 for x = 0 to 31
125 c = (y and &h1f) *32*32 + &h1f*32 + (x and &h1f)
130 out &h60,(c-int(c/256)*256) and 255
135 out &h60,(c/256) and 255
140 next x,y

200 pi = 3.1415926
210 for i = 0 to 16
220 nx = 32 : ny = 32 : sx = 0 : sy = 0 : dx = sin (i/16/2*pi)*100 : dy = cos(i/16/2*pi)*100 : gosub 11500
230 next

9990 beep : sound 8,12 : for i = 1 to 2000 : next : beep
9999 stop

10000 'vram write address = p*65536 + a . out &h60 vpokes with autoincrement.
10005 out &h64,0		'write vdp registers 0+
10006 defusr1 = a		'to get at H,L
10010 xx = peek(&hf39c) : out &h63,xx : '?xx;
10020 xx = peek(&hf39d) : out &h63,xx : '?xx;"."
10030 out &h63,p 'bit 7 address increment inhibit
10050 return


11000 if inp(&h65) and 1 then 11000 'wait for blitter
11010 out &h64,32 'write r32+
11020 out &h63,sx and 255 'r32
11030 out &h63,sx / 256   'r33
11040 out &h63,sy and 255 'r34
11050 out &h63,sy / 256   'r35
11060 out &h63,dx and 255 'r36
11070 out &h63,dx / 256   'r37
11080 out &h63,dy and 255 'r38
11090 out &h63,dy / 256   'r39
11100 out &h63,nx and 255 'r40
11110 out &h63,nx / 256   'r41
11120 out &h63,ny and 255 'r42
11130 out &h63,ny / 256   'r43
11140 out &h63,ar         'r44 arg
11150 out &h63,lo         'r45 lop
11151 out &h63,255        'r46
11152 out &h63,255        'r47
11160 out &h64,52 'write r52+
11170 out &h63,op         'r52
11180 return

11500 'blit (sx,sy)-(sx+nx,sy+ny) to (dx,dy)
11510 op = &h40 'lmmm
11520 ar = 0 : lo = &hc
11530 gosub 11000 : return


21000 'regs
21010 data 0,0,0,0
21020 data 0,0,&h87,0
21030 data &hC2,0,0,0
21040 data 0,0,0,0
21050 data 0,0,0,0
21060 data 0,0,0,0
21070 data 0


50000 'B1-B6 VRAM
50010 'Physical mapping: even addresses (bit 0=0) in VRAM0 and odd addresses (bit0=1) in VRAM1. 
50020 '00000-7FDFF Bitmap Data
50030 '7FE00-7FFFF Cursor area (512 bytes)

Van hit9918

Prophet (2911)

afbeelding van hit9918

06-03-2016, 12:25

ok I added transparent blit, now there's everything needed for software sprites.
like, the 9990 part of a whole game is in this tiny BASIC demo.
@kai magazine, you wondered about a truecolor game, what do you think.
in that mode one can throw in photos directly Big smile

1 out &h6f,0 'init superimpose

10 for i = 0 to 24 : read a
12 out &h64,i			'write register i
14 out &h63,a
16 next

60 for i = 0 to 15		'palette
61 out (&h64),128+14 : out (&h63),i*4
70 out (&h61),i*2 : out (&h61),i*2 : out (&h61),i*1 + 13
80 next

90 'CLS beta
92 nx = 512 : ny = 256 : sx = 0 : sy = 0 : dx = s0 : dy = 0
94 ar = 0 : lo = &h00 : op = &h40
96 gosub 11000

100 				'16bit bitmap
110 for y = 0 to 31
115 p = 0 : a = y * 512 * 2 : gosub 10000
120 for x = 0 to 31
125 c = (y and &h1f) *32*32 + &h1f*32 + (x and &h1f)
126 if abs((x-16)*(y-16)) > 64 then c = 0
130 out &h60,(c-int(c/256)*256) and 255
135 out &h60,(c/256) and 255
140 next x,y

200 pi = 3.1415926
210 for i = -1 to 20
220 nx = 32 : ny = 32 : sx = 0 : sy = 0 : dx = i*13 : dy = 128-i*4 : gosub 11600
230 next
250 for i = -1 to 15
260 nx = 32 : ny = 32 : sx = 0 : sy = 0 : dx = 128+i*4 : dy = i*13-1 : gosub 11600
270 next

9990 if inkey$ = "" then 9990
9991 out &h6f,16			'superimpose tidy exit
9999 stop

10000 'vram write address = p*65536 + a . out &h60 vpokes with autoincrement.
10005 out &h64,0		'write vdp registers 0+
10006 defusr1 = a		'to get at H,L
10010 xx = peek(&hf39c) : out &h63,xx : '?xx;
10020 xx = peek(&hf39d) : out &h63,xx : '?xx;"."
10030 out &h63,p 'bit 7 address increment inhibit
10050 return


11000 if inp(&h65) and 1 then 11000 'wait for blitter
11005 dx = dx and 32767 : dy = dy and 32767 'math problems of BASIC
11010 out &h64,32 'write r32+
11020 out &h63,sx and 255 'r32
11030 out &h63,sx / 256   'r33
11040 out &h63,sy and 255 'r34
11050 out &h63,sy / 256   'r35
11060 out &h63,dx and 255 'r36
11070 out &h63,dx / 256   'r37
11080 out &h63,dy and 255 'r38
11090 out &h63,dy / 256   'r39
11100 out &h63,nx and 255 'r40
11110 out &h63,nx / 256   'r41
11120 out &h63,ny and 255 'r42
11130 out &h63,ny / 256   'r43
11140 out &h63,ar         'r44 arg
11150 out &h63,lo         'r45 lop
11151 out &h63,255        'r46
11152 out &h63,255        'r47
11160 out &h64,52 'write r52+
11170 out &h63,op         'r52
11180 return

11500 'blit (sx,sy)-(sx+nx-1,sy+ny-1) to (dx,dy)
11510 op = &h40 'lmmm
11520 ar = 0 : lo = &hc
11530 gosub 11000 : return

11600 'blit (sx,sy)-(sx+nx-1,sy+ny-1) to (dx,dy) with source value = 0 meaning transparent pixel.
11610 op = &h40 'lmmm
11620 ar = 0 : lo = &h1c
11630 gosub 11000 : return


21000 'regs
21010 data 0,0,0,0
21020 data 0,0,&h87,0
21030 data &hC2,0,0,0
21040 data 0,0,0,0
21050 data 0,0,0,0
21060 data 0,0,0,0
21070 data 0


50000 'B1-B6 VRAM
50010 'Physical mapping: even addresses (bit 0=0) in VRAM0 and odd addresses (bit0=1) in VRAM1. 
50020 '00000-7FDFF Bitmap Data
50030 '7FE00-7FFFF Cursor area (512 bytes)

Van Kai Magazine

Paragon (1418)

afbeelding van Kai Magazine

06-03-2016, 12:35

Tha is really exelent hit9918!
I will test it ASAP.

Preciselly, the things I am doing now are truecolor ready, so it would be ideal

Keep up the good work!

Van Manuel

Ascended (18409)

afbeelding van Manuel

06-03-2016, 12:55

Nice program, I got this in openMSX:

Van Kai Magazine

Paragon (1418)

afbeelding van Kai Magazine

06-03-2016, 13:03

Cool!
Manuel, how fast is it?

Van Manuel

Ascended (18409)

afbeelding van Manuel

06-03-2016, 13:25

It almost takes a minute... drawing that first object takes a lot of time.

About 4 seconds when using MSX-BASIC-kun... (after adding the variable names after "NEXT").

Anyway, you can easily try this in openMSX, e.g. with Boosted MSX2 EN, it has Video9000/GFX9000 included. Just run the program in it.

Van Kai Magazine

Paragon (1418)

afbeelding van Kai Magazine

06-03-2016, 13:34

Yes, I will try it. Thanks.
The "drawing the object" part being slow is not an issue since we will BLOAD the graphics.
What is important is that the transparent copys are fast enough, and that it is xbasic compatible, which seems to be the case, so this is a huge step forward on z80+gfx9000+turbobasic programming.

Thank you hit9918! you are a master!

Pagina 9/19
2 | 3 | 4 | 5 | 6 | 7 | 8 | | 10 | 11 | 12 | 13 | 14