2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

asm6でnesファイルを作ってみた

Last updated at Posted at 2020-12-05

環境

  • Windows 10 Home (64bit)

手順

アセンブラの用意

cc65、nesasmも試してみたけどasm6が作りやすいかと。

[Tools - Nesdev wiki]
(https://wiki.nesdev.com/w/index.php/Tools)
からasm6.zipをダウンロード。
例)C:\etc\asm6に配置。

サンプルソースの作成

例)C:\Projects\nesに作成。

test1.asm
	; asm6 test1.asm test1.nes

PRG_COUNT	= 1

	; iNES header
	.db	"NES", $1a
	.db	PRG_COUNT	; PRG-ROM
	.db	$01		; CHR-ROM
	.db	$00		; mapper / mirroring
	.dsb	9, $00

	.base	$10000 - (PRG_COUNT * $4000)
Reset:
	sei
	ldx	#$ff
	txs

	lda	#%00000001
	sta	$4015
	lda	#%10111111
	sta	$4000
	lda	#$00
	sta	$4001
	lda	#%11010101
	sta	$4002
	lda	#$00
	sta	$4003
-
	jmp	-

	.org	$fffa
	.dw	0	; NMI
	.dw	Reset
	.dw	0	; IRQ

	.incbin	"tiles.chr"

ビルド

dev.bat
@echo off
path C:\etc\asm6;%path%
cmd

のようなバッチファイルを用意すると便利。

C:\Projects\nes>fsutil file createNew tiles.chr 8192
ファイル C:\Projects\nes\tiles.chr が作成されました

C:\Projects\nes>asm6 test1.asm test1.nes
pass 1..
test1.nes written (24592 bytes).

NESエミュレータで実行

何でもいいが取り敢えず
[nesterJ - NES Emulator for Win32]
(http://www.dcn.ne.jp/~otim2/nesterj/dl.html)
からnj051b_ja.zipをダウンロード。
test1.nesを実行する。

[FaithJS]
(http://sairoutine.github.io/faithjs/public/)
というWebブラウザ版NESエミュレータもある。

参考リンク

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?