FC的《超級瑪利歐兄弟》記憶體居然只有40KB?

2024-04-07

《超級瑪利歐兄弟》的記憶體居然只有40KB?

任天堂紅白機(Famicom)遊戲《超級瑪利歐兄弟》(スーパーマリオブラザーズ/Super Mario Bros.)的銷售量相當驚人,在日本的總銷售量為681萬片,在全世界總共大賣4,024萬片,成為史上最暢銷的遊戲。

遊戲由32個關卡所組成,而卡帶的記憶體僅有40KB,讓人不禁讚嘆任天堂工程師出色的開發能力。卡帶內有兩個晶片,左邊是8KB用來儲存遊戲圖像,右邊則是32KB用來儲存遊戲程序。工程師發明瓦片圖(Tile Map)的設計,即將畫面出現的所有元素轉換為8x8的圖片呈現,透過編號組合,用代碼傳送到遊戲主機。遊戲畫面運行時只需顯示相應位置的瓦片即可,因此代碼所佔的空間比圖片減少許多。

左右對稱的圖案是由相同的瓦片拼湊而成,透過代碼進行鏡像反轉。草叢和雲朵的瓦片是相同的,僅透過調色更改顏色。整個遊戲共有512個瓦片,每個瓦片有64像素,總數達32,768像素,相當於8KB。所有音樂則佔用1.2MB的記憶體,是遊戲記憶體的30倍。為節省儲存量,工程師用代碼指示遊戲主機的聲音晶片進行演奏,運用幾種固定波型來模擬樂器,音符、音量和音階也用代碼呈現出來,透過演奏形成一首8bit曲子。

The memory of "Super Mario Bros." is only 40KB? The sales volume of the Nintendo Famicom game "Super Mario Bros." (スーパーマリオブラザーズ) is quite astonishing, with a total sales of 6.81 million copies in Japan and a whopping 40.24 million copies worldwide, making it the best-selling game in history. The game consists of 32 levels, and the memory of the cartridge is only 40KB, which is remarkable considering the outstanding development capabilities of Nintendo engineers. Inside the cartridge, there are two chips: 8KB on the left for storing game graphics and 32KB on the right for storing game programs. Engineers invented the design of Tile Map, which converts all elements appearing on the screen into 8x8 images, and transmits them to the game console through coded combinations. When the game screen runs, it only needs to display the corresponding tiles, so the space occupied by the code is much less than that of the image.

The symmetrical patterns on the left and right are composed of the same tiles, which are mirrored and flipped through code. The tiles for grass and clouds are the same, only changing colors through color adjustments. The entire game has 512 tiles, each with 64 pixels, totaling 32,768 pixels, equivalent to 8KB. All the music occupies 1.2MB of memory, which is 30 times the memory of the game. To save storage space, engineers use code to instruct the game console's sound chip to play, using several fixed waveforms to simulate instruments. Notes, volume levels, and scales are also presented in code, forming an 8-bit melody through performance.