comparison lab4/test/bitnot.p @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:bfdcc3820b32
1 (* Bitwise NOT function *)
2
3 var x: integer;
4 begin
5 x := 314159265;
6 x := bitnot(x);
7 print_num(x); newline()
8 end.
9
10 (*<<
11 -314159266
12 >>*)
13
14 (*[[
15 @ picoPascal compiler output
16 .include "fixup.s"
17 .global pmain
18
19 .text
20 pmain:
21 mov ip, sp
22 stmfd sp!, {r4-r10, fp, ip, lr}
23 mov fp, sp
24 @ x := 314159265;
25 set r4, #314159265
26 set r5, _x
27 str r4, [r5]
28 @ x := bitnot(x);
29 mvn r4, r4
30 str r4, [r5]
31 @ print_num(x); newline()
32 mov r0, r4
33 bl print_num
34 bl newline
35 ldmfd fp, {r4-r10, fp, sp, pc}
36 .ltorg
37
38 .comm _x, 4, 4
39 @ End
40 ]]*)