70 lines
1.1 KiB
ArmAsm
70 lines
1.1 KiB
ArmAsm
; ******************************************************************
|
|
; * 6502 code example
|
|
; * (c) 01.05.2017 Paolo Iocco
|
|
; *
|
|
; ******************************************************************
|
|
|
|
#define ROMSIZE $2000
|
|
#define ORIGIN $E000
|
|
#define VECTORS $FFFA
|
|
|
|
; .word ORIGIN ; Memory Base if PRG file
|
|
* = ORIGIN ; Program Counter at ORIGIN (ORG)
|
|
|
|
;* ************** *
|
|
;* Code Segment *
|
|
;* ************** *
|
|
Start:
|
|
lda #$aa
|
|
sta $00
|
|
|
|
ldx #$00
|
|
loop:
|
|
stx $01
|
|
inx
|
|
jmp loop
|
|
|
|
old:
|
|
ldx #$00 ; write message
|
|
Print:
|
|
lda tWelcome,x
|
|
beq Exit
|
|
jsr $ffd2
|
|
inx
|
|
bne Print
|
|
|
|
Exit:
|
|
jmp Exit
|
|
|
|
; * ************* *
|
|
; * INT Segment *
|
|
; * ************* *
|
|
|
|
NMI:
|
|
rti
|
|
|
|
BREAK:
|
|
rti
|
|
|
|
|
|
; * ************** *
|
|
; * Data Segment *
|
|
; * ************** *
|
|
tWelcome:
|
|
.asc " * WELCOME! * "
|
|
.byt $00 ; End of Message
|
|
tEntry:
|
|
.asc "Ready."
|
|
.byt $00 ; End of Message
|
|
|
|
Fill:
|
|
.dsb (ORIGIN+ROMSIZE)-6-*,$ff ;fill up to TOPROM with 0xff
|
|
|
|
;* ***************** *
|
|
;* Vectors Segment *
|
|
;* ***************** *
|
|
* = VECTORS ; Program Counter at ORIGIN (ORG)
|
|
.word NMI
|
|
.word Start
|
|
.word BREAK
|