Stage 3 complete, (+ - * / binary operators implemented)
This commit is contained in:
113
test.s
113
test.s
@@ -1,8 +1,111 @@
|
||||
.globl main
|
||||
main:
|
||||
movl $1, %eax
|
||||
push %eax
|
||||
movl $2, %eax
|
||||
pop %ecx
|
||||
imul %ecx, %eax
|
||||
movl $4, %eax
|
||||
push %eax
|
||||
movl $4, %eax
|
||||
neg %eax
|
||||
pop %ecx
|
||||
addl %ecx, %eax
|
||||
cmpl $0, %eax
|
||||
movl $0, %eax
|
||||
sete %al
|
||||
push %eax
|
||||
movl $6, %eax
|
||||
push %eax
|
||||
movl $2, %eax
|
||||
push %eax
|
||||
movl $2, %eax
|
||||
pop %ecx
|
||||
addl %ecx, %eax
|
||||
movl %eax, %ecx
|
||||
pop %eax
|
||||
cdq
|
||||
idivl %ecx
|
||||
push %eax
|
||||
movl $4, %eax
|
||||
neg %eax
|
||||
pop %ecx
|
||||
imul %ecx, %eax
|
||||
push %eax
|
||||
movl $4, %eax
|
||||
not %eax
|
||||
pop %ecx
|
||||
imul %ecx, %eax
|
||||
push %eax
|
||||
movl $9, %eax
|
||||
movl %eax, %ecx
|
||||
pop %eax
|
||||
cdq
|
||||
idivl %ecx
|
||||
pop %ecx
|
||||
addl %ecx, %eax
|
||||
push %eax
|
||||
movl $4, %eax
|
||||
push %eax
|
||||
movl $5, %eax
|
||||
push %eax
|
||||
movl $32, %eax
|
||||
push %eax
|
||||
movl $2, %eax
|
||||
movl %eax, %ecx
|
||||
pop %eax
|
||||
cdq
|
||||
idivl %ecx
|
||||
pop %ecx
|
||||
imul %ecx, %eax
|
||||
push %eax
|
||||
movl $1, %eax
|
||||
not %eax
|
||||
pop %ecx
|
||||
addl %ecx, %eax
|
||||
movl %eax, %ecx
|
||||
pop %eax
|
||||
cdq
|
||||
idivl %ecx
|
||||
push %eax
|
||||
movl $400, %eax
|
||||
push %eax
|
||||
movl $90, %eax
|
||||
movl %eax, %ecx
|
||||
pop %eax
|
||||
cdq
|
||||
idivl %ecx
|
||||
push %eax
|
||||
movl $1, %eax
|
||||
pop %ecx
|
||||
addl %ecx, %eax
|
||||
pop %ecx
|
||||
subl %eax, %ecx
|
||||
movl %ecx, %eax
|
||||
push %eax
|
||||
movl $5, %eax
|
||||
push %eax
|
||||
movl $4, %eax
|
||||
movl %eax, %ecx
|
||||
pop %eax
|
||||
cdq
|
||||
idivl %ecx
|
||||
push %eax
|
||||
movl $2, %eax
|
||||
push %eax
|
||||
movl $3, %eax
|
||||
pop %ecx
|
||||
addl %ecx, %eax
|
||||
pop %ecx
|
||||
imul %ecx, %eax
|
||||
push %eax
|
||||
movl $9, %eax
|
||||
neg %eax
|
||||
movl %eax, %ecx
|
||||
pop %eax
|
||||
cdq
|
||||
idivl %ecx
|
||||
not %eax
|
||||
neg %eax
|
||||
pop %ecx
|
||||
subl %eax, %ecx
|
||||
movl %ecx, %eax
|
||||
neg %eax
|
||||
pop %ecx
|
||||
addl %ecx, %eax
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user