:20008000328D0720A9168D0720A9208D0720A9008D0720A9268D0720A9018D0720A9318DE5\r
:2000A0000720A9208D0620A9068D0620A9448D0720A9458D0720A9458D0720A9218D0620D9\r
:2000C000A9E68D0620A9448D0720A9458D0720A9458D0720A9008D0720A9548D0720A945FD\r
-:2000E0008D0720A9538D0720A9548D0720A9218D0720A9238D0620A9C18D0620A9D88D07BC\r
-:2001000020A9008D0320A9028D0420A94D8D0420A9038D0420A9648D0420A9328D0420A913\r
-:200120004F8D0420A9018D0420A91E8D0420A93C8D0420A9508D0420A9018D0420A9218DFA\r
-:200140000420A93D8D0420A9518D0420A9028D0420A92D8D0420A91E8D0120A9808D00200B\r
-:200160004C6081400000000000000000000000000000000000000000000000000000000012\r
-:2001800000000000000000000000000000000000000000000000000000000000000000005F\r
+:2000E0008D0720A9538D0720A9548D0720A9218D0720A9548D0720A9458D0720A9538D078A\r
+:2001000020A9548D0720A9218D0720A9218D0720A9238D0620A9C18D0620A9D88D0720A998\r
+:20012000008D0320A9028D0420A94D8D0420A9038D0420A9648D0420A9328D0420A94F8DE0\r
+:200140000420A9018D0420A91E8D0420A93C8D0420A9508D0420A9018D0420A9218D042092\r
+:20016000A93D8D0420A9518D0420A9028D0420A92D8D0420A91E8D0120A9808D00204C7E45\r
+:2001800081400000000000000000000000000000000000000000000000000000000000009E\r
:2001A00000000000000000000000000000000000000000000000000000000000000000003F\r
:2001C00000000000000000000000000000000000000000000000000000000000000000001F\r
:2001E0000000000000000000000000000000000000000000000000000000000000000000FF\r
:200F8000000000000000000000000000000000000000000000000000000000000000000051\r
:200FA000000000000000000000000000000000000000000000000000000000000000000031\r
:200FC000000000000000000000000000000000000000000000000000000000000000000011\r
-:200FE00000000000000000000000000000000000000000000000000000006381008000008D\r
+:200FE00000000000000000000000000000000000000000000000000000008181008000006F\r
:00000001FF\r
--- /dev/null
+ASMSOURCES = sample1.asm\r
+\r
+OBJECTS = $(ASMSOURCES:.asm=.o)\r
+\r
+LIBRARIES =\r
+#-------------------------------------------------------------------------------\r
+all : $(OBJECTS) $(LIBRARIES)\r
+ ld65 -o sample1.nes --config sample1.cfg --obj $(OBJECTS)\r
+ ./dd-img.sh sample1\r
+\r
+.SUFFIXES : .asm .o\r
+\r
+.asm.o :\r
+ ca65 -t none $*.asm\r
+\r
+clean :\r
+ -rm sample1.nes\r
+ -rm *.o\r
+\r
--- /dev/null
+#!/bin/bash
+
+if [ "$1" == "" ] ; then
+ echo "$0 -in_filename (w/o .nex )"
+ exit -1
+fi
+
+in_name=$1
+
+in_file=$in_name.nes
+out_file1=$in_name-prg.bin
+out_file2=$in_name-chr.bin
+
+echo in_file=$in_name.nes
+echo out_file1=$in_name-prg.bin
+echo out_file2=$in_name-chr.bin
+
+echo "processing...."
+
+dd if=$in_file of=$out_file1 bs=16 skip=1 count=2048 2> /dev/null
+dd if=$in_file of=$out_file2 bs=16 skip=2049 2> /dev/null
+#4k img creation
+dd if=sample1-prg.bin of=sample1-prg-4k.bin bs=512 count=8
+
+bin2hex sample1-prg-4k.bin sample1-prg.hex
+bin2hex sample1-chr.bin sample1-chr.hex
+
+echo "done."
:20008000328D0720A9168D0720A9208D0720A9008D0720A9268D0720A9018D0720A9318DE5\r
:2000A0000720A9208D0620A9068D0620A9448D0720A9458D0720A9458D0720A9218D0620D9\r
:2000C000A9E68D0620A9448D0720A9458D0720A9458D0720A9008D0720A9548D0720A945FD\r
-:2000E0008D0720A9538D0720A9548D0720A9218D0720A9238D0620A9C18D0620A9D88D07BC\r
-:2001000020A9008D0320A9028D0420A94D8D0420A9038D0420A9648D0420A9328D0420A913\r
-:200120004F8D0420A9018D0420A91E8D0420A93C8D0420A9508D0420A9018D0420A9218DFA\r
-:200140000420A93D8D0420A9518D0420A9028D0420A92D8D0420A91E8D0120A9808D00200B\r
-:200160004C6081400000000000000000000000000000000000000000000000000000000012\r
-:2001800000000000000000000000000000000000000000000000000000000000000000005F\r
+:2000E0008D0720A9538D0720A9548D0720A9218D0720A9548D0720A9458D0720A9538D078A\r
+:2001000020A9548D0720A9218D0720A9218D0720A9238D0620A9C18D0620A9D88D0720A998\r
+:20012000008D0320A9028D0420A94D8D0420A9038D0420A9648D0420A9328D0420A94F8DE0\r
+:200140000420A9018D0420A91E8D0420A93C8D0420A9508D0420A9018D0420A9218D042092\r
+:20016000A93D8D0420A9518D0420A9028D0420A92D8D0420A91E8D0120A9808D00204C7E45\r
+:2001800081400000000000000000000000000000000000000000000000000000000000009E\r
:2001A00000000000000000000000000000000000000000000000000000000000000000003F\r
:2001C00000000000000000000000000000000000000000000000000000000000000000001F\r
:2001E0000000000000000000000000000000000000000000000000000000000000000000FF\r
:200F8000000000000000000000000000000000000000000000000000000000000000000051\r
:200FA000000000000000000000000000000000000000000000000000000000000000000031\r
:200FC000000000000000000000000000000000000000000000000000000000000000000011\r
-:200FE00000000000000000000000000000000000000000000000000000006381008000008D\r
+:200FE00000000000000000000000000000000000000000000000000000008181008000006F\r
:00000001FF\r
--- /dev/null
+.setcpu "6502"
+.autoimport on
+
+; iNES header
+.segment "HEADER"
+ .byte $4E, $45, $53, $1A ; "NES" Header
+ .byte $02 ; PRG-BANKS
+ .byte $01 ; CHR-BANKS
+ .byte $01 ; Vetrical Mirror
+ .byte $00 ;
+ .byte $00, $00, $00, $00 ;
+ .byte $00, $00, $00, $00 ;
+
+.segment "STARTUP"
+.proc Reset
+
+
+; interrupt off, initialize sp.
+ sei
+ ldx #$ff
+ txs
+
+ ;ppu register initialize.
+ lda #$00
+ sta $2000
+ sta $2001
+
+
+;;palettes:
+;;;;;bg palette
+;;$0f, $00, $10, $20
+;;$0f, $04, $14, $24
+;;$0f, $08, $18, $28
+;;$0f, $0c, $1c, $2c
+;;;;;spr palette
+;;$0f, $00, $10, $20
+;;$0f, $06, $16, $26
+;;$0f, $08, $18, $28
+;;$0f, $0a, $1a, $2a
+
+;step0.1 = palette set.
+ lda #$3f
+ sta $2006
+ lda #$00
+ sta $2006
+
+ lda #$11
+ sta $2007
+ lda #$01
+ sta $2007
+ lda #$03
+ sta $2007
+ lda #$13
+ sta $2007
+
+ lda #$0f
+ sta $2007
+ lda #$04
+ sta $2007
+ lda #$14
+ sta $2007
+ lda #$24
+ sta $2007
+
+ lda #$0f
+ sta $2007
+ lda #$08
+ sta $2007
+ lda #$18
+ sta $2007
+ lda #$28
+ sta $2007
+
+ lda #$05
+ sta $2007
+ lda #$0c
+ sta $2007
+ lda #$1c
+ sta $2007
+ lda #$2c
+ sta $2007
+
+
+;;sprite pallete
+ lda #$00
+ sta $2007
+ lda #$24
+ sta $2007
+ lda #$1b
+ sta $2007
+ lda #$11
+ sta $2007
+
+ lda #$00
+ sta $2007
+ lda #$32
+ sta $2007
+ lda #$16
+ sta $2007
+ lda #$20
+ sta $2007
+
+ lda #$00
+ sta $2007
+ lda #$26
+ sta $2007
+ lda #$01
+ sta $2007
+ lda #$31
+ sta $2007
+
+
+
+;;step1 = name table set.
+;;set vram addr 2005 (first row, 6th col)
+ lda #$20
+ sta $2006
+ lda #$06
+ sta $2006
+
+;;set name tbl data
+;;0x44, 45, 45 = DEE
+
+ lda #$44
+ sta $2007
+ lda #$45
+ sta $2007
+ lda #$45
+ sta $2007
+
+;;set vram addr 21d1
+ lda #$21
+ sta $2006
+ lda #$E6
+ sta $2006
+
+;;msg=DEE TEST !!!
+ lda #$44
+ sta $2007
+ lda #$45
+ sta $2007
+ lda #$45
+ sta $2007
+ lda #$00
+ sta $2007
+ lda #$54
+ sta $2007
+ lda #$45
+ sta $2007
+ lda #$53
+ sta $2007
+ lda #$54
+ sta $2007
+ lda #$21
+ sta $2007
+
+;;msg=TEST !!!
+ lda #$54
+ sta $2007
+ lda #$45
+ sta $2007
+ lda #$53
+ sta $2007
+ lda #$54
+ sta $2007
+ lda #$21
+ sta $2007
+ lda #$21
+ sta $2007
+
+
+;;set vram addr 23c1 (attribute)
+ lda #$23
+ sta $2006
+ lda #$c1
+ sta $2006
+;;attr=11011000
+ lda #$d8
+ sta $2007
+
+
+;;step2 = sprite set.
+;;set sprite addr=00 (first sprite)
+ lda #$00
+ sta $2003
+;;set sprite data: y=02
+ lda #$02
+ sta $2004
+;;tile=0x4d (ascii 'M')
+ lda #$4d
+ sta $2004
+;;set sprite attr=03 (palette 03)
+ lda #$03
+ sta $2004
+;;set sprite data: x=100
+ lda #$64
+ sta $2004
+
+;;set sprite data: y=50
+ lda #$32
+ sta $2004
+;;tile=0x4d (ascii 'O')
+ lda #$4f
+ sta $2004
+;;set sprite attr=01
+ lda #$01
+ sta $2004
+;;set sprite data: x=30
+ lda #$1e
+ sta $2004
+
+;;set sprite data: y=60
+ lda #60
+ sta $2004
+;;tile=0x4d (ascii 'P')
+ lda #$50
+ sta $2004
+;;set sprite attr=01
+ lda #$01
+ sta $2004
+;;set sprite data: x=33
+ lda #$21
+ sta $2004
+
+;;set sprite data: y=61
+ lda #$3d
+ sta $2004
+;;tile=0x4d (ascii 'Q')
+ lda #$51
+ sta $2004
+;;set sprite attr=02
+ lda #$02
+ sta $2004
+;;set sprite data: x=45
+ lda #45
+ sta $2004
+
+ ;;show bg...
+ lda #$1e
+ sta $2001
+
+ ;;;enable nmi
+ lda #$80
+ sta $2000
+
+ ;;done...
+ ;;infinite loop.
+mainloop:
+
+ jmp mainloop
+.endproc
+
+
+nmi_test:
+ rti
+
+;;;for DE1 internal memory constraints.
+.segment "VECINFO_4k"
+ .word nmi_test
+ .word Reset
+ .word $0000
+
+.segment "VECINFO"
+ .word nmi_test
+ .word Reset
+ .word $0000
+
+; character rom file.
+.segment "CHARS"
+ .incbin "character.chr"
--- /dev/null
+# memory map
+MEMORY {
+ HEADER: start = $0000, size = $0010, file = %O, fill = yes;
+ ROMST: start = $8000, size = $0ffa, type = ro, file = %O, fill = yes, define = yes;
+ ROMINFO_4k: start = $8ffa, size = $0006, type = ro, file = %O, fill = yes, define = yes;
+ ROMST_other: start = $9000, size = $6ffa, type = ro, file = %O, fill = yes, define = yes;
+ ROMINFO: start = $fffa, size = $0006, type = ro, file = %O, fill = yes, define = yes;
+ ROMCHR: start = $0000, size = $2000, type = rw, define = yes;
+ ZP: start = $0000, size = $0020, type = rw, define = yes;
+ RAM: start = $0400, size = $0400, type = rw, define = yes;
+ STACK: start = $0200, size = $0200, type = rw, define = yes;
+ SRAM: start = $6000, size = $2000, type = rw, define = yes;
+}
+
+# segment map
+SEGMENTS {
+ HEADER: load = HEADER, type = ro;
+ STARTUP: load = ROMST, type = ro, define = yes;
+ VECINFO_4k: load = ROMINFO_4k, type = ro, define = yes;
+ VECINFO: load = ROMINFO, type = ro, define = yes;
+ RODATA: load = ROMST, type = ro, define = yes;
+ DATA: load = ROMST, run = RAM,type = rw, define = yes;
+ BSS: load = RAM, type = bss, define = yes;
+ ZEROPAGE: load = ZP, type = zp;
+ CODE: load = ROMST, type = ro, define = yes;
+ CHARS: load = ROMCHR, type = ro;
+}
+
+FEATURES {
+ CONDES: segment = RODATA,
+ type = constructor,
+ label = __CONSTRUCTOR_TABLE__,
+ count = __CONSTRUCTOR_COUNT__;
+ CONDES: segment = RODATA,
+ type = destructor,
+ label = __DESTRUCTOR_TABLE__,
+ count = __DESTRUCTOR_COUNT__;
+}
+
+SYMBOLS {
+# __STACKSIZE__ = $0200;
+ __STACKSIZE__: type = weak, value = $0200;
+}