|
|
1.1 root 1:
2: outstanding introduced/emulation bugs:
3: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4:
1.1.1.2 ! root 5: search for 'XXX' in fe2.s to find comments on known breakage.
1.1 root 6:
7:
8: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9:
1.1.1.2 ! root 10: for calling FmtStr:
! 11: d0 = format type described below
! 12: d4 = colour
! 13: d5 = x
! 14: d6 = y
! 15: d7 = 0 ??
1.1 root 16:
17: d0:
1.1.1.2 ! root 18: < 0x3000 string 'd0' in stringtable L3e878, which contains
! 19: only "hello there" and "how are you" :-)
1.1 root 20: 0x3015 "%08x" hex (in d3)
21: 0x3014 "%08x" hex (in d2)
22: 0x3013 "%08x" hex (in d1)
23: 0x3012 HH:MM:SS (in d3)
24: 0x3011 HH:MM:SS (in d2)
25: 0x3010 HH:MM:SS (in d1)
26: 0x300f dd-mon-year (day of year in d3)
27: 0x300e dd-mon-year (in d2)
28: 0x300d dd-mon-year (in d1)
29: 0x300c int32 3 dec places (in d3)
30: 0x300b int32 3 dec places (in d2)
31: 0x300a int32 3 dec places (in d1)
32: 0x3009 int32 2 dec places (in d3)
33: 0x3008 int32 2 dec places (in d2)
34: 0x3007 int32 2 dec places (in d1)
35: 0x3006 int32 1 dec place (in d3)
36: 0x3005 int32 1 dec place (in d2)
37: 0x3004 int32 1 dec place (in d1)
38: 0x3003 int32 (in d3)
39: 0x3002 int32 (in d2)
40: 0x3001 int32 (in d1)
41: 0x3000 erm, like, do last thing printed.
1.1.1.2 ! root 42:
! 43: 0x4xxx use string xxx from stringtable A6_game_strings(a6)
! 44: 0x80xx - 0xa2xx
! 45: use string xxx from stringtable in module given by:
! 46: 12 + a6 + (((d0*2) & 0xffff)>>7)
! 47: (The module string table is then obtained by jumping
! 48: to 40(addr), the address calculated above.
! 49: ( mod0 = 0x80xx, mod1 = 0x82xx, ... )
! 50:
! 51: hm. that there copy thingy is 0x98d8
! 52:
1.1 root 53:
54: SFX indices:
55: ~~~~~~~~~~~~~
56:
57: 0 ui_beep
58: 1 laser0
59: 2 laser1
60: 3 laser2
61: 4 launch_granted
62: 5 station_door_open
63: 6 explode1
64: 7 ??
65: 8 explode2
66: 9 explode3
67: 10 explode4
68: 11 explode5
69: 12 explode6
70: 13 explode7
71: 14 explode8
72: 15 explode9
73: 16 explode10
74: 17 laser_burn
75: 18 ??
76: 19 hyperspace (loop)
77: 20 hyperspace_end
78: 21 send_message
79: 22 fire_missile
80: 23 noise (loop)
81: 24 ECM
82: 25 warning!
83: 26 retract wheels (?)
84: 27 <silence?>
85: 28 select object
86: 29 bing
87: 30 big bing!
88: 31 launch_noise
89: 32 dildo
90:
91: modfuncs:
92: ~~~~~~~~~
93: 4(a4) - init
94: 20(a4) - every turn in 3d view
1.1.1.2 ! root 95: 40(a4) - get string-table
! 96:
! 97:
! 98: random crap
! 99: ~~~~~~~~~~~~~~~
1.1 root 100:
1.1.1.2 ! root 101: the gamedata things the renderer has pointer to in a5:
! 102: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! 103: size offset
! 104: WORD 0 offset added to gamedata pointer before passing to Project3DObj
! 105: WORD 2 offset to another fucking thing in this gamedata obj (L3e14e)
! 106: WORD 4 size of stackframe to allocate in L3e158
! 107: WORD 6 offset to yet another fucking thing in data obj
! 108: WORD 10 some size shift thingy
! 109: WORD 14 some size thingy
! 110:
! 111: from gamedata + 0(gamedata).w (in a5 at Project3DObj):
! 112: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! 113: size offset
! 114: WORD 0 (word & 0x1f) * 2 = offset to projection func in L3e10e
! 115: Read with (a5)+, Passed to project funcs in d6.w.
! 116:
! 117: Then different projector functions read their vertex,color,other crap from (a5)+,
! 118: and on return to Project3DObj the next word will be another projection func index.
! 119: Eg: for ProjectQuad_1:
! 120: Bytes 0,1,2,3 of (a5) are the 4 vertex ids.
! 121: WORD 4 is colour index of some kind.
! 122: for ProjectTriangle_1:
! 123: Bytes 0,1,2 are 3 vertex ids.
! 124: Byte 4 is colour index.
! 125:
! 126:
! 127: for shoving objects into the renderer:
! 128:
! 129: Caller (ejemplo DrawBGStars):
! 130: # Creates 286 byte stackframe with
! 131: lea -286(a7),a7
! 132: move.l a7,a6
! 133:
! 134: { bg stars
! 135: 20(a6) = 0.l
! 136: 24(a6) = 0.l
! 137: 28(a6) = $200.l
! 138: 90(a6) = $b0.w
! 139: }
! 140: { hyperspace cloud (during hyperspace)
! 141: 20(a6) = 0.l
! 142: 24(a6) = 0.l
! 143: 28(a6) = some value (bigger = more distant :)
! 144: 90(a6) = $ba.w
! 145: 116(a6) = 0.w
! 146: 122(a6) = $ffff.w
! 147: }
! 148:
! 149:
! 150: call Put3DObj:
! 151: d0 = 90(a6).w
! 152: a5 = Address of gamedata obj num 'd0.w'.
! 153:
! 154: a4 = a6
! 155:
! 156: # make 220 byte stackframe
! 157: link a6,#-220
! 158:
! 159: copy 32 bytes: -36(a6) = 0(a4) [caller stackframe]
! 160:
! 161: # so (in viewing coords)
! 162: -16(a6) = x
! 163: -12(a6) = y
! 164: -8(a6) = z
! 165:
! 166: # game data shit
! 167: -208(a6) = WORD 10(a5)
! 168:
! 169: -212(a6) = LONG a4 [caller stackframe]
! 170: -156(a6) = 0.w
! 171: -192(a6) = 0.w
! 172:
! 173: # flags Z if obj is onscreen
! 174: call 3DObjClipOffscreen
! 175: if not Z: return
! 176:
! 177: -64(a6) = 0.w
! 178: -154(a6) = $111.w
! 179: # lighting vector:
! 180: copy 3 LONGs: -198(a6) = L60e2 (which is normally 556(a6))
! 181: copy 4 LONGs: -104(a6) = L60f6 (which is normally 576(a6))
! 182:
! 183: call CalcZnLighting
! 184:
! 185:
! 186:
! 187: # Destroy stackframe
! 188: lea 286(a7),a7
! 189:
! 190: call CalcZnLighting:
! 191: d0-2 = z,y,z
! 192: d3 = 0
! 193: d5 = $4000
! 194: d4 = abs (z)
! 195: # find a shift value (d3) to keep abs (x,y,z) coords < $4000
! 196: while (d4 >= $4000) {
! 197: d3 += 1
! 198: d4 >>= 1
! 199: }
! 200:
! 201: d4 = abs (x)
! 202: d4 >>= d3
! 203: while (d4 >= $4000) {
! 204: d3 += 1
! 205: d4 >>= 1
! 206: }
! 207:
! 208: d4 = abs (y)
! 209: d4 >>= d3
! 210: while (d4 >= $4000) {
! 211: d3 += 1
! 212: d4 >>= 1
! 213: }
! 214:
! 215: # all LONG
! 216: x >>= d3
! 217: y >>= d3
! 218: z >>= d3
! 219:
! 220: # save shift val
! 221: -44(a6) = WORD d3
! 222: d3 += 7
! 223: d4 -= WORD -208(a6)
! 224:
! 225: if (d3 < 0) {
! 226: d3 = abs (d3)
! 227: -44(a6) += WORD d3
! 228: WORD x >>= d3
! 229: WORD y >>= d3
! 230: WORD z >>= d3
! 231: }
! 232: x = -x
! 233: y = -y
! 234: z = -z
! 235:
! 236: # WORD 3x3 matrix M[9] at -36(a6)
! 237: x1 = HIGH WORD 2*(x*M[0] + y*M[1] + z*M[2])
! 238: y1 = HIGH WORD 2*(x*M[3] + y*M[4] + z*M[5])
! 239: z1 = HIGH WORD 2*(x*M[6] + y*M[7] + z*M[8])
! 240: -50(a6) = WORD x1,y1,z1
! 241:
! 242: # Lighting vector
! 243: x,y,z = -198(a6)
! 244: x2 = HIGH WORD 2*(x*M[0] + y*M[1] + z*M[2])
! 245: y2 = HIGH WORD 2*(x*M[3] + y*M[4] + z*M[5])
! 246: z2 = HIGH WORD 2*(x*M[6] + y*M[7] + z*M[8])
! 247: -42(a6) = WORD x2,y2,z2
! 248: return
! 249:
! 250:
! 251: # flags Z if obj is onscreen
! 252: call 3DObjClipOffscreen:
! 253: # a5 still game data shit
! 254: x,y,z = viewing coords
! 255: d3 = LONG (WORD 14(a5) << WORD -208(a6))
! 256: z += d3
! 257: # object behind viewer
! 258: if z < 0: return
! 259: x = abs x
! 260: y = abs y
! 261: x -= d3
! 262: if x >= 0 goto l3966e
! 263: x = 0
! 264: l3966e:
! 265: if x > z: return
! 266: y -= d3
! 267: if y >= 0: goto l39678
! 268: y = 0
! 269: l39678:
! 270: y *= 2
! 271: if y > z: return
! 272: x = 0
! 273: return
! 274:
! 275: L3e14e:
! 276: -216(a6) = LONG (gamedata + 2(gamedata).w)
! 277: #alloc stackframe:
! 278: a7 -= WORD 4(gamedata)
! 279: a4 = a7
! 280: # and then some more
! 281: a7 -= WORD 8(gamedata)
! 282: a7 -= $c0
! 283: # save gamedata obj pointer
! 284: -4(a6) = LONG a5
! 285: -220(a6) = LONG gamedata + 6(gamedata).w
! 286:
! 287: # -208(a6) is 10(a5)
! 288: d4 = WORD -208(a6)
! 289: d4 -= WORD 8
! 290: # that shift val
! 291: d4 -= -44(a6)
! 292:
! 293: if (d4 > 0) {
! 294: shift each value in vector3 -50(a6) >> d4.
! 295: }
! 296: # we are the only caller of this func
! 297: call L39690:
! 298: # a4 is the stackframe allocated previously
! 299: # a4 has 4(gamedata).w bytes below it and
! 300: # 8(gamedata).w + $c0 bytes above.
! 301: a0 = a4 + 18
! 302: -160(a0) = 0.w
! 303: -128(a0) = 0.w
! 304: -96(a0) = 0.w
! 305: -64(a0) = 0.w
! 306: -32(a0) = 0.w
! 307: # and then it is wiped according to the length in d0,
! 308: # every 32 fuckheads
! 309: return
! 310: # also only caller of this one
! 311: call L3a00c:
! 312: a0 = 4(a7)
! 313: d1 = 8(gamedata).w # which is frame size above a4...
! 314: # wtf is -98(a6)...
! 315: (a0)+ = LONG -98(a6)
! 316: d1 >>= 1
! 317: d1 -= 3
! 318: if (d1 < 0) return
! 319: do {
! 320: (a0)+ = #$8080.w
! 321: } while (--d1 != -1)
! 322: return
! 323: # OK. so this a4 stackframe now looks like:
! 324: # from 4(a7) to -160(a4) (len 8(gamedata).w) filled with $8080
! 325: # -160(a4) to (4(gamedata).w + a4), every 32-bytes = 0.w
! 326: #
! 327: # The bit below a4 with 32-byte chunks is for storing model vertices
! 328: # transformed to viewing coords. It goes like this:
! 329: # WORD*2 0 projected 2D x,y coords
! 330: # LONG*3 4 20 + viewing transform
! 331: # WORD 18 zero if this vertex has not been setup yet
! 332: # LONG*3 20 model coords transformed by model rotation
! 333: #
! 334: -152(a6) = $2.b
! 335: a5 += WORD 0(a5)
! 336:
! 337: # phew..
! 338: call Project3DObj....
! 339:
! 340: lea -224(a6),a7
! 341: return
! 342:
! 343: 3DPrimCullNLight:
! 344: ARG d0 = WORD (BYTE color id thingy)*2
! 345: a1 = LONG -220(a6) # gamedata + 6(gamedata).w
! 346:
! 347: bclr #1,d0
! 348: if (bit 1 was set) {
! 349: # XXX finish...
! 350: }
! 351: d1,d3 = WORD -4(a1,d0.w)
! 352: d0 = d1
! 353: d1 <<= 8
! 354: d2 = d3
! 355: d2 &= 0xff00
! 356: d3 <<= 8
! 357: d0 >>= 7
! 358: d0 &= 0xfffe
! 359:
! 360: For ProjectCoords:
! 361: Input:
! 362: model coords 3xl 20(a0)
! 363: world coords 3xl -16(a6)
! 364: Output:
! 365: model+world 3xl 4(a0)
! 366: 2d projection 2xw 0(a0)
1.1 root 367:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.