Graphics Demo "Bouncing Line"  

  RSS

Moderator
(@moderator)
Member Admin
Joined: 10 years ago
Posts: 1048
10/09/2010 7:19 pm  

Since BETA31 we have graphics functions for the V4 unit which can be used for the pixel display.
You can use them with the LCS compiler. As mentioned in earlier posts the new comands are:
PPIXLINE (draws a pixel)
PPIXRECT (draws a filled rectangle)
PPIXDOT (draws a dot)

Attached is a nice demo showing a line "bouncing" around in the pixel display when hitting a corner.
Please note that the new graphics comands are not available in todays LCS so please use the NEW LCS 2.0 which will be ready for download next week otherwise this sample will NOT work.

First of all you need to change kotkey 7 and replace the code with this little program:

SETUP
    STARTFREQ:2000 STOPFREQ:2000
    RESBANDW:0 SWEEPTIME:1 
    PULSEMODE:1
 LDCONST 0
 STORESET SPECDISP
 LDCONST 1
 STOREVAR 110
 STOREVAR 111
 STOREVAR 112
 STOREVAR 113
 STOP

Then change program 150. Replace the program with this program:

LOADVAR 100
LOADVAR 101
LOADVAR 102
LOADVAR 103
PPIXLINE 1

LOADVAR 110
LOADVAR 100
ADD
STOREVAR 100
LDSHCO 51
LOADVAR 100
JUMPLT LABEL1
LOADVAR 100
JUMPZ LABEL2
JUMP LABEL3
LABEL1:
LDCONST -1
STOREVAR 110
JUMP LABEL3
LABEL2:
LDCONST 1
STOREVAR 110

LABEL3:
LOADVAR 111
LOADVAR 101
ADD
STOREVAR 101
LDSHCO 24
LOADVAR 101
JUMPLT LABEL4
LOADVAR 101
JUMPZ LABEL5
JUMP LABEL6
LABEL4:
LDCONST -1
STOREVAR 111
JUMP LABEL6
LABEL5:
LDCONST 1
STOREVAR 111

LABEL6:
LOADVAR 112
LOADVAR 102
ADD
STOREVAR 102
LDSHCO 51
LOADVAR 102
JUMPLT LABEL7
LOADVAR 102
JUMPZ LABEL8
JUMP LABEL9
LABEL7:
LDCONST -1
STOREVAR 112
JUMP LABEL9
LABEL8:
LDCONST 1
STOREVAR 112

LABEL9:
LOADVAR 113
LOADVAR 103
ADD
STOREVAR 103
LDSHCO 24
LOADVAR 103
JUMPLT LABEL10
LOADVAR 103
JUMPZ LABEL11
JUMP LABEL12
LABEL10:
LDCONST -1
STOREVAR 113
JUMP LABEL12
LABEL11:
LDCONST 1
STOREVAR 113

LABEL12:
LOADVAR 100
LOADVAR 101
LOADVAR 102
LOADVAR 103
PPIXLINE 0

LOADVAR 100
PRINTINT 4
LOADVAR 101
PRINTINT 6
LOADVAR 102
PRINTINT 7
LOADVAR 103
PRINTINT 9

STOP

To start the demo press key 7.
When ever you press key 7 again the line will use different start parameters which will result in totaly different graphics.
Nice: The 4 line coordinates (X1, Y1 and X2, Y2) will be displayd in the first and third marker fields.

Have fun!

Snip


Quote
Share: