summaryrefslogtreecommitdiff
path: root/test/add-sub.s
blob: d923cdc31c6c34335c56c77b148c4bf7737bf28f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
; Test adding, and subtracting.
;
; Written by mr b0nk 500 <b0nk@b0nk.xyz>

; Main Program.
.org 0
reset:
	cps		; Clear the processor status register.
	ldx.d #$2FFFF	; Reset the stack pointer.
	txs		;
	and #0		; Reset A.
	tab		; Reset B.
	tax		; Reset X.
up:
	inc		; Increment the counter.
	cmp #$FF	; Did the accumulator overflow?
	bcs down	; Yes, so start decrementing.
	bra up		; No, so keep incrementing.
down:
	dec		; Did the accumulator underflow?
	beq up		; Yes, so start incrementing.
	bra down	; No, so keep decrementing.

.org $FFC0
.qword reset
a
d