Files
rasp/tests/test_mul.asm

35 lines
622 B
NASM
Raw Normal View History

.section data $0x0 {
number: .u8 $10
main:
; Test multiplication
mov %status, $1
mov %r0, (number)u8
mul %r0, $1
cmpeq %r0, $10
jz end
; Test multiplication from a register
mov %status, $2
mov %r1, $2
mul %r0, %r1
cmpeq %r0, $20
jz end
; Test negative multiplication
mov %status, $3
mul %r0, $0xFFFFFFFFFFFFFFFF ; -1
cmpeq %r0, $0xFFFFFFFFFFFFFFEC ; -20
jz end
mov %status, $0
end:
halt
.export main
}
.meta {
entry: main
}