-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathd.asm
18241 lines (18130 loc) · 842 KB
/
d.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
zig-cache/bin/main: file format elf32-littlearm
Disassembly of section .stack_top:
08000000 <.stack_top>:
8000000: 20004ff8 strdcs r4, [r0], -r8
Disassembly of section .system_exceptions_vector_table:
08000004 <vector_table>:
8000004: 080000d9 stmdaeq r0, {r0, r3, r4, r6, r7}
8000008: 080001a7 stmdaeq r0, {r0, r1, r2, r5, r7, r8}
800000c: 080001a7 stmdaeq r0, {r0, r1, r2, r5, r7, r8}
8000010: 080001a7 stmdaeq r0, {r0, r1, r2, r5, r7, r8}
8000014: 080001a7 stmdaeq r0, {r0, r1, r2, r5, r7, r8}
8000018: 080001a7 stmdaeq r0, {r0, r1, r2, r5, r7, r8}
...
800002c: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000030: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000034: 00000000 andeq r0, r0, r0
8000038: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
800003c: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000040: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000044: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000048: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
800004c: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000050: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000054: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000058: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
800005c: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000060: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000064: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000068: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
800006c: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000070: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000074: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000078: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
800007c: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000080: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000084: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000088: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
800008c: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000090: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000094: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
8000098: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
800009c: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000a0: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000a4: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000a8: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000ac: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000b0: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000b4: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000b8: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000bc: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000c0: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000c4: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000c8: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000cc: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000d0: 080001ab stmdaeq r0, {r0, r1, r3, r5, r7, r8}
80000d4: 080001ad stmdaeq r0, {r0, r2, r3, r5, r7, r8}
Disassembly of section .cpu_instructions:
080000d8 <stm32f103.resetHandler>:
unusedIsr, // 35
unusedIsr, // 36
uart1Isr, // 37
};
fn resetHandler() callconv(.C) noreturn {
80000d8: f240 0e00 movw lr, #0
80000dc: f240 0000 movw r0, #0
80000e0: f2c2 0e00 movt lr, #8192 ; 0x2000
80000e4: f2c2 0000 movt r0, #8192 ; 0x2000
80000e8: eba0 010e sub.w r1, r0, lr
80000ec: f640 0c08 movw ip, #2056 ; 0x808
80000f0: 088a lsrs r2, r1, #2
80000f2: 2300 movs r3, #0
80000f4: f6c0 0c00 movt ip, #2048 ; 0x800
80000f8: 2000 movs r0, #0
const data_end = @ptrCast([*]u32, &__data_end);
const text_end = @ptrCast([*]u32, &__text_end);
const from = text_end;
const to = data_start;
const len = (@ptrToInt(data_end) - @ptrToInt(data_start)) / 4;
for (from[0..len]) |w, i| to[i] = w;
80000fa: bb8a cbnz r2, 8000160 <stm32f103.resetHandler+0x88>
80000fc: f240 0200 movw r2, #0
8000100: f240 0048 movw r0, #72 ; 0x48
8000104: f2c2 0200 movt r2, #8192 ; 0x2000
8000108: f2c2 0000 movt r0, #8192 ; 0x2000
800010c: 1a80 subs r0, r0, r2
800010e: 0881 lsrs r1, r0, #2
8000110: 3208 adds r2, #8
8000112: f04f 0c00 mov.w ip, #0
8000116: 2300 movs r3, #0
{
const data_start = @ptrCast([*]u32, &__bss_start);
const data_end = @ptrCast([*]u32, &__bss_end);
const from = data_start;
const len = (@ptrToInt(data_end) - @ptrToInt(data_start)) / 4;
for (from[0..len]) |*w| w.* = 0;
8000118: b921 cbnz r1, 8000124 <stm32f103.resetHandler+0x4c>
}
// const start = &__bss_start;
// const bss_size = __bss_size;
// const bss = @ptrCast([*]u8, &__bss_start);
// for (bss[0..bss_size]) |*b| b.* = 0;
systemInit();
800011a: f000 f875 bl 8000208 <stm32f103.systemInit>
main();
800011e: f000 f924 bl 800036a <main>
8000122: bf00 nop
for (from[0..len]) |*w| w.* = 0;
8000124: f043 0501 orr.w r5, r3, #1
8000128: ebb5 0f90 cmp.w r5, r0, lsr #2
800012c: f842 cc08 str.w ip, [r2, #-8]
8000130: d0f3 beq.n 800011a <stm32f103.resetHandler+0x42>
8000132: f043 0502 orr.w r5, r3, #2
8000136: ebb5 0f90 cmp.w r5, r0, lsr #2
800013a: f842 cc04 str.w ip, [r2, #-4]
800013e: d0ec beq.n 800011a <stm32f103.resetHandler+0x42>
8000140: f043 0503 orr.w r5, r3, #3
8000144: ebb5 0f90 cmp.w r5, r0, lsr #2
8000148: f8c2 c000 str.w ip, [r2]
800014c: d0e5 beq.n 800011a <stm32f103.resetHandler+0x42>
800014e: f8c2 c004 str.w ip, [r2, #4]
8000152: 3304 adds r3, #4
8000154: 3210 adds r2, #16
8000156: 3904 subs r1, #4
8000158: 2900 cmp r1, #0
800015a: d0de beq.n 800011a <stm32f103.resetHandler+0x42>
800015c: e7e2 b.n 8000124 <stm32f103.resetHandler+0x4c>
800015e: bf00 nop
for (from[0..len]) |w, i| to[i] = w;
8000160: f85c 4003 ldr.w r4, [ip, r3]
8000164: f040 0501 orr.w r5, r0, #1
8000168: ebb5 0f91 cmp.w r5, r1, lsr #2
800016c: f84e 4003 str.w r4, [lr, r3]
8000170: d0c4 beq.n 80000fc <stm32f103.resetHandler+0x24>
8000172: eb0c 0403 add.w r4, ip, r3
8000176: 6866 ldr r6, [r4, #4]
8000178: f040 0702 orr.w r7, r0, #2
800017c: eb0e 0503 add.w r5, lr, r3
8000180: ebb7 0f91 cmp.w r7, r1, lsr #2
8000184: 606e str r6, [r5, #4]
8000186: d0b9 beq.n 80000fc <stm32f103.resetHandler+0x24>
8000188: 68a6 ldr r6, [r4, #8]
800018a: f040 0703 orr.w r7, r0, #3
800018e: ebb7 0f91 cmp.w r7, r1, lsr #2
8000192: 60ae str r6, [r5, #8]
8000194: d0b2 beq.n 80000fc <stm32f103.resetHandler+0x24>
8000196: 68e4 ldr r4, [r4, #12]
8000198: 3004 adds r0, #4
800019a: 60ec str r4, [r5, #12]
800019c: 3310 adds r3, #16
800019e: 3a04 subs r2, #4
80001a0: 2a00 cmp r2, #0
80001a2: d1dd bne.n 8000160 <stm32f103.resetHandler+0x88>
80001a4: e7aa b.n 80000fc <stm32f103.resetHandler+0x24>
080001a6 <stm32f103.busFaultHandler>:
fn memManageHandler() callconv(.C) noreturn {
showException();
}
fn busFaultHandler() callconv(.C) noreturn {
showException();
80001a6: f000 f8e3 bl 8000370 <stm32f103.showException>
080001aa <stm32f103.debugMonHandler>:
showException();
}
fn svcHandler() callconv(.C) void {}
fn debugMonHandler() callconv(.C) void {}
80001aa: 4770 bx lr
080001ac <uart1Isr>:
gpio.toggle(ledGreen);
uart1.print("z = {}\n", .{z});
}
}
pub fn uart1Isr() callconv(.C) void {
80001ac: f643 000c movw r0, #14348 ; 0x380c
80001b0: f2c4 0001 movt r0, #16385 ; 0x4001
while ((baseAdr.SR & 128) == 0) {}
baseAdr.DR = c;
}
pub fn Isr(self: *Self) void {
if ((baseAdr.SR & 128) == 128) {
80001b4: f850 1c0c ldr.w r1, [r0, #-12]
80001b8: 0609 lsls r1, r1, #24
80001ba: bf58 it pl
80001bc: 4770 bxpl lr
self.writeIdx = nextWriteIdx;
return true;
}
pub fn read(self: *Self) ?T {
if (self.writeIdx == self.readIdx)
80001be: f240 0100 movw r1, #0
80001c2: f2c2 0100 movt r1, #8192 ; 0x2000
80001c6: e9d1 2310 ldrd r2, r3, [r1, #64] ; 0x40
80001ca: 429a cmp r2, r3
80001cc: d110 bne.n 80001f0 <uart1Isr+0x44>
return null;
80001ce: f640 0104 movw r1, #2052 ; 0x804
80001d2: f6c0 0100 movt r1, #2048 ; 0x800
80001d6: 8809 ldrh r1, [r1, #0]
if (self.tx_buffer.read()) |c|
80001d8: 05ca lsls r2, r1, #23
80001da: bf42 ittt mi
80001dc: fa5f fc81 uxtbmi.w ip, r1
baseAdr.DR = c
80001e0: f840 cc08 strmi.w ip, [r0, #-8]
80001e4: 4770 bxmi lr
else
baseAdr.CR1 &= ~@as(u32, (1 << 7));
80001e6: 6801 ldr r1, [r0, #0]
80001e8: f021 0180 bic.w r1, r1, #128 ; 0x80
80001ec: 6001 str r1, [r0, #0]
80001ee: 4770 bx lr
const result = self.buffer[self.readIdx];
80001f0: 18ca adds r2, r1, r3
80001f2: f892 c020 ldrb.w ip, [r2, #32]
self.readIdx = if (self.readIdx == size) 0 else self.readIdx + 1;
80001f6: f1b3 021e subs.w r2, r3, #30
80001fa: bf18 it ne
80001fc: 1c5a addne r2, r3, #1
80001fe: 644a str r2, [r1, #68] ; 0x44
baseAdr.DR = c
8000200: f840 cc08 str.w ip, [r0, #-8]
8000204: 4770 bx lr
8000206: d4d4 bmi.n 80001b2 <uart1Isr+0x6>
08000208 <stm32f103.systemInit>:
fn systemInit() void {
8000208: f241 0004 movw r0, #4100 ; 0x1004
800020c: f2c4 0002 movt r0, #16386 ; 0x4002
RCC.CR |= @as(u32, 0x00000001);
8000210: f850 1c04 ldr.w r1, [r0, #-4]
8000214: 220c movs r2, #12
8000216: f041 0101 orr.w r1, r1, #1
800021a: f840 1c04 str.w r1, [r0, #-4]
RCC.CFGR &= ~@as(u32, 0b0000_0111_0000_0000_1111_1111_1111_0011);
800021e: 6801 ldr r1, [r0, #0]
8000220: f6cf 02ff movt r2, #63743 ; 0xf8ff
8000224: 4011 ands r1, r2
8000226: 6001 str r1, [r0, #0]
RCC.CR &= @as(u32, 0xFEF6FFFF);
8000228: f850 1c04 ldr.w r1, [r0, #-4]
800022c: f64f 72ff movw r2, #65535 ; 0xffff
8000230: f6cf 62f6 movt r2, #65270 ; 0xfef6
8000234: 4011 ands r1, r2
8000236: f840 1c04 str.w r1, [r0, #-4]
RCC.CR &= ~@as(u32, 0xFFFBFFFF);
800023a: f850 1c04 ldr.w r1, [r0, #-4]
800023e: f240 42fc movw r2, #1276 ; 0x4fc
8000242: f401 2180 and.w r1, r1, #262144 ; 0x40000
8000246: f840 1c04 str.w r1, [r0, #-4]
RCC.CFGR &= ~@as(u32, 0b0000_0000_0111_1111_0000_0000_0000_0000);
800024a: 6801 ldr r1, [r0, #0]
800024c: f421 01fe bic.w r1, r1, #8323072 ; 0x7f0000
8000250: 6001 str r1, [r0, #0]
8000252: f44f 011f mov.w r1, #10420224 ; 0x9f0000
RCC.CIR = 0x009F0000;
8000256: 6041 str r1, [r0, #4]
RCC.CR |= @as(u32, RCC_CR_HSEON);
8000258: f850 1c04 ldr.w r1, [r0, #-4]
800025c: f441 3180 orr.w r1, r1, #65536 ; 0x10000
8000260: f840 1c04 str.w r1, [r0, #-4]
HSEStatus = RCC.CR & RCC_CR_HSERDY;
8000264: f850 1c04 ldr.w r1, [r0, #-4]
8000268: f401 3100 and.w r1, r1, #131072 ; 0x20000
800026c: f850 3c04 ldr.w r3, [r0, #-4]
while ((HSEStatus == 0) and (StartUpCounter != HSE_STARTUP_TIMEOUT)) {
8000270: 2900 cmp r1, #0
8000272: f403 3100 and.w r1, r3, #131072 ; 0x20000
8000276: d114 bne.n 80002a2 <stm32f103.systemInit+0x9a>
8000278: f850 3c04 ldr.w r3, [r0, #-4]
800027c: 2900 cmp r1, #0
800027e: f403 3100 and.w r1, r3, #131072 ; 0x20000
8000282: d10e bne.n 80002a2 <stm32f103.systemInit+0x9a>
8000284: f850 3c04 ldr.w r3, [r0, #-4]
8000288: 2900 cmp r1, #0
800028a: f403 3300 and.w r3, r3, #131072 ; 0x20000
800028e: d167 bne.n 8000360 <stm32f103.systemInit+0x158>
8000290: f850 1c04 ldr.w r1, [r0, #-4]
8000294: f401 3100 and.w r1, r1, #131072 ; 0x20000
8000298: b11a cbz r2, 80002a2 <stm32f103.systemInit+0x9a>
800029a: 2b00 cmp r3, #0
800029c: f1a2 0204 sub.w r2, r2, #4
80002a0: d0e4 beq.n 800026c <stm32f103.systemInit+0x64>
if (HSEStatus == 0x01) {
80002a2: 2900 cmp r1, #0
80002a4: d060 beq.n 8000368 <stm32f103.systemInit+0x160>
80002a6: f242 0100 movw r1, #8192 ; 0x2000
80002aa: f2c4 0102 movt r1, #16386 ; 0x4002
FLASH.ACR |= FLASH_ACR_PRFTBE;
80002ae: 680a ldr r2, [r1, #0]
80002b0: f042 0210 orr.w r2, r2, #16
80002b4: 600a str r2, [r1, #0]
FLASH.ACR &= @as(u32, ~FLASH_ACR_LATENCY);
80002b6: 680a ldr r2, [r1, #0]
80002b8: f002 02fc and.w r2, r2, #252 ; 0xfc
80002bc: 600a str r2, [r1, #0]
FLASH.ACR |= @as(u32, FLASH_ACR_LATENCY_2);
80002be: 680a ldr r2, [r1, #0]
80002c0: f042 0202 orr.w r2, r2, #2
80002c4: 600a str r2, [r1, #0]
RCC.CFGR |= @as(u32, RCC_CFGR_HPRE_DIV1);
80002c6: 6801 ldr r1, [r0, #0]
80002c8: 6001 str r1, [r0, #0]
RCC.CFGR |= @as(u32, RCC_CFGR_PPRE2_DIV1);
80002ca: 6801 ldr r1, [r0, #0]
80002cc: 6001 str r1, [r0, #0]
RCC.CFGR |= @as(u32, RCC_CFGR_PPRE1_DIV2);
80002ce: 6801 ldr r1, [r0, #0]
80002d0: f441 6180 orr.w r1, r1, #1024 ; 0x400
80002d4: 6001 str r1, [r0, #0]
RCC.CFGR &= (~@as(u32, RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL));
80002d6: 6801 ldr r1, [r0, #0]
80002d8: f421 117c bic.w r1, r1, #4128768 ; 0x3f0000
80002dc: 6001 str r1, [r0, #0]
RCC.CFGR |= @as(u32, RCC_CFGR_PLLSRC_HSE | RCC_CFGR_PLLMULL9);
80002de: 6801 ldr r1, [r0, #0]
80002e0: f441 11e8 orr.w r1, r1, #1900544 ; 0x1d0000
80002e4: 6001 str r1, [r0, #0]
RCC.CR |= RCC_CR_PLLON;
80002e6: f850 1c04 ldr.w r1, [r0, #-4]
80002ea: f041 7180 orr.w r1, r1, #16777216 ; 0x1000000
80002ee: f840 1c04 str.w r1, [r0, #-4]
80002f2: bf00 nop
while ((RCC.CR & RCC_CR_PLLRDY) == 0) {}
80002f4: f850 1c04 ldr.w r1, [r0, #-4]
80002f8: 0189 lsls r1, r1, #6
80002fa: bf5c itt pl
80002fc: f850 1c04 ldrpl.w r1, [r0, #-4]
8000300: ea5f 1181 movspl.w r1, r1, lsl #6
8000304: d407 bmi.n 8000316 <stm32f103.systemInit+0x10e>
8000306: f850 1c04 ldr.w r1, [r0, #-4]
800030a: 0189 lsls r1, r1, #6
800030c: d403 bmi.n 8000316 <stm32f103.systemInit+0x10e>
800030e: f850 1c04 ldr.w r1, [r0, #-4]
8000312: 0189 lsls r1, r1, #6
8000314: d5ee bpl.n 80002f4 <stm32f103.systemInit+0xec>
RCC.CFGR &= (~@as(u32, RCC_CFGR_SW));
8000316: 6801 ldr r1, [r0, #0]
8000318: f021 0103 bic.w r1, r1, #3
800031c: 6001 str r1, [r0, #0]
RCC.CFGR |= @as(u32, RCC_CFGR_SW_PLL);
800031e: 6801 ldr r1, [r0, #0]
8000320: f041 0102 orr.w r1, r1, #2
8000324: 6001 str r1, [r0, #0]
8000326: bf00 nop
while ((RCC.CFGR & @as(u32, RCC_CFGR_SWS)) != @as(u32, 0x08)) {}
8000328: 6801 ldr r1, [r0, #0]
800032a: f001 010c and.w r1, r1, #12
800032e: 2908 cmp r1, #8
8000330: d00e beq.n 8000350 <stm32f103.systemInit+0x148>
8000332: 6801 ldr r1, [r0, #0]
8000334: f001 010c and.w r1, r1, #12
8000338: 2908 cmp r1, #8
800033a: d009 beq.n 8000350 <stm32f103.systemInit+0x148>
800033c: 6801 ldr r1, [r0, #0]
800033e: f001 010c and.w r1, r1, #12
8000342: 2908 cmp r1, #8
8000344: d004 beq.n 8000350 <stm32f103.systemInit+0x148>
8000346: 6801 ldr r1, [r0, #0]
8000348: f001 010c and.w r1, r1, #12
800034c: 2908 cmp r1, #8
800034e: d1eb bne.n 8000328 <stm32f103.systemInit+0x120>
8000350: f64e 5008 movw r0, #60680 ; 0xed08
8000354: f2ce 0000 movt r0, #57344 ; 0xe000
8000358: f04f 6100 mov.w r1, #134217728 ; 0x8000000
SCB.VTOR = FLASH_BASE | VECT_TAB_OFFSET; //* Vector Table Relocation in Internal FLASH. */
800035c: 6001 str r1, [r0, #0]
fn systemInit() void {
800035e: 4770 bx lr
8000360: 4619 mov r1, r3
if (HSEStatus == 0x01) {
8000362: 2900 cmp r1, #0
8000364: d19f bne.n 80002a6 <stm32f103.systemInit+0x9e>
8000366: bf00 nop
while (true) {}
8000368: e7fe b.n 8000368 <stm32f103.systemInit+0x160>
0800036a <main>:
start() catch |err| {
800036a: f000 f823 bl 80003b4 <start>
800036e: d4d4 bmi.n 800031a <stm32f103.systemInit+0x112>
08000370 <stm32f103.showException>:
fn pendSVHandler() callconv(.C) void {}
fn unusedIsr() callconv(.C) void {}
fn showException() noreturn {
8000370: f241 0004 movw r0, #4100 ; 0x1004
8000374: f2c4 0001 movt r0, #16385 ; 0x4001
.MHz10 => 0b0001,
.MHz2 => 0b0010,
.MHz50 => 0b0011,
};
const bitNr = (@as(u5, (pin.nr % 8)) * 4);
var reg: u32 = pin.gpio.CR[pin.nr / 8];
8000378: 6802 ldr r2, [r0, #0]
800037a: 2301 movs r3, #1
800037c: f242 41f8 movw r1, #9464 ; 0x24f8
reg &= ~@as(u32, 0b1111 << bitNr);
reg |= (cnf | mode) << bitNr;
8000380: f363 5217 bfi r2, r3, #20, #4
8000384: f2c0 0101 movt r1, #1
pin.gpio.CR[pin.nr / 8] = reg;
8000388: 6002 str r2, [r0, #0]
800038a: f44f 5200 mov.w r2, #8192 ; 0x2000
800038e: bf00 nop
8000390: 460b mov r3, r1
}
pub fn set(comptime pin: Pin, level: bool) void {
if (level) {
pin.gpio.BSRR = 1 << pin.nr;
8000392: 60c2 str r2, [r0, #12]
gpio.set(ledGreen, false);
}
pub fn sleep(ySec: u32) void {
var i: u32 = 0;
while (i < ySec) {
8000394: b123 cbz r3, 80003a0 <stm32f103.showException+0x30>
8000396: bf00 nop
asm volatile ("nop");
8000398: bf00 nop
while (i < ySec) {
800039a: 3b01 subs r3, #1
800039c: 2b00 cmp r3, #0
800039e: d1fb bne.n 8000398 <stm32f103.showException+0x28>
80003a0: 460b mov r3, r1
} else {
pin.gpio.BRR = 1 << pin.nr;
80003a2: 6102 str r2, [r0, #16]
80003a4: 2b00 cmp r3, #0
80003a6: d0f3 beq.n 8000390 <stm32f103.showException+0x20>
asm volatile ("nop");
80003a8: bf00 nop
while (i < ySec) {
80003aa: 3b01 subs r3, #1
80003ac: 2b00 cmp r3, #0
80003ae: d1fb bne.n 80003a8 <stm32f103.showException+0x38>
80003b0: e7ee b.n 8000390 <stm32f103.showException+0x20>
80003b2: d4d4 bmi.n 800035e <stm32f103.systemInit+0x156>
080003b4 <start>:
fn start() !void {
80003b4: b08e sub sp, #56 ; 0x38
80003b6: f241 0018 movw r0, #4120 ; 0x1018
80003ba: f2c4 0002 movt r0, #16386 ; 0x4002
RCC.APB2ENR |= switch (gpio) {
80003be: 6801 ldr r1, [r0, #0]
80003c0: 2301 movs r3, #1
80003c2: f041 0110 orr.w r1, r1, #16
80003c6: 6001 str r1, [r0, #0]
80003c8: f640 0104 movw r1, #2052 ; 0x804
80003cc: f2c4 0101 movt r1, #16385 ; 0x4001
var reg: u32 = pin.gpio.CR[pin.nr / 8];
80003d0: f8d1 2800 ldr.w r2, [r1, #2048] ; 0x800
80003d4: f643 070c movw r7, #14348 ; 0x380c
reg |= (cnf | mode) << bitNr;
80003d8: f363 5217 bfi r2, r3, #20, #4
pin.gpio.CR[pin.nr / 8] = reg;
80003dc: f8c1 2800 str.w r2, [r1, #2048] ; 0x800
RCC.APB2ENR |= switch (gpio) {
80003e0: 6802 ldr r2, [r0, #0]
80003e2: f2c4 0701 movt r7, #16385 ; 0x4001
80003e6: f042 0204 orr.w r2, r2, #4
80003ea: 6002 str r2, [r0, #0]
var reg = pin.gpio.CR[pin.nr / 8];
80003ec: 6808 ldr r0, [r1, #0]
80003ee: 2208 movs r2, #8
reg |= (cnf | mode) << bitNr;
80003f0: f362 200b bfi r0, r2, #8, #4
pin.gpio.CR[pin.nr / 8] = reg;
80003f4: 6008 str r0, [r1, #0]
80003f6: f44f 6080 mov.w r0, #1024 ; 0x400
pin.gpio.BRR = 1 << pin.nr;
80003fa: 6108 str r0, [r1, #16]
var reg: u32 = pin.gpio.CR[pin.nr / 8];
80003fc: 6808 ldr r0, [r1, #0]
80003fe: 2209 movs r2, #9
reg |= (cnf | mode) << bitNr;
8000400: f362 1007 bfi r0, r2, #4, #4
pin.gpio.CR[pin.nr / 8] = reg;
8000404: 6008 str r0, [r1, #0]
8000406: f240 2071 movw r0, #625 ; 0x271
baseAdr.BRR = (UartClkFreq) / baudrate;
800040a: f847 0c04 str.w r0, [r7, #-4]
800040e: f04f 0900 mov.w r9, #0
8000412: f242 0088 movw r0, #8328 ; 0x2088
baseAdr.CR2 = cr2;
8000416: f8c7 9004 str.w r9, [r7, #4]
baseAdr.CR1 = cr1;
800041a: 6038 str r0, [r7, #0]
800041c: f24e 4025 movw r0, #58405 ; 0xe425
8000420: f2ce 0000 movt r0, #57344 ; 0xe000
NVIC.IPR[UartVecNr] = UartPrio;
8000424: f880 9000 strb.w r9, [r0]
8000428: f24e 0010 movw r0, #57360 ; 0xe010
800042c: f2ce 0000 movt r0, #57344 ; 0xe000
8000430: 2120 movs r1, #32
NVIC.ISER[UartVecNr / 32] = 1 << (UartVecNr % 32);
8000432: f8c0 10f4 str.w r1, [r0, #244] ; 0xf4
8000436: f64e 5123 movw r1, #60707 ; 0xed23
800043a: f2ce 0100 movt r1, #57344 ; 0xe000
800043e: 22ff movs r2, #255 ; 0xff
SCB.SHPR[11] = SystickPio;
8000440: 700a strb r2, [r1, #0]
8000442: f242 3127 movw r1, #8999 ; 0x2327
STK.LOAD = 9000 - 1;
8000446: 6041 str r1, [r0, #4]
8000448: 2103 movs r1, #3
800044a: f10d 0b18 add.w fp, sp, #24
800044e: f241 0a0c movw sl, #4108 ; 0x100c
STK.CTRL = 3; // TICK_INT & ENABLE
8000452: 6001 str r1, [r0, #0]
while (true) {
8000454: f10b 0022 add.w r0, fp, #34 ; 0x22
8000458: f244 2640 movw r6, #16960 ; 0x4240
800045c: f240 0800 movw r8, #0
8000460: f240 74e6 movw r4, #2022 ; 0x7e6
8000464: f241 7559 movw r5, #5977 ; 0x1759
8000468: f2c4 0a01 movt sl, #16385 ; 0x4001
800046c: 9000 str r0, [sp, #0]
800046e: f2c0 060f movt r6, #15
8000472: f06f 0c01 mvn.w ip, #1
8000476: f2c2 0800 movt r8, #8192 ; 0x2000
800047a: f6c0 0400 movt r4, #2048 ; 0x800
800047e: f2cd 15b7 movt r5, #53687 ; 0xd1b7
8000482: f242 7710 movw r7, #10000 ; 0x2710
8000486: 2000 movs r0, #0
8000488: 9005 str r0, [sp, #20]
800048a: 4630 mov r0, r6
800048c: b980 cbnz r0, 80004b0 <start+0xfc>
800048e: e013 b.n 80004b8 <start+0x104>
8000490: f244 2640 movw r6, #16960 ; 0x4240
8000494: f240 74e6 movw r4, #2022 ; 0x7e6
pub fn sliceAsBytes(slice: anytype) SliceAsBytesReturnType(@TypeOf(slice)) {
const Slice = @TypeOf(slice);
// let's not give an undefined pointer to @ptrCast
// it may be equal to zero and fail a null check
if (slice.len == 0 and comptime meta.sentinel(Slice) == null) {
8000498: f1bc 0f00 cmp.w ip, #0
800049c: f04f 0900 mov.w r9, #0
80004a0: f2c0 060f movt r6, #15
80004a4: f06f 0c01 mvn.w ip, #1
80004a8: f6c0 0400 movt r4, #2048 ; 0x800
80004ac: 4630 mov r0, r6
while (i < ySec) {
80004ae: b118 cbz r0, 80004b8 <start+0x104>
asm volatile ("nop");
80004b0: bf00 nop
while (i < ySec) {
80004b2: 3801 subs r0, #1
80004b4: 2800 cmp r0, #0
80004b6: d1fb bne.n 80004b0 <start+0xfc>
}
}
pub fn toggle(comptime pin: Pin) void {
pin.gpio.ODR ^= 1 << pin.nr;
80004b8: f8da 0000 ldr.w r0, [sl]
80004bc: 9905 ldr r1, [sp, #20]
80004be: f480 5000 eor.w r0, r0, #8192 ; 0x2000
z += 1;
80004c2: 3101 adds r1, #1
80004c4: f8ca 0000 str.w r0, [sl]
80004c8: 2021 movs r0, #33 ; 0x21
80004ca: 9105 str r1, [sp, #20]
while (true) {
const digit = a % base;
index -= 1;
buf[index] = digitToChar(@intCast(u8, digit), uppercase);
a /= base;
if (a == 0) break;
80004cc: 290a cmp r1, #10
80004ce: d30d bcc.n 80004ec <start+0x138>
80004d0: 2964 cmp r1, #100 ; 0x64
80004d2: d30d bcc.n 80004f0 <start+0x13c>
80004d4: f5b1 7f7a cmp.w r1, #1000 ; 0x3e8
80004d8: d30c bcc.n 80004f4 <start+0x140>
a /= base;
80004da: fba1 2305 umull r2, r3, r1, r5
if (a == 0) break;
80004de: 42b9 cmp r1, r7
a /= base;
80004e0: ea4f 3153 mov.w r1, r3, lsr #13
if (a == 0) break;
80004e4: f1a0 0004 sub.w r0, r0, #4
80004e8: d2f0 bcs.n 80004cc <start+0x118>
80004ea: e004 b.n 80004f6 <start+0x142>
if (leftover_padding == 0) break;
}
mem.set(u8, buf[0..index], options.fill);
return writer.writeAll(&buf);
} else {
const padded_buf = buf[index - padding ..];
80004ec: 3801 subs r0, #1
80004ee: e002 b.n 80004f6 <start+0x142>
80004f0: 3802 subs r0, #2
80004f2: e000 b.n 80004f6 <start+0x142>
80004f4: 3803 subs r0, #3
80004f6: f1c0 0021 rsb r0, r0, #33 ; 0x21
return writeFn(self.context, bytes);
}
pub fn writeAll(self: Self, bytes: []const u8) Error!void {
var index: usize = 0;
while (index != bytes.len) {
80004fa: f110 0e04 adds.w lr, r0, #4
80004fe: f149 0100 adc.w r1, r9, #0
8000502: 2800 cmp r0, #0
8000504: bf04 itt eq
8000506: 4601 moveq r1, r0
8000508: f04f 0e04 moveq.w lr, #4
/// Cast an integer to a different integer type. If the value doesn't fit,
/// return an error.
pub fn cast(comptime T: type, x: anytype) (error{Overflow}!T) {
comptime assert(@typeInfo(T) == .Int); // must pass an integer
comptime assert(@typeInfo(@TypeOf(x)) == .Int); // must pass an integer
if (maxInt(@TypeOf(x)) > maxInt(T) and x > maxInt(T)) {
800050c: ebbc 000e subs.w r0, ip, lr
8000510: eb79 0001 sbcs.w r0, r9, r1
8000514: d302 bcc.n 800051c <start+0x168>
fn alloc(allocator: *Allocator, n: usize, ptr_align: u29, len_align: u29) ![]u8 {
const self = @fieldParentPtr(FixedBufferAllocator, "allocator", allocator);
const aligned_addr = mem.alignForward(@ptrToInt(self.buffer.ptr) + self.end_index, ptr_align);
const adjusted_index = aligned_addr - @ptrToInt(self.buffer.ptr);
const new_end_index = adjusted_index + n;
if (new_end_index > self.buffer.len) {
8000516: f1be 0f1d cmp.w lr, #29
800051a: d92d bls.n 8000578 <start+0x1c4>
800051c: f8d8 0040 ldr.w r0, [r8, #64] ; 0x40
8000520: f241 7559 movw r5, #5977 ; 0x1759
8000524: 2100 movs r1, #0
8000526: f2cd 15b7 movt r5, #53687 ; 0xd1b7
800052a: f242 7710 movw r7, #10000 ; 0x2710
for (txt) |c| {
800052e: 2914 cmp r1, #20
8000530: d012 beq.n 8000558 <start+0x1a4>
8000532: bf00 nop
if (nextWriteIdx == self.readIdx)
8000534: f8d8 3044 ldr.w r3, [r8, #68] ; 0x44
const nextWriteIdx = if (self.writeIdx == size) 0 else self.writeIdx + 1;
8000538: f1b0 021e subs.w r2, r0, #30
800053c: bf18 it ne
800053e: 1c42 addne r2, r0, #1
if (nextWriteIdx == self.readIdx)
8000540: 429a cmp r2, r3
8000542: d00b beq.n 800055c <start+0x1a8>
8000544: 5c63 ldrb r3, [r4, r1]
self.buffer[self.writeIdx] = elem;
8000546: 4440 add r0, r8
8000548: f880 3020 strb.w r3, [r0, #32]
self.writeIdx = nextWriteIdx;
800054c: f8c8 2040 str.w r2, [r8, #64] ; 0x40
8000550: 3101 adds r1, #1
8000552: 4610 mov r0, r2
8000554: 2914 cmp r1, #20
8000556: d1ed bne.n 8000534 <start+0x180>
pub fn free(self: Self) u32 {
return size - count(self);
}
pub fn empty(self: Self) bool {
return self.writeIdx == self.readIdx;
8000558: f8d8 2044 ldr.w r2, [r8, #68] ; 0x44
if (!self.tx_buffer.empty())
800055c: 4290 cmp r0, r2
800055e: d0a5 beq.n 80004ac <start+0xf8>
8000560: f643 010c movw r1, #14348 ; 0x380c
8000564: f2c4 0101 movt r1, #16385 ; 0x4001
baseAdr.CR1 |= 1 << 7; // ISR an
8000568: 6808 ldr r0, [r1, #0]
800056a: f040 0080 orr.w r0, r0, #128 ; 0x80
800056e: 6008 str r0, [r1, #0]
8000570: 4630 mov r0, r6
while (i < ySec) {
8000572: 2800 cmp r0, #0
8000574: d19c bne.n 80004b0 <start+0xfc>
8000576: e79f b.n 80004b8 <start+0x104>
8000578: f10e 0901 add.w r9, lr, #1
800057c: f04f 0c00 mov.w ip, #0
8000580: 2300 movs r3, #0
8000582: 2b04 cmp r3, #4
8000584: d104 bne.n 8000590 <start+0x1dc>
8000586: e03a b.n 80005fe <start+0x24a>
8000588: 2200 movs r2, #0
index += try self.write(bytes[index..]);
800058a: 4413 add r3, r2
while (index != bytes.len) {
800058c: 2b04 cmp r3, #4
800058e: d036 beq.n 80005fe <start+0x24a>
index += try self.write(bytes[index..]);
8000590: f1d3 0204 rsbs r2, r3, #4
/// If the returned number of bytes written is less than requested, the
/// buffer is full. Returns `error.NoSpaceLeft` when no bytes would be written.
/// Note: `error.NoSpaceLeft` matches the corresponding error from
/// `std.fs.File.WriteError`.
pub fn write(self: *Self, bytes: []const u8) WriteError!usize {
if (bytes.len == 0) return 0;
8000594: d0f8 beq.n 8000588 <start+0x1d4>
if (self.pos >= self.buffer.len) return error.NoSpaceLeft;
8000596: 45f4 cmp ip, lr
8000598: f200 80f9 bhi.w 800078e <start+0x3da>
const n = if (self.pos + bytes.len <= self.buffer.len)
800059c: eb02 000c add.w r0, r2, ip
80005a0: 4548 cmp r0, r9
for (source) |s, i|
80005a2: f240 70fb movw r0, #2043 ; 0x7fb
80005a6: f6c0 0000 movt r0, #2048 ; 0x800
80005aa: 4418 add r0, r3
80005ac: eb08 010c add.w r1, r8, ip
80005b0: f04f 0400 mov.w r4, #0
80005b4: bf88 it hi
80005b6: eba9 020c subhi.w r2, r9, ip
80005ba: 42a2 cmp r2, r4
80005bc: d016 beq.n 80005ec <start+0x238>
80005be: bf00 nop
80005c0: 5d06 ldrb r6, [r0, r4]
80005c2: 1c67 adds r7, r4, #1
80005c4: 4297 cmp r7, r2
dest[i] = s;
80005c6: 550e strb r6, [r1, r4]
for (source) |s, i|
80005c8: d010 beq.n 80005ec <start+0x238>
80005ca: 1906 adds r6, r0, r4
80005cc: 7875 ldrb r5, [r6, #1]
80005ce: 3701 adds r7, #1
dest[i] = s;
80005d0: 440c add r4, r1
for (source) |s, i|
80005d2: 4297 cmp r7, r2
dest[i] = s;
80005d4: 7065 strb r5, [r4, #1]
for (source) |s, i|
80005d6: d009 beq.n 80005ec <start+0x238>
80005d8: 78b5 ldrb r5, [r6, #2]
80005da: 3701 adds r7, #1
80005dc: 4297 cmp r7, r2
dest[i] = s;
80005de: 70a5 strb r5, [r4, #2]
for (source) |s, i|
80005e0: d004 beq.n 80005ec <start+0x238>
80005e2: 78f5 ldrb r5, [r6, #3]
dest[i] = s;
80005e4: 70e5 strb r5, [r4, #3]
80005e6: 1c7c adds r4, r7, #1
for (source) |s, i|
80005e8: 42a2 cmp r2, r4
80005ea: d1e9 bne.n 80005c0 <start+0x20c>
self.buffer.len - self.pos;
mem.copy(u8, self.buffer[self.pos .. self.pos + n], bytes[0..n]);
self.pos += n;
if (n == 0) return error.NoSpaceLeft;
80005ec: 2a00 cmp r2, #0
80005ee: f10d 0b18 add.w fp, sp, #24
80005f2: f000 80cc beq.w 800078e <start+0x3da>
80005f6: 4494 add ip, r2
80005f8: 4413 add r3, r2
while (index != bytes.len) {
80005fa: 2b04 cmp r3, #4
80005fc: d1c8 bne.n 8000590 <start+0x1dc>
80005fe: 9a00 ldr r2, [sp, #0]
8000600: 9805 ldr r0, [sp, #20]
8000602: f64c 45cd movw r5, #52429 ; 0xcccd
8000606: f04f 0a00 mov.w sl, #0
800060a: f6cc 45cc movt r5, #52428 ; 0xcccc
800060e: f8cd 9010 str.w r9, [sp, #16]
8000612: bf00 nop
a /= base;
8000614: fba0 1305 umull r1, r3, r0, r5
8000618: 08db lsrs r3, r3, #3
800061a: 4691 mov r9, r2
800061c: eb03 0283 add.w r2, r3, r3, lsl #2
8000620: eba0 0242 sub.w r2, r0, r2, lsl #1
buf[index] = digitToChar(@intCast(u8, digit), uppercase);
8000624: b2d6 uxtb r6, r2
return value;
}
pub fn digitToChar(digit: u8, uppercase: bool) u8 {
return switch (digit) {
0...9 => digit + '0',
8000626: f102 0757 add.w r7, r2, #87 ; 0x57
800062a: 2e0a cmp r6, #10
800062c: 4651 mov r1, sl
buf[index] = digitToChar(@intCast(u8, digit), uppercase);
800062e: eb0b 040a add.w r4, fp, sl
0...9 => digit + '0',
8000632: bf38 it cc
8000634: f042 0730 orrcc.w r7, r2, #48 ; 0x30
if (a == 0) break;
8000638: f1aa 0a01 sub.w sl, sl, #1
800063c: f1a9 0201 sub.w r2, r9, #1
8000640: 2809 cmp r0, #9
8000642: 4618 mov r0, r3
buf[index] = digitToChar(@intCast(u8, digit), uppercase);
8000644: 77e7 strb r7, [r4, #31]
if (a == 0) break;
8000646: d8e5 bhi.n 8000614 <start+0x260>
8000648: f1ca 0000 rsb r0, sl, #0
800064c: 9003 str r0, [sp, #12]
800064e: f1c1 0001 rsb r0, r1, #1
8000652: 9002 str r0, [sp, #8]
8000654: f10e 0001 add.w r0, lr, #1
8000658: 2700 movs r7, #0
800065a: 9001 str r0, [sp, #4]
800065c: eb1a 0f07 cmn.w sl, r7
8000660: d105 bne.n 800066e <start+0x2ba>
8000662: e04c b.n 80006fe <start+0x34a>
8000664: 2200 movs r2, #0
index += try self.write(bytes[index..]);
8000666: 4417 add r7, r2
while (index != bytes.len) {
8000668: eb1a 0f07 cmn.w sl, r7
800066c: d047 beq.n 80006fe <start+0x34a>
if (bytes.len == 0) return 0;
800066e: eb1a 0f07 cmn.w sl, r7
8000672: d0f7 beq.n 8000664 <start+0x2b0>
if (self.pos >= self.buffer.len) return error.NoSpaceLeft;
8000674: 45f4 cmp ip, lr
8000676: f200 8086 bhi.w 8000786 <start+0x3d2>
800067a: 9903 ldr r1, [sp, #12]
const n = if (self.pos + bytes.len <= self.buffer.len)
800067c: ebac 0007 sub.w r0, ip, r7
8000680: 1bca subs r2, r1, r7
8000682: 4408 add r0, r1
8000684: 9904 ldr r1, [sp, #16]
8000686: eb09 0407 add.w r4, r9, r7
800068a: 4288 cmp r0, r1
800068c: bf88 it hi
800068e: eba1 020c subhi.w r2, r1, ip
8000692: 9802 ldr r0, [sp, #8]
8000694: 9901 ldr r1, [sp, #4]
8000696: 4460 add r0, ip
8000698: 1bc0 subs r0, r0, r7
800069a: 4288 cmp r0, r1
800069c: bf28 it cs
800069e: 4608 movcs r0, r1
80006a0: eb08 010c add.w r1, r8, ip
80006a4: eba0 000c sub.w r0, r0, ip
80006a8: 3101 adds r1, #1
80006aa: 2600 movs r6, #0
80006ac: b1f0 cbz r0, 80006ec <start+0x338>
80006ae: bf00 nop
80006b0: f814 bc03 ldrb.w fp, [r4, #-3]
80006b4: f046 0301 orr.w r3, r6, #1
80006b8: 4293 cmp r3, r2
dest[i] = s;
80006ba: f801 bc01 strb.w fp, [r1, #-1]
for (source) |s, i|
80006be: d015 beq.n 80006ec <start+0x338>
80006c0: f814 3c02 ldrb.w r3, [r4, #-2]
80006c4: f046 0502 orr.w r5, r6, #2
80006c8: 4295 cmp r5, r2
dest[i] = s;
80006ca: 700b strb r3, [r1, #0]
for (source) |s, i|
80006cc: d00e beq.n 80006ec <start+0x338>
80006ce: f814 3c01 ldrb.w r3, [r4, #-1]
80006d2: f046 0503 orr.w r5, r6, #3
80006d6: 4295 cmp r5, r2
dest[i] = s;
80006d8: 704b strb r3, [r1, #1]
for (source) |s, i|
80006da: d007 beq.n 80006ec <start+0x338>
80006dc: f814 3b04 ldrb.w r3, [r4], #4
80006e0: 3604 adds r6, #4
dest[i] = s;
80006e2: 708b strb r3, [r1, #2]
80006e4: 3804 subs r0, #4
80006e6: 3104 adds r1, #4
for (source) |s, i|
80006e8: 2800 cmp r0, #0
80006ea: d1e1 bne.n 80006b0 <start+0x2fc>
if (n == 0) return error.NoSpaceLeft;
80006ec: 2a00 cmp r2, #0
80006ee: f10d 0b18 add.w fp, sp, #24
80006f2: d048 beq.n 8000786 <start+0x3d2>
80006f4: 4494 add ip, r2
index += try self.write(bytes[index..]);
80006f6: 4417 add r7, r2
while (index != bytes.len) {
80006f8: eb1a 0f07 cmn.w sl, r7
80006fc: d1b7 bne.n 800066e <start+0x2ba>
80006fe: f241 0a0c movw sl, #4108 ; 0x100c
8000702: f04f 0900 mov.w r9, #0
8000706: f2c4 0a01 movt sl, #16385 ; 0x4001
800070a: f1b9 0f01 cmp.w r9, #1
800070e: d106 bne.n 800071e <start+0x36a>
8000710: e03d b.n 800078e <start+0x3da>
8000712: bf00 nop
8000714: 2300 movs r3, #0
index += try self.write(bytes[index..]);
8000716: 4499 add r9, r3
while (index != bytes.len) {
8000718: f1b9 0f01 cmp.w r9, #1
800071c: d037 beq.n 800078e <start+0x3da>
index += try self.write(bytes[index..]);
800071e: f1d9 0301 rsbs r3, r9, #1
if (bytes.len == 0) return 0;
8000722: d0f7 beq.n 8000714 <start+0x360>
if (self.pos >= self.buffer.len) return error.NoSpaceLeft;
8000724: 45f4 cmp ip, lr
8000726: d832 bhi.n 800078e <start+0x3da>
8000728: 9904 ldr r1, [sp, #16]
const n = if (self.pos + bytes.len <= self.buffer.len)
800072a: eb03 000c add.w r0, r3, ip
800072e: 4288 cmp r0, r1
8000730: f240 70fb movw r0, #2043 ; 0x7fb
8000734: f6c0 0000 movt r0, #2048 ; 0x800
8000738: bf88 it hi
800073a: eba1 030c subhi.w r3, r1, ip
800073e: 4448 add r0, r9
8000740: eb08 010c add.w r1, r8, ip
8000744: 2600 movs r6, #0
8000746: 42b3 cmp r3, r6
8000748: d016 beq.n 8000778 <start+0x3c4>
800074a: bf00 nop
800074c: 1984 adds r4, r0, r6
800074e: 79a2 ldrb r2, [r4, #6]
8000750: 1c77 adds r7, r6, #1
8000752: 429f cmp r7, r3
dest[i] = s;
8000754: 558a strb r2, [r1, r6]
for (source) |s, i|
8000756: d00f beq.n 8000778 <start+0x3c4>
8000758: 79e2 ldrb r2, [r4, #7]
800075a: 3701 adds r7, #1
dest[i] = s;
800075c: 440e add r6, r1
for (source) |s, i|
800075e: 429f cmp r7, r3
dest[i] = s;
8000760: 7072 strb r2, [r6, #1]
for (source) |s, i|
8000762: d009 beq.n 8000778 <start+0x3c4>
8000764: 7a22 ldrb r2, [r4, #8]
8000766: 3701 adds r7, #1
8000768: 429f cmp r7, r3
dest[i] = s;
800076a: 70b2 strb r2, [r6, #2]
for (source) |s, i|
800076c: d004 beq.n 8000778 <start+0x3c4>
800076e: 7a62 ldrb r2, [r4, #9]
dest[i] = s;
8000770: 70f2 strb r2, [r6, #3]
8000772: 1c7e adds r6, r7, #1
for (source) |s, i|
8000774: 42b3 cmp r3, r6
8000776: d1e9 bne.n 800074c <start+0x398>
if (n == 0) return error.NoSpaceLeft;
8000778: b14b cbz r3, 800078e <start+0x3da>
800077a: 449c add ip, r3
800077c: 4499 add r9, r3
while (index != bytes.len) {
800077e: f1b9 0f01 cmp.w r9, #1
8000782: d1cc bne.n 800071e <start+0x36a>
8000784: e003 b.n 800078e <start+0x3da>
8000786: f241 0a0c movw sl, #4108 ; 0x100c
800078a: f2c4 0a01 movt sl, #16385 ; 0x4001
800078e: f8d8 0040 ldr.w r0, [r8, #64] ; 0x40
8000792: f241 7559 movw r5, #5977 ; 0x1759
8000796: 2100 movs r1, #0
8000798: f2cd 15b7 movt r5, #53687 ; 0xd1b7
800079c: f242 7710 movw r7, #10000 ; 0x2710
for (txt) |c| {
80007a0: 458c cmp ip, r1
80007a2: d012 beq.n 80007ca <start+0x416>
if (nextWriteIdx == self.readIdx)
80007a4: f8d8 3044 ldr.w r3, [r8, #68] ; 0x44
const nextWriteIdx = if (self.writeIdx == size) 0 else self.writeIdx + 1;
80007a8: f1b0 021e subs.w r2, r0, #30
80007ac: bf18 it ne
80007ae: 1c42 addne r2, r0, #1
if (nextWriteIdx == self.readIdx)
80007b0: 429a cmp r2, r3