Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ============================================================================
- ; Code generated by EinCompiler.
- ; Generator: SVMABackEnd
- ; Date: 05/28/2016 02:12:27.
- ; ============================================================================
- ; Variables are not supported yet.
- ; Functions:
- main:
- bpget
- spget
- bpset
- ; void
- push 33
- cpget
- jmp @print_str
- drop ; str
- push 0
- drop
- ; void
- push 33
- cpget
- jmp @print_str_native
- drop ; str
- push 0
- drop
- bpget
- spset
- bpset
- ret
- print_str:
- bpget
- spget
- bpset
- ; int
- get -3 ; local str
- store 8 [r:push] ; global i
- drop
- ; EinCompiler.LoopInstruction
- ; begin while
- __internal__label0:
- push 1 [f:yes]
- [ex(z)=1] jmp @__internal__label1
- ; int
- push 0
- load 8 ; global i
- cpget
- jmp @read_mem
- drop ; ptr
- store 0 [r:push] ; global x
- drop
- ; EinCompiler.ConditionalInstruction
- ; if condition
- load 0 [f:yes] ; global x
- [ex(z)=1] jmp @__internal__label2 ; Jump to false
- jmp @__internal__label3; jump to end
- __internal__label2:
- ; EinCompiler.BreakLoopInstruction
- jmp @__internal__label1; break
- __internal__label3:
- ; void
- load 0 ; global x
- cpget
- jmp @putc
- drop ; ptr
- push 0
- drop
- ; int
- push 1
- load 8 ; global i
- add
- store 8 [r:push] ; global i
- drop
- jmp @__internal__label0 ; end while
- __internal__label1:
- bpget
- spset
- bpset
- ret
- print_str_native:
- bpget
- spget
- bpset
- get -3
- print_str_loop:
- [i0:peek] loadi [f:yes] ; write flags, also load result, don't discard pointer
- [ex(z)=1] jmp @print_str_end_loop ; when *ptr == 0, then goto print_str_end_loop
- [i0:pop] syscall [ci:1] ; removes the loaded character and prints it
- [i0:arg] add 1 ; adds 1 to the stack top
- jmp @print_str_loop
- print_str_end_loop:
- drop ; discard the result from loadi
- drop ; discard our pointer
- bpget ; leave function
- spset ; by restoring parent base pointer
- bpset
- jmpi ; and jumping back.
- read_mem:
- bpget
- spget
- bpset
- get -3 ; Get address
- loadi
- set -4 ; Set return value
- bpget
- spset
- bpset
- jmpi
- putc:
- bpget
- spget
- bpset
- get -3; Get address
- [i0:pop] syscall [ci:1]
- bpget
- spset
- bpset
- jmpi
Advertisement
Add Comment
Please, Sign In to add comment