Development with MSX BASIC

페이지 3/9
1 | 2 | | 4 | 5 | 6 | 7 | 8

By e_sedes

Expert (112)

e_sedes의 아바타

10-09-2010, 13:34

10 screen 1: width 32: key off
20 screen 2: poke &hFCAF,1

With this thing you can use screen 2 like screen 1, with normal PRINT. And it scrolls like screen 1. But you have to load the char set to the VRAM in your code. Doing color changes on PRINTs can be a little tricky, but it's possible.

By MäSäXi

Paragon (1884)

MäSäXi의 아바타

10-09-2010, 13:51

Great! Smile

But HOW?

I tried it on BlueMSX "MSX2" and it instantly hanged. Then I tried it on "MSX-1 swedish", and it instantly hanged again....

By e_sedes

Expert (112)

e_sedes의 아바타

10-09-2010, 14:21

10 screen 1: width 32: key off
20 screen 2: poke &hFCAF,1
30 cs=peek(4)+peek(5)*256
40 for i=0 to 255*8
50 vpoke(i),peek(i+cs)
51 vpoke(i+&h800),peek(i+cs)
52 vpoke(i+&h1000),peek(i+cs)
60 vpoke(i+&h2000),&h1f
61 vpoke(i+&h2800),&hf1
62 vpoke(i+&h3000),&h1e
70 next
80 cls

Try this.

Line 10 sets VRAM variables for screen 1. These are the same as for screen 2.
Line 20 sets screen 2. In &hFCAF there is the number of the actual screen. If we put 1 at that place BASIC interpreter "thinks" that we are on screen 1, but VDP is on screen 2.

Line 30 looks for the address of the character set on ROM.

Lines 40-70 load char set and color to VRAM.

By JohnHassink

Ambassador (5655)

JohnHassink의 아바타

10-09-2010, 23:11

Cool stuff, thanks e_sedes!

By hit9918

Prophet (2927)

hit9918의 아바타

11-09-2010, 02:38

so now that we can print in screen 2, lets do BOBs with the print command:

10 screen 1: width 32: key off : color ,1,1
20 screen 2 : draw"bm0,0"

21 open "grp:" as #1
22 for n = 1 to 3
23 for i = 0 to 255
24 color 8 : if i >= 64 then color 2
25 ?#1,chr$(i); : next i : next n

130 for i = 1 to 30
140 x1 = rnd(1)*31 : y1 = rnd(1)*31+4*8
150 x2 = rnd(1)*31 : y2 = rnd(1)*31+4*8
160 c = rnd(1)*13+2
170 line(x1,y1)-(x2,y2),c
180 line(x1,y1+64)-(x2,y2+64),c
190 line(x1,y1+128)-(x2,y2+128),c
200 next

210 poke &hFCAF,1

300 w = 4 : h = 4

310 for y = 0 to h-1
320 for x = 0 to w-1
330 a$=a$+chr$(x+y*32+4*32)
340 next x
350 for x = 0 to w-1
360 a$=a$+chr$(29) 'cursor go left
370 next x 
380 if NOT (y = h - 1) then a$=a$+chr$(10) 'cursor go down
390 next y

410 locate rnd(1)*(32-w),rnd(1)*(24-h)
420 ?a$
430 goto 410

press CTRL STOP and enter:

print a$

Big smile

I did paste cursor move ascii codes into a$. I guess this is faster than multiple prints and locate for every line, but dont remember.

Because ascii control codes exist, I avoid using ascii smaller than 32 for graphics.
Start at ascii 128 and the important font will stay.

So now you practically got a fast tile games mode Wink

By baltasarq

Rookie (27)

baltasarq의 아바타

03-06-2011, 12:04

Hi, there!

It has been a while since I asked about porting my BASIC program to MSX Basic. I decided to take a while to modify the source code so it could run on a MSX. Unfortunately, it has been impossible since then.

I have compressed the source code, changed variables to one letter and some other changes like that. Unfortunately, working with the real machine and a diskette drive limits memory so much that it seems to be a lost battle. I cannot work with a real machine without a diskette drive, unless I started working with tapes, something I don't feel ready to do.

The source code runs but it stops at some place at the beginning, while reading DATAs. It is obvious that there is not enough space in RAM, after loading the source code.

Color considerations are now out of topic, since there is no more memory to do anything else.

Now I'm quite convinced that I have to work in a MSX interpreter. My questions are:

a) Maybe I'm able to make the game run if I don't use the diskette drive. I can do that by pressing shift while booting. I have found, however, a lot of disk image creators, but I'd need a tape creator in order to create a tape file that would include my ASCII source code.

b) BTW, just to be sure. If I save my work with SAVE "asalto.bas", then it is stored tokenized, isn't it?

c) Another option is to just test the program by converting it to ROM, by means of a tokenized version. How could I create the tokenized version of a BASIC source code from the PC?

Thank you very much.

By hap

Paragon (2042)

hap의 아바타

03-06-2011, 13:40

Color? It's easy in SCREEN1 (32 cols)

a) I suggest to optimize it more, for example you copy loads of text to RAM and leave it in read-only: over 5KB RAM wasted there alone already
b) Yes. ",A" is specified to save as ASCII: SAVE"file.bas",A
c) BASIC ROMs are limited to 16KB ROM + 16KB RAM, your game won't fit

By baltasarq

Rookie (27)

baltasarq의 아바타

03-06-2011, 14:05

hap, what do you mean about optimizing it more?
Maybe you mean to create a data file which would be loaded by the main program, saving a lot of duplicated data in DATA's. I could certainly do that, though it would mean a lot of recoding.

Is this wwhat you meant, or something else?

Thank you in advance.

By hap

Paragon (2042)

hap의 아바타

03-06-2011, 14:12

In this case I wouldn't put them in a huge DIM text array at all. You can change those data lines to t$="text":RETURN and a big ON x GOSUB {line} statement

By AuroraMSX

Paragon (1902)

AuroraMSX의 아바타

03-06-2011, 14:18

If I save my work with SAVE "asalto.bas", then it is stored tokenized, isn't it?Depends. If you're saving to tape, then SAVE "foo" will save ASCII text; you'll need to use CSAVE "foo" to save the tokenized version. When saving to disk, SAVE "foo" saves the tokenized version and SAVE "foo",A saves your BASIC program as ASCII.

페이지 3/9
1 | 2 | | 4 | 5 | 6 | 7 | 8