Remove dollar sign ($) from front of number tokens

Number tokens with a dollar sign are kind of cumbersome and don't really
serve a purpose, so I'm removing them.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-03-10 15:59:36 -04:00
parent 7c9d4fe908
commit 28edfb6933
9 changed files with 133 additions and 126 deletions

View File

@@ -1,107 +1,107 @@
.section data $0x1000 {
number: .u8 $10
.section data 0x1000 {
number: .u8 10
main:
; Test addition
mov %status, $1
add %r0, $1
cmpeq %r0, $1
mov %status, 1
add %r0, 1
cmpeq %r0, 1
jz end
; Test addition from a register
mov %status, $2
mov %status, 2
add %r0, %r0
cmpeq %r0, $2
cmpeq %r0, 2
jz end
; Test addition from a u8 location
mov %status, $3
mov %status, 3
add %r0, (number)u8
cmpeq %r0, $12
cmpeq %r0, 12
jz end
; Test addition overflow
mov %status, $4
add %r0, $0xFFFFFFFFFFFFFFFF
cmpeq %r0, $11
mov %status, 4
add %r0, 0xFFFFFFFFFFFFFFFF
cmpeq %r0, 11
jz end
; Test subtraction
mov %status, $5
mov %status, 5
mov %r0, (number)u8
sub %r0, $1
cmpeq %r0, $9
sub %r0, 1
cmpeq %r0, 9
jz end
; Test subtraction from a register
mov %status, $6
mov %r1, $2
mov %status, 6
mov %r1, 2
sub %r0, %r1
cmpeq %r0, $7
cmpeq %r0, 7
jz end
; Test subtraction overflow
mov %status, $7
sub %r0, $8
cmpeq %r0, $0xFFFFFFFFFFFFFFFF
mov %status, 7
sub %r0, 8
cmpeq %r0, 0xFFFFFFFFFFFFFFFF
jz end
; Test multiplication
mov %status, $8
mov %status, 8
mov %r0, (number)u8
mul %r0, $1
cmpeq %r0, $10
mul %r0, 1
cmpeq %r0, 10
jz end
; Test multiplication from a register
mov %status, $9
mov %r1, $2
mov %status, 9
mov %r1, 2
mul %r0, %r1
cmpeq %r0, $20
cmpeq %r0, 20
jz end
; Test negative multiplication
mov %status, $10
mul %r0, $0xFFFFFFFFFFFFFFFF ; -1
cmpeq %r0, $0xFFFFFFFFFFFFFFEC ; -20
mov %status, 10
mul %r0, 0xFFFFFFFFFFFFFFFF ; -1
cmpeq %r0, 0xFFFFFFFFFFFFFFEC ; -20
jz end
; Test division
mov %status, $11
mov %status, 11
mov %r0, (number)u8
div %r0, $2
cmpeq %r0, $5
div %r0, 2
cmpeq %r0, 5
jz end
; Test integer division
mov %status, $12
mov %r1, $2
mov %status, 12
mov %r1, 2
div %r0, %r1
cmpeq %r0, $2
cmpeq %r0, 2
jz end
; Test negative division with idiv
mov %status, $13
idiv %r0, $0xFFFFFFFFFFFFFFFF ; -1
cmpeq %r0, $0xFFFFFFFFFFFFFFFE ; -2
mov %status, 13
idiv %r0, 0xFFFFFFFFFFFFFFFF ; -1
cmpeq %r0, 0xFFFFFFFFFFFFFFFE ; -2
jz end
; Test modulo
mov %status, $14
mov %status, 14
mov %r0, (number)u8
mod %r0, $4
cmpeq %r0, $2
mod %r0, 4
cmpeq %r0, 2
jz end
; Test mod from a register
mov %status, $15
mov %status, 15
mod %r0, %r0
cmpeq %r0, $0
cmpeq %r0, 0
jz end
; TODO : Test mod and div by zero
mov %status, $0
mov %status, 0
end:
halt