Commit 19ffb41a authored by Noémie Fong's avatar Noémie Fong
Browse files

Start digital clock, wip and kinda pretty hard to read

parent 889afe2d
.text
main:
# initialisation of the month discrimination
addi $s0, $0, 2709
# initialisation of the value keeping the minutes and seconds
xor $s1, $s1, $s1
# initialisation of the value keeping the hours, the days and the month
xor $s2, $s2, $s2
# initialisation of the value keeping the years
xor $s3, $s3, $s3
# initialisation of the value counting the leap years
xor $s4, $s4, $s4
# initialisation of the flag when processing hours
xor $s5, $s5, $s5
# preparation to treat the seconds
andi $a1, $s1, 15
andi $a2, $s1, 240
xor $a0, $a0, $a0
# TODO: syscall to synch the time
call_zero:
addi $a0, $v0, zero
j print
call_one:
addi $a0, $v0, one
j print
call_two:
addi $a0, $v0, two
j print
call_three:
# HACK : s5 vaut 2 lorsque l'on traite des heures -> on vérifie la dizaine = 2
and $t1, $s5, $a2
bneq $t1, $zero, call_twenty_three
addi $a0, $v0, three
j print
call_twenty_three:
#TODO
call_four:
addi $a0, $v0, four
j print
call_five:
addi $a0, $v0, five
j print
call_six:
addi $a0, $v0, six
j print
call_seven:
addi $a0, $v0, seven
j print
call_eight:
addi $a0, $v0, eight
j print
call_nine:
addi $a0, $v0, nine
addi $t0, $t0, 1
j print
print
srav $t9, $t8, 16
lui $a0, $t9
ori $a0, $t8
addi $v0, $0, 4
syscall
jr $ra
unit:
xor $t0, $t0, $t0
xor $v0, $v0, $v0
# $t0 is a flag at 1 iff an update is needed
xor $t1, $t1, $t1
beq $a1, $t1, call_zero
addi $t1, $t0, 1
beq $a1, $t1, call_one
addi $t1, $t0, 1
beq $a1, $t1, call_two
addi $t1, $t0, 1
beq $a1, $t1, call_three
addi $t1, $t0, 1
beq $a1, $t1, call_four
addi $t1, $t0, 1
beq $a1, $t1, call_five
addi $t1, $t0, 1
beq $a1, $t1, call_six
addi $t1, $t0, 1
beq $a1, $t1, call_seven
addi $t1, $t0, 1
beq $a1, $t1, call_eight
digits:
seconds:
minutes:
hours:
days:
months:
years:
.data
zero: .asciiz "1011111"
one: .asciiz "0000110"
two: .asciiz "0111011"
three: .asciiz "0101111"
four: .asciiz "1100110"
five: .asciiz "1101101"
six: .asciiz "1111101"
seven: .asciiz "0000111"
eight: .asciiz "1111111"
nine: .asciiz "1101111"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment