51 lines
857 B
JavaScript
51 lines
857 B
JavaScript
; -------------------------------------------------
|
|
; Constants
|
|
; -------------------------------------------------
|
|
|
|
; Chip register
|
|
cpu_revision: equ 0x00 ; RO
|
|
cpu_control: equ 0x01 ; R/W
|
|
cpu_status: equ 0x02 ; RO
|
|
cpu_int_ctrl: equ 0x03 ; R/W
|
|
|
|
; -------------------------------------------------
|
|
; Program
|
|
; -------------------------------------------------
|
|
code
|
|
reset: jmp init
|
|
|
|
org 0x001
|
|
; nop
|
|
reti
|
|
|
|
; -------------------------------------------------
|
|
; Main
|
|
; -------------------------------------------------
|
|
init: mov R0, 0x05
|
|
cout (cpu_int_ctrl), R0
|
|
mov R0, 0x00
|
|
loop: nop
|
|
inc R0
|
|
nop
|
|
call subr
|
|
nop
|
|
push R3
|
|
nop
|
|
push R2
|
|
nop
|
|
push R1
|
|
nop
|
|
push R0
|
|
nop
|
|
pop R0
|
|
nop
|
|
pop R1
|
|
nop
|
|
pop R2
|
|
nop
|
|
pop R3
|
|
nop
|
|
jmp loop
|
|
|
|
subr: ret
|