Neon Spiral Injector wrote: > > First, is there any thing special the Massage requires for a game to load. > Perhaps a proper checksum, or some value to be stored in a special > location? Massage does not check the checksum, a real Master System would. Massage can only load roms that are a multiple of 16k (with the exception of those with a 512 byte header), and possibly the minimum limit is 32k. > Second, does Massage use the bank infomation stored in the ROM image? If > it does could you give me a basic description how? If you mean the code at offset 7FF0-7FFF in the rom, I don't take any notice of it. > I guess the third most important question is, do you know the exact format > of character data? I've gotten 3 different replies to this question and > none of them really seem to work. As much detail in this area as possible > would be nice. If all 8 rows of a character are the same, you only need > describe one row. The characters are stored in bitplane format, in other words the first byte represents 8 "bit 0's", the next 8 "bit 1's" and so on: Binary BYTE 0: 00000000 BYTE 1: 00000000 BYTE 2: 00000000 BYTE 3: 11111111 In this case, this would represent 8 pixels of colour 8 (1000 in binary). Bit 7 is the leftmost pixel and bit 0 is the rightmost pixel. The advantage of this system is that where memory is limited, you can choose to have graphics stored in the cartridge in 2, 4, 8 or 16 colour format: (Firstly clear the whole VRAM) 2 colour : Write to byte 0 only. 4 colour : Write to 0 and 1. 8 colour : Write to 0, 1 and 2. 16 colour : Write to all 4. Each char consists of 8*4 bytes, so char number X is at X*32 in VRAM. X=0 to 511. Y=0 to 7. Line Y (plane 0) of char X exists at (X*32)+(Y*4) in VRAM. Line Y (plane 1) of char X exists at (X*32)+(Y*4)+1 in VRAM. Line Y (plane 2) of char X exists at (X*32)+(Y*4)+2 in VRAM. Line Y (plane 3) of char X exists at (X*32)+(Y*4)+3 in VRAM. Also note, that the sms has 16k VRAM which is mirrored at 0x0000, 0x4000 and 0x8000, but!! ONLY write to 0x4000+, and only read from 0x0000+ !!! > Not that important yet, but when I start fooling around with music it will > be very. How many VBlanks interupts occur a second in normal operation? I actually emulate a PAL sms, which runs at 50Hz, select 262 line mode for a psuedo-NTSC mode at 60hz (providing that you set the speed to 117%). > Last if you can think of anything that would be helpful to me in my > attempts to program the SMS I will take it. Erm.... Remember to switch the screen on. Use Vblank : Optional option, and activate the vblank interrupt via the VREG, and do an "EI" instruction. Some of the VREG descriptions in the "unofficial spec" are a bit wrong, here are some examples: VREG 0 (Bits 7-0) Bit 4: SET - Enable H interrupt RES - Disable H interrupt. VREG 1 Bit 6: SET - enable screen! RES - disable screen. Bit 5: SET - Enable V interrupt RES - Disable V interrupt. VREG 5 Base address of the sprite attribute table. Bits 6-1 represent A13-A8, bit 7 and bit 0 are set to 1, so: Data 0x81 Base 0x0000 Data 0xFF Base 0x3F00 I think these are all the parts that are incorrect in the unofficial spec. When using 8x16 sprites, only use even numbered chars. > Oh last, as no one has documented this, if you have an info on the FM chip > in the Mark 3, like the port to write to and the data format that could be > very useful. I didn't actually write the code to emulate the FM chip myself, so I don't know that much about it. Port 240 (decimal) is the register select (0-63 decimal). Port 241 (decimal) is the data write port. Port 242 (decimal) is used to detect if the FM chip is present. According to the guy who wrote the code, it is like the FM-PAC expansion for the MSX which is described in PORTAR.DOC (or something like that) which I think is on one of Marat's fMSX pages. The H interrupts are the most inaccurate parts of the emulator, don't expect there to be any more beyond line 191 (although there is). Line Interrupt mode 2 is supposed to be the most accurate model of interrupts compared to a real Master System, but LI mode 0 is the best for most games! The H interrupts need a lot of explaining...... The value is latched during the NEXT H interrupt (exception : when in vblank). Let's say you want an H interrupt at line 128, then every line after that, setting it to 128 during the vblank is no good, that would cause an H interrupt at 128, but attempt the next one at 256 (not possible). You'd have to set it to 64, when the H int happens at 64, set the H reg to 0, the next H int will happen at 128, then subsequently at every line. Hope this helps in some way. bye, James McKay. Neon Spiral Injector wrote: > > I guess both of those are sort of releated. What I was really trying to > ask about is the paging information, that seems be to stored around FFFF > (perhaps a bit shorter). Right now I'm only worried about 32k programs, as > that is all I need. 32k programs don't seem to use paging, as you can > access up to 64k with the z80's 16-bit addressing. But for future > reference I'm wondering how 128k, 256k, 512k programs work. I'm also > wondering for far future use if the SMS could be forced to access more than > 512k (every video game system has always listed the largest cart that it > can use, but some creative programming always over comes that limit), > either by being able to address more than 32 16k pages, or increasing the > page size or what ever. OK, first of all a memory map (all rom banks are 16k): 0x0000 Page 0. 0x4000 Page 1. 0x8000 Page 2/BB ram. 0xC000 8K RAM. 0xE000 Mirror of 8K RAM (but is reserved and shouldn't be used). 0xFFF0 to 0xFFFF are reserved for banking/future expansion, so addressing more than 512k could've been possible. By default Page 0 is bank 0, and Page 1 is bank 1 within the emulator, giving you the first 32k. 0xFFFC: Battery backed ram: bit 7-4 - no known function. bit 3: 16K RAM or ROM at Page 2. (0=ROM, 1=RAM). bit 2: Which 16k page (0=first, 1=second). bit 1-0 - no known function. If RAM is paged in, then it has priority over the ROM, until the RAM is paged out again. For the following, all values poked are ANDed (within the emulator) to keep them within the legal range of banks, so make the rom length a power of two, ie: 64k. 128k. 256k. 512k. Also 384K which is a special case. Technically Massage could also handle files of 1024K, 2048K and 4096K, but this has never been tried, and it is not known if a real sms could do it. It would be interesting though... If you want bank X, then poke X into one of the following addresses, simple as that. Bank X starts at offset (X*16384) in the rom file. 0xFFFD: Selects bank to go into Page 0. NOTE : Only 15k from 0x0400 to 0x3FFF. The reason for this is that you cannot be sure on power up which banks are in, so the first 1k is always locked to the first 1k of bank 0. Even worse, Massage doesn't emulate this and will swap the whole 16k, I haven't seen any game which uses this, so I've got away with it so far. If you do intend to use this make sure that you take this into consideraton. 0xFFFE: Selects bank to go into Page 1. All 16k. 0xFFFF: Selects bank to go into Page 2. All 16k. So, you have 48K of ROM accessable at a time, followed by 8K of RAM. 0xFFFC to 0xFFFF can also be read, so that you know which page is in (usually used in interrupt routines). > Is there any way you know of to dirrectly address the display? That is a > dirrect method rather than putting characters and sprites on the screen? If you mean a bitmap, then no. The sms only has one official screen mode, and it's impossible to work out the others (if there are any). > I knew it! :) I always play my games around 120%, didn't know about > picking the 262 line mode though. Actually, those used to PAL setups play it at 120% as well! > One last question. How does Massage know that a cart is battery backed. > And where do I write to? And is the battery backed RAM always 16k? O'kay > that was three questions, but I have a feeling they all can be answered at > pretty much the same time. Massage decides that there is a battery backed ram present whenever the game tries to write to it! The ram can be 16k or 32k, however, it is believed that only the first 16k is battery backed and the other 16k is just extra ram, none of this is too clear, so I just save the whole 32k (if the game has written to the second page). Details about accessing the ram are in an answer above. > Oh, a note about the real SMS. Did you know that it has a hole for a 14 > pin IC on its board, also next to the hole is an unsoldered jumper. Any > ideas what this could be? My first excited guess was that is was where the > FM chip would go, but the Yamaha chip is 18 pin. I'm wondering if NEC ever > made a 14 pin FM chip that was very close to the Yamaha. I'll have to pose > this question to the SMS FAQ maintainer, to see if anyone can turm up more > leads than I. I didn't know that. The FM chip is still very much a mystery. bye, James McKay. Neon Spiral Injector wrote: > > Oh, speaking of types of noise, do you happen to know what the 8 > different types of noise are? Bit 2: White noise=1, Synchronous noise=0. Bit 1,0: Bin Frequency -------------- 00 : Clock/16 01 : Clock/32 10 : Clock/64 11 : Frequency is taken from tone generator 3. Note : Clock is 110Khz. White noise is the only setting that is emulated, and all 8 are exactly the same on the Adlib card, since it doesn't allow you to change the frequency of the snare drum. Synchronous noise is described in the official manual as "a 6.25% duty pulse waveform", but I don't think I've seen anything that actually used it. Note that the PSG is write only. > Yeah, I was thinking about doing that, but there is a lot of code in a game > to be just aimlessly searching for one routine. Do you ever plan on > releasing a debugging version of massage, like one that could tell me what > bank is swapped in, and what offset is being executed? I could add a bit which displays the registers and bank settings etc, as long as it's not a full z80 step by step debugger! > Yes, definately. The more the marrier, and I would rather be working with > people to improve everyone's knowledge of the SMS, rather than have lots of > small groups all trying to compete and just keeping everything they know to > themselves. OK, his email address is: mailto:nmp20@hermes.cam.ac.uk Name : Nathan Page. I only sent him the smsgg.txt a day ago, so he won't know that much yet. > So, my question(s) are: Does the pause button actually halt execution? It > must cause there doesn't seem to be any code there to put the game in a > loop or anything. Why doesn't the pause button do anything on most games > title screens? I would guess it has to with the testing of $C190 in the > example above, to know if you are really in the game, but then that would > mean that either the pause button doen't really halt the program, or the > software can somehow override that halt, but there is not code there that > seems to do either. Then there are games, that do special things if you > press the pause button on the title screen, like bringing up a menu, or > just keeping track of the number of times you press it to turn on tricks. > If you know anything about what the pause button does, it would be helpful. > I'm planning on trying to use the pause button as a debug function, that > would dump status information to the screen, to aid in programming. Well, the pause button just pushes the PC onto the stack, copies IFF1 to IFF2 and sets the PC to $66. That's all it does, no tricks or anything, the code at that point is responsible for signalling to the game that it has been pressed. And when you press the button again, the same thing happens, which is probably why that code complements the number, since it is unaware of whether it is pausing or unpausing. > Oh, I know this a really taboo, but... I'm going to make a ROM request, > well sort of. With all the people translating Japanese games to English, > I'm getting jealous, and want to do one too, only I don't have any Japanese > SMS ROMs (well the dual language ones, but someone else did that work > already). Do you know of any Japanese SMS (Mark III) ROMs around on the > net? I'll probally just end up working on Phantasy Star Adventure for the > GG. Hmm.... A Japanese only sms game... MahjongJ.SMS is Japanese I think, although it's not very exciting. There's the Japanese only version of Castle Of Illusion. Unfortunately the English version is also available! What about translating those tips that you get in Bubble Bobble at the continue screen? > That did make me think of another question... What does the language > switch do? If you feel like explaining, please go ahead. This is much harder to explain, mainly because I can't remember it just now. Ah.. Here's the listing from Powerstrike: ld a,F5 out(3F),a in a,(DD) and C0 cp C0 jz nz,EXIT1 ld a,55 out(3F),a in a,(DD) and C0 or a jr nz,EXIT1 ld a,FF out(3F),a jr EXIT2 EXIT1: xor a EXIT2: ld(C008),a ret This routine writes 0 or FF to C008 depending on the nationality of the Master System, trouble is that I can't remember which is which. EXIT1 might be English. bye, James McKay.