1 | | ------------------------------------------------------------------------------
|
---|
2 | | glcplot.s -- plot a pixel on the LCD display
|
---|
3 | | Version 2 -- 1987-04-23 -- D.N. Lynx Crowe
|
---|
4 | | (c) Copyright 1987 -- D.N. Lynx Crowe
|
---|
5 |
|
---|
6 | | GLCplot(x, y, val)
|
---|
7 | | unsigned x, y, val);
|
---|
8 |
|
---|
9 | | Plot a pixel at ('x', 'y') using lcdbase as the plane address
|
---|
10 | | in GLC RAM. If 'val' is zero, the pixel is cleared,
|
---|
11 | | otherwise the pixel is cleared. No error checking is done.
|
---|
12 | | Limits: 0 LE x LE 511, 0 LE y LE 63.
|
---|
13 | | ------------------------------------------------------------------------------
|
---|
14 | .text
|
---|
15 |
|
---|
16 | .xdef GLCplot
|
---|
17 | .xref lcd_a0,lcd_a1,lcdbase
|
---|
18 |
|
---|
19 | XLOC = 8 | 'x' parameter offset
|
---|
20 | YLOC = 10 | 'y' parameter offset
|
---|
21 | VAL = 12 | 'val' parameter offset
|
---|
22 |
|
---|
23 | G_CRSWR = 0x46 | GLC set cursor command
|
---|
24 | G_MWRITE = 0x42 | GLC write command
|
---|
25 | G_MREAD = 0x43 | GLC read command
|
---|
26 |
|
---|
27 | .page
|
---|
28 |
|
---|
29 | GLCplot: link a6,#0 | Link stack frames
|
---|
30 | moveq #63,d0 | d0 = (63-y) * 85
|
---|
31 | sub.w YLOC(a6),d0 | ...
|
---|
32 | mulu #85,d0 | ...
|
---|
33 | clr.l d1 | d1 = x/6
|
---|
34 | move.w XLOC(a6),d1 | ...
|
---|
35 | divu #6,d1 | ...
|
---|
36 | add.w d1,d0 | d0 = (63-y)*85 + (x/6)
|
---|
37 | swap d1 | d2 = 7 - (x%6) % 8
|
---|
38 | moveq #7,d2 | ...
|
---|
39 | sub.w d1,d2 | ...
|
---|
40 | andi.w #7,d2 | ...
|
---|
41 | lsr.w #3,d1 | d1 = (x%6) / 8
|
---|
42 | add.w d1,d0 | d0 = cursor address
|
---|
43 | add.w lcdbase,d0 | ...
|
---|
44 | move.w d0,d1 | d1 = cursor address, too
|
---|
45 | move.b #G_CRSWR,lcd_a1 | Send cursor address to GLC
|
---|
46 | move.b d0,lcd_a0 | ...
|
---|
47 | lsr.w #8,d0 | ...
|
---|
48 | move.b d0,lcd_a0 | ...
|
---|
49 | move.b #G_MREAD,lcd_a1 | Read old pixel byte
|
---|
50 | move.b lcd_a1,d0 | ... into d0
|
---|
51 | tst.w VAL(a6) | Check val for zero
|
---|
52 | beq glcplt1 | Jump if val EQ 0
|
---|
53 |
|
---|
54 | bset d2,d0 | Set the pixel to 1
|
---|
55 | bra glcplt2 | Go write pixel to GLC
|
---|
56 |
|
---|
57 | glcplt1: bclr d2,d0 | Clear the pixel to 0
|
---|
58 |
|
---|
59 | glcplt2: move.b #G_CRSWR,lcd_a1 | Send cursor address to GLC
|
---|
60 | move.b d1,lcd_a0 | ...
|
---|
61 | lsr.w #8,d1 | ...
|
---|
62 | move.b d1,lcd_a0 | ...
|
---|
63 | move.b #G_MWRITE,lcd_a1 | Setup GLC to write pixel
|
---|
64 | move.b d0,lcd_a0 | Write pixel
|
---|
65 | unlk a6 | Unlink stack frames
|
---|
66 | rts | Return to caller
|
---|
67 |
|
---|
68 | .end
|
---|