-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCountdown.asm
More file actions
25 lines (24 loc) · 788 Bytes
/
Countdown.asm
File metadata and controls
25 lines (24 loc) · 788 Bytes
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
#Countdown
#
#This program counts a number down to zero
#The user inputs a number and the program
#counts it down to zero
#
#This version uses mnemonics
#
#Label Address Purpose
#loop 02 Branch here and run until zero
#number 09 DAT Number to countdown is stored here
#one 10 DAT one is a constant - stays the same
#end 08 Halt the program
IN #Input the number and store it in number
STO 09
LDA 09 #Load number onto accumulator,
OUT #output it and branch to the
BRZ 08 #end if it is zero
SUB 10 #Keep subtracting one
STO 09 #Store result in 09
BR 02 #Go back to the top of the loop
COB
DAT 000
DAT 001