Video: Lesson P31 - Hardware Sprites on the MSX1!

MSX & MSX2 including the V9990 GPU (V9K)
User avatar
akuyou
Posts: 398
Joined: Mon Apr 22, 2019 3:19 am
Contact:

Video: Lesson P31 - Hardware Sprites on the MSX1!

Post by akuyou » Wed Apr 24, 2019 12:41 pm



www.chibiakumas.com/z80/platform4.php#LessonP31

Lets take a quick look at MSX1 sprites
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

John
Posts: 12
Joined: Tue Mar 24, 2020 1:18 am

Re: Video: Lesson P31 - Hardware Sprites on the MSX1!

Post by John » Sun Apr 26, 2020 10:06 pm

Do you have the code for software sprites, that can be coloured and placed anywhere the screen like the hardware sprites , for the MSX1 ? I see you have done software sprites on other systems.

User avatar
akuyou
Posts: 398
Joined: Mon Apr 22, 2019 3:19 am
Contact:

Re: Video: Lesson P31 - Hardware Sprites on the MSX1!

Post by akuyou » Wed Apr 29, 2020 10:08 am

You could use the tilemap to simulate software sprites in the way shown here:

https://www.chibiakumas.com/z80/platform.php#LessonP10
https://www.chibiakumas.com/z80/simples ... p#LessonS6


You can also use the 3 pattern banks mode of the screen to simulate a bitmap screen if you wish... I showed it being used to display a color screen here:
https://www.chibiakumas.com/z80/platform6.php#LessonP52

I did try using the tilemap to simulate a bitmap screen, using all 3 pattern banks, but it was pretty slow in the way I was using it, so It's not something I pursued any further... instead I use the system as a Tilemap now like the SMS and others.
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

John
Posts: 12
Joined: Tue Mar 24, 2020 1:18 am

Re: Video: Lesson P31 - Hardware Sprites on the MSX1!

Post by John » Wed Apr 29, 2020 4:46 pm

I want to use the your bitmap simulation code, that uses all 3 tile banks in screen 2, for MSX 1 to load more than one background screen for a game. I thought it would just be a simple straight forward extension. I will describe a simple extension I tried -but why doesn't it work?
The starting point was your lines of code below given near the end of your program-I have just given the relevant lines below, instead of the whole program (though that is attached) for clear reading. The image for the screen used is you image from your lesson.

TestSprite:
incbin "C:\screens\MSX1Screen.RAW"
TestSpriteEnd:

TestSpritePalette:
incbin "C:\screens\MSX1Screen.RAW.COL"
TestSpritePalette_End:

I extended the original code above (by original I mean your code) with the lines below that come AFTER the above lines of your original code

TestSprite2:
incbin "C:\screens\MSX1Screen.RAW"
TestSprite2End:

TestSprite2Palette:
incbin "C:\screens\MSX1Screen.RAW.COL"
TestSprite2Palette_End:

This code works and the screen shot of the code is shown ("Screenshot for WorkingCode-Sprite2codeafteroriginalcode.png")
along with the asm code ("WorkingCode-Sprite2codeafteroriginalcode")
But when I make the very simple change of swapping the order of the code so the sprite 2 code does not come after as shown below -the code does not load the screen (it is the same screen), see the screen shot ("Screenshot forNON WorkingCode-Sprite2code NOT afteroriginalcode") and its code ("NONWorkingCode-Sprite2codeNOTafteroriginalcode")
Both the screens/images are the same (but if the code did work then simply replacing one of the screens, to load two different screens by swapping the order of the code). The files used are attached. Maybe the problem originate from the incbin file that is generated by Akusprite.

TestSprite2:
incbin "C:\screens\MSX1Screen.RAW"
TestSprite2End:

TestSprite2Palette:
incbin "C:\screens\MSX1Screen.RAW.COL"
TestSprite2Palette_End:

TestSprite:
incbin "C:\screens\MSX1Screen.RAW"
TestSpriteEnd:

TestSpritePalette:
incbin "C:\screens\MSX1Screen.RAW.COL"
TestSpritePalette_End:
Attachments
Screenquestionfiles.zip
(165.29 KiB) Downloaded 19 times

User avatar
akuyou
Posts: 398
Joined: Mon Apr 22, 2019 3:19 am
Contact:

Re: Video: Lesson P31 - Hardware Sprites on the MSX1!

Post by akuyou » Wed Apr 29, 2020 9:43 pm

Your cartridge is going over 16k - which is not a problem in itself, the trouble is, the MSX probably does not have the second 16k paged in to Z80 ram.

There's a good reason Grime Z80 was so small - it was to avoid having to deal with hassle like this!

if you want to go over 16k You'll need to take a look at the rather painful topic of bank switching:

I cover it a bit here (Cartridge Mappers section)
https://www.chibiakumas.com/z80/platform3.php#LessonP25

Though to be honest GRAUW's documentation may be better:
http://bifi.msxnet.org/msxnet/tech/megaroms
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

John
Posts: 12
Joined: Tue Mar 24, 2020 1:18 am

Re: Video: Lesson P31 - Hardware Sprites on the MSX1!

Post by John » Thu Apr 30, 2020 2:27 am

Bank switching only applied to cartridges as far as I understand. Are you saying it will work if the program was made as a MSX-1 tape image? Because tape cannot use banks of memory as it is sequentially and mechanically loaded. So two screens can be loaded into the RAM of a 64K MSX-1.

User avatar
akuyou
Posts: 398
Joined: Mon Apr 22, 2019 3:19 am
Contact:

Re: Video: Lesson P31 - Hardware Sprites on the MSX1!

Post by akuyou » Thu Apr 30, 2020 9:31 am

I've never made a tape image so I have no idea how the MSX OS works with it - you're welcome to try it, but it's not something I can help you with.

If you can't keep your program below 16k, I think one way or another you're going to have to learn about bank switching... personally, I think working with cartridges would be easier but I'm no expert on such things.

I'd suggest you take a look at the OpenMSX debugger, it can show you what banks are paged in, so you can see if your code is seeing the memory it expects (That's how I identified the problem with the example)
t.png
t.png (28.37 KiB) Viewed 438 times
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

John
Posts: 12
Joined: Tue Mar 24, 2020 1:18 am

Re: Video: Lesson P31 - Hardware Sprites on the MSX1!

Post by John » Thu Apr 30, 2020 7:44 pm

I am reading your notes and I think I am beginning to understand
how bank of memory work on the MSX 1.

Just check with you I have understood it correctly so far.
So the 64K is split into four banks which are of size 16k.
Each bank is addressed by a slot or a subslot of a slot.
The cartridge banks on every MSX1 are fixed to two possibilities.

So to load two screen, using cart ridge banks, you would basically put
two similar copies of your screen 2 drawing program
in two different cartridge banks (one in each bank).
The first bank is the one automatically runs when the machine
in turned on with the cart in it.
The program in the first bank will draw the first screen,.
then the program in the first bank will switch to the
other bank. Once that is done the program in the
second bank runs to draw the second screen.

Did I understand it correct;y o far?

John
Posts: 12
Joined: Tue Mar 24, 2020 1:18 am

Re: Video: Lesson P31 - Hardware Sprites on the MSX1!

Post by John » Thu Apr 30, 2020 9:04 pm

Another question, I think I can save a lot of memory, about 5kb on one of the two images, by using zx spectrum colouring for one of the images for an MSX1 screen. Can I use an Akusprite export to colour an MSX1 screen in the style of the ZX Spectrum? Still need to know about banks because I want the other screen to be MSX1 style colouring.

User avatar
akuyou
Posts: 398
Joined: Mon Apr 22, 2019 3:19 am
Contact:

Re: Video: Lesson P31 - Hardware Sprites on the MSX1!

Post by akuyou » Fri May 01, 2020 3:15 am

No, I'm afraid there's no functionality to do that in Akusprite editor.
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

Post Reply

Return to “MSX & MSX2 Assembly Programming”