annotate exporters.pde @ 121:25a29d29ee6a

Add helper class MPWriteCtx for exporting data and source code.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 09 Jul 2018 18:07:04 +0300
parents 55b0a77af602
children ffa6533584ca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1 //
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
2 // machine definitions
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
3 // source writer and other export/import functions
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
4 // remember hexdump -C !
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
5 //
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
6 String g_formatname, g_formatext;
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
7 int g_dataoffs;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
8 int[] g_grids = new int[16];
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
9 int OLD = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
10 int NEW = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
11 int g_gridmode = OLD;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
12
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
13
121
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
14 public class MPWriteCtx
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
15 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
16 public int m_offs, m_bpl, m_bytes, m_indent;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
17 public String m_byteDef, m_eol, m_src;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
18
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
19 MPWriteCtx()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
20 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
21 m_offs = 0;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
22 m_bpl = 32;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
23 m_bytes = 0;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
24 m_indent = 4;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
25 m_byteDef = ".byte";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
26 m_src = "";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
27 m_eol = "\n";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
28 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
29
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
30 void setOffs(int offs)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
31 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
32 m_offs = offs;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
33 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
34
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
35 void setBPL(int bpl)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
36 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
37 m_bpl = bpl;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
38 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
39
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
40 String getIndent()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
41 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
42 String str = "";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
43 for (int n = 0; n < m_indent; n++)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
44 str += " ";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
45 return str;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
46 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
47
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
48 void label(String blabel)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
49 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
50 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
51 m_src += blabel +":";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
52 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
53 m_bytes = 0;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
54 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
55
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
56 void comment(String bstr)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
57 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
58 indent();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
59 m_src += "; "+ bstr;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
60 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
61 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
62
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
63 void eol()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
64 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
65 m_src += m_eol;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
66 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
67
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
68 void eod()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
69 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
70 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
71 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
72 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
73
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
74 void byteDef()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
75 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
76 m_src += m_byteDef +" ";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
77 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
78
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
79 void indent()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
80 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
81 m_src += getIndent();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
82 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
83
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
84 void line(String str)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
85 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
86 m_src += str;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
87 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
88 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
89
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
90 void writeByte(int bval, String blabel)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
91 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
92 m_data[m_offs++] = byte(bval);
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
93
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
94 if (blabel != null)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
95 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
96 m_src += blabel +": "+ m_byteDef +" "+ str(int(bval)) + m_eol;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
97 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
98 else
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
99 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
100 m_src += str(int(bval));
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
101
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
102 if (m_bpl > 0 &&
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
103 ++m_bytes >= m_bpl)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
104 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
105 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
106 indent();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
107 byteDef();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
108 m_bytes = 0;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
109 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
110 else
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
111 m_src += ",";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
112 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
113 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
114
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
115 void writeByteAt(int offs, int bval, String blabel)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
116 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
117 m_offs = offs;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
118 writeByte(bval, blabel);
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
119 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
120 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
121
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
122
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
123 void mpCopyByte(byte[] fdata, int moffs, int toffs)
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
124 {
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
125 g_map[moffs ] = byte((fdata[toffs] & 128) >> 7);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
126 g_map[moffs + 1] = byte((fdata[toffs] & 64) >> 6);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
127 g_map[moffs + 2] = byte((fdata[toffs] & 32) >> 5);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
128 g_map[moffs + 3] = byte((fdata[toffs] & 16) >> 4);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
129 g_map[moffs + 4] = byte((fdata[toffs] & 8) >> 3);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
130 g_map[moffs + 5] = byte((fdata[toffs] & 4) >> 2);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
131 g_map[moffs + 6] = byte((fdata[toffs] & 2) >> 1);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
132 g_map[moffs + 7] = byte( fdata[toffs] & 1);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
133 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
134
29
249c4f5742f3 Refactor the import/export stuff a bit and the GUI bits for JS.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
135
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
136 void mpSetDataOffs(int offs)
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
137 {
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
138 g_dataoffs = offs;
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
139 }
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
140
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
141
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
142 void mpWriteByte(int bb)
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
143 {
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
144 g_template[g_dataoffs++] = byte(bb);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
145 }
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
146
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
147
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
148 void mpLoadTemplate(String fname)
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
149 {
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
150 g_template = mpLoadBinaryFile("templates/" + fname);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
151 }
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
152
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
153
117
44a07b1c620d Rename 'bool' -> 'boolean'.
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
154 boolean mpImportFormat(byte[] fdata)
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
155 {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
156 int x, y, x2, y2, y3, head, xx, yy, yp, ad, valu;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
157 int p1, p2, p3;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
158
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
159 head = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
160
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
161 if (machine == SPECTRUM) //SCR=SCREEN$
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
162 {
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
163 // 32*24*8 bytes of bitmap
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
164 // 32*24 bytes of attributes
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
165 if (fdata.length < 6912) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
166 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
167 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
168 for (y = 0; y < 3; y++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
169 for (y2 = 0; y2 < 8; y2++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
170 for (yy = 0; yy < 8; yy++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
171 for (x = 0; x < 32; x++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
172 {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
173 yp = y * 64 + yy * 8 + y2;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
174 ad = 1024 + yp * 256 + x * 8;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
175 mpCopyByte(fdata, ad, head);
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
176 head++;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
177 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
178
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
179 for (y = 0; y < 24; y++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
180 for (x = 0; x < 32; x++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
181 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
182 ad = 65536 + x + y * (32 * 8);
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
183 valu = fdata[head];
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
184 int ink = valu & 7;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
185 int pap = valu & 56;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
186 pap = pap >> 3;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
187 int bri = valu & 64;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
188 bri = bri >> 6;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
189 ink = ink + bri * 8;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
190 pap = pap + bri * 8;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
191 if (pap == 8) {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
192 pap = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
193 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
194 for (y2 = 0; y2 <= 7; y2++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
195 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
196 g_map[ad + y2 * 32] = byte(ink);
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
197 g_map[ad + y2 * 32 + MX * MY * 8] = byte(pap);
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
198 }
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
199 head++;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
200 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
201 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
202 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
203 if (machine == C64) {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
204 //0x0002->bitmap
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
205 //0x1f42->colormap
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
206 //0x232a=border (take the lower nybble)
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
207 if (fdata.length < 9006) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
208 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
209 }
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
210 if (fdata.length >= 0x232a) {
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
211 g_map[0] = byte(fdata[0x232a] & 0x0f);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
212 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
213 for (y = 0; y < 25; y++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
214 for (x = 0; x < 40; x++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
215 for (y2 = 0; y2 <= 7; y2++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
216 {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
217 head = 2 + x * 8 + y * (40 * 8) + y2;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
218 ad = 1024 + x * 8 + y * (320 * 8) + y2 * 320;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
219 mpCopyByte(fdata, ad, head);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
220 p1 = fdata[0x1f42 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
221 p2 = fdata[0x1f42 + x + y * 40] & 0xf0;
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
222 p2 = p2 >> 4;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
223 g_map[65536 + x + y * 40 * 8 + y2 * 40] = byte(p2);
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
224 g_map[65536 + MX * MY * 8 + x + y * 40 * 8 + y2 * 40] = byte(p1);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
225 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
226 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
227 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
228 if (machine == PLUS4) { // Botticelli
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
229 //g.hires.prg = botticelli
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
230 //2 - luminance 40*25
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
231 //1026 - colors 40*25
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
232 //2050 - bitmappi 40*25*8
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
233 if (fdata.length < 10050) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
234 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
235 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
236 int l1, l2;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
237 for (y = 0; y < 25; y++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
238 for (x = 0; x < 40; x++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
239 for (y2 = 0; y2 <= 7; y2++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
240 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
241 head = 2050 + x * 8 + y * (40 * 8) + y2;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
242 ad = 1024 + x * 8 + y * (320 * 8) + y2 * 320;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
243 mpCopyByte(fdata, ad, head);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
244
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
245 p1 = fdata[1026 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
246 p2 = fdata[1026 + x + y * 40] & 0xf0;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
247 p2 = p2 >> 4;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
248 l1 = fdata[2 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
249 l2 = fdata[2 + x + y * 40] & 0xf0;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
250 l2 = l2 >> 4;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
251 g_map[65536 + x + y * 40 * 8 + y2 * 40] = byte(convertluminance(l1, p2));
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
252 g_map[65536 + MX * MY * 8 + x + y * 40 * 8 + y2 * 40] = byte(convertluminance(l2, p1));
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
253 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
254 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
255 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
256 if (machine == PLUS4M) { // Multi Botticelli
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
257 //m.multi.prg = multi botticelli
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
258 //2- lumins 40*25
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
259 //1024 - bäkki1
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
260 //1025 - bäkki2
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
261 //1026 - colors 40*25
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
262 //2050 - bitmap 40*25*8
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
263 if (fdata.length < 10050) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
264 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
265 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
266 int l1, l2;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
267 for (y = 0; y < 25; y++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
268 for (x = 0; x < 40; x++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
269 for (y2 = 0; y2 <= 7; y2++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
270 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
271 head = 2050 + x * 8 + y * (40 * 8) + y2;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
272 ad = 1024 + x * 8 + y * (320 * 8) + y2 * 320;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
273 mpCopyByte(fdata, ad, head);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
274
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
275 p1 = fdata[1026 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
276 p2 = fdata[1026 + x + y * 40] & 0xf0;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
277 p2 = p2 >> 4;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
278 l1 = fdata[2 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
279 l2 = fdata[2 + x + y * 40] & 0xf0;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
280 l2 = l2 >> 4;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
281 g_map[65536 + x + y * 40 + 1000] = byte(convertluminance(l1, p2));
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
282 g_map[65536 + x + y * 40 + 0000] = byte(convertluminance(l2, p1));
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
283 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
284
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
285 p1 = int(fdata[1025]) & 0xf0;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
286 l1 = int(fdata[1025]) & 0x0f;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
287 p1 = p1 >> 4;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
288 g_map[1] = byte(convertluminance(l1, p1));
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
289 p1 = int(fdata[1024]) & 0xf0;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
290 l1 = int(fdata[1024]) & 0x0f;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
291 p1 = p1 >> 4;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
292 g_map[2] = byte(convertluminance(l1, p1));
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
293 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
294 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
295 if (machine == C64M) { //advanced art studio
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
296 //adv. art studio (=multicolor) 10018 bytes
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
297 //0x0002 bitmap (40*25*8)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
298 //0x1f42 colors1 (40*25)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
299 //0x232a border
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
300 //0x232b background
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
301 //0x233a colors2 (40*25)
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
302 if (fdata.length < 10018) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
303 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
304 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
305 for (y = 0; y < 25; y++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
306 for (x = 0; x < 40; x++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
307 for (y2 = 0; y2 < 8; y2++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
308 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
309 ad = 1024 + x * 8 + y * (320 * 8) + y2 * 320;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
310
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
311 head = 2 + x * 8 + y * (40 * 8) + y2;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
312 mpCopyByte(fdata, ad, head);
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
313
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
314 p1 = fdata[0x1f42 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
315 p2 = (fdata[0x1f42 + x + y * 40] >> 4) & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
316 p3 = fdata[0x233a + x + y * 40] & 0x0f;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
317
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
318 g_map[65536 + x + y * 40] = byte(p1);
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
319 g_map[65536 + x + y * 40 + 1000] = byte(p2);
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
320 g_map[65536 + x + y * 40 + 2000] = byte(p3);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
321 }
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
322 g_map[0] = byte(fdata[0x232a] & 0x0f); //bord
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
323 g_map[1] = byte(fdata[0x232b] & 0x0f); //baku
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
324 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
325 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
326 if (machine == MSX) { // sc2
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
327 // 7=bitmap 32*24*8
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
328 // 7+(32*24*8)=colormap 32*24
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
329 if (fdata.length < 14343) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
330 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
331 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
332 for (y = 0; y < 24; y++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
333 for (x = 0; x < 32; x++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
334 for (y2 = 0; y2 <= 7; y2++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
335 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
336 head = 7 + x * 8 + y * (32 * 8) + y2;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
337 ad = 1024 + x * 8 + y * (256 * 8) + y2 * 256;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
338 mpCopyByte(fdata, ad, head);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
339 p1 = fdata[(8199) + x * 8 + ((y * 8 * 32) + y2)] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
340 p2 = fdata[(8199) + x * 8 + ((y * 8 * 32) + y2)] & 0xf0;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
341 p2 = p2 >> 4;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
342 if (p1 == 0) {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
343 p1 = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
344 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
345 if (p2 == 0) {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
346 p2 = 1;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
347 }
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
348 g_map[65536 + x + y * 32 * 8 + y2 * 32] = byte(p2);
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
349 g_map[65536 + MX * MY * 8 + x + y * 32 * 8 + y2 * 32] = byte(p1);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
350 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
351 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
352 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
353 if (machine == CPC) { // a studio?
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
354 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
355 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
356
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
357 consistency();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
358 refresh();
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
359 g_boxreconstruct = 2;
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
360 return true;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
361 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
362
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
363
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
364 byte[] mpExportFormat(int subformat)
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
365 {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
366 int val1, val2, val3;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
367 int y, y2, yy, x, yp, xp, ad, valu, valu2, bri;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
368
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
369 if (machine == PLUS4) { // botticelli hires
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
370 mpLoadTemplate("g.hires.prg");
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
371 mpSetDataOffs(0x02);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
372 mpExportColorData(40, 25, 65536, 5); //lumis
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
373 mpSetDataOffs(1026);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
374 mpExportColorData(40, 25, 65536, 4); //colors
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
375 mpSetDataOffs(2050);
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
376 mpExportBitmapData(40, 25);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
377 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
378 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
379 if (machine == PLUS4M) { // multi botticelli multicolor
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
380 mpLoadTemplate("m.multi.prg");
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
381 val2 = getpluscolor(int(g_map[1]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
382 val1 = getplusluminance(int(g_map[1]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
383 val3 = val2 * 16 + val1;
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
384 mpSetDataOffs(1025);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
385 mpWriteByte(val3);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
386 val2 = getpluscolor(int(g_map[2]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
387 val1 = getplusluminance(int(g_map[2]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
388 val3 = val2 * 16 + val1;
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
389 mpSetDataOffs(1024);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
390 mpWriteByte(val3);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
391 mpSetDataOffs(1026);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
392 mpExportColorData(40, 25, 65536, 6); //colors
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
393 mpSetDataOffs(2);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
394 mpExportColorData(40, 25, 65536, 7); //lumis
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
395 mpSetDataOffs(2050);
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
396 mpExportBitmapData(40, 25);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
397 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
398 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
399 if (machine == C64) {
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
400 mpLoadTemplate("hires.art");
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
401 mpSetDataOffs(2);
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
402 mpExportBitmapData(40, 25);
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
403 mpSetDataOffs(0x1f42);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
404 mpExportColorData(40, 25, 65536, 0);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
405 mpSetDataOffs(0x232a);
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
406 mpWriteByte(g_map[0]);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
407 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
408 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
409 if (machine == C64M) {
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
410 if (subformat == 0)
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
411 {
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
412 // Advanced Art Studio
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
413 mpLoadTemplate("multic.ocp");
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
414 mpSetDataOffs(2);
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
415 mpExportBitmapData(40, 25);
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
416 mpSetDataOffs(0x1f42);
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
417 mpExportColorData(40, 25, 65536, 1);
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
418 mpSetDataOffs(0x233a);
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
419 mpExportColorData(40, 25, 65536 + 2000, 2);
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
420 mpSetDataOffs(0x232a);
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
421 mpWriteByte(g_map[0]);
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
422 mpSetDataOffs(0x232b);
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
423 mpWriteByte(g_map[1]);
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
424 }
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
425 else
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
426 {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
427 // Koala Painter
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
428 mpLoadTemplate("multic.kla");
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
429 mpSetDataOffs(2);
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
430 mpExportBitmapData(40, 25);
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
431 mpSetDataOffs(0x1f42);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
432 mpExportColorData(40, 25, 65536, 1);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
433 mpSetDataOffs(0x232a);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
434 mpExportColorData(40, 25, 65536 + 2000, 2);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
435 mpSetDataOffs(0x2712);
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
436 mpWriteByte(g_map[1] & 0x0f);
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
437 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
438 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
439 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
440 if (machine == MSX) {
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
441 mpLoadTemplate("msx-screen2.sc2");
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
442 mpSetDataOffs(7);
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
443 mpExportBitmapData(32, 24);
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
444 mpSetDataOffs(7 + (32 * 24 * 8) + 768 + 1280);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
445 mpExportColorData(32, 24, 65536, 3); //there's an exception for msx-style
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
446 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
447 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
448 if (machine == SPECTRUM) {
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
449 mpLoadTemplate("zx-screen.scr");
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
450 mpSetDataOffs(0);
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
451 for (y = 0; y < 3; y++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
452 for (y2 = 0; y2 < 8; y2++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
453 for (yy = 0; yy < 8; yy++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
454 for (x = 0; x < 32; x++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
455 {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
456 yp = y * 64 + yy * 8 + y2;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
457 ad = 1024 + yp * 256 + x * 8;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
458
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
459 valu = g_map[ad + 0] * 128 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
460 g_map[ad + 1] * 64 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
461 g_map[ad + 2] * 32 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
462 g_map[ad + 3] * 16 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
463 g_map[ad + 4] * 8 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
464 g_map[ad + 5] * 4 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
465 g_map[ad + 6] * 2 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
466 g_map[ad + 7] * 1;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
467
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
468 mpWriteByte(valu);
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
469 }
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
470
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
471 for (y = 0; y < 24; y++)
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
472 for (x = 0; x <= 31; x++)
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
473 {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
474 ad = 65536 + x + y * 256;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
475 valu = int(g_map[ad]);
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
476 valu2 = int(g_map[ad + MX * MY * 8]);
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
477 bri = 0;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
478 if (valu >= 8) {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
479 bri = 1;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
480 valu = valu - 8;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
481 valu2 = valu2 - 8;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
482 if (valu2 <= 0) {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
483 valu2 = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
484 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
485 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
486 if (bri == 1) {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
487 valu += 64;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
488 }
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
489 mpWriteByte(valu + valu2 * 8);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
490 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
491 }
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
492 else
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
493 return null;
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
494
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
495 return fdata;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
496 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
497
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
498
117
44a07b1c620d Rename 'bool' -> 'boolean'.
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
499 byte[] mpExportMachinePRG(boolean sorsa)
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
500 {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
501 // any common text headers
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
502 String src = ";machine=" + str(machine) + " (" + g_name + ")\n";
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
503 String bsrc = "";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
504
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
505 if (machine == C64) { //C64 HIRES
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
506
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
507 mpLoadTemplate("c64show.prg");
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
508 mpSetDataOffs(0x0227);
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
509 bsrc = mpExportBitmapData(40, 25);
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
510
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
511 mpSetDataOffs(0x2167);
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
512 mpWriteByte(g_map[0]); //=border
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
513 mpSetDataOffs(0x2168);
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
514 mpWriteByte(g_map[1]); //=background mutta ei tarvita
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
515 mpSetDataOffs(0x2169);
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
516 src += "; The following two first values are border and background\n";
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
517 src += mpExportColorData(40, 25, 65536, 0);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
518
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
519 //c64show.prg
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
520 //offsets
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
521 //0x0227->bitmappi (40x25 x 8 bytee)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
522 //0x2167:borderi väri
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
523 //0x2169->värikartta (40x25 bytee, nyppelit foreg/backg)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
524 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
525 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
526 if (machine == C64M) { //C64 MULTICOLOR
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
527
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
528 mpLoadTemplate("c64mshow.prg");
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
529 mpSetDataOffs(0x0239);
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
530 bsrc = mpExportBitmapData(40, 25);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
531
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
532 // first color information
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
533 mpSetDataOffs(0x2179);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
534 mpWriteByte(g_map[0]);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
535 mpSetDataOffs(0x217A);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
536 mpWriteByte(g_map[1]);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
537 mpSetDataOffs(0x217B);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
538 src += "; The following two first values are border and background\n";
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
539 src += mpExportColorData(40, 25, 65536, 1);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
540
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
541 // second color information
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
542 mpSetDataOffs(0x2563);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
543 src += "; The following goes to $D800 onwards\n";
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
544 src += mpExportColorData(40, 25, 65536 + 2000, 2);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
545
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
546 //c64 multicolor
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
547 //offsets
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
548 //0x0239->bitmappi (40x25 x 8 bytee)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
549 //0x2179:borderi väri
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
550 //0x217A:bäkkis väri
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
551 //0x217B->värikartta 1 (40x25 bytee, nyppelit foreg/backg ilmeisesti)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
552 //0x2563->värikartta 2 (40x25 bytee, nyppeli 3-väri nepan osoitteessa $d800-)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
553 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
554 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
555 if (machine == PLUS4M) { //PLUS4 MULTICOLOR
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
556 mpLoadTemplate("showpfourm.prg");
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
557 src += " .global _bitmap\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
558 src += " .global _color1\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
559 src += " .global _color2\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
560 src += " .global _border\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
561 src += " .global _back1\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
562 src += " .global _back2\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
563 src += "_bitmap:\n";
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
564 mpSetDataOffs(0x013e);
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
565 bsrc = mpExportBitmapData(40, 25);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
566 src += "_border:\n";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
567 val1 = getpluscolor(int(g_map[0]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
568 val2 = getplusluminance(int(g_map[0]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
569 val3 = val2 * 16 + val1;
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
570 mpSetDataOffs(0x207e);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
571 mpWriteByte(val3);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
572 src += " .byte " + val3 +"\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
573 src += "_back1:\n";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
574 val1 = getpluscolor(int(g_map[1]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
575 val2 = getplusluminance(int(g_map[1]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
576 val3 = val2 * 16 + val1;
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
577 mpSetDataOffs(0x207f);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
578 mpWriteByte(val3);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
579 src += " .byte " + val3 +"\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
580 src += "_back2:\n";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
581 val1 = getpluscolor(int(g_map[2]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
582 val2 = getplusluminance(int(g_map[2]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
583 val3 = val2 * 16 + val1;
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
584 mpSetDataOffs(0x2080);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
585 mpWriteByte(val3);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
586 src += " .byte " + val3 +"\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
587 src += "_color1:\n";
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
588 mpSetDataOffs(0x2081);
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
589 src += mpExportColorData(40, 25, 65536, 6);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
590 src += "_color2:\n";
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
591 mpSetDataOffs(0x2469);
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
592 src += mpExportColorData(40, 25, 65536, 7);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
593 //plus4 multic
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
594 //0x013e bitmap (40 x 25 x 8)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
595 //0x207e border
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
596 //0x207f background 1
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
597 //0x2080 background 2
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
598 //0x2081 colors (40 x 25)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
599 //0x2469 luminance (40 x 25)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
600 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
601 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
602 if (machine == PLUS4) { // Plus 4 hires
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
603 mpLoadTemplate("showpfour.prg");
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
604 src += " .global _bitmap\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
605 src += " .global _color\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
606 src += " .global _lumi\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
607 src += " .global _border\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
608 src += "_bitmap:\n";
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
609 mpSetDataOffs(0x0137);
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
610 bsrc = mpExportBitmapData(40, 25);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
611 val1 = getpluscolor(int(g_map[0]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
612 val2 = getplusluminance(int(g_map[0]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
613 val3 = val2 * 16 + val1;
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
614 mpSetDataOffs(0x2077);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
615 mpWriteByte(val3); //border
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
616
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
617 mpSetDataOffs(0x2078);
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
618 src += mpExportColorData(40, 25, 65536, 4); //colors
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
619 mpSetDataOffs(0x2460);
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
620 src += mpExportColorData(40, 25, 65536, 5); //lumis
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
621 //plus4 hires
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
622 //0x0137 bitmap (40 x 25 x 8)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
623 //0x2077 borderi
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
624 //0x2078 colors (40 x 25)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
625 //0x2460 luminance (40 x 25)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
626 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
627 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
628 if (machine == MSX) { // MSX
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
629 mpLoadTemplate("msxshow.com");
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
630 mpSetDataOffs(0x00f9);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
631 src += "\t.globl _nimi1,_nimi2\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
632 src += "\t.area _CODE\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
633 src += "_nimi1:\n";
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
634 bsrc = mpExportBitmapData(32, 24);
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
635 mpSetDataOffs(0x18f9);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
636 //mpWriteByte(g_map[1]); //backg
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
637 //src += "; The first following value is background\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
638 src += "_nimi2:\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
639 src += mpExportColorData(32, 24, 65536, 3); //there's an exception for msx-style
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
640 //msx comm
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
641 //0x00f9 bitmap (32x24 x 8 bytes)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
642 //0x18f9 background color
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
643 //0x18fa colors (32*24 bytes)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
644 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
645 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
646 if (machine == SPECTRUM) { // ZX Spectrum
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
647
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
648 //would need some cleaning up
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
649
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
650 // src += " .area _DATA\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
651 // src += " .globl _taustakuva\n\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
652 // src += "_taustakuva:\n";
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
653 mpLoadTemplate("specshow.tap");
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
654
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
655 int checksum = 0xc9;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
656 for (y = 0x1d24; y <= 0x1d3d; y++) { //1d3e
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
657 checksum = checksum ^ int(g_template[y]);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
658 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
659
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
660 //TAP requires fiddling with the checksum
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
661 //println("Checksum:"+hex(checksum,2));
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
662 mpSetDataOffs(0x0223);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
663 src += ".byte " + (str(g_map[0])) + " ;border\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
664 mpWriteByte(g_map[0]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
665 checksum = checksum ^ int(g_map[0]);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
666
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
667 for (int y = 0; y <= 2; y++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
668 for (int y2 = 0; y2 <= 7; y2++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
669 for (int yy = 0; yy <= 7; yy++)
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
670 {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
671 src += ".byte ";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
672 for (int x = 0; x <= 31; x++)
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
673 {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
674 int yp = y * 64 + yy * 8 + y2,
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
675 ad = 1024 + yp * 256 + x * 8,
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
676 valu = g_map[ad + 0] * 128 + g_map[ad + 1] * 64 + g_map[ad + 2] * 32 + g_map[ad + 3] * 16 + g_map[ad + 4] * 8 + g_map[ad + 5] * 4 + g_map[ad + 6] * 2 + g_map[ad + 7] * 1;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
677
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
678 src += str(valu);
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
679 mpWriteByte(valu);
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
680 checksum = checksum ^ int(valu);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
681 if (x <= 30) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
682 src += ",";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
683 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
684 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
685 src += "\n";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
686 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
687
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
688 src += "; attributes\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
689 for (int y = 0; y < 24; y++)
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
690 {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
691 src += ".byte ";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
692 for (int x = 0; x < 32; x++)
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
693 {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
694 int ad = 65536 + x + y * 256,
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
695 valu = int(g_map[ad]),
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
696 valu2 = int(g_map[ad + MX * MY * 8]),
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
697 bri = 0;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
698
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
699 if (valu >= 8)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
700 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
701 bri = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
702 valu = valu - 8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
703 valu2 = valu2 - 8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
704 if (valu2 <= 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
705 valu2 = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
706 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
707 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
708 if (bri == 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
709 valu = valu + 64;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
710 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
711
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
712 src += str(valu + valu2 * 8);
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
713 mpWriteByte(valu + valu2 * 8);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
714 checksum = checksum ^ int(valu + valu2 * 8);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
715 if (x <= 30) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
716 src += ",";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
717 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
718 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
719 src += "\n";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
720 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
721 //println("checksum:"+hex(checksum,2));
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
722 mpSetDataOffs(0x1d3e);
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
723 mpWriteByte(int(checksum));
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
724 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
725 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
726 if (machine == CPC) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
727 int val1, val2, val3, valu;
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
728 mpLoadTemplate("cpc-mode0.bin");
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
729
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
730 mpSetDataOffs(69); //bitmap offset
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
731 bsrc = mpExportBitmapData_CPC(160, 200);
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
732 mpSetDataOffs(16453);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
733 src += ";palette\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
734 src += ".byte ";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
735
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
736 //fixed # of palette entries, just trying to be generic
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
737 for (int i = 0; i < g_maxcolors; i++)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
738 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
739 val1 = int(g_g[i] / (256 / g_palsteps));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
740 val2 = int(g_r[i] / (256 / g_palsteps));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
741 val3 = int(g_b[i] / (256 / g_palsteps));
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
742
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
743 mpWriteByte(val1 * 9 + val2 * 3 + val3);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
744 src += str(val1 * 9 + val2 * 3 + val3);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
745 if (i < g_maxcolors - 1) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
746 src += ",";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
747 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
748 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
749
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
750 valu = int(g_map[0]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
751 val1 = int(g_g[valu] / (256 / g_palsteps));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
752 val2 = int(g_r[valu] / (256 / g_palsteps));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
753 val3 = int(g_b[valu] / (256 / g_palsteps));
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
754
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
755 src += "\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
756 src += ";border\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
757 src += ".byte ";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
758
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
759 mpSetDataOffs(16469);
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
760
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
761 mpWriteByte(val1 * 9 + val2 * 3 + val3);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
762 src += str(val1 * 9 + val2 * 3 + val3);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
763 //cpc
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
764 //69 bitmap 16384 bytes
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
765 //16453 palette 16 bytes (0..26)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
766 //16469 border color (0..26)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
767 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
768 else
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
769 return null;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
770
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
771 // any common lead-outs
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
772 if (sorsa)
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
773 return src +"\n"+ bsrc;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
774 else
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
775 return g_template;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
776 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
777
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
778
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
779 String mpExportBitmapData_CPC(int xwid, int yy)
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
780 {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
781 int x, y, ad, val1, val2, y2;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
782 int pix0b0, pix0b1, pix0b2, pix0b3;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
783 int pix1b0, pix1b1, pix1b2, pix1b3;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
784 String src = ";bitmap\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
785
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
786 for (y2 = 0; y2 < 8; y2++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
787 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
788 for (y = 0; y < 25; y++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
789 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
790 src += " .byte ";
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
791 for (x = 0; x < int(xwid / 2); x++) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
792 ad = 1024 + (y * 8) * X + (y2 * X) + x * 4;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
793
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
794 val1 = int(g_map[ad]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
795 pix0b0 = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
796 pix0b1 = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
797 pix0b2 = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
798 pix0b3 = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
799 if ((val1 & 1) != 0) pix0b0 = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
800 if ((val1 & 2) != 0) pix0b1 = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
801 if ((val1 & 4) != 0) pix0b2 = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
802 if ((val1 & 8) != 0) pix0b3 = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
803
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
804 val1 = int(g_map[ad + 2]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
805
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
806 pix1b0 = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
807 pix1b1 = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
808 pix1b2 = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
809 pix1b3 = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
810 if ((val1 & 1) != 0) pix1b0 = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
811 if ((val1 & 2) != 0) pix1b1 = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
812 if ((val1 & 4) != 0) pix1b2 = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
813 if ((val1 & 8) != 0) pix1b3 = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
814
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
815 val2 = pix1b3 + pix0b3 * 2 + pix1b1 * 4 + pix0b1 * 8 + pix1b2 * 16 + pix0b2 * 32 + pix1b0 * 64 + pix0b0 * 128;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
816
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
817 src += str(int(val2));
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
818 mpWriteByte(val2);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
819
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
820 if (x < int(xwid / 2) - 1) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
821 src += ",";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
822 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
823 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
824 src += "\n";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
825 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
826 src += " .byte ";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
827
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
828 for (int j = 0; j <= 47; j++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
829 {
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
830 mpWriteByte(0);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
831 src += str(int(0));
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
832 if (j < 47) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
833 src += ",";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
834 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
835 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
836 src += "\n";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
837 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
838 src += "\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
839 return src;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
840 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
841
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
842
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
843 String mpExportBitmapData(int xx, int yy)
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
844 {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
845 String src = "";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
846 //String src = "unsigned char img[]={";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
847
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
848 int linep = 0,
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
849 xwid = xx * 8,
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
850 ywid = yy * 8;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
851
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
852 for (int y = 0; y < yy; y++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
853 for (int x = 0; x < xx; x++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
854 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
855 // src += " .byte ";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
856 src += "\t.db ";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
857 for (int y2 = 0; y2 < 8; y2++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
858 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
859 int ad = 1024 + y * (xwid * 8) + (y2 * xwid) + x * 8;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
860 int value =
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
861 g_map[ad + 0] * 128 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
862 g_map[ad + 1] * 64 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
863 g_map[ad + 2] * 32 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
864 g_map[ad + 3] * 16 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
865 g_map[ad + 4] * 8 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
866 g_map[ad + 5] * 4 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
867 g_map[ad + 6] * 2 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
868 g_map[ad + 7] * 1;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
869
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
870 src += str(int(value));
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
871 mpWriteByte(int(value));
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
872
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
873 if (y2 <= 6) {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
874 src += ",";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
875 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
876 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
877 src += "\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
878 if (++linep == xx)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
879 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
880 linep = 0;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
881 src += "\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
882 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
883 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
884 src += "\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
885
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
886 return src;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
887 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
888
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
889
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
890 int convertluminance(int l, int f)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
891 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
892 int res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
893 if (f == 0) return 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
894 if (l == 0) res = 0 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
895 if (l == 1) res = 15 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
896 if (l == 2) res = 30 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
897 if (l == 3) res = 45 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
898 if (l == 4) res = 60 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
899 if (l == 5) res = 75 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
900 if (l == 6) res = 90 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
901 if (l == 7) res = 105 + f;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
902 return res;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
903 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
904
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
905
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
906 int getplusluminance(int c)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
907 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
908 int res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
909 if (c == 0) res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
910 if (c >= 1 && c <= 15) res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
911 if (c >= 16 && c <= 30) res = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
912 if (c >= 31 && c <= 45) res = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
913 if (c >= 46 && c <= 60) res = 3;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
914 if (c >= 61 && c <= 75) res = 4;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
915 if (c >= 76 && c <= 90) res = 5;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
916 if (c >= 91 && c <= 105) res = 6;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
917 if (c >= 106 && c <= 120) res = 7;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
918 return res;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
919 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
920
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
921
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
922 int getpluscolor(int c)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
923 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
924 int res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
925 if (c == 0) res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
926 if (c >= 1 && c <= 15) res = c;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
927 if (c >= 16 && c <= 30) res = c - 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
928 if (c >= 31 && c <= 45) res = c - 30;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
929 if (c >= 46 && c <= 60) res = c - 45;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
930 if (c >= 61 && c <= 75) res = c - 60;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
931 if (c >= 76 && c <= 90) res = c - 75;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
932 if (c >= 91 && c <= 105) res = c - 90;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
933 if (c >= 106 && c <= 120) res = c - 105;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
934 return res;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
935 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
936
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
937
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
938 String mpExportColorData(int xx, int yy, int source, int param)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
939 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
940 int valu, valu2, kalu, muista, ad, linep, xwid, ywid, xoor, yline, myrpsi;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
941 String src = "";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
942
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
943 xwid = xx * 8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
944 ywid = yy * 8;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
945
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
946 myrpsi = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
947 xoor = xx;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
948
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
949 if (param == 0 || param == 4 || param == 5) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
950 xoor = xx * 8;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
951 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
952 if (machine == MSX) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
953 myrpsi = 7;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
954 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
955 if (param < 2) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
956 src += "colora:\n";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
957 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
958 if (param == 2) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
959 src += "colorb:\n";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
960 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
961 if (param < 2) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
962 src += " .byte " + int(g_map[0]) + "," + int(g_map[1]) +"\n";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
963 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
964 if (param == 3) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
965 // src += "color:\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
966 // src += " .byte ";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
967 // src += g_map[0]+" \n";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
968 xoor = xx * 8;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
969 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
970 if (param == 4) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
971 src += "_border:\n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
972 src += " .byte ";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
973 kalu = getpluscolor(int(g_map[0]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
974 valu2 = getplusluminance(int(g_map[0]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
975 valu = valu2 * 16 + kalu;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
976 src += valu + " \n";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
977 src += "_color:\n";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
978 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
979 if (param == 5) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
980 src += "_lumi:\n";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
981 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
982
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
983 for (int y = 0; y < yy; y++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
984 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
985 //src += " .byte ";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
986 src += "\t.db ";
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
987 for (int x = 0; x < xx; x++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
988 for (yline = 0; yline <= myrpsi; yline++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
989 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
990 ad = source + x + y * xoor + yline * xx;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
991
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
992 switch (param)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
993 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
994 case 0:
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
995 valu = int(g_map[ad]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
996 valu2 = int(g_map[ad + MX * MY * 8]);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
997 break;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
998
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
999 case 1:
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1000 valu2 = int(g_map[ad]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1001 valu = int(g_map[ad + 1000]);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1002 break;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1003
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1004 case 2:
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1005 valu2 = int(g_map[ad]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1006 valu = 0;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1007 break;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1008
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1009 case 3:
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1010 valu = int(g_map[ad]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1011 valu2 = int(g_map[ad + MX * MY * 8]);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1012 break;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1013
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1014 case 4:
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1015 //plus4 colortable
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1016 valu = getpluscolor(int(g_map[ad]));
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1017 valu2 = getpluscolor(int(g_map[ad + MX * MY * 8]));
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1018 break;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1019
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1020 case 5:
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1021 //plus4 lumitable
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1022 valu = getplusluminance(int(g_map[ad + MX * MY * 8]));
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1023 valu2 = getplusluminance(int(g_map[ad]));
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1024 break;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1025
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1026 case 6:
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1027 //plus4 multic1
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1028 valu2 = getpluscolor(int(g_map[ad]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1029 valu = getpluscolor(int(g_map[ad + 1000]));
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1030 break;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1031
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1032 case 7:
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1033 //plus4 multic2
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1034 valu = getplusluminance(int(g_map[ad]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1035 valu2 = getplusluminance(int(g_map[ad + 1000]));
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1036 break;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1037
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1038 default:
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1039 return null;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1040 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1041
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1042 src += str(valu * 16 + valu2);
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1043 mpWriteByte(valu * 16 + valu2);
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1044 if (x < (xx - 1) || yline < myrpsi)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1045 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1046 src += ",";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1047 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1048 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
1049 src += "\n";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1050 }
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
1051
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
1052 return src +"\n";
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1053 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1054
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1055
117
44a07b1c620d Rename 'bool' -> 'boolean'.
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
1056 boolean mpImportFromImage(PImage image)
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1057 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1058 if (image == null)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1059 return false;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1060
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1061 if (image.width <= 16 || image.height <= 16)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1062 return false;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1063
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1064 int balx, baly, xx, yy, x2, y2, rr, gg, bb, avg, molox, i, j, target;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1065 int cx, cy;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1066 int aas, bbs, swap, idefix, avx, avy;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1067 int[] pixut = new int[260];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1068 int[] idx = new int[260];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1069 int[] histog = new int[8192];
14
cecc594d1559 Remove unused code and variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
1070 float ww, hh, fld, compa;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1071 color c;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1072 int xcolors, limitter, vertti, erkki;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1073 int rh, gh, bh;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1074
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1075 xcolors = g_maxcolors;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1076 vertti = 8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1077 erkki = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1078 limitter = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1079 if (g_britemode == 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1080 xcolors = 8;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1081 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1082 if (g_attrimode == 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1083 vertti = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1084 erkki = 8;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1085 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1086 if (g_multic == 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1087 limitter = 4;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1088 } //because zero color can be anywhere?
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1089 if (g_multic == 2) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1090 limitter = 16;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1091 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1092 molox = 1;
6
07ddf9cfc6c2 Cast char to int where needed and other related operations.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
1093 command(int('O')); //special clear screen
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1094 if (g_multic == 1 || g_hzoomer == 2) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1095 molox = 2;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1096 }
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1097
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1098 balx = int(image.width / X) * molox;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1099 baly = int(image.height / Y);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1100 if (balx < 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1101 balx = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1102 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1103 if (baly < 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1104 baly = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1105 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1106
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1107 if (g_palsteps > 0)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1108 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1109 for (i = 0; i < g_maxcolors; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1110 makecolor(i, 0, 0, 0);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1111 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1112
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1113 int maxhis, palls, psteps;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1114 psteps = int(g_palsteps - 1);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1115 maxhis = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1116 palls = int(255 / psteps);
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1117
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1118 for (cy = 0; cy < MY * erkki; cy++)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1119 for (cx = 0; cx < MX; cx++)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1120 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1121 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + molox)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1122 {
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1123 x2 = int(image.width / X) * xx;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1124 y2 = int(image.height / Y) * yy;
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1125 rr = 0;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1126 gg = 0;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1127 bb = 0;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1128 avg = 0;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1129
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1130 for (avy = 0; avy < baly; avy++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1131 for (avx = 0; avx < balx; avx++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1132 c = image.get(x2 + avx, y2 + avy);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1133 rr = rr + int(red(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1134 gg = gg + int(green(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1135 bb = bb + int(blue(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1136 avg++;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1137 }
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1138 }
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1139
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1140 rh = rr / (avg);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1141 gh = gg / (avg);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1142 bh = bb / (avg);
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1143
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1144 rh = int(rh) / palls;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1145 gh = int(gh) / palls;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1146 bh = int(bh) / palls;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1147 histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)]++;
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1148
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1149 if (histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)] > maxhis) {
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1150 maxhis = histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)];
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1151 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1152 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1153
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1154 int step = 0;
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1155 for (j = maxhis; j > 0; j--)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1156 for (i = 0; i <= 4096; i++)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1157 {
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1158 if (histog[i] == j)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1159 {
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1160 rh = i / int(g_palsteps * g_palsteps);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1161 gh = i - int(rh * (g_palsteps * g_palsteps));
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1162 gh = gh / int(g_palsteps);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1163 bh = i - int(rh * (g_palsteps * g_palsteps));
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1164 bh = bh - int(gh * g_palsteps);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1165 rh = rh * int(palls);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1166 gh = gh * int(palls);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1167 bh = bh * int(palls);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1168 if (step < g_maxcolors) {
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1169 makecolor(step, rh, gh, bh);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1170 step++;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1171 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1172 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1173 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1174 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1175
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1176 for (cy = 0; cy < MY * erkki; cy++)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1177 for (cx = 0; cx < MX; cx++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1178 for (i = 0; i < xcolors; i++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1179 pixut[i] = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1180 idx[i] = i;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1181 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1182 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1183 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + molox) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1184 x2 = int(image.width / X) * xx;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1185 y2 = int(image.height / Y) * yy;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1186 rr = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1187 gg = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1188 bb = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1189 avg = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1190 for (avy = 0; avy < baly; avy++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1191 for (avx = 0; avx < balx; avx++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1192 c = image.get(x2 + avx, y2 + avy);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1193 rr = rr + int(red(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1194 gg = gg + int(green(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1195 bb = bb + int(blue(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1196 avg++;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1197 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1198 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1199 rr = rr / (avg);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1200 gg = gg / (avg);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1201 bb = bb / (avg);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1202 g_farge = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1203 target = -1;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1204 compa = 9999;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1205 for (i = 0; i < xcolors; i++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1206 fld = dist(rr, gg, bb, g_r[i], g_g[i], g_b[i]);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1207 if (fld < compa) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1208 compa = fld;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1209 target = i;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1210 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1211 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1212
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1213 g_farge = target;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1214 pixut[target]++; //histogramming
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1215 }
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1216 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1217
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1218 for (aas = 0; aas < xcolors; aas++)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1219 for (bbs = 0; bbs <= aas; bbs++)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1220 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1221 if (pixut[aas] > pixut[bbs])
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1222 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1223 swap = pixut[aas];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1224 pixut[aas] = pixut[bbs];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1225 pixut[bbs] = swap;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1226 swap = idx[aas];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1227 idx[aas] = idx[bbs];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1228 idx[bbs] = swap;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1229 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1230 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1231
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1232 for (idefix = 0; idefix < limitter; idefix++)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1233 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1234 i = idx[idefix];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1235 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1236 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1237 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + molox)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1238 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1239
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1240 x2 = int(image.width / X) * xx;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1241 y2 = int(image.height / Y) * yy;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1242
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1243 rr = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1244 gg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1245 bb = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1246 avg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1247 for (avy = 0; avy < baly; avy++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1248 for (avx = 0; avx < balx; avx++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1249 c = image.get(x2 + avx, y2 + avy);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1250 rr = rr + int(red(c));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1251 gg = gg + int(green(c));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1252 bb = bb + int(blue(c));
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1253 avg++;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1254 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1255 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1256 rr = rr / (avg);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1257 gg = gg / (avg);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1258 bb = bb / (avg);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1259 g_farge = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1260 target = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1261 compa = 9999;
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1262 for (j = 0; j < limitter; j++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1263 fld = dist(rr, gg, bb, g_r[idx[j]], g_g[idx[j]], g_b[idx[j]]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1264 if (fld < compa) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1265 compa = fld;
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1266 target = idx[j];
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1267 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1268 }
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1269 if (i == target) {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1270
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1271 g_farge = target;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1272 makepoint(xx, yy);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1273 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1274 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1275 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1276
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1277 if (idefix == 0) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1278 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1279 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + molox) {
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1280 g_farge = idx[0];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1281 makepoint(xx, yy);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1282 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1283 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1284 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1285 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1286 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1287 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1288
88
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1289
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1290 void mpRenderToImageAt(PImage output, int xoffs, int yoffs)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1291 {
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1292 if (output == null)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1293 return;
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1294
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1295 for (int yy = 0; yy < output.width; yy++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1296 for (int xx = 0; xx < output.width; xx++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1297 {
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1298 color c = color(g_r[259], g_g[259], g_b[259]);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1299 output.set(xx, yy, c);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1300 }
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1301
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1302 for (int yy = 0; yy < Y; yy++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1303 for (int xx = 0; xx < X; xx++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1304 {
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1305 int f;
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1306 if (g_multic == 1 || g_hzoomer == 2)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1307 f = getmultic(chop2(xx), yy, 0);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1308 else
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1309 f = getabsa(xx, yy, 0);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1310
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1311 if (machine == MSX && f == 0)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1312 f = g_map[1];
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1313
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1314 color c = color(g_r[f], g_g[f], g_b[f]);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1315
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1316 for (int vertti = 0; vertti <= g_omag; vertti++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1317 for (int mortti = 0; mortti <= g_omag; mortti++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1318 {
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1319 output.set(
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1320 xx * g_omag + xoffs + mortti,
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1321 yy * g_omag + yoffs + vertti,
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1322 c);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1323 }
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1324 }
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1325 }
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1326
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1327
117
44a07b1c620d Rename 'bool' -> 'boolean'.
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
1328 PImage mpRenderImage(boolean border)
88
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1329 {
94
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1330 PImage output;
88
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1331
94
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1332 if (border)
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1333 {
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1334 pimage = createImage(
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1335 X * g_omag + g_bordh * g_omag,
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1336 Y * g_omag + g_bordv * g_omag,
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1337 RGB);
88
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1338
94
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1339 mpRenderToImageAt(output, int((g_bordh * g_omag) / 2), int((g_bordv * g_omag) / 2));
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1340 }
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1341 else
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1342 {
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1343 output = createImage(X * g_omag, Y * g_omag, RGB);
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1344 mpRenderToImageAt(output, 0, 0);
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1345 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1346
88
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1347 return output;
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1348 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1349
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1350
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1351 void make_c64_palette() {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1352 // Pepto's murky C64 palette: http://www.pepto.de/projects/colorvic
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1353 int rgb[] = {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1354 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1355 0xffFFFFFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1356 0xff68372B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1357 0xff70A4B2,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1358 0xff6F3D86,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1359 0xff588D43,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1360 0xff352879,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1361 0xffB8C76F,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1362 0xff6F4F25,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1363 0xff433900,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1364 0xff9A6759,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1365 0xff444444,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1366 0xff6C6C6C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1367 0xff9AD284,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1368 0xff6C5EB5,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1369 0xff959595
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1370 };
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1371 for (int i = 0; i < g_maxcolors; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1372 rgb[i] = rgb[i] & 0xffffff;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1373 g_grids[i] = rgb[i] + 0xff282828;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1374 makecolor(i, rgb[i] >> 16, (rgb[i] & 0xff00FF00) >> 8, rgb[i] & 0xff0000FF);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1375 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1376 g_grids[1] = 0xffd0d0d0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1377 g_gridmode = NEW;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1378 g_map[13] = byte(C64);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1379 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1380
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1381 void make_plus4_palette() {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1382 int rgb[] = {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1383 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1384 0xff2C2C2C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1385 0xff621307,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1386 0xff00424C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1387 0xff510378,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1388 0xff004E00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1389 0xff27188E,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1390 0xff303E00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1391 0xff582100,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1392 0xff463000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1393 0xff244400,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1394 0xff630448,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1395 0xff004E0C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1396 0xff0E2784,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1397 0xff33118E,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1398 0xff184800,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1399 0xff3B3B3B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1400 0xff702419,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1401 0xff00505A,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1402 0xff601685,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1403 0xff125D00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1404 0xff36289B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1405 0xff3F4C00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1406 0xff663100,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1407 0xff553F00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1408 0xff345200,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1409 0xff711656,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1410 0xff005C1D,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1411 0xff1F3691,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1412 0xff42229B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1413 0xff285700,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1414 0xff424242,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1415 0xff772C21,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1416 0xff055861,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1417 0xff661E8C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1418 0xff1B6400,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1419 0xff3E30A2,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1420 0xff475400,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1421 0xff6D3900,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1422 0xff5C4700,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1423 0xff3B5900,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1424 0xff771F5D,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1425 0xff046325,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1426 0xff273E98,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1427 0xff492AA1,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1428 0xff305E00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1429 0xff515151,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1430 0xff843B31,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1431 0xff17656F,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1432 0xff742E99,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1433 0xff2B7100,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1434 0xff4C3FAF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1435 0xff556200,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1436 0xff7A4709,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1437 0xff6A5500,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1438 0xff4A6700,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1439 0xff852F6B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1440 0xff177135,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1441 0xff364CA5,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1442 0xff5739AE,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1443 0xff3F6B00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1444 0xff7A7A7A,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1445 0xffAC665C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1446 0xff468E97,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1447 0xff9C5AC0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1448 0xff57992E,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1449 0xff766AD5,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1450 0xff7E8A13,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1451 0xffA2713A,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1452 0xff927E20,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1453 0xff748F14,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1454 0xffAC5A93,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1455 0xff459960,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1456 0xff6276CB,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1457 0xff8064D4,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1458 0xff6A9419,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1459 0xff959595,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1460 0xffC58178,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1461 0xff62A8B1,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1462 0xffB675D9,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1463 0xff73B34C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1464 0xff9185ED,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1465 0xff99A433,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1466 0xffBB8C57,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1467 0xffAC993E,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1468 0xff8FAA34,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1469 0xffC676AD,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1470 0xff62B37B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1471 0xff7D91E4,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1472 0xff9B80ED,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1473 0xff85AE38,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1474 0xffAFAFAF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1475 0xffDE9B93,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1476 0xff7DC2CA,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1477 0xffCF90F2,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1478 0xff8DCD68,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1479 0xffAB9FFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1480 0xffB3BE51,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1481 0xffD5A673,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1482 0xffC6B35B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1483 0xffA9C351,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1484 0xffDF91C7,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1485 0xff7DCC96,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1486 0xff97ABFD,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1487 0xffB59AFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1488 0xff9FC755,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1489 0xffE1E1E1,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1490 0xffFFCFC6,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1491 0xffB2F4FC,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1492 0xffFFC4FF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1493 0xffC1FE9D,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1494 0xffDDD2FF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1495 0xffE5F088,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1496 0xffFFD9A8,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1497 0xffF7E591,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1498 0xffDBF588,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1499 0xffFFC4F9,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1500 0xffB1FEC9,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1501 0xffCBDDFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1502 0xffE7CDFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1503 0xffD2F98C
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1504 };
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1505 for (int i = 0; i < g_maxcolors; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1506 rgb[i] = rgb[i] & 0xffffff;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1507 makecolor(i, rgb[i] >> 16, (rgb[i] & 0xff00FF00) >> 8, rgb[i] & 0xff0000FF);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1508 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1509 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1510
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1511 void make_msx_palette() {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1512 int rgb[] = {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1513 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1514 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1515 0xff3EB849,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1516 0xff74D07D,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1517 0xff5955E0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1518 0xff8076F1,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1519 0xffB95E51,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1520 0xff65DBEF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1521 0xffDB6559,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1522 0xffFF897D,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1523 0xffCCC35E,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1524 0xffDED087,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1525 0xff3AA241,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1526 0xffB766B5,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1527 0xffCCCCCC,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1528 0xffFFFFFF
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1529 };
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1530
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1531 for (int i = 0; i < g_maxcolors; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1532 rgb[i] = rgb[i] & 0xffffff;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1533 g_grids[i] = rgb[i] + 0xff1f1f1f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1534 makecolor(i, (rgb[i] >> 16), (rgb[i] & 0xff00FF00) >> 8, rgb[i] & 0xff0000FF);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1535 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1536 g_grids[5] = 0xff9f95Ff;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1537 g_grids[7] = 0xff84faEF;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1538 g_grids[9] = 0xffffa99d;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1539 g_grids[15] = 0xffd8d8d8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1540 g_gridmode = NEW;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1541 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1542
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1543 void make_spectrum_palette() {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1544 int rgb[] = {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1545 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1546 0xff0000C0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1547 0xffC00000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1548 0xffC000C0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1549 0xff00C000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1550 0xff00C0C0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1551 0xffC0C000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1552 0xffC0C0C0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1553 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1554 0xff0000FF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1555 0xffFF0000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1556 0xffFF00FF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1557 0xff00FF00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1558 0xff00FFFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1559 0xffFFFF00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1560 0xffFFFFFF
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1561 };
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1562
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1563 g_grids[9] = 0xff0000d8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1564 g_grids[10] = 0xffd80000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1565 g_grids[11] = 0xffd800d8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1566 g_grids[12] = 0xff00d800;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1567 g_grids[13] = 0xff00d8d8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1568 g_grids[14] = 0xffd8d800;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1569 g_grids[15] = 0xffd8d8d8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1570 for (int i = 0; i < g_maxcolors; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1571 rgb[i] = rgb[i] & 0xffffff;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1572 if (i <= 8) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1573 g_grids[i] = rgb[i] + 0xff282828;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1574 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1575 makecolor(i, (rgb[i] >> 16), (rgb[i] & 0xff00FF00) >> 8, rgb[i] & 0xff0000FF);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1576 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1577 g_gridmode = NEW;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1578 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1579
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
1580
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1581 void mpSetupMachine(int m)
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
1582 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1583 machine = m;
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1584 g_exportext = "none";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1585 g_map[3] = byte(machine);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1586 g_map[13] = byte(machine);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1587 g_palsteps = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1588 g_farge = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1589 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1590 g_britemode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1591 g_charlimit = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1592 g_hzoomer = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1593 g_backmode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1594 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1595 g_formatext = "";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1596 g_maxcolors = 16;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1597 X = 320;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1598 Y = 200;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1599
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1600 if (machine == C64) { //c64 hires
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1601 g_name = "c64";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1602 g_exportext = "prg";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1603 g_exportname = "PRG file";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1604 g_formatname = "Art Studio";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1605 g_formatext = "art";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1606
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1607 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1608 g_map[1] = byte(255);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1609 g_map[0] = 6;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1610 make_c64_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1611 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1612 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1613 if (machine == CPC) { //Amstrad CPC mode 0
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1614 g_name = "cpc";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1615 g_exportext = "bin";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1616 g_exportname = "BIN file"
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1617 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1618 g_formatext = "";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1619
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1620 g_hzoomer = 2;
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1621 g_palsteps = 3;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1622 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1623 g_attrimode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1624 g_map[1] = byte(255);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1625 g_map[0] = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1626
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1627 makecolor(0, 0, 0, 0);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1628 makecolor(1, 0x0, 0x0, 0x80);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1629 makecolor(2, 0x00, 0x00, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1630 makecolor(3, 0x80, 0x00, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1631 makecolor(4, 0x80, 0x00, 0x80);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1632 makecolor(5, 0x80, 0x00, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1633 makecolor(6, 0xFF, 0x00, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1634 makecolor(7, 0xFF, 0x00, 0x80);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1635 makecolor(8, 0xFF, 0x00, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1636 makecolor(9, 0x00, 0x80, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1637 makecolor(10, 0x00, 0x80, 0x80);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1638 makecolor(11, 0x00, 0x80, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1639 makecolor(12, 0x80, 0x80, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1640 makecolor(13, 0x80, 0x80, 0x80);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1641 makecolor(14, 0x80, 0x80, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1642 makecolor(15, 0xFF, 0xFF, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1643 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1644 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1645 if (machine == MSX) { // MSX
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1646 g_name = "msx";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1647 g_exportext = "com";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1648 g_exportname = "COM file";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1649 g_formatname = "Screen 2";
68
59731a72ce8b Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
1650 g_formatext = "sc2";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1651
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1652 X = 256;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1653 Y = 192;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1654 g_attrimode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1655 g_backmode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1656 g_farge = 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1657 g_backg = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1658
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1659 //TI99 variant
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1660 /*
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1661 makecolor(0,0,0,0);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1662 makecolor(1,0,0,0);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1663
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1664 makecolor(2,0x21,0xc8,0x42); //21c842 medgreen
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1665 makecolor(3,0x5e,0xdc,0x78);//5edc78 light green
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1666 makecolor(4,0x54,0x55,0xed);//5455ed dark blue
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1667 makecolor(5,0x7d,0x76,0xFc);//7d76fc light blue
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1668
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1669 makecolor(6,0xd4,0x52,0x4d); //d4524d dark red
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1670 makecolor(7,0x42,0xeb,0xf5); //42ebf5 cyan
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1671 makecolor(8,0xfc,0x55,0x54); //fc5554 medium red
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1672 makecolor(9,0xff,0x79,0x78); //ff7978 light red
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1673 makecolor(10,0xd4,0xc1,0x54);// d4c154 dark yellow
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1674 makecolor(11,0xe6,0xce,0x80);// e6ce80 light yellow
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1675 makecolor(12,0x21,0xb0,0x3b);// 21b03b dark green
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1676 makecolor(13,0xc9,0x5b,0xba);// c95bba magenta
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1677 makecolor(14,0xCc,0xcc,0xCc);// gray
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1678 makecolor(15,0xFF,0xFF,0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1679 */
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1680 make_msx_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1681 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1682 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1683 if (machine == SPECTRUM) { // ZX Spectrum
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1684 g_name = "spec";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1685 g_exportext = "tap";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1686 g_exportname = "TAP file";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1687 g_formatname = "Screen$";
68
59731a72ce8b Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
1688 g_formatext = "scr";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1689
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1690 X = 256;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1691 Y = 192;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1692 g_farge = 7;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1693 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1694 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1695 g_britemode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1696 g_map[0] = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1697 g_map[1] = byte(255);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1698 make_spectrum_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1699 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1700 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1701 if (machine == TIMEX) { // timex sinclair
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1702 g_name = "tmx";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1703
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1704 X = 256;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1705 Y = 192;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1706 g_farge = 7;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1707 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1708 g_attrimode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1709 g_britemode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1710 g_map[1] = byte(255);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1711 make_spectrum_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1712 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1713 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1714 if (machine == JR200) { // Panasonic JR200
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1715 g_name = "jr200";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1716
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1717 X = 256;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1718 Y = 192;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1719 g_maxcolors = 8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1720 g_farge = 7;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1721 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1722 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1723 g_map[1] = byte(255);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1724 make_spectrum_palette(); //cheating
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1725 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1726 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1727 if (machine == PLUS4M || machine == PLUS4) { // Commodore plus/4
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1728 g_name = "plus4m";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1729 g_exportext = "prg";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1730 g_exportname = "PRG file";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1731 g_formatname = "M.Botticelli";
68
59731a72ce8b Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
1732 g_formatext = "prg";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1733
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1734 g_backmode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1735 g_multic = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1736 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1737 g_maxcolors = 121;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1738 g_charlimit = 2;
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1739 g_map[0] = 6;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1740 g_map[1] = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1741 g_map[2] = 61;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1742 g_farge = 61;
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1743
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1744 if (machine == PLUS4) { // plus/4 hires
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1745 g_name = "plus4";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1746 g_formatname = "Botticelli";
68
59731a72ce8b Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
1747 g_formatext = "prg";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1748 g_multic = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1749 g_backmode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1750 g_charlimit = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1751 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1752 g_map[1] = byte(255);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1753 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1754 make_plus4_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1755 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1756 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1757 if (machine == C64M) { //c64 multicolor
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1758 g_name = "c64m";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1759 g_exportext = "prg";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1760 g_exportname = "PRG file";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1761 g_formatname = "A. A. Studio";
68
59731a72ce8b Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
1762 g_formatext = "ocp";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1763
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1764 g_backmode = 1;
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1765 g_charlimit = 3;
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1766 g_multic = 1;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1767 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1768 g_map[1] = byte(0);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1769 g_map[0] = 6;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1770 make_c64_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1771 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1772 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1773 if (machine == AMIGA) { //generic 16bit
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1774 g_name = "test";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1775 g_exportext = "";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1776 g_exportname = "";
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
1777 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1778 g_formatext = "";
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
1779
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1780 g_backmode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1781 g_maxcolors = 32;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1782 g_palsteps = 16;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1783 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1784 g_attrimode = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1785 g_map[1] = byte(0);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1786 for (int z = 0; z < g_maxcolors; z++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1787 if (z < 16) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1788 makecolor(z, z * 17, z * 17, z * 17);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1789 } else {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1790 makecolor(z, (z - 16) * 17, 0, 0);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1791 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1792 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1793 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1794 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1795 if (machine == C64FLI) { //c64 hires FLI = AFLI
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
1796 g_name = "afli";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1797 g_exportext = "prg";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1798 g_exportname = "PRG file";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1799 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1800 g_formatext = "";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1801
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1802 g_attrimode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1803 g_map[1] = byte(255);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1804 g_map[0] = 6;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1805 make_c64_palette();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1806 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1807 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1808 if (machine == C64FLIM) { //C64 FLI multicolor
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1809 g_name = "fli";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1810 g_exportext = "";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1811 g_exportname = "PRG file";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1812 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1813 g_formatext = "";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1814
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1815 g_hzoomer = 2;
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1816 g_maxcolors = 16;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1817 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1818 g_attrimode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1819 g_map[1] = byte(255);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1820 g_map[0] = 6;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1821 make_c64_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1822 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1823 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1824 if (machine == FAKEX) { // Fake 8-bit computer
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1825 g_name = "fake";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1826 g_exportext = "";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1827 g_exportname = "";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1828 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1829 g_formatext = "";
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
1830
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1831 X = 320;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1832 Y = 200;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1833 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1834 g_attrimode = 2; //g_palsteps=4;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1835 g_farge = 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1836 g_backg = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1837 make_c64_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1838 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1839 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1840 if (machine == PICO8) { // Pico-8 fantasy console
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1841 g_name = "pico8";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1842 g_exportext = "";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1843 g_exportname = "";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1844 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1845 g_formatext = "";
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
1846
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1847 X = 128;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1848 Y = 128;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1849 g_farge = 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1850 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1851 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1852 g_attrimode = 2;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1853 makecolor(0, 0, 0, 0);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1854 makecolor(1, 32, 51, 123);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1855 makecolor(2, 126, 37, 83);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1856 makecolor(3, 0, 144, 61);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1857 makecolor(4, 171, 82, 54);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1858 makecolor(5, 52, 54, 53);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1859 makecolor(6, 194, 195, 199);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1860 makecolor(7, 255, 241, 232);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1861 makecolor(8, 255, 0, 77);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1862 makecolor(9, 255, 155, 0);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1863 makecolor(10, 255, 231, 39);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1864 makecolor(11, 0, 226, 50);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1865 makecolor(12, 41, 173, 255);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1866 makecolor(13, 132, 112, 169);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1867 makecolor(14, 255, 119, 168);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1868 makecolor(15, 255, 214, 197);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1869 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1870 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1871 if (machine == UNIA) { // Unia digital palette
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1872 g_name = "unia";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1873 g_exportext = "";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1874 g_exportname = "";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1875 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1876 g_formatext = "";
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
1877
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1878 X = 256;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1879 Y = 192;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1880 g_farge = 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1881 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1882 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1883 g_attrimode = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1884 makecolor(0, 0, 0, 0);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1885 makecolor(1, 0xff, 0xff, 0xff);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1886 makecolor(2, 0xff, 0xfd, 0x38);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1887 makecolor(3, 0xff, 0xc5, 0x00);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1888 makecolor(4, 0xff, 0x00, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1889 makecolor(5, 0xff, 0x3c, 0xb4);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1890 makecolor(6, 0xa0, 0x23, 0xbc);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1891 makecolor(7, 0x1b, 0xa1, 0xfc);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1892 makecolor(8, 0xe1, 0xe1, 0xe1);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1893 makecolor(9, 0xb9, 0x63, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1894 makecolor(10, 0xff, 0xaa, 0xbe);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1895 makecolor(11, 0xd2, 0x9b, 0xd7);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1896 makecolor(12, 0xad, 0xad, 0xad);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1897 makecolor(13, 0x00, 0xb7, 0xb7);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1898 makecolor(14, 0x23, 0xaf, 0x32);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1899 makecolor(15, 0x29, 0xf7, 0xa7);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1900 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1901 }