View difference between Paste ID: a5qC9A6u and qbNJLXGA
SHOW: | | - or go back to the newest paste.
1-
Another World Opcode List
1+
Another World File Formats
2
(Based from RAW by Gregory Montoir, New RAW by Fabien Sanglard and from technical notes by Eric Chahi from Another World 15th Anniversary Disc)
3-
00 FF 00 04 00 F6 00 01 00 E3 00 00 00 32 00 00 06
3+
4-
<bh:00><bh:ff><bh:00><bh:04><bh:00><bh:f6><bh:00><bh:01><bh:00><bh:e3><bh:00><bh:00><bh:00>2<bh:00><bh:00><bh:06>
4+
5
00 DD NNNN
6-
3f9fd
6+
(Variable = Imm16)
7
8
Set	Vd, Vs
9
01 DD SS
10
(VariableDest = VariableSource)
11
12
Add	Vd, Vs
13
02 DD SS
14
(VariableDest += VariableSource)
15
16
Add.i	Vn, Imm16
17
03 DD NNNN
18
(Variable += Imm16)
19
20
Jsr	Address
21
04 AAAA
22
23
return
24
05
25
26
break
27
06
28
29
Jmp	Address
30
07 AAAA
31
32
SetVec	Nb, Address
33
08 VV AAAA
34
(Vec = $FFFF; No code to run)
35
36
dbra	Vn, Address
37
09 VV AAAA
38
(Go to Address if Variable != 0)
39
40-
Si Vn = Vn	Jmp Address
40+
41
If Vn = Vn	Jmp Address
42
0A 80 VV WW AAAA
43-
Si Vn <> Vn	Jmp Address
43+
44
If Vn <> Vn	Jmp Address
45
0A 81 VV WW AAAA
46-
Si Vn > Vn	Jmp Address
46+
47
If Vn > Vn	Jmp Address
48
0A 82 VV WW AAAA
49-
Si Vn => Vn	Jmp Address
49+
50
If Vn => Vn	Jmp Address
51
0A 83 VV WW AAAA
52-
Si Vn < Vn	Jmp Address
52+
53
If Vn < Vn	Jmp Address
54
0A 84 VV WW AAAA
55-
Si Vn <= Vn	Jmp Address
55+
56
If Vn <= Vn	Jmp Address
57
0A 85 VV WW AAAA
58
59
60-
Si Vn = Imm8	Jmp Address
60+
61
If Vn = Imm8	Jmp Address
62
0A 00 VV WW AAAA
63-
Si Vn <> Imm8	Jmp Address
63+
64
If Vn <> Imm8	Jmp Address
65
0A 01 VV WW AAAA
66-
Si Vn > Imm8	Jmp Address
66+
67
If Vn > Imm8	Jmp Address
68
0A 02 VV WW AAAA
69-
Si Vn => Imm8	Jmp Address
69+
70
If Vn => Imm8	Jmp Address
71
0A 03 VV WW AAAA
72-
Si Vn < Imm8	Jmp Address
72+
73
If Vn < Imm8	Jmp Address
74
0A 04 VV WW AAAA
75-
Si Vn <= Imm8	Jmp Address
75+
76
If Vn <= Imm8	Jmp Address
77
0A 05 VV WW AAAA
78
79
80-
Si Vn = Imm16	Jmp Address
80+
81
If Vn = Imm16	Jmp Address
82
0A 40 VV WWWW AAAA
83-
Si Vn <> Imm16	Jmp Address
83+
84
If Vn <> Imm16	Jmp Address
85
0A 41 VV WWWW AAAA
86-
Si Vn > Imm16	Jmp Address
86+
87
If Vn > Imm16	Jmp Address
88
0A 42 VV WWWW AAAA
89-
Si Vn => Imm16	Jmp Address
89+
90
If Vn => Imm16	Jmp Address
91
0A 43 VV WWWW AAAA
92-
Si Vn < Imm16	Jmp Address
92+
93
If Vn < Imm16	Jmp Address
94
0A 44 VV WWWW AAAA
95-
Si Vn <= Imm16	Jmp Address
95+
96
If Vn <= Imm16	Jmp Address
97
0A 45 VV WWWW AAAA
98
99
100-
0B NN 00?
100+
101
0B NN 00
102
(Set Palette)
103
104
Vec Start, End, Unlock
105
0C SS EE 00
106
(Unlock Vectors from Start to End)
107
108
Vec Start, End, Lock
109
0C SS EE 01
110
(Lock Vectors from Start to End)
111
112
Vec Start, End, Clean
113
0C SS EE 02
114
(Delete Vectors from Start to End)
115
116
SetWS Nb
117
0D NN
118
(Select Work screen)
119
120
Clr Nb, Color
121
0E NN 0C
122
(Clear screen with Color)
123
124
Copy Ss Sd
125
0F SS DD
126
(Copy workscreen to another workscreen, see Screen Buffers for more info)
127
128
Show NN
129
10 NN
130
(Show workscreen)
131
132
Bigend
133
11
134
(break + current vector = $FFFF)
135
136
Text TxtNb, X, Y, Color
137
12 TTTT XX YY 0C
138
(Show Text at X,Y with color)
139
140
Sub Vd, Vs
141
13 DD SS
142
(VariableDest -= VariableSource)
143
144
And.i Vn,Imm16
145
14 VV IIII
146
(Variable &= Imm16)
147
148
Or.i Vn,Imm16
149
15 VV IIII
150
(Variable ^= Imm16)
151
152
Lsl Vn, Imm16
153
16 VV IIII
154
(Variable <= Imm16)
155
156
Lsr Vn, Imm16
157
17 VV IIII
158
(Variable >= Imm16)
159
160
Play FileNb, Note, Volume, Channel
161
18 FFFF NN VV CC
162
(Play Sound at Note, Volume at one channel)
163
164
Load FileNb
165
19 FFFF
166
(Load File number. If 0 then release the memory)
167
168
Song FileNb, Tempo, Position
169
1A FFFF TTTT PP
170
(If file number and tempo = 0 then stop song)
171
(If file number = 0 and tempo != than current tempo then change tempo of current song)
172
173
174
Spr.s Addr, X, Y
175
(80 || AA) AA XX YY
176
177-
[C0||Color] LL HH PP
177+
178
Spr.l Addr, X, Y, (Z)
179
01XXYYZZb AAAA (XX)XX (YY)YY (ZZZZ)
180-
GM Format:
180+
181-
02 RX RY NN
181+
182-
CHHHHHHHb HH RX RY (MCCCCCCCb MM)
182+
183
3=11=No Z or X||100
184-
Screen Buffers:
184+
185
Exemples:
186
Spr.l Addr, X16, Y16, Z16
187
40 AAAA XXXX YYYY ZZZZ
188
189
Spr.l Addr, X8, Y8, Z8
190
6B AAAA XX YY ZZ
191
192-
Palette Format:
192+
193
55 AAAA VX VY VX
194
195-
Compression:
195+
196-
Backwards.
196+
197-
[18:51] <@Seru-kun> https://github.com/fabiensanglard/Another-World-Bytecode-Interpreter/blob/master/bank.cpp
197+
Header:
198-
[18:56] <@hcs> wow, yeah, that's pretty hard to read
198+
[C0||Pallette] HH VV PP
199-
[18:57] <@hcs> but it looks like the whole getCode, nextChunk, rcr thing is just pulling off bits
199+
(HH = Horizontal Size, VV = Vertical Size)
200-
[18:58] <@hcs> everything is run backwards, for whatever reason
200+
201-
[18:59] <@hcs> storage mode is indicated by two or three bit prefixes, these are what the ifs starting at 93 do
201+
Points:
202-
[19:01] <@hcs> 00 is a string of literal bytes, the next three bits give the number-1, (that's the meaning of decUnk(8,0)
202+
203-
[19:01] <@hcs> er, decUnk1(3,0)
203+
204-
[19:02] <@hcs> decUnk2 looks like LZ77, with decUnk2(8) (prefix 01) you have a 8 bit backreference length
204+
205-
[19:03] <@hcs> backref distance, rather
205+
Polygon Group Format:
206-
[19:04] <@hcs> prefix 01 only does 2 bytes, but it can be 1 to 256 bytes back
206+
Header:
207-
[19:05] <@hcs> notice how line 77 adds i, the backref distance, whereas most processing is done with decrements, so we're reaching back in the already decompressed data
207+
02 BX BY NN
208-
[19:06] <@hcs> The other prefixes are just different variations on the same theme, 111 is literals, 8 bit length + 8 + 1 (the second arg in decUnk1(8, 8) indicates an additional to the count)
208+
(BX = Horizontal Point Base, BY = Vertical Point Base)
209-
[19:06] <@hcs> *an addition
209+
210-
[19:07] <@hcs> this nicely complements the decUnk1(3,0), which can give you up to 8, decUnk1(8,8) can give you from 9 to 255+9
210+
Group:
211-
[19:08] <@hcs> 110 is followed by an 8 bit backreference length (-1) with is used by decUnk(12), so there's also a 12 bit backreference distance
211+
CHHHHHHHb HH RX RY (APPPPPPPb) (MM)
212-
[19:09] <@hcs> 100 and 101 have a fixed length (3 and 4 respectively) and 9 or 10 bit backreference dists
212+
C = 0: Default Color
213
C = 1: Color 4
214
H = Group number (15-bit)
215
RX = X relative
216-
Source Codes:
216+
RY = Y relative
217-
code0:
217+
A = Mask Flag Bit
218
P = Pallette (only if C = 1)
219-
start	jsr	init
219+
MM = Mask (only if A = 1)
220-
	setvec	60	flip10
220+
221-
	seti	v255	4
221+
222-
	seti	v246	1
222+
Screen Buffers (workscreens):
223-
	seti	v227	0
223+
224-
	seti	v50	0
224+
225-
	break
225+
226-
	play	106	20	0	2
226+
227-
	play	106	20	0	3
227+
228-
	play	106	20	0	1
228+
229-
	play	106	20	0	0
229+
230-
	jsr	initiz
230+
Special Screen copy (Source Screen byte only):
231-
	jsr	setmar
231+
10000SSb
232-
	jsr	inic
232+
SS = Screen Buffer (0 to 3)
233-
	jsr	mun1
233+
Copy Screen to Destination Screen at Vertical Position taken from Variable 249
234-
	setvec	20	nag1
234+
235-
	setvec	21	nag2
235+
236-
	setvec	20	mard1a
236+
Color Format:
237-
	seti	v99	2
237+
238-
	si	v4	=	48	suit
238+
239
Color Number:
240
0 to 15 = Plain colors
241-
code1:
241+
16 = Written to the last screen
242
17 = Written to the first screen
243-
snes1	setvec	1	fdera1
243+
244-
zic01	song	4025	0	1
244+
245-
	setvec	2	derape
245+
Pallette Format:
246-
	setvec	3	plan1
246+
64 pallettes with 16 colors (32 bytes)
247-
	setvec	60	flip10
247+
64 * 32 = 2048.
248-
	bigend
248+
249-
stopv	bigend
249+
First half is for Amiga
250-
flip1	addi	v199	1
250+
Last half is for other ports
251-
	show	255
251+
252-
	setws	255
252+
Special Variables:
253-
	si	v250	<>	0	exit
253+
V60  = Random Seed
254-
	copy	64	255
254+
V218 = Keyboard Letter Key pressed (from 'a' to 'z' only)
255-
	break
255+
V229 = Joystick Vertical (0 = None; -1 = Up; 1 = Down)
256-
	jmp	flip1
256+
V244 = Used for Music Sync
257-
flip10	addi	v199	1
257+
V249 = Vertical Position for Copy (Can be used for vertical scrolling)
258-
	show	255
258+
V250 = Joystick Button (0 = Release; 1 = Hold)
259-
	setws	255
259+
V251 = Joystick Vertical (0 = None; -1 = Up; 1 = Down)
260-
	copy	0	255
260+
V252 = Joystick Horizontal (0 = None; -1 = Left; 1 = Right)
261-
	break
261+
V253 = Button Mask (0000UDLR)
262-
	addi	v199	1
262+
V254 = Button Mask 2 (B000UDLR)
263
V255 = Game Speed