Another cool basic trick: fastest and shorter chars redefining

Por thegeps

Paragon (1192)

Imagen del thegeps

27-02-2020, 18:44

Well, as you remember in SeuTen code explanation I used a poke to change PRINT pointers to a selected page so I was able to draw 4 pages to show in sequence simulating a horizontal scroll...
We can use the same trick to print values wherever we want in VRAM! Not only in name table but in pattern table too (and sprites pattern, color pattern and so on). We'll have a faster (fastest?) redefinition too, becuse PRINT is VERY fast compared with VPOKE series. Look at the video. First redefinition I used in SeuTen and then the new technique:

https://youtu.be/N4HWb3oGTJg

and here's the complete listing of what you've just seen in the video:

0 B$="¿ÿ¿U¿ÿ¿ÿþÿþUþÿþÿûÿûUûÿûÿïÿïUïÿïÿ'ßWßßWß'äûêûûêûäÿÿÿÿÿÿÿÿ":SCREEN1,2,0:COLOR,1,4:WIDTH32:DEFINTA-Z:KEYOFF
15 cls:fork=0to24:locate0,k:print"abcdefgabcdefgabcdefgabcdefgabc";:next
20 FORK=0TO55:VPOKE776+K,PEEK(32778+K):NEXT
35 ifinkey$=""goto35
40 cls:fork=0to24:locate0,k:print"ABCDEFGABCDEFGABCDEFGABCDEFGABC";:next
50 poke63779,0:locate8,16:?"¿ÿ¿U¿ÿ¿ÿþÿþUþÿþÿûÿûUûÿûÿïÿïUïÿïÿ'ßWßßWß'äûêûûêûäÿÿÿÿÿÿÿÿ"
60 poke63779,24:REM reset PRINT pointers
65 ifinkey$=""goto65elseend

As you see I used locate to point start address. Infact 16*32=512 (y coordinate)+ 8 (x coordinate)=520. 520/8=65, "A" char

Login sesión o register para postear comentarios

Por jltursan

Prophet (2619)

Imagen del jltursan

27-02-2020, 19:05

Brilliant!, the only drawback I can think of is how hard could be to type such weird characters used in th redefinition. It remembers me the japanese listings and their endless amount of weird kanas to type Smile

Por Dolphin101546015

Champion (336)

Imagen del Dolphin101546015

27-02-2020, 21:13

Try move PT and NT to upper VRAM, and print to it Wink

Por thegeps

Paragon (1192)

Imagen del thegeps

27-02-2020, 21:22

jltursan wrote:

Brilliant!, the only drawback I can think of is how hard could be to type such weird characters used in th redefinition. It remembers me the japanese listings and their endless amount of weird kanas to type Smile

Oh, well, listing is what you see in the video. The listing pasted here is how it appear in Windows (I saved the program from openMSX using SAVE"redef.txt",A

Anyway I use a little trick to have the right chars sequence: a little basic program where hexadecimal codes are printed on screen as chr$(val("&h"+value)). Then I create a new last line of that listing by inserting before the printed string 100 a$=" and another " at the end of the string. Then I save again the program and do a copy/past from that fule to file I have to use (like a tenliner game listing). Obviously I care to haven't invalid chars values when drawing tiles...

Por thegeps

Paragon (1192)

Imagen del thegeps

27-02-2020, 21:26

Dolphin101546015 wrote:

Try move PT and NT to upper VRAM, and print to it Wink

Why? Explain your idea, I'm curious

Por farique

Resident (39)

Imagen del farique

27-02-2020, 22:36

thegeps wrote:

hexadecimal codes are printed on screen as chr$(val("&h"+value)).

I used that trick on a Basic program I made to change the graphic of games. The Basic program had to be tiny to live with the ML one so it was divided into parts. The first one listed the game in binary, showing the address positions, the second program printed the third one on the screen, basically a block of 8 lines of 0 and 1 on a DATA line and a FOR loop. The trick, and the moral of the story, is that it printed the third one all ready, the only thing I had to do was to change the 0 and 1 to the pattern I wanted, press enter on each line and RUN (then BSAVE the game). You can print that last line all set up, with quotes and line number and just ENTER it.

Por Dolphin101546015

Champion (336)

Imagen del Dolphin101546015

28-02-2020, 00:45

thegeps wrote:

Why? Explain your idea, I'm curious

You uses &hF923, for select pointing of print to the VRAM, but you use HIGH byte of addressing,
so for it pointing you select any page in VRAM by 256 bytes each.
And you using locate after, to printing inside this page.
But you able do it with writing to &hF922 (LOW address byte).
Such you have possibility to addressing 65536 address places in the VRAM.
But almost all MSX2 have 128kb of VRAM Smile

Por thegeps

Paragon (1192)

Imagen del thegeps

28-02-2020, 08:51

Dolphin101546015 wrote:
thegeps wrote:

Why? Explain your idea, I'm curious

You uses &hF923, for select pointing of print to the VRAM, but you use HIGH byte of addressing,
so for it pointing you select any page in VRAM by 256 bytes each.
And you using locate after, to printing inside this page.
But you able do it with writing to &hF922 (LOW address byte).
Such you have possibility to addressing 65536 address places in the VRAM.
But almost all MSX2 have 128kb of VRAM Smile

You are totally right. In this case I used locate just to use less chars as possible (I showed this technique for use within tenliners, after all)
Locate8,16 is 10 chars long
Poke&hf922,8 (obviously you have to do poke&hf923,2 before) is 12 chars long (11 chars if decimal notation is used)

Por Dolphin101546015

Champion (336)

Imagen del Dolphin101546015

28-02-2020, 11:00

deleted

Por Dolphin101546015

Champion (336)

Imagen del Dolphin101546015

28-02-2020, 10:50

thegeps wrote:

You are totally right. In this case I used locate just to use less chars as possible (I showed this technique for use within tenliners, after all)

Ok, but I told about using upper VRAM first Wink
By your method you don't reach it I mean.
I forever redefine tables in my soft, and my lovely method, is using upper VRAM first Smile
PS: also: pokead,x:pokead+1,y is faster and shorter abit methink Wink

Por thegeps

Paragon (1192)

Imagen del thegeps

28-02-2020, 14:19

Yep, I always use to assign address values to variables Wink if it isn't needed I leave tables as they are