summaryrefslogtreecommitdiff
path: root/test/add-sub.s
blob: 694931d56b1b84d8e0f36fb95b3f32e4d3241d58 (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.w #$FFFF	; Reset the stack pointer.
	txs		;
	lsr #16		; 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.
	jmp up		; No, so keep incrementing.
down:
	dec		; Did the accumulator underflow?
	beq up		; Yes, so start incrementing.
	jmp down	; No, so keep decrementing.

.org $FFC0
.qword reset
a
d