-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tasks5.a51
120 lines (96 loc) · 2.21 KB
/
Tasks5.a51
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
;$include(t89c51cc01.inc)
;BSEG
;hihihi bit P2.4
;CSEG
;ORG 000h
;main: LJMP loop1
;ORG 0000h
;LJMP init
;ORG 000Bh
;LJMP timer0int
;ORG
;LJMP timer1int
;ORG 000Bh
;LJMP timer0interrupt
;loop1:
;MOV R1,#0FFh
;loop2:
;MOV R2,#0FFh
;loopit:
;DJNZ R2,loopit
;DJNZ R1,loop2
;CPL P2.4
;LJMP main
;END
$include(t89c51cc01.inc)
BSEG
datab bit P4.1
shiftb bit P4.0
storeb bit P3.2
CSEG
ORG 0000h
LJMP init
ZERO: DB 11111b,00001b,01101b,01101b,01101b,01101b,01101b,00001b
ONE: DB 11111b,11011b,11011b,11011b,11011b,11011b,11011b,11011b
TWO: DB 11111b,00001b,01111b,01111b,00001b,11101b,11101b,00001b
THREE: DB 11111b,00001b,11101b,11101b,00001b,11101b,11101b,00001b
FOUR: DB 11111b,11101b,11101b,11101b,00001b,01101b,01101b,01101b
FIVE: DB 11111b,00001b,11101b,11101b,00001b,01111b,01111b,00001b
SIX: DB 11111b,00001b,01101b,01101b,00001b,01111b,01111b,00001b
SEVEN: DB 11111b,10111b,10111b,10111b,10111b,11011b,11101b,00001b
EIGHT: DB 11111b,00001b,01101b,01101b,00001b,01101b,01101b,00001b
NINE: DB 11111b,00001b,11101b,11101b,00001b,01101b,01101b,00001b
POINT: DB 11111b,11111b,11111b,11011b, 11111b, 11011b, 11111b, 11111b
init:
mov r2, #00d
MOV R3, #08d ; 7 counter for Pointer
MOV R4, #08d ; 8 rows
MOV R5, #05d
MOV R7, #11111110b;
MOV R6, #08d
CLR shiftb
CLR datab
CLR storeb
CLR A
MOV DPTR,#ZERO ; pointer goes to the first element of ONE
main:
outerloop:
mov A, r2
mov B, #08d
mul AB
ADD A,R3;
MOVC A,@A+DPTR
innerloop:
RRC A ; rotate right and put in the carry
MOV datab,C ; then put the value of carry in tghe data bit
SETB shiftb; we shift
CLR shiftb; we clear
DJNZ R5,innerloop; redo 5 times
MOV R5, #05h
inc r2
djnz r6, outerloop
mov r6, #08d
mov r2, #00d
MOV A,R7;
lines1:
RRC A;
MOV datab,C
SETB shiftb
CLR shiftb
DJNZ R4,lines1
MOV R4, #08h;
SETB storeb
CLR storeb ; store bit
MOV A,R7
RR A;
MOV R7,A
DJNZ R3,reset
MOV R3, #08h
MOV A,R3
LJMP main
reset:
MOV A,R3
LJMP main
endr:
RETI
END