summaryrefslogtreecommitdiffstats
path: root/README
blob: a75e2e3f50974efb6f899cd97d8b68437977cab1 (plain)
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
This is a simple assembler for lp5523 led chips. You
can use it to convert the microcode from lp5523 engines
into human readable code and the other way around.

------------------------------------------------------------
The Assembly Language
------------------------------------------------------------

The assembly language consists of the following mnemonics:

 * start
 This must be specified at the beginning of each program.

 * restart
 Jumps back to the start.

 * stop
 Stops the engine.

 * stopr
 Stops the engine with reset.

 * stopi
 Stops the engine with interrupt.

 * stopri
 Stops the engine with reset & interrupt.

 * send1, send2, send3
 Sends signal to engine 1, 2 or 3.

 * wait1, wait2, wait3
 Waits for signal from engine 1, 2 or 3.

 * set LEVEL
 Sets output to LEVEL (0-255).

 * sleep TIME
  - TIME can be between 0 and 61
 Does nothing for the specified amount of time. See
 below for TIME value -> time in seconds calculation.

 * fade TIME +STEPS
  - TIME can be between 0 and 61
  - STEPS can be between 0 and 255
  - The '+' is important
 Slowly increase the output by STEPS in the specified
 amount of time.

 * fade TIME -STEPS
  - TIME can be between 0 and 61
  - STEPS can be between 0 and 255
  - The '-' is important
 Slowly decrease the output by STEPS in the specified
 amount of time.

 * branch COUNT PC
  - COUNT can be between 0 and 63
  - PC can be between 0 and 95
 Jumps (back) COUNT times to the opcode located at PC.
 A COUNT value of 0 is interpreted as infinite.


Calculation of time in ms for a given TIME value:

 if(value < 31)
	return value * 0.49ms;
 else
	return (value-31) * 15.6ms;

--------------------------------------------------------
Usage
--------------------------------------------------------

Assemble lp5523.S into lp5523 machine code:
 $ lp5523-as file.S > result.txt
 $ echo "code" | lp5523-as > result.txt

Disassemble lp5523 machine code in assembly code:
 $ lp5523-as -d input > result.txt
 $ echo "code" | lp5523-as -d > result.txt

--------------------------------------------------------
Building & Installation
--------------------------------------------------------

Building:
 $ make

Running Unit Tests:
 $ make test

Installation:
 $ install -m755 lp5523 /usr/local/bin