Stage 3 complete, (+ - * / binary operators implemented)

This commit is contained in:
2026-01-31 21:32:53 -05:00
parent 1d9ad824a6
commit 409c5938f9
11 changed files with 190 additions and 31 deletions

113
test.s
View File

@@ -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