-
Notifications
You must be signed in to change notification settings - Fork 0
/
grids.asm
138 lines (113 loc) · 2.13 KB
/
grids.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
#include p18f87k22.inc
global draw_grids
grids code
draw_grids
clrf LATD
clrf LATE
movlw 0x0 ; Move literal (0) to WREG
movwf TRISD, ACCESS ; Move WREG literal to FREG, assign file register to TRISB. Port C all outputs
movlw 0x0 ; Move literal (0) to WREG
movwf TRISE, ACCESS ; Move WREG literal to FREG, assign file register to TRISB. Port C all outputs
; PORTD - y-axis | PORTE - x-axis
draw_rows
movlw 0x01 ; y-axis at 0V, x-axis 0V - 7V
movwf LATD
call inc_row ; After incrementing, x-axis (LATE) is now at 7V
movlw 0x1B ; y-axis at 1V, x-axis 7V - 0V
movwf LATD
call dec_row ; After incrementing, x-axis (LATE) is now at 0V
movlw 0x36 ; y-axis at 2V, x-axis 0V - 7V
movwf LATD
call inc_row
movlw 0x51 ; y-axis at 3V, x-axis 7V - 0V
movwf LATD
call dec_row
movlw 0x6C ; y-axis at 4V, x-axis 0V - 7V
movwf LATD
call inc_row
movlw 0x87 ; y-axis at 5V, x-axis 7V - 0V
movwf LATD
call dec_row
movlw 0xA2 ; y-axis at 6V, x-axis 0V - 7V
movwf LATD
call inc_row
movlw 0xBD ; y-axis at 7V, x-axis 7V - 0V
movwf LATD
call dec_row
draw_cols
call dec_col ; x-axis at 0V, y-axis 7V - 0V
movlw 0x1B ; x-axis at 1V, y-axis 0V - 7V
movwf LATE
call inc_col
movlw 0x36 ; x-axis at 2V, y-axis 7V - 0V
movwf LATE
call dec_col
movlw 0x51 ; x-axis at 3V, y-axis 0V - 7V
movwf LATE
call inc_col
movlw 0x6C ; x-axis at 4V, y-axis 7V - 0V
movwf LATE
call dec_col
movlw 0x87 ; x-axis at 5V, y-axis 0V - 7V
movwf LATE
call inc_col
movlw 0xA2 ; x-axis at 6V, y-axis 7V - 0V
movwf LATE
call dec_col
movlw 0xBD ; x-axis at 7V, y-axis 0V - 7V
movwf LATE
call inc_col
return
inc_row
incf LATE, 1
nop
nop
nop
nop
nop
nop
nop
movlw 0xBD
cpfseq LATE
bra inc_row
return
dec_row
decf LATE, 1
nop
nop
nop
nop
nop
nop
nop
movlw 0x01
cpfseq LATE
bra dec_row
return
inc_col
incf LATD, 1
nop
nop
nop
nop
nop
nop
nop
movlw 0xBD
cpfseq LATD
bra inc_col
return
dec_col
decf LATD, 1
nop
nop
nop
nop
nop
nop
nop
movlw 0x01
cpfseq LATD
bra dec_col
return
end