-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.asm
1144 lines (988 loc) · 17.6 KB
/
main.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
; Controller ATTINY 2313 at 8 MHz internal RC oscillator
; Brown-out at 1.8V, fuse CKDIV8 is ON
; Design:
; --------
; RESET --|1 20|-- +3..4.2V, -- Capacitor ~0.1uF --|
; |-- Light1 --| |-- SCK
; |-- Light2 --| |-- MISO
; |-- Light3 --| |-- MOSI
; |-- Light4 --| |--
; |-- Light5 --| |--
; |-- Light6 --| |--
; |-- Light7 --| |--
; |-- Light8 --| |-- Reed Switch --|
; |--|10 11|--
; --------
; ------------------------------------------------------------------------
; Device
.include "tn2313def.inc"
; ------------------------------------------------------------------------
; Registers
.def R4_PERIOD = R4
.def R5_PERIOD = R5
.def R6_SPEED = R6
.def R7_TEXT_BEGIN = R7
.def R8_TEXT_SYMB = R8
.def R9_SYMB_LINE = R9
.def R10_ANGLE_COUNTER = R10
.def R11_ANGLE_COUNTER = R11
.def R12_CLB = R12
.def R13_SP = R13
.def R14_SLP = R14
.def R15_CLB_PRINT = R15
;------------------------------------------------------------------------
.eseg
.org 0x000
.db 128
;------------------------------------------------------------------------
.cseg
.org 0x0000
RJMP Reset ; Reset Handler
.org 0x0001
RETI ; External Interrupt0 Handler
.org 0x0002
RETI ; External Interrupt1 Handler
.org 0x0003
RETI ; Timer1 Capture Handler
.org 0x0004
RETI ; Timer1 CompareA Handler
.org 0x0005
RETI ; Timer1 Overflow Handler
.org 0x0006
RJMP Timer ; Timer0 Overflow Handler
.org 0x0007
RETI ; USART0 RX Complete Handler
.org 0x0008
RETI ; USART0,UDR Empty Handler
.org 0x0009
RETI ; USART0 TX Complete Handler
.org 0x000A
RETI ; Analog Comparator Handler
.org 0x000B
RETI ; PCINT0 Handler
.org 0x000C
RETI ; Timer1 Compare B Handler
.org 0x000D
RETI ; Timer0 Compare A Handler
.org 0x000E
RETI ; Timer0 Compare B Handler
.org 0x000F
RETI ; USI Start Handler
.org 0x0010
RETI ; USI Overflow Handler
.org 0x0011
RETI ; EEPROM Ready Handler
.org 0x0012
RETI ; Watchdog Overflow Handler
.org 0x0013
RETI ; PCINT1 Handler
.org 0x0014
RETI ; PCINT2 Handler
;------------------------------------------------------------------------
Data:
;1
.db 0b00000000,\
0b00000000
.db 0b00000000,\
0b01000010
.db 0b01111111,\
0b01000000
.db 0b00000000,\
0b00000000
;2
.db 0b00000000,\
0b00000000
.db 0b01000010,\
0b01100001
.db 0b01010001,\
0b01001001
.db 0b01000110,\
0b00000000
;3
.db 0b00000000,\
0b00000000
.db 0b00100010,\
0b01000001
.db 0b01000001,\
0b01001001
.db 0b00110110,\
0b00000000
;4
.db 0b00000000,\
0b00000000
.db 0b00111000,\
0b00100100
.db 0b00100010,\
0b01111111
.db 0b00100000,\
0b00000000
;5
.db 0b00000000,\
0b00000000
.db 0b00101111,\
0b01001001
.db 0b01001001,\
0b01001001
.db 0b00110001,\
0b00000000
;6
.db 0b00000000,\
0b00000000
.db 0b00111110,\
0b01001001
.db 0b01001001,\
0b01001001
.db 0b00110010,\
0b00000000
;7
.db 0b00000000,\
0b00000000
.db 0b00000001,\
0b01100001
.db 0b00011001,\
0b00000101
.db 0b00000011,\
0b00000000
;8
.db 0b00000000,\
0b00000000
.db 0b00110110,\
0b01001001
.db 0b01001001,\
0b01001001
.db 0b00110110,\
0b00000000
;9
.db 0b00000000,\
0b00000000
.db 0b00100110,\
0b01001001
.db 0b01001001,\
0b01001001
.db 0b00111110,\
0b00000000
;10 - 0
.db 0b00000000,\
0b00000000
.db 0b00111110,\
0b01000001
.db 0b01000001,\
0b01000001
.db 0b00111110,\
0b00000000
;11 - space
.db 0b00000000,\
0b00000000
.db 0b00000000,\
0b00000000
.db 0b00000000,\
0b00000000
.db 0b00000000,\
0b00000000
;12 - YO
.db 0b00000000,\
0b00000000
.db 0b01111101,\
0b01010101
.db 0b01010100,\
0b01000101
.db 0b01000101,\
0b00000000
;13 - heart
.db 0b00000000,\
0b00011100
.db 0b00100010,\
0b01000001
.db 0b10000010,\
0b01000001
.db 0b00100010,\
0b00011100
;14 - ball
.db 0b00000000,\
0b00000000
.db 0b00011000,\
0b00111100
.db 0b00111100,\
0b00011000
.db 0b00000000,\
0b00000000
;15 - left
.db 0b00000000,\
0b00000000
.db 0b00001000,\
0b00010100
.db 0b00100010,\
0b01111111
.db 0b00000000,\
0b00000000
;16 - right
.db 0b00000000,\
0b00000000
.db 0b01111111,\
0b00100010
.db 0b00010100,\
0b00001000
.db 0b00000000,\
0b00000000
;17 - point
.db 0b00000000,\
0b00000000
.db 0b00000000,\
0b00000000
.db 0b11000000,\
0b11000000
.db 0b00000000,\
0b00000000
;18 - line
.db 0b00000000,\
0b00000000
.db 0b00001000,\
0b00001000
.db 0b00001000,\
0b00001000
.db 0b00000000,\
0b00000000
;19 - k
.db 0b00000000,\
0b00000000
.db 0b01111111,\
0b00010000
.db 0b00101000,\
0b01000100
.db 0b01000100,\
0b00000000
;20 - m
.db 0b00000000,\
0b00000000
.db 0b01111100,\
0b00000100
.db 0b01111000,\
0b00000100
.db 0b01111000,\
0b00000000
;21 - /
.db 0b00000000,\
0b00000000
.db 0b00100000,\
0b00010000
.db 0b00001000,\
0b00000100
.db 0b00000010,\
0b00000000
;22 - h
.db 0b00000000,\
0b01111111
.db 0b00001000,\
0b00000100
.db 0b00000100,\
0b01111000
.db 0b00000000,\
0b00000000
;23 - =
.db 0b00000000,\
0b00000000
.db 0b00101000,\
0b00101000
.db 0b00101000,\
0b00101000
.db 0b00000000,\
0b00000000
;24 - S
.db 0b00000000,\
0b00000000
.db 0b00101110,\
0b01001001
.db 0b01001001,\
0b01001001
.db 0b00110010,\
0b00000000
;25 - i
.db 0b00000000,\
0b00000000
.db 0b00000000,\
0b01000100
.db 0b01111101,\
0b01000000
.db 0b00000000,\
0b00000000
;26 - t
.db 0b00000000,\
0b00000100
.db 0b00000100,\
0b00111111
.db 0b01000100,\
0b01000100
.db 0b00000000,\
0b00000000
;27 - n
.db 0b00000000,\
0b01111100
.db 0b00001000,\
0b00000100
.db 0b00000100,\
0b01111000
.db 0b00000000,\
0b00000000
;28 - underline
.db 0b00000000,\
0b10000000
.db 0b10000000,\
0b10000000
.db 0b10000000,\
0b10000000
.db 0b10000000,\
0b00000000
;29 - [
.db 0b00000000,\
0b00000000
.db 0b00000000,\
0b01111111
.db 0b01000001,\
0b00000000
.db 0b00000000,\
0b00000000
;30 - ]
.db 0b00000000,\
0b00000000
.db 0b00000000,\
0b01000001
.db 0b01111111,\
0b00000000
.db 0b00000000,\
0b00000000
;31 - a
.db 0b00000000,\
0b00100000
.db 0b01010100,\
0b01010100
.db 0b01010100,\
0b01111000
.db 0b00000000,\
0b00000000
;32 - r
.db 0b00000000,\
0b01111100
.db 0b00001000,\
0b00000100
.db 0b00000100,\
0b00001000
.db 0b00000000,\
0b00000000
;33 - e
.db 0b00000000,\
0b00111000
.db 0b01010100,\
0b01010100
.db 0b01010100,\
0b01001000
.db 0b00000000,\
0b00000000
;34 - c
.db 0b00000000,\
0b00111000
.db 0b01000100,\
0b01000100
.db 0b01000100,\
0b00101000
.db 0b00000000,\
0b00000000
;35 - l
.db 0b00000000,\
0b00000000
.db 0b01000010,\
0b01111110
.db 0b01000000,\
0b00000000
.db 0b00000000,\
0b00000000
;36 - b
.db 0b00000000,\
0b01111111
.db 0b01000100,\
0b01000100
.db 0b01000100,\
0b00111000
.db 0b00000000,\
0b00000000
;37 - V
.db 0b00000000,\
0b00011111
.db 0b00100000,\
0b01000000
.db 0b01000000,\
0b00100000
.db 0b00011111,\
0b00000000
;38 - o
.db 0b00000000,\
0b00111000
.db 0b01000100,\
0b01000100
.db 0b01000100,\
0b00111000
.db 0b00000000,\
0b00000000
;39 - p
.db 0b00000000,\
0b11111100
.db 0b00100100,\
0b00100100
.db 0b00100100,\
0b00011000
.db 0b00000000,\
0b00000000
;40 - u
.db 0b00000000,\
0b00000000
.db 0b00111100,\
0b01000000
.db 0b00100000,\
0b01111100
.db 0b00000000,\
0b00000000
;41 - A
.db 0b00000000,\
0b01111100
.db 0b00010010,\
0b00010001
.db 0b00010001,\
0b01111110
.db 0b00000000,\
0b00000000
;42 - T
.db 0b00000000,\
0b00000001
.db 0b00000001,\
0b01111111
.db 0b00000001,\
0b00000001
.db 0b00000000,\
0b00000000
;43 - L
.db 0b00000000,\
0b01111111
.db 0b01000000,\
0b01000000
.db 0b01000000,\
0b01000000
.db 0b00000000,\
0b00000000
Spd_data:
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.db 0,0,0,97,93,88,84,80,77,74,71,69,66,64,62,60
.db 58,56,54,53,51,50,49,47,46,45,44,43,42,41,40,39
.db 39,38,37,36,36,35,34,34,33,32,32,31,31,30,30,29
.db 29,28,28,28,27,27,26,26,26,25,25,25,24,24,24,23
.db 23,23,23,22,22,22,22,21,21,21,21,20,20,20,20,19
.db 19,19,19,19,19,18,18,18,18,18,17,17,17,17,17,17
.db 17,16,16,16,16,16,16,16,15,15,15,15,15,15,15,15
.db 14,14,14,14,14,14,14,14,14,14,13,13,13,13,13,13
.db 13,13,13,13,13,12,12,12,12,12,12,12,12,12,12,12
.db 12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11
.db 11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
.db 10,10,10,9,9,9,9,9,9,9,9,9,9,9,9,9
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;------------------------------------------------------------------------
Reset:
; DDRA
LDI R17, 0b00000011
OUT 0x1A, R17
; DDRB
LDI R17, 0b00000000
OUT 0x17, R17
; PORTB
LDI R17, 0b11111001
OUT 0x18, R17
; DDRD
LDI R17, 0b00111111
OUT 0x11, R17
; PORTD
LDI R17, 0b00000000
OUT 0x12, R17
; Timers
LDI R17, 0b00000010
OUT 0x39, R17
; Timer 0
LDI R17, 0b00000011
OUT 0x33, R17
; Timer 1
LDI R17, 0b00000100
OUT 0x2E, R17
; Sleep mode
LDI R17, 0b00100000
OUT 0x35, R17
; Text Off
CLR R16
STS 0x60, R16
; Clb
Clb_READ:
LDI R16, 199
MOV R12_CLB, R16
CLR R15_CLB_PRINT
SBIC 0x1C, 1
RJMP Clb_READ
LDI R16, 0
OUT 0x1E, R16
SBI 0x1C,0
IN R16, 0x1D
MOV R12_CLB, R16
; SP
LDI R16, 0xDF
OUT 0x3D, R16
SEI
;------------------------------------------------------------------------
Main:
SLEEP
MOV R16, R14_SLP
CPI R16, 1
BRNE Main_SLEEP_RET
LDI R16, 0b00110000
OUT 0x3B, R16
LDI R16, 0b00000001
OUT 0x20, R16
LDI R17, 0b00110000
OUT 0x35, R17
RCALL Clb_WRITE
SLEEP
CLR R15_CLB_PRINT
LDI R17, 0b00100000
OUT 0x35, R17
LDI R16, 0
OUT 0x3B, R16
Main_SLEEP_RET:
IN R16, 0x16
ANDI R16, 0b00000001
CPI R16, 0b00000000
BRNE Main
Main_ON:
SLEEP
IN R16, 0x16
ANDI R16, 0b00000001
CPI R16, 0b00000001
BRNE Main_ON
CLR R10_ANGLE_COUNTER
CLR R11_ANGLE_COUNTER
RCALL Impulse
CLR R14_SLP
RJMP Main
;------------------------------------------------------------------------
Clb_WRITE:
MOV R16, R15_CLB_PRINT
CPI R16, 0
BREQ Clb_WRITE_RET
EEWrite:
SBIC 0x1C, 1
RJMP EEWrite
LDI R17, 0b00000000
OUT 0x1C, R17
LDI R17, 0x00
OUT 0x1E, R17
MOV R17, R12_CLB
OUT 0x1D, R17
CLI
SBI 0x1C, 2
SBI 0x1C, 1
SEI
Clb_WRITE_RET:
RET
;------------------------------------------------------------------------
Timer:
PUSH R16
IN R16, 0x3F
PUSH R16
Timer_SLEEP:
MOV R16, R14_SLP
CPI R16, 1
BREQ Timer_RET
Timer_A:
CLR R16
INC R10_ANGLE_COUNTER
CP R10_ANGLE_COUNTER, R16
BRNE Timer_A_INC_END
INC R11_ANGLE_COUNTER
Timer_A_INC_END:
MOV R16, R10_ANGLE_COUNTER
MOV R17, R11_ANGLE_COUNTER
CPI R17, 200
BRNE Timer_A_END
CLR R14_SLP
INC R14_SLP
Timer_A_END:
RCALL Timer_CORR
RCALL Lights_OFF
RCALL Period_Max_STOP
RCALL Period_SET
RCALL Speed_CALC
RCALL Text_PRINT
RCALL Line_PRINT
; Decor -----------------------
; RCALL Frames
; RCALL Byte_WRITE
RCALL Name_WRITE
RCALL Decor1
; Decor_END -------------------
Timer_RET:
POP R16
OUT 0x3F, R16
POP R16
RETI
;-----------------------------------------------------------------------
Lights_OFF:
LDI R17, 0
OUT 0x12, R17
OUT 0x1B, R17
RET
Impulse:
LDI R17, 0b00111111
OUT 0x12, R17
LDI R17, 0b00000011
OUT 0x1B, R17
LDI R17, 0b00000000
OUT 0x12, R17
LDI R17, 0
OUT 0x1B, R17
RET
Frames:
Frames_All:
MOV R16, R10_ANGLE_COUNTER
ANDI R16, 0b00000111
CPI R16, 0
BRNE Frames_2
RCALL Impulse
RJMP Frames_RET
Frames_All_END:
Frames_2:
LDI R17, 0b00100001
OUT 0x12, R17
LDI R17, 0b00000000
OUT 0x1B, R17
LDI R17, 0b00000000
OUT 0x12, R17
LDI R17, 0
OUT 0x1B, R17
Frames_2_END:
Frames_RET:
RET
Decor1:
MOV R16, R10_ANGLE_COUNTER
ANDI R16, 0b01111111
CPI R16, 0
BRNE Decor1_RET
MOV R16, R6_SPEED
CPI R16, 9
BRMI Decor1_RET
MOV R16, R6_SPEED
CPI R16, 14
BRPL Decor1_RET
LDI R16, 16 ; |>
STS 0x60, R16
LDI R16, 16 ; |>
STS 0x61, R16
LDI R16, 0
STS 0x62, R16
LDI R16, 0x60
MOV R8_TEXT_SYMB, R16
LDI R16, 1
MOV R7_TEXT_BEGIN, R16
Decor1_RET:
RET
Name_WRITE:
MOV R16, R11_ANGLE_COUNTER
CPI R16, 0
BRNE Name_WRITE_RET
MOV R16, R10_ANGLE_COUNTER
CPI R16, 0x2A
BRNE Name_WRITE_RET
MOV R16, R6_SPEED
CPI R16, 15
BRMI Name_WRITE_RET
MOV R16, R6_SPEED
CPI R16, 30
BRPL Name_WRITE_RET
LDI R16, 41 ; A
STS 0x60, R16
LDI R16, 32 ; r
STS 0x61, R16
LDI R16, 26 ; t
STS 0x62, R16
LDI R16, 42 ; T
STS 0x63, R16
LDI R16, 33 ; e
STS 0x64, R16
LDI R16, 34 ; c
STS 0x65, R16
LDI R16, 22 ; h
STS 0x66, R16
LDI R16, 43 ; L
STS 0x67, R16
LDI R16, 31 ; a
STS 0x68, R16
LDI R16, 36 ; b
STS 0x69, R16
LDI R16, 0
STS 0x6A, R16 ; Make sure that nums are in order.
LDI R16, 0x60
MOV R8_TEXT_SYMB, R16
LDI R16, 1
MOV R7_TEXT_BEGIN, R16
Name_WRITE_RET:
RET
Text_PRINT:
MOV R16, R7_TEXT_BEGIN
CPI R16, 1
BRNE Text_PRINT_RET
CLR R7_TEXT_BEGIN
MOV R28, R8_TEXT_SYMB
CLR R29
LD R16, Y
CPI R16, 0
BREQ Text_PRINT_RET
LDI R16, 1
MOV R9_SYMB_LINE, R16
Text_PRINT_RET:
RET
Line_PRINT:
MOV R16, R9_SYMB_LINE
CPI R16, 0
BREQ Line_PRINT_RET
LD R16, Y
DEC R16
CLR R17
LDI R30, low(Data*2)
LDI R31, high(Data*2)
CLC
ROL R16
ROL R17
CLC
ROL R16
ROL R17
CLC
ROL R16
ROL R17
ADD R30, R16
ADC R31, R17
MOV R16, R9_SYMB_LINE
DEC R16
CLR R17
ADD R30, R16
ADC R31, R17
LPM R16, Z
RCALL Line_OUT
INC R9_SYMB_LINE
MOV R16, R9_SYMB_LINE
CPI R16, 9
BRNE Line_PRINT_RET
CLR R9_SYMB_LINE
INC R8_TEXT_SYMB
LDI R16, 1
MOV R7_TEXT_BEGIN, R16
Line_PRINT_RET:
RET
Line_OUT:
LDI R18, 0b00000000
; D0,D1
MOV R17, R16
ANDI R17, 0b00000011
OR R18, R17
; D2,D3,D4,D5
MOV R17, R16
ANDI R17, 0b11110000
LSR R17
LSR R17
OR R18, R17
OUT 0x12, R18
LDI R18, 0b00000000
; A0
MOV R17, R16
ANDI R17, 0b00001000
LSR R17
LSR R17
LSR R17
OR R18, R17
; A1
MOV R17, R16
ANDI R17, 0b00000100
LSR R17
OR R18, R17
OUT 0x1B, R18
Line_OUT_RET:
RET
Num_Text_WRITE:
MOV R17, R16
LDI R18, 0
Num_Text_100_BEGIN:
SUBI R17, 100
BRCS Num_Text_100_WRITE
INC R18
RJMP Num_Text_100_BEGIN
Num_Text_100_WRITE:
LDI R19, 11
STS 0x60, R19
CPI R18, 0
BREQ Num_Text_100_END
STS 0x60, R18
Num_Text_100_END:
SUBI R17, -100
LDI R18, 0
Num_Text_10_BEGIN:
SUBI R17, 10
BRCS Num_Text_10_WRITE
INC R18
RJMP Num_Text_10_BEGIN
Num_Text_10_WRITE:
LDI R19, 10
STS 0x61, R19
CPI R18, 0
BREQ Num_Text_10_END
STS 0x61, R18
Num_Text_10_END:
SUBI R17, -10
Num_Text_1_WRITE:
LDI R19, 10
STS 0x62, R19
CPI R17, 0
BREQ Num_Text_1_END
STS 0x62, R17
Num_Text_1_END:
LDI R17, 0
STS 0x63, R17
Num_Text_DEL0:
LDS R17, 0x60