remove the asm code
This commit is contained in:
parent
fdfeee1d72
commit
a9f1cd6a67
2 changed files with 0 additions and 73 deletions
Binary file not shown.
|
@ -1,73 +0,0 @@
|
|||
# (c) 2023 Tan, Kian-ting
|
||||
# ===
|
||||
# Tiananmen Massacre - Hong Kong Independence - Free Hong Kong, Tibet, Southern Mongolia
|
||||
# Uyghur Concentration Camps - Taiwan Independence - Chinese Internet Censorships
|
||||
# Red Terror by Chinese Communist Party
|
||||
# ===
|
||||
# 9 * 9 multipulation table
|
||||
|
||||
# storing string
|
||||
.data
|
||||
format: .asciz "%d * %d = %d\n" #string succeeded by '\0'
|
||||
|
||||
.text
|
||||
.global main
|
||||
|
||||
loop1:
|
||||
# b += 1
|
||||
addq $1, %r9
|
||||
|
||||
# a = 0
|
||||
movq $1, %r8
|
||||
|
||||
# goto loop
|
||||
jmp loop
|
||||
|
||||
loop:
|
||||
|
||||
mov %r8, %rsi
|
||||
mov %r9, %rdx
|
||||
|
||||
# rcx = r8 * r9
|
||||
mov %r8, %rcx
|
||||
imulq %r9, %rcx
|
||||
|
||||
xor %rax, %rax # rax = 0
|
||||
# backup r8, rdi, r9
|
||||
mov %r8, %r12
|
||||
mov %rdi, %r13
|
||||
mov %r9, %r14
|
||||
# printf(rdi, rsi, rdx, rcx);
|
||||
call printf
|
||||
|
||||
# restore r8, rdi, r9
|
||||
mov %r14, %r9
|
||||
mov %r13, %rdi
|
||||
mov %r12, %r8
|
||||
|
||||
# a += 1
|
||||
addq $1, %r8
|
||||
|
||||
# IF a <= 9 goto loop
|
||||
cmp $9, %r8
|
||||
jle loop
|
||||
|
||||
# IF b < 9 goto loop1
|
||||
cmp $9, %r9
|
||||
jl loop1
|
||||
|
||||
# goto final
|
||||
jmp final
|
||||
main:
|
||||
|
||||
push %rbx
|
||||
mov $1, %r8 # r8 = a
|
||||
mov $1, %r9 # r9 = b
|
||||
mov $0, %r15
|
||||
mov $format, %rdi
|
||||
jmp loop
|
||||
|
||||
final:
|
||||
pop %rbx
|
||||
ret
|
||||
|
Loading…
Reference in a new issue