Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ファミコンアセンブリ入門

 ファミコンアセンブリ入門

Here I gave a small introduction to programming in assembly for the NES emulator fceux.

Daniel Sangorrin

March 28, 2018
Tweet

More Decks by Daniel Sangorrin

Other Decks in Programming

Transcript

  1. 6502 アセンブリ https://skilldrick.github.io/easy6502/ LDX #0 ; X will be the

    pixel index LDA #3 ; A will contain the color FIRST: STA $0200,X INX CPX #255 BCC FIRST STA $02FF LDX #0 LDA #4 SECOND: STA $0300,X INX CPX #255 BCC SECOND STA $03FF LDX #0 LDA #5 THIRD: STA $0400,X INX CPX #255 BCC THIRD STA $04FF LDX #0 LDA #6 FOURTH: STA $0500,X INX CPX #255 BCC FOURTH STA $05FF
  2. WINE + FCEUX • Fceux available in Linux • But

    no debug functionality • WINE to run the Win32 version $ sudo dpkg --add-architecture i386 $ wget -nc https://dl.winehq.org/wine-builds/Release.key $ sudo apt-key add Release.key $ sudo apt-add-repository https://dl.winehq.org/wine- builds/ubuntu/ $ sudo apt-get update $ sudo apt-get install --install-recommends winehq-stable [Alt] sudo apt-get install --install-recommends winehq-devel $ wine fceux xxx.nes
  3. cc65 • Install the cc65 compiler $ git clone https://github.com/cc65/cc65.git

    $ cd cc65 $ make $ sudo make install PREFIX=/usr $ which cc65 /usr/bin/cc65 <- C compiler $ which ca65 /usr/bin/ca65 <- ASM compiler
  4. Hello World $ git clone https://github.com/cirla/nesdev.git $ cd nesdev $

    git checkout hello_world $ ls reset.s: initialization of the NES hello_world.c: contains main called from reset.s hello_world.cfg: linker script (describes the CPU memory map used) sprites.chr: file with sprites (Bitmap ROM) $ make -> hello_world.nes $ wine fceux.exe hello_world.nes -> shows a hello world