Mercurial > hg > forks > multipaint-js
annotate exporters.pde @ 222:0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
in FBI FLI Designer v1.1 format.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 05 Sep 2018 12:57:46 +0300 |
parents | 823672f83ae9 |
children | 33a5c7670e66 |
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 // |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
6 |
49 | 7 |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
8 public class MPWriteCtx |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
9 { |
126 | 10 public int m_offs, m_bpl, m_bytes, m_indent, m_state, m_intmode; |
11 public String m_byteDef, m_eol, m_src, m_prefix; | |
12 public byte[] m_data; | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
13 |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
14 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 m_offs = 0; |
126 | 17 m_data = new byte[1*1024]; |
18 | |
19 setBPLOff(); | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
20 m_bytes = 0; |
126 | 21 m_state = -1; |
22 | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
23 m_indent = 4; |
126 | 24 |
121
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"; |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
28 |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
29 m_intmode = 0; |
126 | 30 m_prefix = ""; |
121
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 |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
33 void setOffs(int offs) |
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 m_offs = offs; |
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 |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
38 void setBPL(int bpl) |
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 m_bpl = bpl; |
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 |
126 | 43 void setBPLOff() |
44 { | |
45 m_bpl = -1; | |
46 } | |
47 | |
48 void loadTemplate(String fname) | |
49 { | |
50 m_data = mpLoadBinaryFile("templates/" + fname); | |
51 } | |
52 | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
53 byte[] getData() |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
54 { |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
55 return m_data; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
56 } |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
57 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
58 byte[] getSource() |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
59 { |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
60 return m_src; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
61 } |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
62 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
63 String getHexValue(int dval, int dlen) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
64 { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
65 static final String mpHexChars[16] = "0123456789abcdef"; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
66 char[] dstr = new char[dlen]; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
67 |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
68 for (i = dlen - 1; i >= 0; i--) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
69 { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
70 dstr[i] = mpHexChars[dval & 0x0f]; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
71 dval >>= 4; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
72 } |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
73 |
129 | 74 return dstr.join(''); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
75 } |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
76 |
126 | 77 String getByteStr(int val) |
78 { | |
79 switch (m_intmode) | |
80 { | |
81 case 0: return str(val & 0xff); | |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
82 case 1: return "$"+ getHexValue(val & 0xff, 2); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
83 case 2: return getHexValue(val & 0xff, 2) +"h"; |
126 | 84 } |
85 } | |
86 | |
87 void addIndent() | |
88 { | |
89 for (int n = 0; n < m_indent; n++) | |
90 m_src += " "; | |
91 } | |
92 | |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
93 void addByteSep() |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
94 { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
95 m_src += ","; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
96 } |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
97 |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
98 void addEOL() |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
99 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
100 m_state = 4; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
101 m_src += m_eol; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
102 } |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
103 |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
104 void addByteDef(boolean force) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
105 { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
106 if (m_state != 2 || force) |
126 | 107 { |
108 m_src += m_eol; | |
109 addIndent(); | |
110 } | |
111 | |
112 m_src += m_byteDef +" "; | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
113 m_bytes = 0; |
126 | 114 m_state = 2; |
115 } | |
116 | |
117 void addLabel(String blabel, boolean nl) | |
118 { | |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
119 if (m_state != 3) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
120 addEOL(); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
121 |
126 | 122 m_src += m_prefix + blabel +":"+ (nl ? " " : ""); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
123 m_state = 3; |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
124 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
125 |
125 | 126 void addComment(String bstr) |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
127 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
128 if (m_state != 4) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
129 addEOL(); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
130 |
126 | 131 m_src += "; "+ bstr + m_eol; |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
132 m_state = 4; |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
133 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
134 |
126 | 135 void addLine(String bstr) |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
136 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
137 if (m_state != 4) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
138 addEOL(); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
139 |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
140 m_src += bstr.replace("@@", m_prefix) + m_eol; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
141 m_state = 4; |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
142 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
143 |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
144 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
|
145 { |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
146 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
|
147 |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
148 if (blabel != null) |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
149 { |
126 | 150 addLabel(blabel, true); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
151 m_state = 2; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
152 addByteDef(false); |
126 | 153 m_src += getByteStr(bval); |
154 m_src += m_eol; | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
155 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
156 else |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
157 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
158 if (m_state != 2) |
126 | 159 addByteDef(true); |
160 else | |
129 | 161 if (m_bpl > 0 && m_bytes >= m_bpl) |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
162 addByteDef(true); |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
163 |
126 | 164 if (m_bytes++ > 0) |
165 addByteSep(); | |
166 | |
167 m_src += getByteStr(bval); | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
168 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
169 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
170 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
171 void writeByteAt(int boffs, int bval, String blabel) |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
172 { |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
173 m_offs = boffs; |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
174 writeByte(bval, blabel); |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
175 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
176 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
177 |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
178 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
179 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
|
180 { |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
181 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 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
|
187 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
|
188 g_map[moffs + 7] = byte( fdata[toffs] & 1); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
189 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
190 |
29
249c4f5742f3
Refactor the import/export stuff a bit and the GUI bits for JS.
Matti Hamalainen <ccr@tnsp.org>
parents:
14
diff
changeset
|
191 |
117 | 192 boolean mpImportFormat(byte[] fdata) |
84
025efefd1704
Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
193 { |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
194 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
|
195 int p1, p2, p3; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
196 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
197 head = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
198 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
199 if (g_machine == SPECTRUM) //SCR=SCREEN$ |
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 // 32*24*8 bytes of bitmap |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
202 // 32*24 bytes of attributes |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
203 if (fdata.length < 6912) { |
49 | 204 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
205 } |
49 | 206 for (y = 0; y < 3; y++) |
207 for (y2 = 0; y2 < 8; y2++) | |
208 for (yy = 0; yy < 8; yy++) | |
209 for (x = 0; x < 32; x++) | |
210 { | |
211 yp = y * 64 + yy * 8 + y2; | |
212 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
|
213 mpCopyByte(fdata, ad, head); |
49 | 214 head++; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
215 } |
49 | 216 |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
217 for (y = 0; y < 24; y++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
218 for (x = 0; x < 32; x++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
219 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
220 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
|
221 valu = fdata[head]; |
158 | 222 int bri = (valu >> 6) & 1; |
223 int ink = (valu & 7) + bri * 8; | |
224 int pap = ((valu >> 3) & 7) + bri * 8; | |
225 if (pap == 8) | |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
226 pap = 0; |
158 | 227 |
228 for (y2 = 0; y2 < 8; y2++) | |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
229 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
230 g_map[ad + y2 * 32] = byte(ink); |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
231 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
|
232 } |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
233 head++; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
234 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
235 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
236 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
237 if (g_machine == C64) { |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
238 //0x0002->bitmap |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
239 //0x1f42->colormap |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
240 //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
|
241 if (fdata.length < 9006) { |
49 | 242 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
243 } |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
244 if (fdata.length >= 0x232a) { |
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
245 g_map[0] = byte(fdata[0x232a] & 0x0f); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
246 } |
49 | 247 for (y = 0; y < 25; y++) |
248 for (x = 0; x < 40; x++) | |
158 | 249 for (y2 = 0; y2 < 8; y2++) |
49 | 250 { |
251 head = 2 + x * 8 + y * (40 * 8) + y2; | |
252 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
|
253 mpCopyByte(fdata, ad, head); |
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
254 p1 = fdata[0x1f42 + x + y * 40] & 0x0f; |
158 | 255 p2 = (fdata[0x1f42 + x + y * 40] >> 4) & 0x0f; |
256 | |
49 | 257 g_map[65536 + x + y * 40 * 8 + y2 * 40] = byte(p2); |
258 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
|
259 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
260 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
261 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
262 if (g_machine == PLUS4) { // Botticelli |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
263 //g.hires.prg = botticelli |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
264 //2 - luminance 40*25 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
265 //1026 - colors 40*25 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
266 //2050 - bitmappi 40*25*8 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
267 if (fdata.length < 10050) { |
49 | 268 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
269 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
270 int l1, l2; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
271 for (y = 0; y < 25; y++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
272 for (x = 0; x < 40; x++) |
158 | 273 for (y2 = 0; y2 < 8; y2++) |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
274 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
275 head = 2050 + x * 8 + y * (40 * 8) + y2; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
276 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
|
277 mpCopyByte(fdata, ad, head); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
278 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
279 p1 = fdata[1026 + x + y * 40] & 0x0f; |
158 | 280 p2 = (fdata[1026 + x + y * 40] >> 4) & 0x0f; |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
281 l1 = fdata[2 + x + y * 40] & 0x0f; |
158 | 282 l2 = (fdata[2 + x + y * 40] >> 4) & 0x0f; |
283 | |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
284 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
|
285 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
|
286 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
287 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
288 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
289 if (g_machine == PLUS4M) { // Multi Botticelli |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
290 //m.multi.prg = multi botticelli |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
291 //2- lumins 40*25 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
292 //1024 - bäkki1 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
293 //1025 - bäkki2 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
294 //1026 - colors 40*25 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
295 //2050 - bitmap 40*25*8 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
296 if (fdata.length < 10050) { |
49 | 297 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
298 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
299 int l1, l2; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
300 for (y = 0; y < 25; y++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
301 for (x = 0; x < 40; x++) |
158 | 302 for (y2 = 0; y2 < 8; y2++) |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
303 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
304 head = 2050 + x * 8 + y * (40 * 8) + y2; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
305 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
|
306 mpCopyByte(fdata, ad, head); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
307 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
308 p1 = fdata[1026 + x + y * 40] & 0x0f; |
158 | 309 p2 = (fdata[1026 + x + y * 40] >> 4) & 0x0f; |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
310 l1 = fdata[2 + x + y * 40] & 0x0f; |
158 | 311 l2 = (fdata[2 + x + y * 40] >> 4) & 0x0f; |
312 | |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
313 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
|
314 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
|
315 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
316 |
158 | 317 p1 = (int(fdata[1025]) >> 4) & 0x0f; |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
318 l1 = int(fdata[1025]) & 0x0f; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
319 g_map[1] = byte(convertluminance(l1, p1)); |
158 | 320 |
321 p1 = (int(fdata[1024]) >> 4) & 0x0f; | |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
322 l1 = int(fdata[1024]) & 0x0f; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
323 g_map[2] = byte(convertluminance(l1, p1)); |
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 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
326 if (g_machine == C64M) { //advanced art studio |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
327 //adv. art studio (=multicolor) 10018 bytes |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
328 //0x0002 bitmap (40*25*8) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
329 //0x1f42 colors1 (40*25) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
330 //0x232a border |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
331 //0x232b background |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
332 //0x233a colors2 (40*25) |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
333 if (fdata.length < 10018) { |
49 | 334 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
335 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
336 for (y = 0; y < 25; y++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
337 for (x = 0; x < 40; x++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
338 for (y2 = 0; y2 < 8; y2++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
339 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
340 ad = 1024 + x * 8 + y * (320 * 8) + y2 * 320; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
341 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
|
342 mpCopyByte(fdata, ad, head); |
11 | 343 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
344 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
|
345 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
|
346 p3 = fdata[0x233a + x + y * 40] & 0x0f; |
85
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 * 40] = byte(p1); |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
349 g_map[65536 + x + y * 40 + 1000] = byte(p2); |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
350 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
|
351 } |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
352 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
|
353 g_map[1] = byte(fdata[0x232b] & 0x0f); //baku |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
354 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
355 else |
222
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
356 if (g_machine == C64FLIM) { |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
357 // FBI Crew FLI designer 1.x & 2.0 (unpacked) |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
358 // { DO_COPY , DS_COLOR_RAM , 0x0000, 0, 0, 0, NULL, NULL }, |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
359 // DEF_SCREEN_RAMS_8(0x0400, 0, 0x400, 0), |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
360 // { DO_COPY , DS_BITMAP_RAM , 0x2400, 0, 0, 0, NULL, NULL }, |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
361 // { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL }, |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
362 if (fdata.length != 17409) { |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
363 // TODO XXX: Check for load addresses 3c00 and 3ff0 |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
364 return false; |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
365 } |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
366 for (y = 0; y < 25; y++) |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
367 for (x = 0; x < 40; x++) |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
368 for (y2 = 0; y2 < 8; y2++) |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
369 { |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
370 ad = x + y * 40; |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
371 mpCopyByte(fdata, |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
372 1024 + x * 8 + y * (320 * 8) + y2 * 320, |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
373 0x2402 + x * 8 + y * (40 * 8) + y2); |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
374 |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
375 p1 = fdata[0x0402 + ad] & 0x0f; |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
376 p2 = (fdata[0x0402 + ad] >> 4) & 0x0f; |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
377 p3 = fdata[0x0002 + ad] & 0x0f; |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
378 |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
379 g_map[65536 + x + y * 40] = byte(p1); |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
380 g_map[65536 + x + y * 40 + 1000] = byte(p2); |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
381 g_map[65536 + x + y * 40 + 2000] = byte(p3); |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
382 } |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
383 g_map[0] = byte(0); //bord |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
384 g_map[1] = byte(0); //baku |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
385 } |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
386 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
387 if (g_machine == MSX) { // sc2 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
388 // 7=bitmap 32*24*8 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
389 // 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
|
390 if (fdata.length < 14343) { |
49 | 391 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
392 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
393 for (y = 0; y < 24; y++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
394 for (x = 0; x < 32; x++) |
158 | 395 for (y2 = 0; y2 < 8; y2++) |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
396 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
397 head = 7 + x * 8 + y * (32 * 8) + y2; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
398 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
|
399 mpCopyByte(fdata, ad, head); |
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
400 p1 = fdata[(8199) + x * 8 + ((y * 8 * 32) + y2)] & 0x0f; |
158 | 401 p2 = (fdata[(8199) + x * 8 + ((y * 8 * 32) + y2)] >> 4) & 0x0f; |
402 | |
403 if (p1 == 0) | |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
404 p1 = 1; |
158 | 405 if (p2 == 0) |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
406 p2 = 1; |
158 | 407 |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
408 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
|
409 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
|
410 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
411 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
412 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
413 if (g_machine == CPC) { // a studio? |
49 | 414 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
415 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
416 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
417 consistency(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
418 refresh(); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
419 g_boxreconstruct = 2; |
49 | 420 return true; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
421 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
422 |
49 | 423 |
126 | 424 boolean mpExportFormat(MPWriteCtx ctx, int subformat) |
49 | 425 { |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
426 int val1, val2, val3; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
427 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
|
428 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
429 if (g_machine == PLUS4) { // botticelli hires |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
430 ctx.loadTemplate("g.hires.prg"); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
431 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
432 ctx.setOffs(0x02); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
433 mpExportColorData(ctx, 40, 25, 65536, 5); //lumis |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
434 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
435 ctx.setOffs(1026); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
436 mpExportColorData(ctx, 40, 25, 65536, 4); //colors |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
437 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
438 ctx.setOffs(2050); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
439 mpExportBitmapData(ctx, 40, 25); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
440 } |
49 | 441 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
442 if (g_machine == PLUS4M) { // multi botticelli multicolor |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
443 ctx.loadTemplate("m.multi.prg"); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
444 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
445 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
|
446 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
|
447 val3 = val2 * 16 + val1; |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
448 ctx.writeByteAt(1025, val3); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
449 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
450 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
|
451 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
|
452 val3 = val2 * 16 + val1; |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
453 ctx.writeByteAt(1024, val3); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
454 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
455 ctx.setOffs(1026); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
456 mpExportColorData(ctx, 40, 25, 65536, 6); //colors |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
457 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
458 ctx.setOffs(2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
459 mpExportColorData(ctx, 40, 25, 65536, 7); //lumis |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
460 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
461 ctx.setOffs(2050); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
462 mpExportBitmapData(ctx, 40, 25); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
463 } |
49 | 464 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
465 if (g_machine == C64) { |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
466 ctx.loadTemplate("hires.art"); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
467 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
468 ctx.setOffs(2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
469 mpExportBitmapData(ctx, 40, 25); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
470 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
471 ctx.setOffs(0x1f42); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
472 mpExportColorData(ctx, 40, 25, 65536, 0); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
473 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
474 ctx.writeByteAt(0x232a, g_map[0]); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
475 } |
49 | 476 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
477 if (g_machine == C64M) { |
90
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
478 if (subformat == 0) |
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
479 { |
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
480 // Advanced Art Studio |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
481 ctx.loadTemplate("multic.ocp"); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
482 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
483 ctx.setOffs(2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
484 mpExportBitmapData(ctx, 40, 25); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
485 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
486 ctx.setOffs(0x1f42); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
487 mpExportColorData(ctx, 40, 25, 65536, 1); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
488 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
489 ctx.setOffs(0x233a); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
490 mpExportColorData(ctx, 40, 25, 65536 + 2000, 2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
491 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
492 ctx.writeByteAt(0x232a, g_map[0]); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
493 ctx.writeByteAt(0x232b, g_map[1]); |
90
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
494 } |
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
495 else |
49 | 496 { |
497 // Koala Painter | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
498 ctx.loadTemplate("multic.kla"); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
499 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
500 ctx.setOffs(2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
501 mpExportBitmapData(ctx, 40, 25); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
502 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
503 ctx.setOffs(0x1f42); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
504 mpExportColorData(ctx, 40, 25, 65536, 1); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
505 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
506 ctx.setOffs(0x232a); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
507 mpExportColorData(ctx, 40, 25, 65536 + 2000, 2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
508 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
509 ctx.writeByteAt(0x2712, g_map[1] & 0x0f); |
49 | 510 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
511 } |
49 | 512 else |
222
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
513 if (g_machine == C64FLIM) { |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
514 // FBI Crew FLI designer 1.x & 2.0 (unpacked) |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
515 // { DO_COPY , DS_COLOR_RAM , 0x0000, 0, 0, 0, NULL, NULL }, |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
516 // DEF_SCREEN_RAMS_8(0x0400, 0, 0x400, 0), |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
517 // { DO_COPY , DS_BITMAP_RAM , 0x2400, 0, 0, 0, NULL, NULL }, |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
518 // { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL }, |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
519 ctx.loadTemplate("fbifd.fd1"); |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
520 |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
521 ctx.setOffs(2); |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
522 mpExportColorData(ctx, 40, 25, 65536 + 2000, 2); |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
523 |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
524 for (int nbank = 1; nbank <= 8; nbank++) |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
525 { |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
526 ctx.setOffs(2 + nbank * 0x0400); |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
527 mpExportColorData(ctx, 40, 25, 65536, 1); |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
528 } |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
529 |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
530 ctx.setOffs(0x2402); |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
531 mpExportBitmapData(ctx, 40, 25); |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
532 } |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
533 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
534 if (g_machine == MSX) { |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
535 ctx.loadTemplate("msx-screen2.sc2"); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
536 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
537 ctx.setOffs(7); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
538 mpExportBitmapData(ctx, 32, 24); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
539 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
540 ctx.setOffs(7 + (32 * 24 * 8) + 768 + 1280); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
541 mpExportColorData(ctx, 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
|
542 } |
49 | 543 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
544 if (g_machine == SPECTRUM) { |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
545 ctx.loadTemplate("zx-screen.scr"); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
546 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
547 ctx.setOffs(0); |
49 | 548 for (y = 0; y < 3; y++) |
549 for (y2 = 0; y2 < 8; y2++) | |
550 for (yy = 0; yy < 8; yy++) | |
551 for (x = 0; x < 32; x++) | |
552 { | |
553 yp = y * 64 + yy * 8 + y2; | |
554 ad = 1024 + yp * 256 + x * 8; | |
555 | |
556 valu = g_map[ad + 0] * 128 + | |
557 g_map[ad + 1] * 64 + | |
558 g_map[ad + 2] * 32 + | |
559 g_map[ad + 3] * 16 + | |
560 g_map[ad + 4] * 8 + | |
561 g_map[ad + 5] * 4 + | |
562 g_map[ad + 6] * 2 + | |
563 g_map[ad + 7] * 1; | |
564 | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
565 ctx.writeByte(valu); |
49 | 566 } |
567 | |
568 for (y = 0; y < 24; y++) | |
90
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
569 for (x = 0; x <= 31; x++) |
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
570 { |
49 | 571 ad = 65536 + x + y * 256; |
572 valu = int(g_map[ad]); | |
573 valu2 = int(g_map[ad + MX * MY * 8]); | |
574 bri = 0; | |
575 if (valu >= 8) { | |
576 bri = 1; | |
577 valu = valu - 8; | |
578 valu2 = valu2 - 8; | |
579 if (valu2 <= 0) { | |
580 valu2 = 0; | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
581 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
582 } |
49 | 583 if (bri == 1) { |
584 valu += 64; | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
585 } |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
586 ctx.writeByte(valu + valu2 * 8); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
587 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
588 } |
90
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
589 else |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
590 return false; |
90
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
591 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
592 return true; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
593 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
594 |
49 | 595 |
126 | 596 boolean mpExportMachinePRG(MPWriteCtx ctx) |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
597 { |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
598 // any common text headers |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
599 ctx.addComment("g_machine=" + str(g_machine) + " (" + g_name + ")"); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
600 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
601 if (g_machine == C64) { //C64 HIRES |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
602 ctx.loadTemplate("c64show.prg"); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
603 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
604 ctx.setOffs(0x0227); |
125 | 605 ctx.addLabel("_bitmap"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
606 mpExportBitmapData(ctx, 40, 25); |
95
517348a7b543
More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
607 |
126 | 608 ctx.writeByteAt(0x2167, g_map[0], "_border"); //=border |
609 ctx.writeByteAt(0x2168, g_map[1], "_backg"); //=background mutta ei tarvita | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
610 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
611 ctx.setOffs(0x2169); |
126 | 612 ctx.addLabel("_screenram"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
613 mpExportColorData(ctx, 40, 25, 65536, 0); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
614 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
615 //c64show.prg |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
616 //offsets |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
617 //0x0227->bitmappi (40x25 x 8 bytee) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
618 //0x2167:borderi väri |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
619 //0x2169->värikartta (40x25 bytee, nyppelit foreg/backg) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
620 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
621 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
622 if (g_machine == C64M) { //C64 MULTICOLOR |
126 | 623 ctx.loadTemplate("c64mshow.prg"); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
624 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
625 ctx.setOffs(0x0239); |
126 | 626 ctx.addLabel("_bitmap"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
627 mpExportBitmapData(ctx, 40, 25); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
628 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
629 // first color information |
126 | 630 ctx.writeByteAt(0x2179, g_map[0], "_border"); |
631 ctx.writeByteAt(0x217a, g_map[1], "_backg"); | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
632 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
633 ctx.setOffs(0x217B); |
126 | 634 ctx.addLabel("_screenram"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
635 mpExportColorData(ctx, 40, 25, 65536, 1); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
636 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
637 // second color information |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
638 ctx.setOffs(0x2563); |
126 | 639 ctx.addLabel("_colorram"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
640 mpExportColorData(ctx, 40, 25, 65536 + 2000, 2); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
641 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
642 //c64 multicolor |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
643 //offsets |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
644 //0x0239->bitmappi (40x25 x 8 bytee) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
645 //0x2179:borderi väri |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
646 //0x217A:bäkkis väri |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
647 //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
|
648 //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
|
649 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
650 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
651 if (g_machine == PLUS4M) { //PLUS4 MULTICOLOR |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
652 ctx.loadTemplate("showpfourm.prg"); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
653 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
654 ctx.addLine(".global @@_bitmap"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
655 ctx.addLine(".global @@_color1"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
656 ctx.addLine(".global @@_color2"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
657 ctx.addLine(".global @@_border"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
658 ctx.addLine(".global @@_back1"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
659 ctx.addLine(".global @@_back2"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
660 |
125 | 661 ctx.addLabel("_bitmap"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
662 ctx.setOffs(0x013e); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
663 mpExportBitmapData(ctx, 40, 25); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
664 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
665 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
|
666 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
|
667 val3 = val2 * 16 + val1; |
125 | 668 ctx.addLabel("_border"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
669 ctx.setOffs(0x207e); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
670 ctx.writeByte(val3); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
671 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
672 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
|
673 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
|
674 val3 = val2 * 16 + val1; |
125 | 675 ctx.addLabel("_back1"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
676 ctx.setOffs(0x207f); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
677 ctx.writeByte(val3); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
678 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
679 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
|
680 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
|
681 val3 = val2 * 16 + val1; |
125 | 682 ctx.addLabel("_back2"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
683 ctx.setOffs(0x2080); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
684 ctx.writeByte(val3); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
685 |
125 | 686 ctx.addLabel("_color1"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
687 ctx.setOffs(0x2081); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
688 mpExportColorData(ctx, 40, 25, 65536, 6); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
689 |
125 | 690 ctx.addLabel("_color2"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
691 ctx.setOffs(0x2469); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
692 mpExportColorData(ctx, 40, 25, 65536, 7); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
693 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
694 //plus4 multic |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
695 //0x013e bitmap (40 x 25 x 8) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
696 //0x207e border |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
697 //0x207f background 1 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
698 //0x2080 background 2 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
699 //0x2081 colors (40 x 25) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
700 //0x2469 luminance (40 x 25) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
701 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
702 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
703 if (g_machine == PLUS4) { // Plus 4 hires |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
704 ctx.loadTemplate("showpfour.prg"); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
705 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
706 ctx.addLine(".global @@_bitmap"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
707 ctx.addLine(".global @@_color"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
708 ctx.addLine(".global @@_lumi"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
709 ctx.addLine(".global @@_border"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
710 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
711 ctx.setOffs(0x0137); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
712 ctx.addLabel("_bitmap"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
713 mpExportBitmapData(ctx, 40, 25); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
714 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
715 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
|
716 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
|
717 val3 = val2 * 16 + val1; |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
718 ctx.writeByteAt(0x2077, val3, "_border"); //border |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
719 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
720 ctx.setOffs(0x2078); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
721 ctx.addLabel("_color"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
722 mpExportColorData(ctx, 40, 25, 65536, 4); //colors |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
723 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
724 ctx.setOffs(0x2460); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
725 ctx.addLabel("_lumi"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
726 mpExportColorData(ctx, 40, 25, 65536, 5); //lumis |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
727 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
728 //plus4 hires |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
729 //0x0137 bitmap (40 x 25 x 8) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
730 //0x2077 borderi |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
731 //0x2078 colors (40 x 25) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
732 //0x2460 luminance (40 x 25) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
733 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
734 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
735 if (g_machine == MSX) { // MSX |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
736 ctx.loadTemplate("msxshow.com"); |
126 | 737 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
738 ctx.addLine(".globl @@_bitmap,@@_nimi2"); |
125 | 739 ctx.addLine(".area _CODE"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
740 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
741 ctx.setOffs(0x00f9); |
125 | 742 ctx.addLabel("_bitmap"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
743 mpExportBitmapData(ctx, 32, 24); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
744 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
745 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
746 //ctx.writeByte(g_map[1]); //backg |
125 | 747 //ctx.addComment("The first following value is background"); |
748 ctx.addLabel("_nimi2"); | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
749 ctx.setOffs(0x18f9); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
750 mpExportColorData(ctx, 32, 24, 65536, 3); //there's an exception for msx-style |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
751 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
752 //msx comm |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
753 //0x00f9 bitmap (32x24 x 8 bytes) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
754 //0x18f9 background color |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
755 //0x18fa colors (32*24 bytes) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
756 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
757 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
758 if (g_machine == SPECTRUM) { // ZX Spectrum |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
759 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
760 //would need some cleaning up |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
761 |
126 | 762 // ctx.addLine(".area _DATA"); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
763 // ctx.addLine(".globl @@_taustakuva"); |
125 | 764 // ctx.addLabel("_taustakuva"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
765 ctx.loadTemplate("specshow.tap"); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
766 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
767 int checksum = 0xc9; |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
768 for (y = 0x1d24; y < 0x1d3e; y++) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
769 { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
770 checksum = checksum ^ int(g_template[y]); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
771 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
772 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
773 //TAP requires fiddling with the checksum |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
774 //println("Checksum:"+hex(checksum,2)); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
775 ctx.writeByteAt(0x0223, g_map[0], "_something1"); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
776 checksum = checksum ^ int(g_map[0]); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
777 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
778 ctx.addLabel("_something2"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
779 ctx.setBPL(32); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
780 for (int y = 0; y <= 2; y++) |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
781 for (int y2 = 0; y2 < 8; y2++) |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
782 for (int yy = 0; yy < 8; yy++) |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
783 for (int x = 0; x < 32; x++) |
87 | 784 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
785 int yp = y * 64 + yy * 8 + y2, |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
786 ad = 1024 + yp * 256 + x * 8, |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
787 valu = |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
788 g_map[ad + 0] * 128 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
789 g_map[ad + 1] * 64 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
790 g_map[ad + 2] * 32 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
791 g_map[ad + 3] * 16 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
792 g_map[ad + 4] * 8 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
793 g_map[ad + 5] * 4 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
794 g_map[ad + 6] * 2 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
795 g_map[ad + 7] * 1; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
796 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
797 ctx.writeByte(valu); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
798 checksum = checksum ^ int(valu); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
799 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
800 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
801 ctx.addLabel("_attributes"); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
802 for (int y = 0; y < 24; y++) |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
803 for (int x = 0; x < 32; x++) |
87 | 804 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
805 int ad = 65536 + x + y * 256, |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
806 valu = int(g_map[ad]), |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
807 valu2 = int(g_map[ad + MX * MY * 8]), |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
808 bri = 0; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
809 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
810 if (valu >= 8) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
811 { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
812 bri = 1; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
813 valu = valu - 8; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
814 valu2 = valu2 - 8; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
815 if (valu2 <= 0) { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
816 valu2 = 0; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
817 } |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
818 } |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
819 if (bri == 1) { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
820 valu = valu + 64; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
821 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
822 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
823 ctx.writeByte(valu + valu2 * 8); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
824 checksum = checksum ^ int(valu + valu2 * 8); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
825 } |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
826 ctx.setBPLOff(); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
827 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
828 ctx.writeByteAt(0x1d3e, int(checksum), "_checksum"); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
829 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
830 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
831 if (g_machine == CPC) { |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
832 int val1, val2, val3, valu; |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
833 ctx.loadTemplate("cpc-mode0.bin"); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
834 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
835 ctx.setOffs(69); //bitmap offset |
125 | 836 ctx.addLabel("_bitmap"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
837 mpExportBitmapData_CPC(ctx, 160, 200); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
838 |
87 | 839 //fixed # of palette entries, just trying to be generic |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
840 ctx.setOffs(16453); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
841 ctx.setBPL(32); |
125 | 842 ctx.addLabel("_palette"); |
87 | 843 for (int i = 0; i < g_maxcolors; i++) |
844 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
845 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
|
846 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
|
847 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
|
848 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
849 ctx.writeByte(val1 * 9 + val2 * 3 + val3); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
850 } |
126 | 851 ctx.setBPLOff(); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
852 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
853 valu = int(g_map[0]); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
854 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
|
855 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
|
856 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
|
857 |
126 | 858 ctx.setOffs(16469); |
125 | 859 ctx.addLabel("_border"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
860 ctx.writeByte(val1 * 9 + val2 * 3 + val3); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
861 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
862 //cpc |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
863 //69 bitmap 16384 bytes |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
864 //16453 palette 16 bytes (0..26) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
865 //16469 border color (0..26) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
866 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
867 else |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
868 return false; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
869 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
870 ctx.addEOL(); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
871 return true; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
872 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
873 |
86 | 874 |
129 | 875 void mpExportBitmapData_CPC(MPWriteCtx ctx, int mwidth, int mheight) |
86 | 876 { |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
877 int x, y, ad, val1, val2, y2; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
878 int pix0b0, pix0b1, pix0b2, pix0b3; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
879 int pix1b0, pix1b1, pix1b2, pix1b3; |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
880 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
881 ctx.setBPL(32); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
882 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
883 for (y2 = 0; y2 < 8; y2++) |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
884 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
885 ctx.addByteDef(true); |
126 | 886 |
129 | 887 for (y = 0; y < int(mheight / 8); y++) |
888 for (x = 0; x < int(mwidth / 2); x++) | |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
889 { |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
890 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
|
891 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
892 val1 = int(g_map[ad]); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
893 pix0b0 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
894 pix0b1 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
895 pix0b2 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
896 pix0b3 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
897 if ((val1 & 1) != 0) pix0b0 = 1; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
898 if ((val1 & 2) != 0) pix0b1 = 1; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
899 if ((val1 & 4) != 0) pix0b2 = 1; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
900 if ((val1 & 8) != 0) pix0b3 = 1; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
901 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
902 val1 = int(g_map[ad + 2]); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
903 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
904 pix1b0 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
905 pix1b1 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
906 pix1b2 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
907 pix1b3 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
908 if ((val1 & 1) != 0) pix1b0 = 1; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
909 if ((val1 & 2) != 0) pix1b1 = 1; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
910 if ((val1 & 4) != 0) pix1b2 = 1; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
911 if ((val1 & 8) != 0) pix1b3 = 1; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
912 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
913 val2 = pix1b3 + pix0b3 * 2 + pix1b1 * 4 + pix0b1 * 8 + pix1b2 * 16 + pix0b2 * 32 + pix1b0 * 64 + pix0b0 * 128; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
914 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
915 ctx.writeByte(val2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
916 } |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
917 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
918 ctx.addByteDef(true); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
919 for (int j = 0; j <= 47; j++) |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
920 ctx.writeByte(0); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
921 } |
129 | 922 |
126 | 923 ctx.setBPLOff(); |
924 ctx.addEOL(); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
925 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
926 |
86 | 927 |
129 | 928 void mpExportBitmapData(MPWriteCtx ctx, int mwidth, int mheight) |
86 | 929 { |
129 | 930 int xwid = mwidth * 8, |
931 ywid = mheight * 8; | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
932 |
126 | 933 ctx.setBPL(32); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
934 ctx.addByteDef(true); |
126 | 935 |
129 | 936 for (int y = 0; y < mheight; y++) |
937 for (int x = 0; x < mwidth; x++) | |
938 for (int y2 = 0; y2 < 8; y2++) | |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
939 { |
129 | 940 int ad = 1024 + y * (xwid * 8) + (y2 * xwid) + x * 8; |
941 int value = | |
942 g_map[ad + 0] * 128 + | |
943 g_map[ad + 1] * 64 + | |
944 g_map[ad + 2] * 32 + | |
945 g_map[ad + 3] * 16 + | |
946 g_map[ad + 4] * 8 + | |
947 g_map[ad + 5] * 4 + | |
948 g_map[ad + 6] * 2 + | |
949 g_map[ad + 7] * 1; | |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
950 |
129 | 951 ctx.writeByte(value); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
952 } |
129 | 953 |
126 | 954 ctx.setBPLOff(); |
955 ctx.addEOL(); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
956 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
957 |
86 | 958 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
959 int convertluminance(int l, int f) |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
960 { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
961 int res = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
962 if (f == 0) return 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
963 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
|
964 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
|
965 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
|
966 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
|
967 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
|
968 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
|
969 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
|
970 if (l == 7) res = 105 + f; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
971 return res; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
972 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
973 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
974 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
975 int getplusluminance(int c) |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
976 { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
977 int res = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
978 if (c == 0) res = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
979 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
|
980 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
|
981 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
|
982 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
|
983 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
|
984 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
|
985 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
|
986 if (c >= 106 && c <= 120) res = 7; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
987 return res; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
988 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
989 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
990 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
991 int getpluscolor(int c) |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
992 { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
993 int res = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
994 if (c == 0) res = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
995 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
|
996 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
|
997 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
|
998 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
|
999 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
|
1000 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
|
1001 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
|
1002 if (c >= 106 && c <= 120) res = c - 105; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1003 return res; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1004 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1005 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1006 |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1007 void mpExportColorData(MPWriteCtx ctx, int width, int height, int srcoffs, int param) |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1008 { |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1009 int xmult, myrpsi; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1010 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1011 myrpsi = 0; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1012 |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1013 if (param == 0 || param == 3 || param == 4 || param == 5) |
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1014 xmult = width * 8; |
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1015 else |
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1016 xmult = width; |
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1017 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1018 if (g_machine == MSX) { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1019 myrpsi = 7; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1020 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1021 |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1022 for (int yc = 0; yc < height; yc++) |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1023 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
1024 ctx.addByteDef(true); |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1025 for (int xc = 0; xc < width; xc++) |
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1026 for (int yline = 0; yline <= myrpsi; yline++) |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1027 { |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1028 int valu1, valu2, ad = srcoffs + xc + yc * xmult + yline * width; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1029 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1030 switch (param) |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1031 { |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1032 case 0: |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1033 valu1 = int(g_map[ad]); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1034 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
|
1035 break; |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1036 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1037 case 1: |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1038 valu2 = int(g_map[ad]); |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1039 valu1 = int(g_map[ad + 1000]); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1040 break; |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1041 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1042 case 2: |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1043 valu2 = int(g_map[ad]); |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1044 valu1 = 0; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1045 break; |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1046 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1047 case 3: |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1048 valu1 = int(g_map[ad]); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1049 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
|
1050 break; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1051 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1052 case 4: |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1053 //plus4 colortable |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1054 valu1 = getpluscolor(int(g_map[ad])); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1055 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
|
1056 break; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1057 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1058 case 5: |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1059 //plus4 lumitable |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1060 valu1 = getplusluminance(int(g_map[ad + MX * MY * 8])); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1061 valu2 = getplusluminance(int(g_map[ad])); |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1062 break; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1063 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1064 case 6: |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1065 //plus4 multic1 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1066 valu2 = getpluscolor(int(g_map[ad])); |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1067 valu1 = getpluscolor(int(g_map[ad + 1000])); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1068 break; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1069 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1070 case 7: |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1071 //plus4 multic2 |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1072 valu1 = getplusluminance(int(g_map[ad])); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1073 valu2 = getplusluminance(int(g_map[ad + 1000])); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1074 break; |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1075 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1076 default: |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1077 return null; |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1078 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1079 |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1080 ctx.writeByte(valu1 * 16 + valu2); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1081 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1082 } |
126 | 1083 ctx.addEOL(); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1084 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1085 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1086 |
117 | 1087 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
|
1088 { |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1089 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
|
1090 return false; |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1091 |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1092 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
|
1093 return false; |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1094 |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1095 int balx, baly, xx, yy, x2, y2, rr, gg, bb, avg, i, j, target; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1096 int cx, cy; |
196 | 1097 int swap, idefix, avx, avy; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1098 int[] pixut = new int[260]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1099 int[] idx = new int[260]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1100 int[] histog = new int[8192]; |
14
cecc594d1559
Remove unused code and variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
1101 float ww, hh, fld, compa; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1102 color c; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1103 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
|
1104 int rh, gh, bh; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1105 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1106 xcolors = g_maxcolors; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1107 vertti = 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1108 erkki = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1109 limitter = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1110 if (g_britemode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1111 xcolors = 8; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1112 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1113 if (g_attrimode == 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1114 vertti = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1115 erkki = 8; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1116 } |
154 | 1117 if (g_multic == 1) |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1118 limitter = 4; |
154 | 1119 else |
1120 //because zero color can be anywhere? | |
1121 if (g_multic == 2) | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1122 limitter = 16; |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1123 |
6
07ddf9cfc6c2
Cast char to int where needed and other related operations.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
1124 command(int('O')); //special clear screen |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1125 |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1126 balx = int(image.width / X) * g_pixelw; |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1127 baly = int(image.height / Y); |
154 | 1128 if (balx < 1) |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1129 balx = 1; |
154 | 1130 if (baly < 1) |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1131 baly = 1; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1132 |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1133 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
|
1134 { |
154 | 1135 int psteps = int(g_palsteps - 1), |
1136 maxhis = 0, | |
1137 palls = int(255 / psteps); | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1138 |
154 | 1139 for (i = 0; i < g_maxcolors; i++) |
1140 makecolor(i, 0, 0, 0); | |
87 | 1141 |
1142 for (cy = 0; cy < MY * erkki; cy++) | |
1143 for (cx = 0; cx < MX; cx++) | |
1144 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) | |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1145 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + g_pixelw) |
87 | 1146 { |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1147 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
|
1148 y2 = int(image.height / Y) * yy; |
87 | 1149 rr = 0; |
1150 gg = 0; | |
1151 bb = 0; | |
1152 avg = 0; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1153 |
154 | 1154 for (avy = 0; avy < baly; avy++) |
1155 for (avx = 0; avx < balx; avx++) | |
1156 { | |
1157 c = image.get(x2 + avx, y2 + avy); | |
1158 rr = rr + int(red(c)); | |
1159 gg = gg + int(green(c)); | |
1160 bb = bb + int(blue(c)); | |
1161 avg++; | |
87 | 1162 } |
1163 | |
154 | 1164 rh = int(int(rr / avg) / palls); |
1165 gh = int(int(gg / avg) / palls); | |
1166 bh = int(int(bb / avg) / palls); | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1167 |
154 | 1168 int hindex = int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh); |
1169 if (++histog[hindex] > maxhis) | |
1170 maxhis = histog[hindex]; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1171 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1172 |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1173 int step = 0; |
87 | 1174 for (j = maxhis; j > 0; j--) |
1175 for (i = 0; i <= 4096; i++) | |
1176 { | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1177 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
|
1178 { |
87 | 1179 rh = i / int(g_palsteps * g_palsteps); |
1180 gh = i - int(rh * (g_palsteps * g_palsteps)); | |
1181 gh = gh / int(g_palsteps); | |
1182 bh = i - int(rh * (g_palsteps * g_palsteps)); | |
1183 bh = bh - int(gh * g_palsteps); | |
1184 rh = rh * int(palls); | |
1185 gh = gh * int(palls); | |
1186 bh = bh * int(palls); | |
154 | 1187 if (step < g_maxcolors) |
1188 { | |
87 | 1189 makecolor(step, rh, gh, bh); |
1190 step++; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1191 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1192 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1193 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1194 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1195 |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1196 for (cy = 0; cy < MY * erkki; cy++) |
154 | 1197 for (cx = 0; cx < MX; cx++) |
1198 { | |
1199 for (i = 0; i < xcolors; i++) | |
1200 { | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1201 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
|
1202 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
|
1203 } |
196 | 1204 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) |
1205 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + g_pixelw) | |
1206 { | |
1207 x2 = int(image.width / X) * xx; | |
1208 y2 = int(image.height / Y) * yy; | |
1209 rr = 0; | |
1210 gg = 0; | |
1211 bb = 0; | |
1212 avg = 0; | |
154 | 1213 |
196 | 1214 for (avy = 0; avy < baly; avy++) |
1215 for (avx = 0; avx < balx; avx++) | |
1216 { | |
1217 c = image.get(x2 + avx, y2 + avy); | |
1218 rr += int(red(c)); | |
1219 gg += int(green(c)); | |
1220 bb += int(blue(c)); | |
1221 avg++; | |
1222 } | |
1223 | |
1224 rr = int(rr / avg); | |
1225 gg = int(gg / avg); | |
1226 bb = int(bb / avg); | |
1227 g_farge = 0; | |
1228 target = -1; | |
1229 compa = 9999; | |
1230 for (i = 0; i < xcolors; i++) | |
1231 { | |
1232 fld = dist(rr, gg, bb, g_r[i], g_g[i], g_b[i]); | |
1233 if (fld < compa) | |
154 | 1234 { |
196 | 1235 compa = fld; |
1236 target = i; | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1237 } |
196 | 1238 } |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1239 |
196 | 1240 g_farge = target; |
1241 pixut[target]++; //histogramming | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1242 } |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1243 |
196 | 1244 for (int aas = 0; aas < xcolors; aas++) |
1245 for (int bbs = 0; bbs <= aas; bbs++) | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1246 { |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1247 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
|
1248 { |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1249 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
|
1250 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
|
1251 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
|
1252 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
|
1253 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
|
1254 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
|
1255 } |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1256 } |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1257 |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1258 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
|
1259 { |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1260 i = idx[idefix]; |
196 | 1261 |
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 (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) |
154 | 1263 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + g_pixelw) |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1264 { |
154 | 1265 x2 = int(image.width / X) * xx; |
1266 y2 = int(image.height / Y) * yy; | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1267 |
154 | 1268 rr = 0; |
1269 gg = 0; | |
1270 bb = 0; | |
1271 avg = 0; | |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1272 for (avy = 0; avy < baly; avy++) |
196 | 1273 for (avx = 0; avx < balx; avx++) |
1274 { | |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1275 c = image.get(x2 + avx, y2 + avy); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1276 rr = rr + int(red(c)); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1277 gg = gg + int(green(c)); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1278 bb = bb + int(blue(c)); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1279 avg++; |
154 | 1280 } |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1281 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1282 rr = int(rr / avg); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1283 gg = int(gg / avg); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1284 bb = int(bb / avg); |
196 | 1285 |
154 | 1286 g_farge = 0; |
1287 target = -1; | |
1288 compa = 9999; | |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1289 for (j = 0; j < limitter; j++) |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1290 { |
154 | 1291 fld = dist(rr, gg, bb, g_r[idx[j]], g_g[idx[j]], g_b[idx[j]]); |
196 | 1292 if (fld < compa) |
1293 { | |
154 | 1294 compa = fld; |
1295 target = idx[j]; | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1296 } |
154 | 1297 } |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1298 if (i == target) |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1299 { |
154 | 1300 g_farge = target; |
1301 makepoint(xx, yy); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1302 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1303 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1304 |
126 | 1305 if (idefix == 0) |
1306 { | |
1307 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) | |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1308 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + g_pixelw) |
126 | 1309 { |
1310 g_farge = idx[0]; | |
1311 makepoint(xx, yy); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1312 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1313 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1314 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1315 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1316 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1317 |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1318 |
175
3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
1319 void mpRenderToImageAt(PImage output, int xoffs, int yoffs, int omag) |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1320 { |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1321 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
|
1322 return; |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1323 |
196 | 1324 color c = color(g_r[259], g_g[259], g_b[259]); |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1325 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
|
1326 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
|
1327 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
|
1328 |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1329 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
|
1330 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
|
1331 { |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1332 int f; |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1333 if (g_pixelw == 2) |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1334 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
|
1335 else |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1336 f = easygetcolor(xx, yy); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1337 // f = getabsa(xx, yy, 0); |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1338 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1339 if (g_machine == MSX && f == 0) |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1340 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
|
1341 |
196 | 1342 c = color(g_r[f], g_g[f], g_b[f]); |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1343 |
175
3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
1344 for (int vertti = 0; vertti <= omag; vertti++) |
3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
1345 for (int mortti = 0; mortti <= omag; mortti++) |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1346 { |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1347 output.set( |
175
3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
1348 xx * omag + xoffs + mortti, |
3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
1349 yy * omag + yoffs + vertti, |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1350 c); |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1351 } |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1352 } |
201
823672f83ae9
Call PImage::updatePixels() in mpRenderToImageAt() to update the image
Matti Hamalainen <ccr@tnsp.org>
parents:
197
diff
changeset
|
1353 |
823672f83ae9
Call PImage::updatePixels() in mpRenderToImageAt() to update the image
Matti Hamalainen <ccr@tnsp.org>
parents:
197
diff
changeset
|
1354 output.updatePixels(); |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1355 } |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1356 |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1357 |
175
3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
1358 PImage mpRenderImage(boolean border, int bordh, int bordv, int omag) |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1359 { |
94
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1360 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
|
1361 |
94
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1362 if (border) |
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1363 { |
197 | 1364 output = createImage( |
175
3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
1365 (X + bordh) * omag, |
3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
1366 (Y + bordv) * omag, |
94
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1367 RGB); |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1368 |
175
3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
1369 mpRenderToImageAt(output, int((bordh * omag) / 2), int((bordv * omag) / 2), omag); |
94
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1370 } |
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1371 else |
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1372 { |
175
3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
1373 output = createImage(X * omag, Y * omag, RGB); |
3ddf4d799fe6
Get rid of globals g_omag, g_bordh and g_bordv which set PNG/JPEG image
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
1374 mpRenderToImageAt(output, 0, 0, omag); |
94
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1375 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1376 |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1377 return output; |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1378 } |
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 |
154 | 1381 void make_c64_palette() |
1382 { | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1383 // Pepto's murky C64 palette: http://www.pepto.de/projects/colorvic |
154 | 1384 int rgb[] = |
1385 { | |
1386 0x000000, | |
1387 0xFFFFFF, | |
1388 0x68372B, | |
1389 0x70A4B2, | |
1390 0x6F3D86, | |
1391 0x588D43, | |
1392 0x352879, | |
1393 0xB8C76F, | |
1394 0x6F4F25, | |
1395 0x433900, | |
1396 0x9A6759, | |
1397 0x444444, | |
1398 0x6C6C6C, | |
1399 0x9AD284, | |
1400 0x6C5EB5, | |
1401 0x959595 | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1402 }; |
154 | 1403 for (int i = 0; i < g_maxcolors; i++) |
1404 { | |
1405 g_grids[i] = (rgb[i] + 0x282828) | 0xff000000; | |
1406 makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1407 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1408 g_grids[1] = 0xffd0d0d0; |
172
e77a726a587e
Rename FLATRATIO/SQUARERATIO and gridmode OLD/NEW constants to something more sane.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
1409 g_gridmode = GRIDMODE_NEW; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1410 g_map[13] = byte(C64); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1411 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1412 |
154 | 1413 |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1414 void make_coco_palette() |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1415 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1416 } |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1417 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1418 |
154 | 1419 void make_plus4_palette() |
1420 { | |
1421 int rgb[] = | |
1422 { | |
1423 0x000000, | |
1424 0x2C2C2C, | |
1425 0x621307, | |
1426 0x00424C, | |
1427 0x510378, | |
1428 0x004E00, | |
1429 0x27188E, | |
1430 0x303E00, | |
1431 0x582100, | |
1432 0x463000, | |
1433 0x244400, | |
1434 0x630448, | |
1435 0x004E0C, | |
1436 0x0E2784, | |
1437 0x33118E, | |
1438 0x184800, | |
1439 0x3B3B3B, | |
1440 0x702419, | |
1441 0x00505A, | |
1442 0x601685, | |
1443 0x125D00, | |
1444 0x36289B, | |
1445 0x3F4C00, | |
1446 0x663100, | |
1447 0x553F00, | |
1448 0x345200, | |
1449 0x711656, | |
1450 0x005C1D, | |
1451 0x1F3691, | |
1452 0x42229B, | |
1453 0x285700, | |
1454 0x424242, | |
1455 0x772C21, | |
1456 0x055861, | |
1457 0x661E8C, | |
1458 0x1B6400, | |
1459 0x3E30A2, | |
1460 0x475400, | |
1461 0x6D3900, | |
1462 0x5C4700, | |
1463 0x3B5900, | |
1464 0x771F5D, | |
1465 0x046325, | |
1466 0x273E98, | |
1467 0x492AA1, | |
1468 0x305E00, | |
1469 0x515151, | |
1470 0x843B31, | |
1471 0x17656F, | |
1472 0x742E99, | |
1473 0x2B7100, | |
1474 0x4C3FAF, | |
1475 0x556200, | |
1476 0x7A4709, | |
1477 0x6A5500, | |
1478 0x4A6700, | |
1479 0x852F6B, | |
1480 0x177135, | |
1481 0x364CA5, | |
1482 0x5739AE, | |
1483 0x3F6B00, | |
1484 0x7A7A7A, | |
1485 0xAC665C, | |
1486 0x468E97, | |
1487 0x9C5AC0, | |
1488 0x57992E, | |
1489 0x766AD5, | |
1490 0x7E8A13, | |
1491 0xA2713A, | |
1492 0x927E20, | |
1493 0x748F14, | |
1494 0xAC5A93, | |
1495 0x459960, | |
1496 0x6276CB, | |
1497 0x8064D4, | |
1498 0x6A9419, | |
1499 0x959595, | |
1500 0xC58178, | |
1501 0x62A8B1, | |
1502 0xB675D9, | |
1503 0x73B34C, | |
1504 0x9185ED, | |
1505 0x99A433, | |
1506 0xBB8C57, | |
1507 0xAC993E, | |
1508 0x8FAA34, | |
1509 0xC676AD, | |
1510 0x62B37B, | |
1511 0x7D91E4, | |
1512 0x9B80ED, | |
1513 0x85AE38, | |
1514 0xAFAFAF, | |
1515 0xDE9B93, | |
1516 0x7DC2CA, | |
1517 0xCF90F2, | |
1518 0x8DCD68, | |
1519 0xAB9FFF, | |
1520 0xB3BE51, | |
1521 0xD5A673, | |
1522 0xC6B35B, | |
1523 0xA9C351, | |
1524 0xDF91C7, | |
1525 0x7DCC96, | |
1526 0x97ABFD, | |
1527 0xB59AFF, | |
1528 0x9FC755, | |
1529 0xE1E1E1, | |
1530 0xFFCFC6, | |
1531 0xB2F4FC, | |
1532 0xFFC4FF, | |
1533 0xC1FE9D, | |
1534 0xDDD2FF, | |
1535 0xE5F088, | |
1536 0xFFD9A8, | |
1537 0xF7E591, | |
1538 0xDBF588, | |
1539 0xFFC4F9, | |
1540 0xB1FEC9, | |
1541 0xCBDDFF, | |
1542 0xE7CDFF, | |
1543 0xD2F98C | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1544 }; |
154 | 1545 for (int i = 0; i < g_maxcolors; i++) |
1546 { | |
1547 makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1548 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1549 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1550 |
154 | 1551 |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1552 void make_bk_palette() |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1553 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1554 int rgb[] = |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1555 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1556 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1557 0x0000ff, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1558 0x00ff00, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1559 0xff0000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1560 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1561 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1562 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1563 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1564 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1565 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1566 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1567 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1568 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1569 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1570 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1571 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1572 }; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1573 for (int i = 0; i < g_maxcolors; i++) |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1574 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1575 if (i <= 8) |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1576 g_grids[i] = rgb[i] + 0xff282828; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1577 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1578 makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1579 } |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1580 } |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1581 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1582 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1583 void make_ql_palette() |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1584 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1585 int rgb[] = |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1586 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1587 0x000000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1588 0x0000ff, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1589 0xff0000, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1590 0xff00ff, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1591 0x00ff00, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1592 0x00ffff, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1593 0xffff00, |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1594 0xffffff |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1595 }; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1596 g_grids[0] = 0xff282828; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1597 g_grids[1] = 0xff0000d8; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1598 g_grids[2] = 0xffd80000; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1599 g_grids[3] = 0xffd800d8; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1600 g_grids[4] = 0xff00d800; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1601 g_grids[5] = 0xff00d8d8; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1602 g_grids[6] = 0xffd8d800; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1603 g_grids[7] = 0xffd8d8d8; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1604 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1605 for (int i = 0; i < g_maxcolors; i++) |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1606 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1607 // if(i<=8){g_grids[i]=rgb[i]+0xff282828;} |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1608 makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1609 } |
172
e77a726a587e
Rename FLATRATIO/SQUARERATIO and gridmode OLD/NEW constants to something more sane.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
1610 g_gridmode = GRIDMODE_NEW; |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1611 } |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1612 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1613 |
154 | 1614 void make_msx_palette() |
1615 { | |
1616 int rgb[] = | |
1617 { | |
1618 0x000000, | |
1619 0x000000, | |
1620 0x3EB849, | |
1621 0x74D07D, | |
1622 0x5955E0, | |
1623 0x8076F1, | |
1624 0xB95E51, | |
1625 0x65DBEF, | |
1626 0xDB6559, | |
1627 0xFF897D, | |
1628 0xCCC35E, | |
1629 0xDED087, | |
1630 0x3AA241, | |
1631 0xB766B5, | |
1632 0xCCCCCC, | |
1633 0xFFFFFF | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1634 }; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1635 |
154 | 1636 for (int i = 0; i < g_maxcolors; i++) |
1637 { | |
1638 g_grids[i] = (rgb[i] + 0x1f1f1f) | 0xff000000; | |
1639 makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1640 } |
154 | 1641 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1642 g_grids[5] = 0xff9f95Ff; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1643 g_grids[7] = 0xff84faEF; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1644 g_grids[9] = 0xffffa99d; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1645 g_grids[15] = 0xffd8d8d8; |
172
e77a726a587e
Rename FLATRATIO/SQUARERATIO and gridmode OLD/NEW constants to something more sane.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
1646 g_gridmode = GRIDMODE_NEW; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1647 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1648 |
154 | 1649 |
1650 void make_spectrum_palette() | |
1651 { | |
1652 int rgb[] = | |
1653 { | |
1654 0x000000, | |
1655 0x0000C0, | |
1656 0xC00000, | |
1657 0xC000C0, | |
1658 0x00C000, | |
1659 0x00C0C0, | |
1660 0xC0C000, | |
1661 0xC0C0C0, | |
1662 0x000000, | |
1663 0x0000FF, | |
1664 0xFF0000, | |
1665 0xFF00FF, | |
1666 0x00FF00, | |
1667 0x00FFFF, | |
1668 0xFFFF00, | |
1669 0xFFFFFF | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1670 }; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1671 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1672 g_grids[9] = 0xff0000d8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1673 g_grids[10] = 0xffd80000; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1674 g_grids[11] = 0xffd800d8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1675 g_grids[12] = 0xff00d800; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1676 g_grids[13] = 0xff00d8d8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1677 g_grids[14] = 0xffd8d800; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1678 g_grids[15] = 0xffd8d8d8; |
154 | 1679 |
1680 for (int i = 0; i < g_maxcolors; i++) | |
1681 { | |
1682 if (i <= 8) | |
1683 g_grids[i] = (rgb[i] + 0x282828) | 0xff000000; | |
1684 | |
1685 makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1686 } |
172
e77a726a587e
Rename FLATRATIO/SQUARERATIO and gridmode OLD/NEW constants to something more sane.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
1687 g_gridmode = GRIDMODE_NEW; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1688 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1689 |
49 | 1690 |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1691 void mpSetupMachine(int m) |
49 | 1692 { |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1693 g_machine = m; |
154 | 1694 |
1695 g_name = "ERROR"; | |
50 | 1696 g_exportext = "none"; |
154 | 1697 g_exportname = ""; |
1698 g_formatname = ""; | |
1699 g_formatext = ""; | |
1700 g_formatname = ""; | |
1701 g_formatext = ""; | |
1702 | |
172
e77a726a587e
Rename FLATRATIO/SQUARERATIO and gridmode OLD/NEW constants to something more sane.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
1703 g_aspect = AR_SQUARE; |
e77a726a587e
Rename FLATRATIO/SQUARERATIO and gridmode OLD/NEW constants to something more sane.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
1704 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1705 g_map[3] = byte(g_machine); |
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1706 g_map[13] = byte(g_machine); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1707 g_palsteps = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1708 g_farge = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1709 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1710 g_britemode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1711 g_charlimit = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1712 g_hzoomer = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1713 g_backmode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1714 g_maxcolors = 16; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1715 X = 320; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1716 Y = 200; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1717 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1718 if (g_machine == C64) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1719 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1720 //c64 hires |
12
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1721 g_name = "c64"; |
50 | 1722 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
|
1723 g_exportname = "PRG file"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1724 g_formatname = "Art Studio"; |
50 | 1725 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
|
1726 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1727 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1728 g_map[1] = byte(255); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1729 g_map[0] = 6; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1730 make_c64_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1731 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1732 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1733 if (g_machine == CPC) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1734 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1735 //Amstrad CPC mode 0 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1736 g_name = "cpc"; |
50 | 1737 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
|
1738 g_exportname = "BIN file" |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1739 g_formatname = ""; |
50 | 1740 g_formatext = ""; |
12
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1741 |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1742 g_hzoomer = 2; |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1743 g_palsteps = 3; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1744 g_multic = 2; |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1745 g_attrimode = 2; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1746 g_map[1] = byte(255); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1747 g_map[0] = 1; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1748 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1749 makecolor(0, 0, 0, 0); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1750 makecolor(1, 0x0, 0x0, 0x80); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1751 makecolor(2, 0x00, 0x00, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1752 makecolor(3, 0x80, 0x00, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1753 makecolor(4, 0x80, 0x00, 0x80); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1754 makecolor(5, 0x80, 0x00, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1755 makecolor(6, 0xFF, 0x00, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1756 makecolor(7, 0xFF, 0x00, 0x80); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1757 makecolor(8, 0xFF, 0x00, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1758 makecolor(9, 0x00, 0x80, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1759 makecolor(10, 0x00, 0x80, 0x80); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1760 makecolor(11, 0x00, 0x80, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1761 makecolor(12, 0x80, 0x80, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1762 makecolor(13, 0x80, 0x80, 0x80); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1763 makecolor(14, 0x80, 0x80, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1764 makecolor(15, 0xFF, 0xFF, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1765 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1766 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1767 if (g_machine == MSX) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1768 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1769 // MSX |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1770 g_name = "msx"; |
50 | 1771 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
|
1772 g_exportname = "COM file"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1773 g_formatname = "Screen 2"; |
68
59731a72ce8b
Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents:
61
diff
changeset
|
1774 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
|
1775 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1776 X = 256; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1777 Y = 192; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1778 g_attrimode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1779 g_backmode = 1; |
172
e77a726a587e
Rename FLATRATIO/SQUARERATIO and gridmode OLD/NEW constants to something more sane.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
1780 g_aspect = AR_FLAT; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1781 g_farge = 15; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1782 g_backg = 0; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1783 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1784 //TI99 variant |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1785 /* |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1786 makecolor(0,0,0,0); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1787 makecolor(1,0,0,0); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1788 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1789 makecolor(2,0x21,0xc8,0x42); //21c842 medgreen |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1790 makecolor(3,0x5e,0xdc,0x78);//5edc78 light green |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1791 makecolor(4,0x54,0x55,0xed);//5455ed dark blue |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1792 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
|
1793 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1794 makecolor(6,0xd4,0x52,0x4d); //d4524d dark red |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1795 makecolor(7,0x42,0xeb,0xf5); //42ebf5 cyan |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1796 makecolor(8,0xfc,0x55,0x54); //fc5554 medium red |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1797 makecolor(9,0xff,0x79,0x78); //ff7978 light red |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1798 makecolor(10,0xd4,0xc1,0x54);// d4c154 dark yellow |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1799 makecolor(11,0xe6,0xce,0x80);// e6ce80 light yellow |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1800 makecolor(12,0x21,0xb0,0x3b);// 21b03b dark green |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1801 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
|
1802 makecolor(14,0xCc,0xcc,0xCc);// gray |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1803 makecolor(15,0xFF,0xFF,0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1804 */ |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1805 make_msx_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1806 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1807 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1808 if (g_machine == SPECTRUM) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1809 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1810 // ZX Spectrum |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1811 g_name = "spec"; |
50 | 1812 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
|
1813 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
|
1814 g_formatname = "Screen$"; |
68
59731a72ce8b
Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents:
61
diff
changeset
|
1815 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
|
1816 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1817 X = 256; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1818 Y = 192; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1819 g_farge = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1820 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1821 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1822 g_britemode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1823 g_map[0] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1824 g_map[1] = byte(255); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1825 make_spectrum_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1826 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1827 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1828 if (g_machine == TIMEX) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1829 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1830 // timex sinclair |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1831 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
|
1832 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1833 X = 256; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1834 Y = 192; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1835 g_farge = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1836 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1837 g_attrimode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1838 g_britemode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1839 g_map[1] = byte(255); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1840 make_spectrum_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1841 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1842 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1843 if (g_machine == JR200) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1844 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1845 // Panasonic JR200 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1846 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
|
1847 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1848 X = 256; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1849 Y = 192; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1850 g_maxcolors = 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1851 g_farge = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1852 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1853 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1854 g_map[1] = byte(255); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1855 make_spectrum_palette(); //cheating |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1856 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1857 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1858 if (g_machine == PLUS4M || g_machine == PLUS4) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1859 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1860 // 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
|
1861 g_name = "plus4m"; |
50 | 1862 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
|
1863 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
|
1864 g_formatname = "M.Botticelli"; |
68
59731a72ce8b
Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents:
61
diff
changeset
|
1865 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
|
1866 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1867 g_backmode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1868 g_multic = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1869 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1870 g_maxcolors = 121; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1871 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
|
1872 g_map[0] = 6; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1873 g_map[1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1874 g_map[2] = 61; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1875 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
|
1876 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1877 if (g_machine == PLUS4) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1878 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1879 // 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
|
1880 g_name = "plus4"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1881 g_formatname = "Botticelli"; |
68
59731a72ce8b
Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents:
61
diff
changeset
|
1882 g_formatext = "prg"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1883 g_multic = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1884 g_backmode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1885 g_charlimit = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1886 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1887 g_map[1] = byte(255); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1888 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1889 make_plus4_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1890 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1891 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1892 if (g_machine == C64M) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1893 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1894 //c64 multicolor |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1895 g_name = "c64m"; |
50 | 1896 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
|
1897 g_exportname = "PRG file"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1898 g_formatname = "A. A. Studio"; |
68
59731a72ce8b
Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents:
61
diff
changeset
|
1899 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
|
1900 |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1901 g_backmode = 1; |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1902 g_charlimit = 3; |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1903 g_multic = 1; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1904 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1905 g_map[1] = byte(0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1906 g_map[0] = 6; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1907 make_c64_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1908 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1909 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1910 if (g_machine == QLLOW) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1911 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1912 // Sinclair QL low |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1913 g_backmode = 0; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1914 g_maxcolors = 8; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1915 X = 256; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1916 Y = 256; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1917 g_name = "QL"; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1918 g_multic = 2; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1919 g_attrimode = 2; |
172
e77a726a587e
Rename FLATRATIO/SQUARERATIO and gridmode OLD/NEW constants to something more sane.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
1920 g_aspect = AR_FLAT; |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1921 g_map[1] = byte(0); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1922 make_ql_palette(); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1923 } |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1924 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1925 if (g_machine == BK0010) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1926 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1927 // BK0010 patch |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1928 g_backmode = 0; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1929 g_maxcolors = 4; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1930 X = 256; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1931 Y = 256; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1932 g_name = "BK"; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1933 g_multic = 2; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1934 g_attrimode = 2; |
172
e77a726a587e
Rename FLATRATIO/SQUARERATIO and gridmode OLD/NEW constants to something more sane.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
1935 g_aspect = AR_FLAT; |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1936 g_map[1] = byte(0); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1937 make_bk_palette(); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1938 } |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1939 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1940 if (g_machine == AMIGA) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1941 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1942 g_name = "amiga"; |
50 | 1943 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
|
1944 g_exportname = ""; |
49 | 1945 g_formatname = ""; |
50 | 1946 g_formatext = ""; |
49 | 1947 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1948 g_backmode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1949 g_maxcolors = 32; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1950 g_palsteps = 16; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1951 g_multic = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1952 g_attrimode = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1953 g_map[1] = byte(0); |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1954 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1955 for (int cindex = 0; cindex < g_maxcolors; cindex++) |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1956 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1957 if (cindex < 16) |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1958 makecolor(cindex, cindex * 17, cindex * 17, cindex * 17); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1959 else |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1960 makecolor(cindex, (cindex - 16) * 17, 0, 0); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1961 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1962 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1963 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1964 if (g_machine == ATARIST) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1965 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1966 //ATARI ST 512 color |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1967 g_name = "st"; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1968 g_exportext = ""; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1969 g_exportname = ""; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1970 g_formatname = ""; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1971 g_formatext = ""; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1972 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1973 g_backmode = 1; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1974 g_maxcolors = 16; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1975 g_palsteps = 8; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1976 g_multic = 2; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1977 g_attrimode = 2; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1978 g_map[1] = byte(0); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1979 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1980 for (int cindex = 0; cindex < 8; cindex++) |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1981 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1982 makecolor(cindex, cindex * 36, cindex * 36, cindex * 36); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1983 makecolor(cindex + 8, cindex * 36, 36, 0); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1984 } |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1985 } |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1986 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
1987 if (g_machine == C64FLI) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1988 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
1989 //c64 hires FLI = AFLI |
49 | 1990 g_name = "afli"; |
50 | 1991 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
|
1992 g_exportname = "PRG file"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1993 g_formatname = ""; |
50 | 1994 g_formatext = ""; |
12
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1995 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1996 g_attrimode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1997 g_map[1] = byte(255); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1998 g_map[0] = 6; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1999 make_c64_palette(); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2000 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
2001 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
2002 if (g_machine == C64FLIM) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2003 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2004 //C64 FLI multicolor |
222
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
2005 g_name = "flimc"; |
50 | 2006 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
|
2007 g_exportname = "PRG file"; |
222
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
2008 g_formatname = "FBI FLI Designer 1.0"; |
0e8011589d76
Preliminary work for implementing C64 FLI multicolor import/export (does not work yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
2009 g_formatext = "fd1"; |
12
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
2010 |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
2011 g_hzoomer = 2; |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
2012 g_maxcolors = 16; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2013 g_multic = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2014 g_attrimode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2015 g_map[1] = byte(255); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2016 g_map[0] = 6; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2017 make_c64_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2018 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
2019 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
2020 if (g_machine == C64NOLIMIT) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2021 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2022 g_name = "c64hino"; |
50 | 2023 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
|
2024 g_exportname = ""; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2025 g_formatname = ""; |
50 | 2026 g_formatext = ""; |
11 | 2027 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2028 X = 320; |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2029 Y = 256; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2030 g_multic = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2031 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
|
2032 g_farge = 15; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2033 g_backg = 0; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2034 make_c64_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2035 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
2036 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
2037 if (g_machine == PICO8) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2038 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2039 // Pico-8 fantasy console |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2040 g_name = "pico8"; |
50 | 2041 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
|
2042 g_exportname = ""; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2043 g_formatname = ""; |
50 | 2044 g_formatext = ""; |
11 | 2045 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2046 X = 128; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2047 Y = 128; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2048 g_farge = 15; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2049 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2050 g_multic = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2051 g_attrimode = 2; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2052 makecolor(0, 0, 0, 0); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2053 makecolor(1, 32, 51, 123); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2054 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
|
2055 makecolor(3, 0, 144, 61); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2056 makecolor(4, 171, 82, 54); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2057 makecolor(5, 52, 54, 53); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2058 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
|
2059 makecolor(7, 255, 241, 232); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2060 makecolor(8, 255, 0, 77); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2061 makecolor(9, 255, 155, 0); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2062 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
|
2063 makecolor(11, 0, 226, 50); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2064 makecolor(12, 41, 173, 255); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2065 makecolor(13, 132, 112, 169); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2066 makecolor(14, 255, 119, 168); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2067 makecolor(15, 255, 214, 197); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2068 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
2069 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
2070 if (g_machine == COCO3) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2071 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2072 //6-bit RGB, 16 out of 64 possible |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2073 g_name = "coco"; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2074 g_exportext = ""; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2075 g_exportname = ""; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2076 g_formatname = ""; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2077 g_formatext = ""; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2078 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2079 g_backmode = 1; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2080 g_maxcolors = 16; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2081 g_palsteps = 4; //00 00 00 |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2082 g_multic = 2; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2083 g_attrimode = 2; |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2084 g_map[1] = byte(0); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2085 make_coco_palette(); |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2086 } |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2087 else |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
2088 if (g_machine == UNIA) |
160
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2089 { |
546146bc2247
More changes integrated from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
2090 // Unia digital palette |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2091 g_name = "unia"; |
50 | 2092 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
|
2093 g_exportname = ""; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2094 g_formatname = ""; |
50 | 2095 g_formatext = ""; |
11 | 2096 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2097 X = 256; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2098 Y = 192; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2099 g_farge = 15; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2100 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2101 g_multic = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2102 g_attrimode = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
2103 makecolor(0, 0, 0, 0); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2104 makecolor(1, 0xff, 0xff, 0xff); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2105 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
|
2106 makecolor(3, 0xff, 0xc5, 0x00); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2107 makecolor(4, 0xff, 0x00, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2108 makecolor(5, 0xff, 0x3c, 0xb4); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2109 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
|
2110 makecolor(7, 0x1b, 0xa1, 0xfc); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2111 makecolor(8, 0xe1, 0xe1, 0xe1); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2112 makecolor(9, 0xb9, 0x63, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2113 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
|
2114 makecolor(11, 0xd2, 0x9b, 0xd7); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2115 makecolor(12, 0xad, 0xad, 0xad); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2116 makecolor(13, 0x00, 0xb7, 0xb7); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2117 makecolor(14, 0x23, 0xaf, 0x32); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2118 makecolor(15, 0x29, 0xf7, 0xa7); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2119 } |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
2120 |
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
2121 // Compute pixel width |
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
2122 if (g_multic == 1 || g_hzoomer == 2) |
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
2123 g_pixelw = 2; |
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
2124 else |
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
2125 g_pixelw = 1; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2126 } |