comparison lab4/test/not.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 (* Boolean negation *)
2
3 var b: boolean;
4
5 begin
6 b := not b;
7 if b then print_string("ok"); newline() end
8 end.
9
10 (*<<
11 ok
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 @ b := not b;
25 set r4, _b
26 ldrb r0, [r4]
27 eor r5, r0, #1
28 strb r5, [r4]
29 @ if b then print_string("ok"); newline() end
30 cmp r5, #0
31 beq .L2
32 mov r1, #2
33 set r0, g1
34 bl print_string
35 bl newline
36 .L2:
37 ldmfd fp, {r4-r10, fp, sp, pc}
38 .ltorg
39
40 .comm _b, 1, 4
41 .data
42 g1:
43 .byte 111, 107
44 .byte 0
45 @ End
46 ]]*)