add more code

This commit is contained in:
Tan, Kian-ting 2024-12-16 23:43:42 +08:00
parent 0385a6ee7d
commit fdfeee1d72
3 changed files with 106 additions and 0 deletions

BIN
230810組合語言/ex.out Executable file

Binary file not shown.

73
230810組合語言/ex.s Normal file
View file

@ -0,0 +1,73 @@
# (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

View file

@ -0,0 +1,33 @@
POJ,TL
ch,ts
o͘,oo
ó͘,óo
ò͘,òo
ô͘,ôo
ō͘,ōo
o̍,o̍o
hⁿ, nnh
ⁿ,nn
ek,ik
e̍k,i̍k
eng,ing
éng,íng
èng,ìng
êng,îng
ēng,īng
oa,ua
óa,uá
òa,uà
ôa,uâ
ōa,uā
o̍a,ua̍
oá,uá
oà,uà
oâ,uâ
oā,uā
oa̍,ua̍
úi,uí
ùi,uì
ûi,uî
ūi,uī
u̍i,ui̍
1 POJ TL
2 ch ts
3 oo
4 ó͘ óo
5 ò͘ òo
6 ô͘ ôo
7 ō͘ ōo
8 o̍o
9 hⁿ nnh
10 nn
11 ek ik
12 e̍k i̍k
13 eng ing
14 éng íng
15 èng ìng
16 êng îng
17 ēng īng
18 oa ua
19 óa
20 òa
21 ôa
22 ōa
23 o̍a ua̍
24
25
26
27
28 oa̍ ua̍
29 úi
30 ùi
31 ûi
32 ūi
33 u̍i ui̍