⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hardware.txt

📁 著名SFC模拟器Snes9x的源代码。
💻 TXT
📖 第 1 页 / 共 2 页
字号:
have to place the sprite at off-screen position.The SNES hardware seems to impose limits on the number of sprites that canappear on each scanline; there are one or two games out there that rely onthis 'feature' to hide sprites they don't want visible.Mosaic------The SNES has a hardware mosaic effect. The upper left-hand pixel from a blockof pixels up to 16 pixels wide can be made to cover the area of the other15; the pixel appears up to 16 times its original size. The effect can onlybe used on the background layers, not sprites. All backgrounds share thesame size setting but the effect can be turned on and off per backgroundlayer.Many ROMs combine the mosaic effect with a brightness fade to zoom out of onegame screen then zoom on to the next.Offset Per Tile---------------Three of the background screen modes reduce the number of visible backgroundlayers by one, and use its screen data as per-tile background scroll datafor the remaining visible layers.The background modes vary as to whether the vertical and horizontal scrollvalues can both be altered, or just one of them. Tetris Attack uses theeffect to allow different parts of the screen to scroll vertically atdifferent rates.The horizontal per-tile offset feature is very limited and only allowsadjustment in steps of 8 pixels.Mode 7------Nintendo use this background screen mode to really show off the SNES comparedto the Sega's Mega Drive.By specifying a centre of rotation and a 2 by 2 transformation matrix, themode 7 screen can be rotated, scaled, stretched, squashed, etc. just bywriting to a few PPU registers. By varying the values on each scanline, somevery interesting effects can be produced, these include a perspectiveeffect, shears, split-screen zooms, etc.Each pixel is 8-bit (256 colours per pixel) and the screen itself has avirtual screen size of 1024x1024.Mode 7 has another feature where the number of colours are reduced to 128and the spare bit is used to swap a pixel between background layer 0 and 1,thus altering the sprite to background priority. This allows some pixels tobe appear in front of sprites and others appear behind.Colour Addition / Subtraction-----------------------------The pixels of background layers and sprites can be directed to one of twoplaces, the main-screen or the sub-screen. The sub-screen is like a virtualscreen that cannot normally be seen, but the SNES has hardware that can addor subtract the RGB colour palette values of each pixel on the sub-screen toor from RGB values of pixels on the main-screen. The effect is thatbackground layers on the on the main-screen appear translucent, allowing thesub-screen partly to show through. Examples are cloud, mist and water effects.The effect can be turned on and off for each background layer on themain-screen. There's a master switch for sprites as well, but when turnedon, only sprites with certain colour palette numbers actually have theirpixel values added to or subtracted from.The SNES also has a separate fixed colour value; if colour addition orsubtraction is enabled and there's nothing on the sub-screen, the fixedcolour is added or subtracted instead. I've seen it used by games to darkenan area of the screen then overlay a menu on top, to implement afade-to-white effect and to tint an area of the screen a particular colour.Windows-------The SNES provides two "clip windows". Each window is just an area defined bya left and right position. A background layer or all sprites can be selectedto appear only inside or outside the window.If both windows are enabled on the same background layer or for all sprites,the areas they define are combined using one of four logical combinationmodes: OR, AND, XOR and N-XOR.If the left and/or right values are altered on each scanline (normally usingH-DMA), many different shaped windows can be created; I've seen circles,pentagons, wavy lines, doughnuts, G's, etc.There's also the colour window. Each window or both windows can be used todefine the area of the colour window. When the colour window is enabled forthe sub-screen, transparency effects occur only inside or outside the colourwindow. When the colour window is enabled for the main-screen, it acts likea master clip window, clipping all background layers and sprites and eventhe back-drop colour to the area either inside or outside the colour window;in the clipped areas, the sub-screen is displayed or just black.Direct Colour Mode------------------On the 256 colour background modes, the otherwise unused 3-bit per-tilecolour palette number can be used in combination with the 8-bit tile pixeldata to form an 11-bit colour value (2048 colours) without using the SNEScolour palette registers.Mode 7 has the same feature, but since mode 7 uses a different tile layoutwith no 3-bit colour palette number, a fixed 256 colours are availableinstead, again without using the SNES colour palette registers.Interlace---------The SNES normally generates a non-interlaced picture. Interlace can be turnedon and the only thing that happens is that the screen appears to flickerslightly due to the way a television works.  However, in the two hi-res.background screen modes, if interlace is turned on the vertical resolutiondoubles from 512x224 to 512x448 (or 512x478 if the expand vertical flag isalso set).Not many games use the feature due to the flicker introduced by theinterlace, so its use is normally limited to title screens. However, onegame I know of, RPM Racing, uses the effect during the game.DMA---The SNES provides 8 DMA (direct-memory-access) channels, although only one canbe active at once. Without any intervention of the 65c816 CPU, up to 64K ofdata can be transferred from RAM or ROM to any PPU (picture processing unit)register. Since V-RAM, colour palette and sprite position and display data canonly be written to via PPU registers, DMA provides a very convenient method oftransferring data faster than the CPU alone could provide. There are PPUregisters to read or write to the 128k work RAM, so DMA could be used to copydata from ROM to RAM as well.There is also a DMA read mode, where data is transferred from PPU registersto RAM.There are various limitations on DMA - if multiple DMA channels are startedat once, they execute in order, the numerically lowest one first, then thenext highest and so on. The 65c816 is stopped while DMA takes place. EachDMA operation can only access one 64k bank at once. However, the biggestlimitation is that DMA can only take place when the graphics chips aren'talso performing graphics data DMA, i.e. DMA can only be used during thev-blank period or when the screen is forcible blanked.H-DMA-----H-DMA is like DMA in that data is transferred from ROM or RAM to PPUregisters without the intervention of the CPU. However, instead of all thedata being transferred in one block, a few bytes are transferred at a time,just before the start of the each scanline. H-DMA shares the same channels as normal DMA, so each channel can be set upfor DMA or H-DMA, but since normal DMA only occurs during v-blank and H-DMAis disabled during this time, its actually easy to reuse a channel for bothtypes of DMA.There are various H-DMA modes that define how many bytes should betransferred each scanline, whether the destination PPU register is 8-bit or16-bit, should new data be transferred each scanline, or can the same databe reused if a count value hasn't reached zero, etc.H-DMA gives a very powerful weapon to programmers, it allows PPU registervalues to be easily changed each scanline, so many games can and do use itto change screen colours, background scroll values, window shape values,mode 7 matrix values, transparency effects, etc. during the frame.Extra Chips Used by the SNES Inside Some Game Paks==================================================Super FX--------The Super FX is just a fast, integer RISC-type processor but with a built-inplot instruction that can draw a single pixel in the SNES' planar format intoa virtual screen very quickly, very handy for 3d polygon rendering. Its astrange chip though - no stack, a 512 byte cache and a one stage pipe-linethat causes the instruction following a branch instruction to be executed.Instructions fetched from the cache often execute in a single cycle.Super FX games came with additional RAM inside the game pak that is used aswork RAM for the 'FX chip and as save-game positions, if the ROM supports it.The 'FX chip has 16 16-bit registers and built-in fast integer multiply.Although the Super FX and the 65c816 can run in parallel, the 'FX chip can'taccess the game pack ROM or RAM at the same time as the main SNES CPU, so mostgames just get the SNES CPU to execute a wait loop in the SNES work RAM. The 'FX can't access the SNES custom hardware chips, so if the 'FX hasrendered a screen image in its work RAM, it has to go to sleep while the SNESCPU copies the screen to video RAM, usually using DMA. The SNES CPU can passparameters to 'FX routines either by writing them into the 'FX work RAM orwriting directly into the 'FX registers, which it can be accessed by the CPU only when the 'FX chip is sleeping.There are two versions of the 'FX chip, the original 10MHz chip used in StarFox and limited to 1Mb of ROM access and 64K RAM and a newer version used inYoshi's Island, Doom, Vortex, Winter Gold, Star Fox 2, etc. which can beclocked at 21MHz and can access twice as much ROM and RAM.DSP1----The DSP1 is an early digital signal processor with an on-board ROM,manufactured by NEC. The on-board ROM was loaded with a program developedby Nintendo to turn the chip into a 3d maths co-processor, able to performmost primitive, but time-consuming, calculations required when manipulatingobjects in a 3d coordinate system relatively quickly, compared to thespeed of the 65c816 CPU alone, that is.Most of the calculations supported seemed to be those required by a simpleflight simulator, i.e. the calculations available were choosen with PilotWings in mind.The DSP1 has been used in several other games, may be as many as 20, thoughmost ignore a lot of the available features. The games include Mario Kart, TopGear 3000, Battle Racers, Super Air Diver and Bases Loaded 2.SA-1----The SA-1 is a fast, custom 65c816 8/16-bit processor, the same as inside theSNES itself, but clocked at 10MHz compared to a maximum of 3.58MHz for the CPUinside the SNES.The SA-1 isn't just a CPU, it also contains some extra circuits developed byNintendo which includes some very fast RAM, a memory mapper, DMA and severalreal-time timers.The SNES (or ROM copiers) can only access the ROM inside the game pak via theSA-1; and the SA-1 only enables access to the ROM once the game pack's regionlock-out chip has verified it has successfully communicated with a lock-outchip inside the SNES. This very effectively prevents SNES ROM copiers frombeing able to copy the ROM.The SA-1 is used in Mario RPG and seems to be used in several other gamesthat Nintendo released in 1996 and beyond.S-DD1-----Very little is known about this chip. It seems to be another digital signalprocessor, possibly made by Texas Instruments, dedicated to decompressinggraphics data. Only two games I know of use the chip, Street Fighter Alpha 2and Star Ocean.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -