annotate 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
rev   line source
mike@0 1 (* Boolean negation *)
mike@0 2
mike@0 3 var b: boolean;
mike@0 4
mike@0 5 begin
mike@0 6 b := not b;
mike@0 7 if b then print_string("ok"); newline() end
mike@0 8 end.
mike@0 9
mike@0 10 (*<<
mike@0 11 ok
mike@0 12 >>*)
mike@0 13
mike@0 14 (*[[
mike@0 15 @ picoPascal compiler output
mike@0 16 .include "fixup.s"
mike@0 17 .global pmain
mike@0 18
mike@0 19 .text
mike@0 20 pmain:
mike@0 21 mov ip, sp
mike@0 22 stmfd sp!, {r4-r10, fp, ip, lr}
mike@0 23 mov fp, sp
mike@0 24 @ b := not b;
mike@0 25 set r4, _b
mike@0 26 ldrb r0, [r4]
mike@0 27 eor r5, r0, #1
mike@0 28 strb r5, [r4]
mike@0 29 @ if b then print_string("ok"); newline() end
mike@0 30 cmp r5, #0
mike@0 31 beq .L2
mike@0 32 mov r1, #2
mike@0 33 set r0, g1
mike@0 34 bl print_string
mike@0 35 bl newline
mike@0 36 .L2:
mike@0 37 ldmfd fp, {r4-r10, fp, sp, pc}
mike@0 38 .ltorg
mike@0 39
mike@0 40 .comm _b, 1, 4
mike@0 41 .data
mike@0 42 g1:
mike@0 43 .byte 111, 107
mike@0 44 .byte 0
mike@0 45 @ End
mike@0 46 ]]*)