Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; oefening 4
- (assemble-and-run '(start
- (assign v1 (const 3))
- (assign v2 (const 5))
- (assign cont (label stop))
- (goto (label start-expt-rec))
- start-expt-rec
- (test (op =) (reg v2) (const 0))
- (branch (label return-1))
- (save cont)
- (assign cont (label rec-exp))
- (assign v2 (op -) (reg v2) (const 1))
- (goto (label start-expt-rec))
- rec-exp
- (assign res (op *) (reg v1) (reg res))
- (restore cont)
- (goto (reg cont))
- return-1
- (assign res (const 1))
- (goto (reg cont))
- stop))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement