annotate lab4/test/rep1.p @ 1:b5139af1a420 tip basis

Fixed permissions on compile scripts
author Mike Spivey <mike@cs.ox.ac.uk>
date Fri, 13 Oct 2017 17:27:58 +0100
parents bfdcc3820b32
children
rev   line source
mike@0 1 var i, j, k: integer;
mike@0 2 begin
mike@0 3 i := 0;
mike@0 4 repeat
mike@0 5 j := 1;
mike@0 6 repeat
mike@0 7 j := j+1; k := k+1;
mike@0 8 until j > i;
mike@0 9 i := i+1
mike@0 10 until i > 10;
mike@0 11 print_num(k); newline()
mike@0 12 end.
mike@0 13
mike@0 14 (*<<
mike@0 15 56
mike@0 16 >>*)
mike@0 17
mike@0 18 (*[[
mike@0 19 @ picoPascal compiler output
mike@0 20 .include "fixup.s"
mike@0 21 .global pmain
mike@0 22
mike@0 23 .text
mike@0 24 pmain:
mike@0 25 mov ip, sp
mike@0 26 stmfd sp!, {r4-r10, fp, ip, lr}
mike@0 27 mov fp, sp
mike@0 28 @ i := 0;
mike@0 29 mov r0, #0
mike@0 30 set r1, _i
mike@0 31 str r0, [r1]
mike@0 32 .L2:
mike@0 33 @ j := 1;
mike@0 34 mov r0, #1
mike@0 35 set r1, _j
mike@0 36 str r0, [r1]
mike@0 37 .L4:
mike@0 38 @ j := j+1; k := k+1;
mike@0 39 set r4, _j
mike@0 40 ldr r0, [r4]
mike@0 41 add r5, r0, #1
mike@0 42 str r5, [r4]
mike@0 43 set r4, _k
mike@0 44 ldr r0, [r4]
mike@0 45 add r6, r0, #1
mike@0 46 str r6, [r4]
mike@0 47 @ until j > i;
mike@0 48 set r4, _i
mike@0 49 ldr r7, [r4]
mike@0 50 cmp r5, r7
mike@0 51 ble .L4
mike@0 52 @ i := i+1
mike@0 53 add r5, r7, #1
mike@0 54 str r5, [r4]
mike@0 55 cmp r5, #10
mike@0 56 ble .L2
mike@0 57 @ print_num(k); newline()
mike@0 58 mov r0, r6
mike@0 59 bl print_num
mike@0 60 bl newline
mike@0 61 ldmfd fp, {r4-r10, fp, sp, pc}
mike@0 62 .ltorg
mike@0 63
mike@0 64 .comm _i, 4, 4
mike@0 65 .comm _j, 4, 4
mike@0 66 .comm _k, 4, 4
mike@0 67 @ End
mike@0 68 ]]*)