当前位置:网站首页>How does FC game console work?
How does FC game console work?
2020-11-09 00:28:00 【shzwork】
(NES PPU)
Do a simple calculation :
The resolution of the 256x240 = 61440, That is, there are so many pixels on the screen .( Ignore NTSC Loss of system 16 That's ok ,PAL The system is 256x240)
If we only show black and white , That is, every pixel is black or white , So a single pixel bit That's all right. , At such a high resolution , Total needs 1 * 61440 / 8 / 1024 = 7.5KB, If you do this directly, the black and white dots can't fit the host video memory , At that time, the better computers were just about the same .
Let's say we use the very common 256 color , namely 8 Binary bits , A byte store , The whole picture 61440 / 1024 = 60KB, This is in FC Time is something that no ordinary machine can do directly .
To show color , At that time, different machines had various techniques , It can be said that the eight immortals cross the sea and show their magical powers .FC The first method used is called Color Cell, say concretely :
- Divide the whole image into many 8x8 Small cell ( Or call it tile)
- Every cell At most there is 4 Color
such , Each pixel only uses 2bit To store colors , And then to the total 32x30 = 960 individual cell Redistribute color coding , Indicates which colors are available .
Take a chestnut , We know the devil city (Castlevania, 1986) start :( The picture is from [dustmop.io blog])
The smallest lattice in the graph ( All the light lines cut out ) That is, a cell or tile, four tile Form a block( It's just a bright line ). In the picture, we use 10 Color . You can't find any more than 4 Colored cell.
Let's see another one. I'm the top one :
Encoding cell The table will be stored in video memory called name table In the region , Just now the opening area code of demon city is shaped as shown in the figure below :
FC The second brilliant thing is the advanced scrolling technology , because PPU There are two inside ( After the mirror image, there are four )name table To store cell Table information , We can always pre store more than the display , After the player or program triggers the scrolling operation , By sending two registers PPUSCROLL and PPUCTRL Write relevant information , You can move the game lens .
stay FC Previous hosts , Scrolling almost always covers the whole screen , It's expensive .FC At the same time, it makes the action 、 Shooting games have been greatly developed .
The last part is the movement in the game Sprite, Stored in a specific built-in memory area of the graphics card , Usually a single size is 8x8 or 8x16, Most of the protagonists we see are many Sprite Put together , such as Mario It's actually 4 individual Sprite Spell out , Just make sure it doesn't fall apart in the program .
Sprite Is displayed over the background , No matter how the background is set , stay PPU Conduct Sprite After detection, the corresponding bit will be set to Sprite The color of .
Last ,btw, Basically all FC/NES Development materials can be found in NES dev And its appendages wiki Found on the , It's just that without the relevant professional knowledge, it may be more difficult to gnaw .
Chinese people's 《 Nintendo game programming 》 Generally speaking, the book is more detailed , However, many key points are vague , And spent a lot of time teaching how to write code . It's good for the layman , It's basically useless for professionals . what's more , The book says little about Rationale Things that are , For real learning, it's disastrous .
http://nesdev.com/NESDoc.pdf
The basic principles are written in this document . The core is CPU(Central Processing Unit) and PPU(Picture Processing Unit),PPU It's a wonderful design .
Github There are various versions of NES Simulator source code , Through this code, you can understand more clearly NES Operation process :
- go + OpenGL video + PortAudio Audio :fogleman/nes · GitHub
- javascript + dynamicaudio Audio :bfirsh/jsnes · GitHub
- Rust : pcwalton/sprocketnes · GitHub
- C++ :Cephas1982/NES · GitHub ( This is not finished yet )
FC Image controller developed by Ricoh (PPU), Yes 2KB Video memory of , The palette shows 48 Color and 5 A gray scale . One screen can show 64 A character (sprites) , The role format is 8x8 or 8x16 Pixel , One scan line shows at most 8 A character , Although this limit can be exceeded , But it causes the character to blink . The background can only show one scroll , The resolution of the picture is 256x240 , But because NTSC System limitations , Can't show top and bottom 8 Scanning lines , So the resolution remains 256x224.
Architecturally ,FC There's a pseudo sound processor (pseudo-Audiom Processing Unit,pAPU), In real hardware , This processor is integrated into 2A03 NMOS In the processor [2].pAPU Built in 2 It's almost the same (nearly-identical) The rectangular wave channel of ,1 Three triangular channels ,1 Noise channels and 1 Audio sample playback channels (DCM, Delta modulation mode )[2]. among 3 There are analog channels for playing music ,1 A murmur channel shows a special sound effect ( Explosions , Gunfire, etc ), The audio sample playback channel can be used to represent continuous background sound .
FC There is a reset switch on the mainframe 、1 A power switch 、1 Game card slots 、2 One with a cross direction key 2 Key handle ( Game controller ), On the main handle “ choice ” and “ Start ” Button . There is a power interface on the back of the host 、RF RF output interface 、 Video image output interface 、 Audio out connector . There is also an expansion port ahead , Used to connect the light gun 、 Additional external devices such as continuous transmitter handle .
FC Games are usually stored in the form of read-only memory in a game card that can be plugged into the host slot , Capacity is LA series 24K,LB series 40K,LC series 48K,LD series 64K,LE series 80K,LF series 128K,LG series 160K,LH series 256K, Teka series and all in one cassette tape, etc . There are also some with batteries to keep game progress .
1986 year 2 month 21 Japan , Nintendo also launched a FC Disk drive , Can be in FC Host through the converter to use a dedicated floppy drive to read and write games , The capacity of the floppy disk is 112KB.
版权声明
本文为[shzwork]所创,转载请带上原文链接,感谢
边栏推荐
- Have you ever thought about why the transaction and refund have to be split into different tables
- 老大问我:“建表为啥还设置个自增 id ?用流水号当主键不正好么?”
- How does semaphore, a thread synchronization tool that uses an up counter, look like?
- A bunch of code forgot to indent? Shortcut teach you carefree!
- 使用递增计数器的线程同步工具 —— 信号量,它的原理是什么样子的?
- 用两个栈实现队列
- Introduction to nmon
- VIM 入门手册, (VS Code)
- Table join
- Flink's datasource Trilogy 3: customization
猜你喜欢
Copy on write collection -- copyonwritearraylist
服务器性能监控神器nmon使用介绍
理论与实践相结合彻底理解CORS
APP 莫名崩溃,开始以为是 Header 中 name 大小写的锅,最后发现原来是容器的错!
Fiddler无法正常抓取谷歌等浏览器的请求_解决方案
How to analyze Android anr problems
What are the basic requirements for big data posts?
APP 莫名崩溃,开始以为是 Header 中 name 大小写的锅,最后发现原来是容器的错!
A few lines of code can easily transfer traceid across systems, so you don't have to worry about losing the log!
How to deploy pytorch lightning model to production
随机推荐
如何将 PyTorch Lightning 模型部署到生产中
如何通过Sidecar自定义资源减少Istio代理资源消耗
How to make scripts compatible with both Python 2 and python 3?
Why need to use API management platform
The interface testing tool eolinker makes post request
How to analyze Android anr problems
梁老师小课堂|谈谈模板方法模式
Pipedrive如何在每天部署50+次的情况下支持质量发布?
基于链表的有界阻塞队列 —— LinkedBlockingQueue
写时复制集合 —— CopyOnWriteArrayList
How to deploy pytorch lightning model to production
Database design: paradigms and anti paradigms
14.Kubenetes简介
Teacher Liang's small class
CSP-S 2020 游记
When iperf is installed under centos7, the solution of make: * no targets specified and no makefile found. Stop
通过canvas获取视频第一帧封面图
文件拷贝的实现
Esockettimeout solution in request in nodejs
云计算之路-出海记-小目标:Hello World from .NET 5.0 on AWS