Super Nintendo Entertainment System >> Assembly

Hello world!


Ref. https://georgjz.github.io/tags/#tutorial

main.s

.p816
.i16
.a8

.segment "code"
.proc reset
  sei
  clc
  xce
  lda #$81
  sta $4200
  jmp main
.endproc

.proc main
  wai
  jmp main
.endproc

.proc nmi
  lda $4210
  rti
.endproc

.segment "vector"
.addr $0000, $0000, $0000
.addr nmi, $0000, $0000
.word $0000, $0000
.addr $0000, $0000, $0000
.addr $0000, reset, $0000

main.ld

memory {
  ROM0: start = $008000, size = $8000, fill = yes;
}

segments {
  code:   load = ROM0, align = $100;
  vector: load = ROM0, start = $00ffe4;
}

編譯

$ ca65 --cpu 65816 -o main.o main.s
$ ld65 -C main.ld main.o -o main.smc

完成


返回上一頁