|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Goto page Previous 1, 2, 3 ... 16, 17, 18 |
Author | Message |
---|---|
|
Posted: Wed Sep 25, 2024 8:38 am |
nice effect!
I'm totally fine with everyone creating their logo as they see fit, as there's not really an official one. |
|
|
question
Posted: Wed Sep 25, 2024 7:25 pm
|
So is this a program like Genesis has SGDK I want to make a shmup using sprites I created. Also what language is used assembly? | |
|
Posted: Thu Sep 26, 2024 6:13 am |
Yes, this is similar to what SGDK is for Genesis. It's using the C language, as the topic title says.
You can read a quick introduction at this wiki. |
|
|
Posted: Fri Oct 04, 2024 5:52 pm |
First, thanks for timer handler, it works great, but the reason why I'm writing again, is SDCC 4.4 currently supported because I am getting linker error messages like:
SDCC 4.3 works fine with the same code. |
|
|
Posted: Sat Oct 05, 2024 3:32 pm |
These are warnings, you can ignore them.
Anyway, I suspect if you remove --sdcccall 1 from your SDCC command line (it's the default anyway) the warnings will likely go away. |
|
|
Posted: Thu Dec 05, 2024 9:09 pm |
Hi, I searched the web for SFX samples and found the following site: https://harmlesslion.com/sn_sfxr/
Unfortunately something isn't right, I suspect wrong loops. Vgmplay and Winamp can play this tracks but showing a wrong length. Psglib only plays a long tone. How can I fix this? |
|
|
Posted: Fri Dec 06, 2024 8:24 am |
I've never seen that web page before, but it seems a nice tool!
As for what I can tell, the VGMs looks fine - I generated this VGM which contains (vgm2txt tool output): VGM Header:
VGM Signature: "Vgm " File Version: 0x00000110 (1.10) EOF Offset: 0x00000066 (absolute) GD3 Tag Offset: 0x00000000 (absolute) Data Offset: 0x00000040 (absolute) Total Length: 3675 samples (00:00.08 s) Loop Point Offset: 0x0000025C (absolute) Loop Start: 4293842011 samples (530:65566.03 s) Loop Length: 1128960 samples (00:25.60 s) Recording Rate: 60 Hz SN76496 Clock: 3579540 Hz SN76496 Feedback: 0x00 SN76496 ShiftRegWidth: 15 bits SN76496 Flags: 0x00 YM2413 Clock: 0 Hz - unused YM2612 Clock: 0 Hz - unused YM2151 Clock: 0 Hz - unused SegaPCM Clock: 0 Hz - unused SegaPCM Interface: 0x00000000 RF5C68 Clock: 0 Hz - unused YM2203 Clock: 0 Hz - unused YM2203 AY8910 Flags: 0x00 YM2608 Clock: 0 Hz - unused YM2608 AY8910 Flags: 0x00 YM2610 Clock: 0 Hz - unused YM3812 Clock: 0 Hz - unused YM3526 Clock: 0 Hz - unused Y8950 Clock: 0 Hz - unused YMF262 Clock: 0 Hz - unused YMF278B Clock: 0 Hz - unused YMF271 Clock: 0 Hz - unused YMZ280B Clock: 0 Hz - unused RF5C164 Clock: 0 Hz - unused PWM Clock: 0 Hz - unused AY8910 Clock: 0 Hz - unused AY8910 Type: 0x00 - AY-3-8910A AY8910 Flags: 0x00 Volume Modifier: 0x00 (0) = 1.000 Reserved (0x7D): 0x00 Loop Base: 0x00 = ±0 Loop Modifier: 0x00 (MaxLoops * 0.00) GB DMG Clock: 0 Hz - unused NES APU Clock: 0 Hz - unused MultiPCM Clock: 0 Hz - unused UPD7759 Clock: 0 Hz - unused OKIM6258 Clock: 0 Hz - unused OKIM6258 Flags: 0x00 K054539 Flags: 0x00 C140 Type: 0x00 OKIM6295 Clock: 0 Hz - unused K051649 Clock: 0 Hz - unused K054539 Clock: 0 Hz - unused HuC6280 Clock: 0 Hz - unused C140 Clock: 0 Hz - unused K053260 Clock: 0 Hz - unused Pokey Clock: 0 Hz - unused QSound Clock: 0 Hz - unused VGMData: 0x00000040: 50 84 SN76496: Latch/Data: Tone Ch 0 -> 0x004 0x00000042: 50 03 SN76496: Data: 03 0x00000044: 50 93 SN76496: Latch/Data: Volume Ch 0 -> 0x3 = 80% 0x00000046: 62 Wait: 735 samples (1/60 s) (total 735 (00:00.01)) 0x00000047: 50 84 SN76496: Latch/Data: Tone Ch 0 -> 0x004 0x00000049: 50 03 SN76496: Data: 03 0x0000004B: 50 95 SN76496: Latch/Data: Volume Ch 0 -> 0x5 = 66% 0x0000004D: 62 Wait: 735 samples (1/60 s) (total 1470 (00:00.03)) 0x0000004E: 50 84 SN76496: Latch/Data: Tone Ch 0 -> 0x004 0x00000050: 50 03 SN76496: Data: 03 0x00000052: 50 98 SN76496: Latch/Data: Volume Ch 0 -> 0x8 = 46% 0x00000054: 62 Wait: 735 samples (1/60 s) (total 2205 (00:00.05)) 0x00000055: 50 84 SN76496: Latch/Data: Tone Ch 0 -> 0x004 0x00000057: 50 03 SN76496: Data: 03 0x00000059: 50 9B SN76496: Latch/Data: Volume Ch 0 -> 0xB = 26% 0x0000005B: 62 Wait: 735 samples (1/60 s) (total 2940 (00:00.06)) 0x0000005C: 50 84 SN76496: Latch/Data: Tone Ch 0 -> 0x004 0x0000005E: 50 03 SN76496: Data: 03 0x00000060: 50 9D SN76496: Latch/Data: Volume Ch 0 -> 0xD = 13% 0x00000062: 62 Wait: 735 samples (1/60 s) (total 3675 (00:00.08)) 0x00000063: 50 9F SN76496: Latch/Data: Volume Ch 0 -> 0xF = 0% 0x00000065: 66 End of Data and it seems correct to me. I then tried converting it to PSG format and the result is what is expected. Note that this SFX uses channel 0, are you using channel 0 too? |
|
|
Posted: Sat Dec 07, 2024 3:52 pm |
Oh, thanks after checking my code again it sounds much better when you put the PSG(SFX)Frame in the correct scope, my fault.
Btw. when should I use sfx routines? Is this only for the channel parameter so you can mix music and sfx together? PS: Any chances to get a tile decompression into SGlib? |
|
|
Posted: Sun Dec 08, 2024 4:47 pm |
you need to tell the vgm2psg converter tool which channel(s) the SFX uses, and then also pass that parameter when firing the SFX from code
Let me see what I can do :) |
|
|
Posted: Tue Dec 10, 2024 12:19 pm |
@dark: I think I could add ZX7 to be used as general data compressor, making it decompress directly to VRAM - how would you create the asset anyway? BMP2Tile has no support for 'legacy' modes AFAIK... | |
|
Posted: Thu Dec 12, 2024 7:11 pm |
I'm using my python script(already posted here somewhere) for converting images like start and death screen. For this I use 1,5 segments(256+128 tiles) of the screen, the rest on top and bottom is free for text.
You see in the output of my build environment, there aren't much space left. Btw. Do the sprite data uses the same data format as tile data? For the tile data you need second array for the index(2x4bits) to map to the fix color palette, for each tile line(FG, BG). But the sprite have only one color per sprite, so how do I set the colors? Technically the BG should be always color index 0. |
|
|
Sprite clipping
Posted: Thu Dec 12, 2024 9:17 pm
|
Hi Sverx!
Working for the next competition, I am trying to archieve 50/60fps instead of the 2 frames in 1 technique I have been using in the past, for that I am using GSlib (faster than my scroll engine) and I am refining my engine to have only the needed functionality. In the process, I realised that I need optimizing functions for some things, in particular for sprite clipping. The question is if would be logic to have the adjoining SMS_addSprites (Two,Three and Four) with clipping, or I have some alternative (by example the metasprites functionality with clipping) with similar performance. Even more, maybe I do not need vertical clipping, only horizontal one, as is very difficult to have a sprite based block with more than 64 pixels height. Regards! |
|
|
Posted: Thu Dec 12, 2024 9:45 pm |
By example, this would be a clipping add_two_adjoining sprites one:
unsigned char drawTwoSprites(unsigned int x, unsigned int y, unsigned char base)
{ // Check y y-=windowtop; if((y>192)&&(y<65536-16))return 0; // Adjust with map x-=windowleft; if(x<256-8) { SMS_addTwoAdjoiningSprites(x,y,base); return 1; } else if(x<256) { SMS_addSprite(x,y,base); return 1; } else if(x>(65536-8)) { SMS_addSprite(x+8,y,base+2); return 1; } else return 0; } windowleft and windowtop are the coordinates of the window in the gslib map, to get the absolute position to draw the sprite. It could be done better than this? Maybe the metasprites (if they have clipping) will be faster than this approach? I am thinking in 16x16, but also in 24x32, 32x32... up to 32x48 sprites. |
|
|
Posted: Fri Dec 13, 2024 10:02 am |
I see, so I will add ZX7 decompression to VRAM, and I also should look into turning SGlib into a real library (I mean, made of a few modules instead of being a single module) so that to save ROM when functions aren't used. It will require some time, though.
A sprite color is the fourth parameter in SG_addSprite (unsigned char x, unsigned char y, unsigned char tile, unsigned char attr) the tile data has the same format as the BG tiles AFAIK.
@eruiz00 - I suspect you're trying to map world coordinates to screen coordinates, but SMSlib can't do that, so you have either to use the provided SpriteClipping functions (which are indeed slow) or write code to determine when a sprite gets clipped, which looks like what you're doing already. Metasprites can help with their clipping, but you still have to determine if each metasprite needs to be drawn or not, as they can't be placed outside of the screen. |
|
|
Posted: Fri Dec 13, 2024 4:45 pm |
First step done, I just pushed an update to SGlib adding the SG_decompressZX7toVRAM(const void *src, unsigned int dst) function, that can be easily called through one of the macros SG_loadZX7compressedBGTiles(src,tilefrom)
depending on if you want to load tiles for the background or tiles for the sprites
SG_loadZX7compressedSpritesTiles(src,tilefrom) Let me know if this works, I'll work on breaking the SGlib single module into parts later, hopefully soon. |
|
|
Posted: Sat Dec 14, 2024 10:24 pm |
Ummmm....
I checked the metasprite code and i saw that it has some sort of clipping for the sprites, so I made an utility to convert a tilemap from bmp2tile to a metasprite definition (using the coordinates 0,0 - 8,0 - 0,8 - 8,8 ..... ) and it worked, yeah! but I found that, as the position parameters for the metasprites are unsigned chars, I suppose that the clipping iis done, but you cannot draw a metasprite with, let's say... negative coordinates for the origin, or cordinates greater than 256, 192, so I returned to the function published before (although I have to develop functions for other array sizes, 32x40, 32x64....) |
|
|
Posted: Sun Dec 15, 2024 2:41 pm |
@eruiz00: yes, that's what I meant to say regarding metasprites, they don't work in 'wide' coordinates, so you can't say place a metasprite at (-2,100) and have part of it show on screen, you can only place them on screen using screen coordinates and have the parts outside of screen removed - the best you can do is to put a metasprite origin in a central point and let half of it disappear when it goes close to the border
also remember, you can't place any hardware sprite at any negative X coordinate showing only a part of it on screen, the only alternatives are: - early clock mode bit (all sprites are placed 8 pixels left of their coordinate) - hide the leftmost 8 pixels of screen and use that as a new border (as sprite won't appear on top of the hidden part) |
|
|
Posted: Sun Dec 15, 2024 5:59 pm |
Hi,
there is a typo in the readme of SGlib, should be named with a prefix SG_. Are there tutorials out there how to set up Sublime with the Emulicious Debugger plugin? |
|
|
Posted: Sun Dec 15, 2024 6:09 pm |
Yeah, I saw it... so I returned to my adhoc functions (one per size) with optimized clipping, something like the ones I used in electric dreams but more optimized (and now, that I am doing my little pure asm functions, I am very happy with the performance, it's not too hard!!!). A bug I found is in GSLib, I explain, if I make this: unsigned int *meta=GSL_metatileLookup(tilex,tiley);
*meta=newvalue; GSL_metatileUpdate(); The screeen update will fail if the four tiles are, horizontally, partially out of screen (by example, if the first column is in column 31). It is not a big trouble for me, as I am using my own ansi c function, but it is a bug. I explain, gslib will update two metatiles, the one pointed by *meta and the next one (updating 8 tiles in total). I don't know if you have energy to dive into gslib (as it is a long and very complex code), I do not need such fix, really, it's only for your information. Regards. |
|
|
Posted: Sun Dec 15, 2024 8:40 pm |
You should be able to set it up following the instructions for Sublime's Sublime Debugger extension. |
|
|
Posted: Mon Dec 16, 2024 9:24 am |
Thanks. I'm still learning how to properly copy&paste...
I'm keeping a copy of Psidum's original code with a few bugfixes here - see if that works better, and please file an issue (or alternatively post here) if the bug is still there, thanks! |
|
|
Prepend sprites
Posted: Sun Dec 22, 2024 8:28 am
|
Hi, happy christmas to everyone!
I realised that I need to have a function to add an sprite in front of the previously added ones in the same frame. Could it be possible? I refer to something like this: SMS_addTwoAdjoiningSprites(124,40,232); SMS_prependTwoAdjoiningSprites(124,40,232); <-- these two sprites are going to be shown in front of the prior ones. I know, I could change the workflow for each frame to put these sprites earlier, but I would need to include an additional loop (for all enemies that need this feature) and I am short of cpu&vdp time (as always xD) regards. |
|
|
Posted: Sun Dec 22, 2024 2:52 pm |
You might want to use signed char SMS_reserveSprite (void) so that you can 'set aside' one/a few sprites to be possibly used later if they are needed. Example:
reserved1=SMS_reserveSprite();
reserved2=SMS_reserveSprite(); then if later you then realize you needed those, you then use these two functions: void SMS_updateSpritePosition (signed char sprite, unsigned char x, unsigned char y)
void SMS_updateSpriteImage (signed char sprite, unsigned char tile) for instance something like SMS_updateSpritePosition (reserved1, 100, 120);
SMS_updateSpriteImage (reserved1, EXPLOSION_SPRITE); SMS_updateSpritePosition (reserved2, 108, 120); SMS_updateSpriteImage (reserved2, EXPLOSION_SPRITE+2); I don't know if this solves your specific issue but I hope it will :) |
|
|
Posted: Sun Dec 22, 2024 8:05 pm |
Could I use these functions without reservesprite first? I am thinking in direct editing of the sprite table without having to reserve the 64 available sprites... and set the number of used sprites without having to reserve them.
are the reserved values a serie of numbers? (-63, -62, -61.... o 0,1,2...) |
|
|
Posted: Mon Dec 23, 2024 9:06 am |
yes, in theory you could do that by reserving all the 64 sprites once in the beginning and the repositioning them at every frame, but I suspect it will be much slower, so that's likely not a good idea
another approach could be to completely skip the sprite functions and directly access the sprite buffers, but again it's hardly going to be faster can't you simply add a check in your loop over the enemies that if some flag is set you'll first add the additional sprites and then add the regular ones? I mean, I don't know exactly what you're doing so I have no idea of what I'm saying... |
|
|
Posted: Mon Dec 23, 2024 10:59 am |
I got a solution, but not technical, I changed some visual aspect of the game and now it is not needed, it was an interesting theme for me, to touch the sprite table without use of the SMS_devkit functions. | |
|
Posted: Mon Dec 23, 2024 1:03 pm |
you can see the sprite buffer variables are defined here and they are: unsigned char SpriteTableY[MAXSPRITES];
so if you want to handle these directly, just remember to set SpriteNextFree to the number of sprites you're using before calling SMS_copySpritestoSAT() or alternatively you can set that to 64 just once but then remember to set all unused sprites Y to some value such as 199 (must be > 192 and < 240) and not equal to 0xD0 because that's the sprite terminator. Also values in SpriteTableY needs to be Y coordinates - 1
unsigned char SpriteTableXN[MAXSPRITES*2]; unsigned char SpriteNextFree; |
|
|
Posted: Mon Dec 23, 2024 2:39 pm |
I just added a decompression function for the stc4 compressed tileset format: SMS_loadSTC4compressedTiles (src, tilefrom)
the decompressor is pretty fast (~23 tiles/frame average) and the compression rate for the stc4 format are at around 40% average (so the compressed data is approx 60% of the size of the original data) also compressed tilesets can be concatenated and loaded with a single call, provided you remove the terminator byte from all the tilesets except for the last one - example using assets2banks: {
# put multiple stc4 compressed tilesets into one single block tileset_1.stc4compr :segment -1 tileset_2.stc4compr :segment -1 tileset_3.stc4compr } and then load them with a single call with: SMS_loadSTC4compressedTiles (tileset_1_stc4compr, 0) for instance.
|
|
|
.h and .c compile missing
Posted: Sun Dec 29, 2024 3:39 pm
|
hello! Firstly, thanks for the Devkit!
I'm having a problem that I don't quite understand why it happens. When I compile the game including only the "bank(x).h" files, it compiles but does not load the images saved in it. If I include the "bank(x).c" files in the code, they load normally, but I use up space in the code bank. I saw in all the examples that they all only load the .h file from the bank. What am I doing wrong? (I generated them with folder2c). main.c #include <stdio.h> #include <stdlib.h> #include "SMSlib.h" #include "bank2.h" #include "bank3.h" #include "bank4.h" my compilation code: sdcc -c -mz80 --constseg bank2 bank2.c sdcc -c -mz80 --constseg bank3 bank3.c sdcc -c -mz80 --constseg bank4 bank4.c sdcc -c -mz80 --peep-file peep-rules.txt main.c sdcc -o main.ihx -mz80 --no-std-crt0 --data-loc 0xC000 -Wl-b_BANK2=0x24000 -Wl-b_BANK3=0x34000 -Wl-b_BANK4=0x44000 crt0_sms.rel main.rel SMSlib.lib bank2.rel bank3.rel bank4.rel makesms main.ihx main.sms |
|
|
Posted: Sun Dec 29, 2024 5:07 pm |
Are you doing a bank switch in your code? Like so:
SMS_mapROMBank(tiles_bin_bank); SMS_loadTiles (tiles_bin, 0, tiles_bin_size); See the example here: https://www.smspower.org/forums/18547-BankSwitchingDevkitSMS |
|
|
.h and .c compile missing
Posted: Sun Dec 29, 2024 7:34 pm
|
My code:
void carregar_fundos() { SMS_mapROMBank(2); SMS_displayOff(); SMS_loadBGPalette(fundojogopal_bin); SMS_loadPSGaidencompressedTiles(fundojogotiles_psgcompr,0); SMS_loadTileMap(0,0, fundojogotilemap_bin, fundojogotilemap_bin_size); if (nlevel==2) { SMS_setBGPaletteColor(0, RGB(0, 0, 170)); SMS_setBGPaletteColor(2, RGB(0, 85, 255)); SMS_setBGPaletteColor(3, RGB(0, 170, 255)); SMS_displayOn(); } } If I add #include "bank2.c" at the beginning along with "bank2.h" it loads perfectly. But if I remove bank2.c it doesn't load. The problem is that adding the ".c" of all banks takes up space in the code bank. In all the examples I see, no one ever puts "#include bank(x).c". I've tried compiling in different ways, but I still can't understand what I'm doing wrong. |
|
|
Posted: Mon Dec 30, 2024 2:22 pm |
it looks like you're linking data banks (banks that contain your assets) at the wrong address. It should be -Wl-b_BANK2=0x28000 -Wl-b_BANK3=0x38000 -Wl-b_BANK4=0x48000 because data banks should be at 0xn8000
Also it's better if you don't do SMS_mapROMBank(2); but do SMS_mapROMBank(fundojogopal_bin_bank); instead, so that if you move your assets around everything will still work correctly.
I hope this helps! :) |
|
|
Posted: Mon Dec 30, 2024 4:36 pm |
There is an example around that uses 4000. I initially used that example as well, but later changed it to 8000.
No idea where 4000 comes from. Is that value ever correct, or is the example just plain incorrect? |
|
|
Posted: Mon Dec 30, 2024 5:15 pm |
Where is the example? The 0xn4000 is used to map code banks (so when using banked code), not data banks, as data is mapped at 0xn8000 instead (banked code use slot-1 page [at $4000] through trampolines in crt0 to map chunks of code when needed, but the assets needs to be manually banked in using slot-2 page [at $8000]) |
|
|
Posted: Mon Dec 30, 2024 8:07 pm |
it WORKED!! Thank you very much!!! *** sverx's makesms converter *** Info: 36826 bytes used/81920 total [44.95%] - size of output ROM is 80 KB Info: [bank0 6938] [bank1 16313] [bank2 9678] [bank3 1610] [bank4 10555] bytes free Compiling with that code line, I have a code bank (0) of 16k, and an empty bank of 1. Can I put code in it, just use __banked? So do I need to change the bank1 address to 14000? If I want to use more banks with code, do I just change the addresses to 4000? and leave the asset values at 8000? Another question, is there another way to keep the 32k bank for coding and add many asset banks by compiling the way I'm doing? |
|
|
Posted: Tue Dec 31, 2024 11:18 am |
Sorry, i don't remember where i got it. In my build batch i can see i tried 4000 because i commented out before i fixed it to 8000. I must've gotten the 4000 from somewhere. Probably it was an example that used banked code 4000.
I think if you don't use bank1 you will have room for code. Yes, you can/should use _bank. If you look inside your bank.h files you will see it points to the bank number. E.g. #define background_tilemap_stmcompr_bank 2 You can use as many assets bank as you want. This is an example of what i used: sdcc -o output.ihx -mz80 --no-std-crt0 --data-loc 0xC000 -Wl-b_BANK2=0x28000 -Wl-b_BANK3=0x38000 -Wl-b_BANK4=0x48000 -Wl-b_BANK5=0x58000 -Wl-b_BANK6=0x68000 -Wl-b_BANK7=0x78000 -Wl-b_BANK8=0x88000 ..\SMSlib\crt0_sms.rel main.rel ..\SMSlib\SMSlib.lib bank2.rel bank3.rel bank4.rel bank5.rel bank6.rel bank7.rel bank8.rel Nowadays i use assets2banks instead of folder2c. I simply put all my assets in one folder and use _bank to find the correct bank. |
|
|
Posted: Tue Dec 31, 2024 2:20 pm |
Basically there are two options:
the first approach is what people usually do, unless you're building a complex game also, as @slogra pointed out, you can use assets2banks instead of folder2c, it will automatically organize your assets in banks and you won't ever have to worry about where something ended up because it creates all the definitions for you - instructions and more details here! |
|
|
Posted: Tue Dec 31, 2024 4:28 pm |
Thank you very much friends! You guys are awesome! Everything works perfect here! Happy new year and a great 2025 with lots of codes and master system! |
|
Goto page Previous 1, 2, 3 ... 16, 17, 18 |