
tgvectrex.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <urandom16>:

#define RAND_MAX_32 ((1UL << 31UL) - 1UL)
//#define RAND_MAX ((1U << 15) - 1)
static unsigned long rseed = 0UL;
static inline unsigned short urandom16(void)
{
       0:	55                   	push   %rbp
       1:	48 89 e5             	mov    %rsp,%rbp
  return (rseed = (rseed * 214013L + 2531011L) & RAND_MAX_32) >> 16;
       4:	48 8b 05 00 00 00 00 	mov    0x0(%rip),%rax        # b <urandom16+0xb>
       b:	48 69 c0 fd 43 03 00 	imul   $0x343fd,%rax,%rax
      12:	48 05 c3 9e 26 00    	add    $0x269ec3,%rax
      18:	25 ff ff ff 7f       	and    $0x7fffffff,%eax
      1d:	48 89 05 00 00 00 00 	mov    %rax,0x0(%rip)        # 24 <urandom16+0x24>
      24:	48 8b 05 00 00 00 00 	mov    0x0(%rip),%rax        # 2b <urandom16+0x2b>
      2b:	48 c1 e8 10          	shr    $0x10,%rax
}
      2f:	5d                   	pop    %rbp
      30:	c3                   	retq   

0000000000000031 <putPenDown>:

#define UP 0
#define DOWN 1
static unsigned char pen;
static void putPenDown(void)
{
      31:	55                   	push   %rbp
      32:	48 89 e5             	mov    %rsp,%rbp
  pen = DOWN;
      35:	c6 05 00 00 00 00 01 	movb   $0x1,0x0(%rip)        # 3c <putPenDown+0xb>
}
      3c:	5d                   	pop    %rbp
      3d:	c3                   	retq   

000000000000003e <putPenUp>:

static void putPenUp(void)
{
      3e:	55                   	push   %rbp
      3f:	48 89 e5             	mov    %rsp,%rbp
  pen = UP;
      42:	c6 05 00 00 00 00 00 	movb   $0x0,0x0(%rip)        # 49 <putPenUp+0xb>
}
      49:	5d                   	pop    %rbp
      4a:	c3                   	retq   

000000000000004b <gotoxy>:

static short last_x, last_y;
static void gotoxy(short x, short y)
{
      4b:	55                   	push   %rbp
      4c:	48 89 e5             	mov    %rsp,%rbp
      4f:	48 83 ec 10          	sub    $0x10,%rsp
      53:	89 fa                	mov    %edi,%edx
      55:	89 f0                	mov    %esi,%eax
      57:	66 89 55 fc          	mov    %dx,-0x4(%rbp)
      5b:	66 89 45 f8          	mov    %ax,-0x8(%rbp)
  // since 'down' is 1, we can just do "if (pen) ..." and when we do,
  // can make this a boolean 'pen_down'.  However I'd rather just remove
  // all traces of Scratch's pen up/pen down
  if (pen == DOWN) Display_Vectrex_vector(last_x, last_y, x, y);
      5f:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 66 <gotoxy+0x1b>
      66:	3c 01                	cmp    $0x1,%al
      68:	75 26                	jne    90 <gotoxy+0x45>
      6a:	0f bf 4d f8          	movswl -0x8(%rbp),%ecx
      6e:	0f bf 55 fc          	movswl -0x4(%rbp),%edx
      72:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 79 <gotoxy+0x2e>
      79:	0f bf f0             	movswl %ax,%esi
      7c:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 83 <gotoxy+0x38>
      83:	98                   	cwtl   
      84:	89 c7                	mov    %eax,%edi
      86:	b8 00 00 00 00       	mov    $0x0,%eax
      8b:	e8 00 00 00 00       	callq  90 <gotoxy+0x45>
  last_x = x; last_y = y;
      90:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
      94:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 9b <gotoxy+0x50>
      9b:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
      9f:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # a6 <gotoxy+0x5b>
}
      a6:	c9                   	leaveq 
      a7:	c3                   	retq   

00000000000000a8 <irand>:

static inline unsigned short irand(short max) {
      a8:	55                   	push   %rbp
      a9:	48 89 e5             	mov    %rsp,%rbp
      ac:	48 83 ec 08          	sub    $0x8,%rsp
      b0:	89 f8                	mov    %edi,%eax
      b2:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
  // returns int 0..max-1
  return urandom16() % max; // probably not very random, but this is a video game, not crypto
      b6:	e8 45 ff ff ff       	callq  0 <urandom16>
      bb:	0f b7 c0             	movzwl %ax,%eax
      be:	0f bf 4d fc          	movswl -0x4(%rbp),%ecx
      c2:	89 c2                	mov    %eax,%edx
      c4:	c1 fa 1f             	sar    $0x1f,%edx
      c7:	f7 f9                	idiv   %ecx
      c9:	89 d0                	mov    %edx,%eax
}
      cb:	c9                   	leaveq 
      cc:	c3                   	retq   

00000000000000cd <pickrandom>:

static short pickrandom(short low, short high)
{
      cd:	55                   	push   %rbp
      ce:	48 89 e5             	mov    %rsp,%rbp
      d1:	48 83 ec 08          	sub    $0x8,%rsp
      d5:	89 fa                	mov    %edi,%edx
      d7:	89 f0                	mov    %esi,%eax
      d9:	66 89 55 fc          	mov    %dx,-0x4(%rbp)
      dd:	66 89 45 f8          	mov    %ax,-0x8(%rbp)
  // We'll just assume that high > low...
  return (short)irand(high-low+1)+low;  // pick a random integer between low and high inclusive.
      e1:	0f b7 55 f8          	movzwl -0x8(%rbp),%edx
      e5:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
      e9:	89 d1                	mov    %edx,%ecx
      eb:	66 29 c1             	sub    %ax,%cx
      ee:	89 c8                	mov    %ecx,%eax
      f0:	83 c0 01             	add    $0x1,%eax
      f3:	98                   	cwtl   
      f4:	89 c7                	mov    %eax,%edi
      f6:	e8 ad ff ff ff       	callq  a8 <irand>
      fb:	0f b7 55 fc          	movzwl -0x4(%rbp),%edx
      ff:	01 d0                	add    %edx,%eax
}
     101:	c9                   	leaveq 
     102:	c3                   	retq   

0000000000000103 <setintensity>:

static void setintensity(unsigned char brightness)
{
     103:	55                   	push   %rbp
     104:	48 89 e5             	mov    %rsp,%rbp
     107:	89 f8                	mov    %edi,%eax
     109:	88 45 fc             	mov    %al,-0x4(%rbp)
  vectrex_beam_intensity = brightness&127; // &127 is redundant if there are no errors in the code :-/
     10c:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
     110:	83 e0 7f             	and    $0x7f,%eax
     113:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 119 <setintensity+0x16>
}
     119:	5d                   	pop    %rbp
     11a:	c3                   	retq   

000000000000011b <isqrt>:
// if not there are probably some simpler approximate-square-root algorithms I can
// use instead.  But lets see how well the obvious one works first...
//

static unsigned short isqrt(unsigned short op)
{
     11b:	55                   	push   %rbp
     11c:	48 89 e5             	mov    %rsp,%rbp
     11f:	89 f8                	mov    %edi,%eax
     121:	66 89 45 ec          	mov    %ax,-0x14(%rbp)
  unsigned short res = 0U;
     125:	66 c7 45 fa 00 00    	movw   $0x0,-0x6(%rbp)
  unsigned short one = 1U<<14U; // The second-to-top bit is set
     12b:	66 c7 45 fc 00 40    	movw   $0x4000,-0x4(%rbp)
  unsigned short limit;

  // "one" starts at the highest power of four <= than the argument.
  while (one > op) one >>= 2;
     131:	eb 05                	jmp    138 <isqrt+0x1d>
     133:	66 c1 6d fc 02       	shrw   $0x2,-0x4(%rbp)
     138:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     13c:	66 3b 45 ec          	cmp    -0x14(%rbp),%ax
     140:	77 f1                	ja     133 <isqrt+0x18>

  while (one != 0) {
     142:	eb 39                	jmp    17d <isqrt+0x62>
    if (op >= (limit = res + one)) {
     144:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     148:	0f b7 55 fa          	movzwl -0x6(%rbp),%edx
     14c:	01 d0                	add    %edx,%eax
     14e:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
     152:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     156:	66 3b 45 ec          	cmp    -0x14(%rbp),%ax
     15a:	77 18                	ja     174 <isqrt+0x59>
      op -= limit;
     15c:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     160:	66 29 45 ec          	sub    %ax,-0x14(%rbp)
      res += one;
     164:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     168:	66 01 45 fa          	add    %ax,-0x6(%rbp)
      res += one;
     16c:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     170:	66 01 45 fa          	add    %ax,-0x6(%rbp)
    }
    res >>= 1;
     174:	66 d1 6d fa          	shrw   -0x6(%rbp)
    one >>= 2;
     178:	66 c1 6d fc 02       	shrw   $0x2,-0x4(%rbp)
  unsigned short limit;

  // "one" starts at the highest power of four <= than the argument.
  while (one > op) one >>= 2;

  while (one != 0) {
     17d:	66 83 7d fc 00       	cmpw   $0x0,-0x4(%rbp)
     182:	75 c0                	jne    144 <isqrt+0x29>
  }
#ifdef SQRT_ROUNDING
  /* Do arithmetic rounding to nearest integer */
  if (op > res) res++;
#endif
  return res;
     184:	0f b7 45 fa          	movzwl -0x6(%rbp),%eax
}
     188:	5d                   	pop    %rbp
     189:	c3                   	retq   

000000000000018a <asin_of_fp2_14>:

// Could use asin(x) = atan2 (x, sqrt ((1.0 + x) * (1.0 - x)))
// except our atan2 is pretty slow and isqrt is worse, and then we have muldiv to worry about!

static short asin_of_fp2_14(fp2_14 angle) // parameter is consistent with the result of fp2_14_sin(angle)
{                                       // angle inherited from Scratch implementation is in range -1.0 to 1.0
     18a:	55                   	push   %rbp
     18b:	48 89 e5             	mov    %rsp,%rbp
     18e:	89 f8                	mov    %edi,%eax
     190:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
                                        //
                                        // Our reimplementation should used 256 angles rather than degrees
                                        // NOTE that I am non-standardly returning -128..128 rather than 0..255 -
                                        // this is to be compatible with the Scratch implementation

  if (angle > 128) return -(asintab[256-angle]>>6);  // or use abs instead of '-'.  first half of table is all negative or 0.
     194:	66 81 7d fc 80 00    	cmpw   $0x80,-0x4(%rbp)
     19a:	7e 21                	jle    1bd <asin_of_fp2_14+0x33>
     19c:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
     1a0:	ba 00 01 00 00       	mov    $0x100,%edx
     1a5:	89 d1                	mov    %edx,%ecx
     1a7:	29 c1                	sub    %eax,%ecx
     1a9:	89 c8                	mov    %ecx,%eax
     1ab:	48 98                	cltq   
     1ad:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
     1b4:	00 
     1b5:	66 c1 f8 06          	sar    $0x6,%ax
     1b9:	f7 d8                	neg    %eax
     1bb:	eb 12                	jmp    1cf <asin_of_fp2_14+0x45>
  return asintab[angle]>>6; // returns fp equivalent to -1.0 to 1.0 I think
     1bd:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
     1c1:	48 98                	cltq   
     1c3:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
     1ca:	00 
     1cb:	66 c1 f8 06          	sar    $0x6,%ax
  // and avoid any loss of precision due to the shifting.  Not that accuracy is so important here.

  // This whole area is getting a bit messy, but at least I'm starting to get
  // the last of the missing components in place.  May end up doing a lot of side-by-side comparison with the Scratch code
  // to debug some of this... (after removing all the randoms and making it all repeatable...)
}
     1cf:	5d                   	pop    %rbp
     1d0:	c3                   	retq   

00000000000001d1 <s16_nabs>:
 * abs/labs/llabs behavior).
 *
 * @param i 16-bit signed integer
 * @return negative absolute value of i; defined for all values of i
 */
static inline short s16_nabs(const short j) {
     1d1:	55                   	push   %rbp
     1d2:	48 89 e5             	mov    %rsp,%rbp
     1d5:	89 f8                	mov    %edi,%eax
     1d7:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
//  const short negSign = ~(j >> 15); // splat sign bit into all 16 and complement
  // if j is positive (negSign is -1), xor will invert j and sub will add 1
  // otherwise j is unchanged
//  return (j ^ negSign) - negSign;
//#else
  return (j < 0 ? j : -j);
     1db:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
     1df:	89 c2                	mov    %eax,%edx
     1e1:	c1 fa 1f             	sar    $0x1f,%edx
     1e4:	31 d0                	xor    %edx,%eax
     1e6:	29 d0                	sub    %edx,%eax
     1e8:	f7 d8                	neg    %eax
//#endif
}
     1ea:	5d                   	pop    %rbp
     1eb:	c3                   	retq   

00000000000001ec <muldiv>:

// I haven't checked this yet for signed parameters, so the places I'm using it
// all assume the parameters are unsigned and handle the negation separately.
// Rather hacky.  I'll revisit this after the code is running well.
unsigned short muldiv(unsigned short a, unsigned short b, unsigned short c)
{
     1ec:	55                   	push   %rbp
     1ed:	48 89 e5             	mov    %rsp,%rbp
     1f0:	89 f1                	mov    %esi,%ecx
     1f2:	89 d0                	mov    %edx,%eax
     1f4:	66 89 7d fc          	mov    %di,-0x4(%rbp)
     1f8:	66 89 4d f8          	mov    %cx,-0x8(%rbp)
     1fc:	66 89 45 f4          	mov    %ax,-0xc(%rbp)
      b >>= 1; qn <<= 1; rn <<= 1; if (rn >= c) { qn++; rn -= c; }
    }
  }
 return q; // also, r = (a * b) % c   (q = quotient, r = remainder)
#else
 return (unsigned short)(((unsigned long)a * (unsigned long)b) / (unsigned long)c);
     200:	0f b7 55 fc          	movzwl -0x4(%rbp),%edx
     204:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     208:	48 0f af c2          	imul   %rdx,%rax
     20c:	0f b7 55 f4          	movzwl -0xc(%rbp),%edx
     210:	48 89 55 e8          	mov    %rdx,-0x18(%rbp)
     214:	ba 00 00 00 00       	mov    $0x0,%edx
     219:	48 f7 75 e8          	divq   -0x18(%rbp)
#endif
}
     21d:	5d                   	pop    %rbp
     21e:	c3                   	retq   

000000000000021f <q15_mul>:

static inline short q15_mul(const short j, const short k) {
     21f:	55                   	push   %rbp
     220:	48 89 e5             	mov    %rsp,%rbp
     223:	48 83 ec 08          	sub    $0x8,%rsp
     227:	89 fa                	mov    %edi,%edx
     229:	89 f0                	mov    %esi,%eax
     22b:	66 89 55 fc          	mov    %dx,-0x4(%rbp)
     22f:	66 89 45 f8          	mov    %ax,-0x8(%rbp)
  // I'll fix this later.  Use a flag, and s16_nabs() to unnegate the negative params
  // check it works using the atan_test.c program - trivial mistakes here can really break things
  if (j<0 && k<0) return (short)muldiv(-j,-k,1<<15);
     233:	66 83 7d fc 00       	cmpw   $0x0,-0x4(%rbp)
     238:	79 29                	jns    263 <q15_mul+0x44>
     23a:	66 83 7d f8 00       	cmpw   $0x0,-0x8(%rbp)
     23f:	79 22                	jns    263 <q15_mul+0x44>
     241:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     245:	f7 d8                	neg    %eax
     247:	0f b7 c8             	movzwl %ax,%ecx
     24a:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     24e:	f7 d8                	neg    %eax
     250:	0f b7 c0             	movzwl %ax,%eax
     253:	ba 00 80 00 00       	mov    $0x8000,%edx
     258:	89 ce                	mov    %ecx,%esi
     25a:	89 c7                	mov    %eax,%edi
     25c:	e8 00 00 00 00       	callq  261 <q15_mul+0x42>
     261:	eb 6e                	jmp    2d1 <q15_mul+0xb2>
  if (j<0) return -(short)muldiv(-j,k,1<<15);
     263:	66 83 7d fc 00       	cmpw   $0x0,-0x4(%rbp)
     268:	79 22                	jns    28c <q15_mul+0x6d>
     26a:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     26e:	0f b7 c8             	movzwl %ax,%ecx
     271:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     275:	f7 d8                	neg    %eax
     277:	0f b7 c0             	movzwl %ax,%eax
     27a:	ba 00 80 00 00       	mov    $0x8000,%edx
     27f:	89 ce                	mov    %ecx,%esi
     281:	89 c7                	mov    %eax,%edi
     283:	e8 00 00 00 00       	callq  288 <q15_mul+0x69>
     288:	f7 d8                	neg    %eax
     28a:	eb 45                	jmp    2d1 <q15_mul+0xb2>
  if (k<0) return -(short)muldiv(j,-k,1<<15);
     28c:	66 83 7d f8 00       	cmpw   $0x0,-0x8(%rbp)
     291:	79 22                	jns    2b5 <q15_mul+0x96>
     293:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     297:	f7 d8                	neg    %eax
     299:	0f b7 c8             	movzwl %ax,%ecx
     29c:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     2a0:	0f b7 c0             	movzwl %ax,%eax
     2a3:	ba 00 80 00 00       	mov    $0x8000,%edx
     2a8:	89 ce                	mov    %ecx,%esi
     2aa:	89 c7                	mov    %eax,%edi
     2ac:	e8 00 00 00 00       	callq  2b1 <q15_mul+0x92>
     2b1:	f7 d8                	neg    %eax
     2b3:	eb 1c                	jmp    2d1 <q15_mul+0xb2>
  return (short)muldiv(j, k, 1<<15);
     2b5:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     2b9:	0f b7 c8             	movzwl %ax,%ecx
     2bc:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     2c0:	0f b7 c0             	movzwl %ax,%eax
     2c3:	ba 00 80 00 00       	mov    $0x8000,%edx
     2c8:	89 ce                	mov    %ecx,%esi
     2ca:	89 c7                	mov    %eax,%edi
     2cc:	e8 00 00 00 00       	callq  2d1 <q15_mul+0xb2>
}
     2d1:	c9                   	leaveq 
     2d2:	c3                   	retq   

00000000000002d3 <q15_div>:

static inline short q15_div(const short numer, const short denom) {
     2d3:	55                   	push   %rbp
     2d4:	48 89 e5             	mov    %rsp,%rbp
     2d7:	48 83 ec 08          	sub    $0x8,%rsp
     2db:	89 fa                	mov    %edi,%edx
     2dd:	89 f0                	mov    %esi,%eax
     2df:	66 89 55 fc          	mov    %dx,-0x4(%rbp)
     2e3:	66 89 45 f8          	mov    %ax,-0x8(%rbp)
  // ditto
  if (numer<0 && denom<0) return (short)muldiv(-numer, 1<<15,  -denom);
     2e7:	66 83 7d fc 00       	cmpw   $0x0,-0x4(%rbp)
     2ec:	79 27                	jns    315 <q15_div+0x42>
     2ee:	66 83 7d f8 00       	cmpw   $0x0,-0x8(%rbp)
     2f3:	79 20                	jns    315 <q15_div+0x42>
     2f5:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     2f9:	f7 d8                	neg    %eax
     2fb:	0f b7 d0             	movzwl %ax,%edx
     2fe:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     302:	f7 d8                	neg    %eax
     304:	0f b7 c0             	movzwl %ax,%eax
     307:	be 00 80 00 00       	mov    $0x8000,%esi
     30c:	89 c7                	mov    %eax,%edi
     30e:	e8 00 00 00 00       	callq  313 <q15_div+0x40>
     313:	eb 68                	jmp    37d <q15_div+0xaa>
  if (numer<0) return -(short)muldiv(-numer, 1<<15,  denom);
     315:	66 83 7d fc 00       	cmpw   $0x0,-0x4(%rbp)
     31a:	79 20                	jns    33c <q15_div+0x69>
     31c:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     320:	0f b7 d0             	movzwl %ax,%edx
     323:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     327:	f7 d8                	neg    %eax
     329:	0f b7 c0             	movzwl %ax,%eax
     32c:	be 00 80 00 00       	mov    $0x8000,%esi
     331:	89 c7                	mov    %eax,%edi
     333:	e8 00 00 00 00       	callq  338 <q15_div+0x65>
     338:	f7 d8                	neg    %eax
     33a:	eb 41                	jmp    37d <q15_div+0xaa>
  if (denom<0) return -(short)muldiv(numer, 1<<15,  -denom);
     33c:	66 83 7d f8 00       	cmpw   $0x0,-0x8(%rbp)
     341:	79 20                	jns    363 <q15_div+0x90>
     343:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     347:	f7 d8                	neg    %eax
     349:	0f b7 d0             	movzwl %ax,%edx
     34c:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     350:	0f b7 c0             	movzwl %ax,%eax
     353:	be 00 80 00 00       	mov    $0x8000,%esi
     358:	89 c7                	mov    %eax,%edi
     35a:	e8 00 00 00 00       	callq  35f <q15_div+0x8c>
     35f:	f7 d8                	neg    %eax
     361:	eb 1a                	jmp    37d <q15_div+0xaa>
  return (short)muldiv(numer, 1<<15,  denom);
     363:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     367:	0f b7 d0             	movzwl %ax,%edx
     36a:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     36e:	0f b7 c0             	movzwl %ax,%eax
     371:	be 00 80 00 00       	mov    $0x8000,%esi
     376:	89 c7                	mov    %eax,%edi
     378:	e8 00 00 00 00       	callq  37d <q15_div+0xaa>
}
     37d:	c9                   	leaveq 
     37e:	c3                   	retq   

000000000000037f <fxpt_atan2>:
 *
 * @param y y-coordinate in signed 16-bit
 * @param x x-coordinate in signed 16-bit
 * @return angle in (val / 32768) * pi radian increments from 0x0000 to 0xFFFF
 */
unsigned short fxpt_atan2(const short y, const short x) {
     37f:	55                   	push   %rbp
     380:	48 89 e5             	mov    %rsp,%rbp
     383:	48 83 ec 18          	sub    $0x18,%rsp
     387:	89 fa                	mov    %edi,%edx
     389:	89 f0                	mov    %esi,%eax
     38b:	66 89 55 ec          	mov    %dx,-0x14(%rbp)
     38f:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
  short nabs_y, nabs_x;
  if (x == y) { // x/y or y/x would return -1 since 1 isn't representable
     393:	0f b7 45 e8          	movzwl -0x18(%rbp),%eax
     397:	66 3b 45 ec          	cmp    -0x14(%rbp),%ax
     39b:	75 2c                	jne    3c9 <fxpt_atan2+0x4a>
    if (y > 0) { // 1/8
     39d:	66 83 7d ec 00       	cmpw   $0x0,-0x14(%rbp)
     3a2:	7e 0a                	jle    3ae <fxpt_atan2+0x2f>
      return 8192U;
     3a4:	b8 00 20 00 00       	mov    $0x2000,%eax
     3a9:	e9 19 01 00 00       	jmpq   4c7 <fxpt_atan2+0x148>
    } else if (y < 0) { // 5/8
     3ae:	66 83 7d ec 00       	cmpw   $0x0,-0x14(%rbp)
     3b3:	79 0a                	jns    3bf <fxpt_atan2+0x40>
      return 40960U;
     3b5:	b8 00 a0 ff ff       	mov    $0xffffa000,%eax
     3ba:	e9 08 01 00 00       	jmpq   4c7 <fxpt_atan2+0x148>
    } else { // x = y = 0
      return 0U;
     3bf:	b8 00 00 00 00       	mov    $0x0,%eax
     3c4:	e9 fe 00 00 00       	jmpq   4c7 <fxpt_atan2+0x148>
    }
  }
  nabs_y = s16_nabs(y); nabs_x = s16_nabs(x);
     3c9:	0f bf 45 ec          	movswl -0x14(%rbp),%eax
     3cd:	89 c7                	mov    %eax,%edi
     3cf:	e8 fd fd ff ff       	callq  1d1 <s16_nabs>
     3d4:	66 89 45 f0          	mov    %ax,-0x10(%rbp)
     3d8:	0f bf 45 e8          	movswl -0x18(%rbp),%eax
     3dc:	89 c7                	mov    %eax,%edi
     3de:	e8 ee fd ff ff       	callq  1d1 <s16_nabs>
     3e3:	66 89 45 f2          	mov    %ax,-0xe(%rbp)
  if (nabs_x < nabs_y) { // octants 1, 4, 5, 8
     3e7:	0f b7 45 f2          	movzwl -0xe(%rbp),%eax
     3eb:	66 3b 45 f0          	cmp    -0x10(%rbp),%ax
     3ef:	7d 62                	jge    453 <fxpt_atan2+0xd4>
    const short y_over_x = q15_div(y, x);
     3f1:	0f bf 55 e8          	movswl -0x18(%rbp),%edx
     3f5:	0f bf 45 ec          	movswl -0x14(%rbp),%eax
     3f9:	89 d6                	mov    %edx,%esi
     3fb:	89 c7                	mov    %eax,%edi
     3fd:	e8 d1 fe ff ff       	callq  2d3 <q15_div>
     402:	66 89 45 f4          	mov    %ax,-0xc(%rbp)
    const short correction = q15_mul(/*q15_from_double(0.273 * M_1_PI)*/2847, s16_nabs(y_over_x));
     406:	0f bf 45 f4          	movswl -0xc(%rbp),%eax
     40a:	89 c7                	mov    %eax,%edi
     40c:	e8 c0 fd ff ff       	callq  1d1 <s16_nabs>
     411:	98                   	cwtl   
     412:	89 c6                	mov    %eax,%esi
     414:	bf 1f 0b 00 00       	mov    $0xb1f,%edi
     419:	e8 01 fe ff ff       	callq  21f <q15_mul>
     41e:	66 89 45 f6          	mov    %ax,-0xa(%rbp)
    const short unrotated = q15_mul(/*q15_from_double(0.25 + 0.273 * M_1_PI)*/11039 + correction, y_over_x);
     422:	0f bf 55 f4          	movswl -0xc(%rbp),%edx
     426:	0f b7 45 f6          	movzwl -0xa(%rbp),%eax
     42a:	66 05 1f 2b          	add    $0x2b1f,%ax
     42e:	98                   	cwtl   
     42f:	89 d6                	mov    %edx,%esi
     431:	89 c7                	mov    %eax,%edi
     433:	e8 e7 fd ff ff       	callq  21f <q15_mul>
     438:	66 89 45 f8          	mov    %ax,-0x8(%rbp)
    if (x > 0) { // octants 1, 8
     43c:	66 83 7d e8 00       	cmpw   $0x0,-0x18(%rbp)
     441:	7e 06                	jle    449 <fxpt_atan2+0xca>
      return unrotated;
     443:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     447:	eb 7e                	jmp    4c7 <fxpt_atan2+0x148>
    } else { // octants 4, 5
      return 32768U + unrotated;
     449:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     44d:	66 05 00 80          	add    $0x8000,%ax
     451:	eb 74                	jmp    4c7 <fxpt_atan2+0x148>
    }
  } else { // octants 2, 3, 6, 7
    const short x_over_y = q15_div(x, y);
     453:	0f bf 55 ec          	movswl -0x14(%rbp),%edx
     457:	0f bf 45 e8          	movswl -0x18(%rbp),%eax
     45b:	89 d6                	mov    %edx,%esi
     45d:	89 c7                	mov    %eax,%edi
     45f:	e8 6f fe ff ff       	callq  2d3 <q15_div>
     464:	66 89 45 fa          	mov    %ax,-0x6(%rbp)
    const short correction = q15_mul(/*q15_from_double(0.273 * M_1_PI)*/2847, s16_nabs(x_over_y));
     468:	0f bf 45 fa          	movswl -0x6(%rbp),%eax
     46c:	89 c7                	mov    %eax,%edi
     46e:	e8 5e fd ff ff       	callq  1d1 <s16_nabs>
     473:	98                   	cwtl   
     474:	89 c6                	mov    %eax,%esi
     476:	bf 1f 0b 00 00       	mov    $0xb1f,%edi
     47b:	e8 9f fd ff ff       	callq  21f <q15_mul>
     480:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
    const short unrotated = q15_mul(/*q15_from_double(0.25 + 0.273 * M_1_PI)*/11039 + correction, x_over_y);
     484:	0f bf 55 fa          	movswl -0x6(%rbp),%edx
     488:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     48c:	66 05 1f 2b          	add    $0x2b1f,%ax
     490:	98                   	cwtl   
     491:	89 d6                	mov    %edx,%esi
     493:	89 c7                	mov    %eax,%edi
     495:	e8 85 fd ff ff       	callq  21f <q15_mul>
     49a:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
    if (y > 0) { // octants 2, 3
     49e:	66 83 7d ec 00       	cmpw   $0x0,-0x14(%rbp)
     4a3:	7e 12                	jle    4b7 <fxpt_atan2+0x138>
      return 16384U - unrotated;
     4a5:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     4a9:	ba 00 40 00 00       	mov    $0x4000,%edx
     4ae:	89 d1                	mov    %edx,%ecx
     4b0:	66 29 c1             	sub    %ax,%cx
     4b3:	89 c8                	mov    %ecx,%eax
     4b5:	eb 10                	jmp    4c7 <fxpt_atan2+0x148>
    } else { // octants 6, 7
      return 49152U - unrotated;
     4b7:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     4bb:	ba 00 c0 ff ff       	mov    $0xffffc000,%edx
     4c0:	89 d1                	mov    %edx,%ecx
     4c2:	66 29 c1             	sub    %ax,%cx
     4c5:	89 c8                	mov    %ecx,%eax
    }
  }
}
     4c7:	c9                   	leaveq 
     4c8:	c3                   	retq   

00000000000004c9 <Scratch_atan2_fakedegrees>:

}
#endif

static short Scratch_atan2_fakedegrees(short x, short y)  // substitute for atan2(x/y) but using 256 angles in a circle rather than 360 degrees
{
     4c9:	55                   	push   %rbp
     4ca:	48 89 e5             	mov    %rsp,%rbp
     4cd:	48 83 ec 18          	sub    $0x18,%rsp
     4d1:	89 fa                	mov    %edi,%edx
     4d3:	89 f0                	mov    %esi,%eax
     4d5:	66 89 55 ec          	mov    %dx,-0x14(%rbp)
     4d9:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
  short result = ((fxpt_atan2(x, y)>>8)-128);
     4dd:	0f bf 55 e8          	movswl -0x18(%rbp),%edx
     4e1:	0f bf 45 ec          	movswl -0x14(%rbp),%eax
     4e5:	89 d6                	mov    %edx,%esi
     4e7:	89 c7                	mov    %eax,%edi
     4e9:	e8 00 00 00 00       	callq  4ee <Scratch_atan2_fakedegrees+0x25>
     4ee:	66 c1 e8 08          	shr    $0x8,%ax
     4f2:	83 c0 80             	add    $0xffffff80,%eax
     4f5:	66 89 45 fe          	mov    %ax,-0x2(%rbp)

  if (result <= -64) {
     4f9:	66 83 7d fe c1       	cmpw   $0xffc1,-0x2(%rbp)
     4fe:	7d 0a                	jge    50a <Scratch_atan2_fakedegrees+0x41>
    return result + 128;
     500:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     504:	66 83 e8 80          	sub    $0xff80,%ax
     508:	eb 14                	jmp    51e <Scratch_atan2_fakedegrees+0x55>
  } else if (result >= 64) {
     50a:	66 83 7d fe 3f       	cmpw   $0x3f,-0x2(%rbp)
     50f:	7e 09                	jle    51a <Scratch_atan2_fakedegrees+0x51>
    return result - 128;
     511:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     515:	83 c0 80             	add    $0xffffff80,%eax
     518:	eb 04                	jmp    51e <Scratch_atan2_fakedegrees+0x55>
  }
  return result;
     51a:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax

}
     51e:	c9                   	leaveq 
     51f:	c3                   	retq   

0000000000000520 <numdigits>:
  return 0; // returns atan of angle - watch for range issues!
}
#endif

static unsigned char numdigits(short num)
{
     520:	55                   	push   %rbp
     521:	48 89 e5             	mov    %rsp,%rbp
     524:	89 f8                	mov    %edi,%eax
     526:	66 89 45 ec          	mov    %ax,-0x14(%rbp)
  // a chain of if/then/elses may be more efficient than a software divide by 10 ?
  unsigned char result = 0U;
     52a:	c6 45 ff 00          	movb   $0x0,-0x1(%rbp)
  do {
    num = num / 10;
     52e:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
     532:	0f bf d0             	movswl %ax,%edx
     535:	69 d2 67 66 00 00    	imul   $0x6667,%edx,%edx
     53b:	c1 ea 10             	shr    $0x10,%edx
     53e:	66 c1 fa 02          	sar    $0x2,%dx
     542:	66 c1 f8 0f          	sar    $0xf,%ax
     546:	89 d1                	mov    %edx,%ecx
     548:	66 29 c1             	sub    %ax,%cx
     54b:	89 c8                	mov    %ecx,%eax
     54d:	66 89 45 ec          	mov    %ax,-0x14(%rbp)
    result++;
     551:	80 45 ff 01          	addb   $0x1,-0x1(%rbp)
  } while (num > 0);
     555:	66 83 7d ec 00       	cmpw   $0x0,-0x14(%rbp)
     55a:	7f d2                	jg     52e <numdigits+0xe>
  return result;
     55c:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
}
     560:	5d                   	pop    %rbp
     561:	c3                   	retq   

0000000000000562 <sinsymmetry>:
                                            // for Scratch arrays, so need to be replaced with
                                            // suitable-adjusted constants (which I think I've
                                            // done now)

static fp2_14 sinsymmetry(unsigned char angle128)
{
     562:	55                   	push   %rbp
     563:	48 89 e5             	mov    %rsp,%rbp
     566:	89 f8                	mov    %edi,%eax
     568:	88 45 fc             	mov    %al,-0x4(%rbp)
  // '>', not '>=', is a special case for sin(x)=1.0
  if (angle128 > 64U) return sine[128-angle128]; else return sine[angle128];
     56b:	80 7d fc 40          	cmpb   $0x40,-0x4(%rbp)
     56f:	76 1b                	jbe    58c <sinsymmetry+0x2a>
     571:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
     575:	ba 80 00 00 00       	mov    $0x80,%edx
     57a:	89 d1                	mov    %edx,%ecx
     57c:	29 c1                	sub    %eax,%ecx
     57e:	89 c8                	mov    %ecx,%eax
     580:	48 98                	cltq   
     582:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
     589:	00 
     58a:	eb 0e                	jmp    59a <sinsymmetry+0x38>
     58c:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
     590:	48 98                	cltq   
     592:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
     599:	00 
}
     59a:	5d                   	pop    %rbp
     59b:	c3                   	retq   

000000000000059c <fp2_14_sin>:

static fp2_14 fp2_14_sin(short angle256)
{
     59c:	55                   	push   %rbp
     59d:	48 89 e5             	mov    %rsp,%rbp
     5a0:	48 83 ec 08          	sub    $0x8,%rsp
     5a4:	89 f8                	mov    %edi,%eax
     5a6:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
  if ((unsigned char)angle256 >= 128U) return -sinsymmetry((unsigned char)(angle256-128)&127); else return sinsymmetry((unsigned char)angle256&127);
     5aa:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     5ae:	84 c0                	test   %al,%al
     5b0:	79 15                	jns    5c7 <fp2_14_sin+0x2b>
     5b2:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     5b6:	0f b6 c0             	movzbl %al,%eax
     5b9:	83 e0 7f             	and    $0x7f,%eax
     5bc:	89 c7                	mov    %eax,%edi
     5be:	e8 9f ff ff ff       	callq  562 <sinsymmetry>
     5c3:	f7 d8                	neg    %eax
     5c5:	eb 11                	jmp    5d8 <fp2_14_sin+0x3c>
     5c7:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     5cb:	0f b6 c0             	movzbl %al,%eax
     5ce:	83 e0 7f             	and    $0x7f,%eax
     5d1:	89 c7                	mov    %eax,%edi
     5d3:	e8 8a ff ff ff       	callq  562 <sinsymmetry>
}
     5d8:	c9                   	leaveq 
     5d9:	c3                   	retq   

00000000000005da <fp2_14_cos>:

static fp2_14 fp2_14_cos(short angle256)
{
     5da:	55                   	push   %rbp
     5db:	48 89 e5             	mov    %rsp,%rbp
     5de:	48 83 ec 08          	sub    $0x8,%rsp
     5e2:	89 f8                	mov    %edi,%eax
     5e4:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
  return fp2_14_sin(angle256+64); // implicit &255 in these unsigned char parameters
     5e8:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     5ec:	83 c0 40             	add    $0x40,%eax
     5ef:	98                   	cwtl   
     5f0:	89 c7                	mov    %eax,%edi
     5f2:	e8 a5 ff ff ff       	callq  59c <fp2_14_sin>
}
     5f7:	c9                   	leaveq 
     5f8:	c3                   	retq   

00000000000005f9 <mul_short_by_fp2_14_returning_short>:

static short mul_short_by_fp2_14_returning_short(short num, fp2_14 fp)
{
     5f9:	55                   	push   %rbp
     5fa:	48 89 e5             	mov    %rsp,%rbp
     5fd:	48 83 ec 18          	sub    $0x18,%rsp
     601:	89 fa                	mov    %edi,%edx
     603:	89 f0                	mov    %esi,%eax
     605:	66 89 55 ec          	mov    %dx,-0x14(%rbp)
     609:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
  short sign = 1;
     60d:	66 c7 45 fe 01 00    	movw   $0x1,-0x2(%rbp)
  if (num < 0) { num = -num; sign = -sign; }
     613:	66 83 7d ec 00       	cmpw   $0x0,-0x14(%rbp)
     618:	79 14                	jns    62e <mul_short_by_fp2_14_returning_short+0x35>
     61a:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
     61e:	f7 d8                	neg    %eax
     620:	66 89 45 ec          	mov    %ax,-0x14(%rbp)
     624:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     628:	f7 d8                	neg    %eax
     62a:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
  if (fp < 0) { fp = -fp; sign = -sign; }
     62e:	66 83 7d e8 00       	cmpw   $0x0,-0x18(%rbp)
     633:	79 14                	jns    649 <mul_short_by_fp2_14_returning_short+0x50>
     635:	0f b7 45 e8          	movzwl -0x18(%rbp),%eax
     639:	f7 d8                	neg    %eax
     63b:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
     63f:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     643:	f7 d8                	neg    %eax
     645:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
  return sign * muldiv(num, fp, ONE_POINT_ZERO);  // clearly could be a lot more efficient, but this has to do for now while developing
     649:	0f b7 45 e8          	movzwl -0x18(%rbp),%eax
     64d:	0f b7 c8             	movzwl %ax,%ecx
     650:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
     654:	0f b7 c0             	movzwl %ax,%eax
     657:	ba 00 40 00 00       	mov    $0x4000,%edx
     65c:	89 ce                	mov    %ecx,%esi
     65e:	89 c7                	mov    %eax,%edi
     660:	e8 00 00 00 00       	callq  665 <mul_short_by_fp2_14_returning_short+0x6c>
     665:	0f b7 55 fe          	movzwl -0x2(%rbp),%edx
     669:	0f af c2             	imul   %edx,%eax
}
     66c:	c9                   	leaveq 
     66d:	c3                   	retq   

000000000000066e <div_int_by_int_returning_fp2_14>:

static fp2_14 div_int_by_int_returning_fp2_14(short num, short den) // divides 2 ints and returns fp result
{
     66e:	55                   	push   %rbp
     66f:	48 89 e5             	mov    %rsp,%rbp
     672:	48 83 ec 18          	sub    $0x18,%rsp
     676:	89 fa                	mov    %edi,%edx
     678:	89 f0                	mov    %esi,%eax
     67a:	66 89 55 ec          	mov    %dx,-0x14(%rbp)
     67e:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
  // should we range-test the results of these? Even if only on the OpenGL version where I can output some diagnostic to a console?
  short sign = 1;
     682:	66 c7 45 fe 01 00    	movw   $0x1,-0x2(%rbp)
  if (num < 0) { num = -num; sign = -sign; }
     688:	66 83 7d ec 00       	cmpw   $0x0,-0x14(%rbp)
     68d:	79 14                	jns    6a3 <div_int_by_int_returning_fp2_14+0x35>
     68f:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
     693:	f7 d8                	neg    %eax
     695:	66 89 45 ec          	mov    %ax,-0x14(%rbp)
     699:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     69d:	f7 d8                	neg    %eax
     69f:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
  if (den < 0) { den = -den; sign = -sign; }
     6a3:	66 83 7d e8 00       	cmpw   $0x0,-0x18(%rbp)
     6a8:	79 14                	jns    6be <div_int_by_int_returning_fp2_14+0x50>
     6aa:	0f b7 45 e8          	movzwl -0x18(%rbp),%eax
     6ae:	f7 d8                	neg    %eax
     6b0:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
     6b4:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     6b8:	f7 d8                	neg    %eax
     6ba:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
  return sign * muldiv(num, ONE_POINT_ZERO, den);
     6be:	0f b7 45 e8          	movzwl -0x18(%rbp),%eax
     6c2:	0f b7 d0             	movzwl %ax,%edx
     6c5:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
     6c9:	0f b7 c0             	movzwl %ax,%eax
     6cc:	be 00 40 00 00       	mov    $0x4000,%esi
     6d1:	89 c7                	mov    %eax,%edi
     6d3:	e8 00 00 00 00       	callq  6d8 <div_int_by_int_returning_fp2_14+0x6a>
     6d8:	0f b7 55 fe          	movzwl -0x2(%rbp),%edx
     6dc:	0f af c2             	imul   %edx,%eax
}
     6df:	c9                   	leaveq 
     6e0:	c3                   	retq   

00000000000006e1 <draw_tg_intro_with_rolling_rotation>:
#define MAX_LASERS 2 /* haven't looked at this closely yet, needs rewrite anyway... */
//static unsigned char projectile_next;
//static short projectiles[MAX_LASERS * PROJECTILE_RECORD_LENGTH]; // 3 fields in this array of structs.  (.lasert, .x, .y)

static inline void draw_tg_intro_with_rolling_rotation(short from_x, short from_y, short to_x, short to_y, unsigned char rot)
{
     6e1:	55                   	push   %rbp
     6e2:	48 89 e5             	mov    %rsp,%rbp
     6e5:	48 83 ec 30          	sub    $0x30,%rsp
     6e9:	89 c8                	mov    %ecx,%eax
     6eb:	44 89 c1             	mov    %r8d,%ecx
     6ee:	66 89 7d ec          	mov    %di,-0x14(%rbp)
     6f2:	66 89 75 e8          	mov    %si,-0x18(%rbp)
     6f6:	66 89 55 e4          	mov    %dx,-0x1c(%rbp)
     6fa:	66 89 45 e0          	mov    %ax,-0x20(%rbp)
     6fe:	88 4d dc             	mov    %cl,-0x24(%rbp)
  if ((from_x != to_x) || (from_y != to_y)) {
     701:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
     705:	66 3b 45 e4          	cmp    -0x1c(%rbp),%ax
     709:	75 0e                	jne    719 <draw_tg_intro_with_rolling_rotation+0x38>
     70b:	0f b7 45 e8          	movzwl -0x18(%rbp),%eax
     70f:	66 3b 45 e0          	cmp    -0x20(%rbp),%ax
     713:	0f 84 f0 01 00 00    	je     909 <draw_tg_intro_with_rolling_rotation+0x228>
    short PackX, PackY, PackZ;
    short screenx; // 3d coordinates are convered to screen coordinates when displaying vectors
    short screeny;

    tgx = from_x; tgy = from_y; tgz = 0;
     719:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
     71d:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 724 <draw_tg_intro_with_rolling_rotation+0x43>
     724:	0f b7 45 e8          	movzwl -0x18(%rbp),%eax
     728:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 72f <draw_tg_intro_with_rolling_rotation+0x4e>
     72f:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 738 <draw_tg_intro_with_rolling_rotation+0x57>
     736:	00 00 

    PackX = to_x; PackY = to_y; PackZ = 0;
     738:	0f b7 45 e4          	movzwl -0x1c(%rbp),%eax
     73c:	66 89 45 f6          	mov    %ax,-0xa(%rbp)
     740:	0f b7 45 e0          	movzwl -0x20(%rbp),%eax
     744:	66 89 45 f8          	mov    %ax,-0x8(%rbp)
     748:	66 c7 45 fa 00 00    	movw   $0x0,-0x6(%rbp)
    PackZ += mul_short_by_fp2_14_returning_short(PackY, fp2_14_sin (rot));
     74e:	0f b6 45 dc          	movzbl -0x24(%rbp),%eax
     752:	89 c7                	mov    %eax,%edi
     754:	e8 43 fe ff ff       	callq  59c <fp2_14_sin>
     759:	0f bf d0             	movswl %ax,%edx
     75c:	0f bf 45 f8          	movswl -0x8(%rbp),%eax
     760:	89 d6                	mov    %edx,%esi
     762:	89 c7                	mov    %eax,%edi
     764:	e8 90 fe ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
     769:	89 c2                	mov    %eax,%edx
     76b:	0f b7 45 fa          	movzwl -0x6(%rbp),%eax
     76f:	01 d0                	add    %edx,%eax
     771:	66 89 45 fa          	mov    %ax,-0x6(%rbp)
    PackY = mul_short_by_fp2_14_returning_short(PackY, fp2_14_cos (rot));
     775:	0f b6 45 dc          	movzbl -0x24(%rbp),%eax
     779:	89 c7                	mov    %eax,%edi
     77b:	e8 5a fe ff ff       	callq  5da <fp2_14_cos>
     780:	0f bf d0             	movswl %ax,%edx
     783:	0f bf 45 f8          	movswl -0x8(%rbp),%eax
     787:	89 d6                	mov    %edx,%esi
     789:	89 c7                	mov    %eax,%edi
     78b:	e8 69 fe ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
     790:	66 89 45 f8          	mov    %ax,-0x8(%rbp)

    PackZ += intro_z;
     794:	0f b7 55 fa          	movzwl -0x6(%rbp),%edx
     798:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 79f <draw_tg_intro_with_rolling_rotation+0xbe>
     79f:	01 d0                	add    %edx,%eax
     7a1:	66 89 45 fa          	mov    %ax,-0x6(%rbp)
    // should I change this to use Get_screenpos() ???
    screenx = ((FOCAL_LENGTH * PackX) / (FOCAL_LENGTH + PackZ));
     7a5:	0f bf 45 f6          	movswl -0xa(%rbp),%eax
     7a9:	c1 e0 0a             	shl    $0xa,%eax
     7ac:	0f bf 55 fa          	movswl -0x6(%rbp),%edx
     7b0:	81 c2 00 04 00 00    	add    $0x400,%edx
     7b6:	89 55 d8             	mov    %edx,-0x28(%rbp)
     7b9:	89 c2                	mov    %eax,%edx
     7bb:	c1 fa 1f             	sar    $0x1f,%edx
     7be:	f7 7d d8             	idivl  -0x28(%rbp)
     7c1:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
    screeny = ((FOCAL_LENGTH * PackY) / (FOCAL_LENGTH + PackZ));
     7c5:	0f bf 45 f8          	movswl -0x8(%rbp),%eax
     7c9:	c1 e0 0a             	shl    $0xa,%eax
     7cc:	0f bf 55 fa          	movswl -0x6(%rbp),%edx
     7d0:	81 c2 00 04 00 00    	add    $0x400,%edx
     7d6:	89 55 d8             	mov    %edx,-0x28(%rbp)
     7d9:	89 c2                	mov    %eax,%edx
     7db:	c1 fa 1f             	sar    $0x1f,%edx
     7de:	f7 7d d8             	idivl  -0x28(%rbp)
     7e1:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
    gotoxy (intro_x + screenx, intro_y + screeny);
     7e5:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 7ec <draw_tg_intro_with_rolling_rotation+0x10b>
     7ec:	89 c2                	mov    %eax,%edx
     7ee:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     7f2:	01 d0                	add    %edx,%eax
     7f4:	0f bf d0             	movswl %ax,%edx
     7f7:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 7fe <draw_tg_intro_with_rolling_rotation+0x11d>
     7fe:	89 c1                	mov    %eax,%ecx
     800:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     804:	01 c8                	add    %ecx,%eax
     806:	98                   	cwtl   
     807:	89 d6                	mov    %edx,%esi
     809:	89 c7                	mov    %eax,%edi
     80b:	e8 3b f8 ff ff       	callq  4b <gotoxy>

    tgz += mul_short_by_fp2_14_returning_short(tgy, fp2_14_sin (rot));
     810:	0f b6 45 dc          	movzbl -0x24(%rbp),%eax
     814:	89 c7                	mov    %eax,%edi
     816:	e8 81 fd ff ff       	callq  59c <fp2_14_sin>
     81b:	0f bf d0             	movswl %ax,%edx
     81e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 825 <draw_tg_intro_with_rolling_rotation+0x144>
     825:	98                   	cwtl   
     826:	89 d6                	mov    %edx,%esi
     828:	89 c7                	mov    %eax,%edi
     82a:	e8 ca fd ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
     82f:	89 c2                	mov    %eax,%edx
     831:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 838 <draw_tg_intro_with_rolling_rotation+0x157>
     838:	01 d0                	add    %edx,%eax
     83a:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 841 <draw_tg_intro_with_rolling_rotation+0x160>
    tgy = mul_short_by_fp2_14_returning_short(tgy, fp2_14_cos (rot));
     841:	0f b6 45 dc          	movzbl -0x24(%rbp),%eax
     845:	89 c7                	mov    %eax,%edi
     847:	e8 8e fd ff ff       	callq  5da <fp2_14_cos>
     84c:	0f bf d0             	movswl %ax,%edx
     84f:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 856 <draw_tg_intro_with_rolling_rotation+0x175>
     856:	98                   	cwtl   
     857:	89 d6                	mov    %edx,%esi
     859:	89 c7                	mov    %eax,%edi
     85b:	e8 99 fd ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
     860:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 867 <draw_tg_intro_with_rolling_rotation+0x186>

    tgz += intro_z;
     867:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 86e <draw_tg_intro_with_rolling_rotation+0x18d>
     86e:	89 c2                	mov    %eax,%edx
     870:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 877 <draw_tg_intro_with_rolling_rotation+0x196>
     877:	01 d0                	add    %edx,%eax
     879:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 880 <draw_tg_intro_with_rolling_rotation+0x19f>
    // ditto Get_screenpos() ???
    screenx = ((FOCAL_LENGTH * tgx) / (FOCAL_LENGTH + tgz));
     880:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 887 <draw_tg_intro_with_rolling_rotation+0x1a6>
     887:	98                   	cwtl   
     888:	c1 e0 0a             	shl    $0xa,%eax
     88b:	0f b7 15 00 00 00 00 	movzwl 0x0(%rip),%edx        # 892 <draw_tg_intro_with_rolling_rotation+0x1b1>
     892:	0f bf d2             	movswl %dx,%edx
     895:	81 c2 00 04 00 00    	add    $0x400,%edx
     89b:	89 55 d8             	mov    %edx,-0x28(%rbp)
     89e:	89 c2                	mov    %eax,%edx
     8a0:	c1 fa 1f             	sar    $0x1f,%edx
     8a3:	f7 7d d8             	idivl  -0x28(%rbp)
     8a6:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
    screeny = ((FOCAL_LENGTH * tgy) / (FOCAL_LENGTH + tgz));
     8aa:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 8b1 <draw_tg_intro_with_rolling_rotation+0x1d0>
     8b1:	98                   	cwtl   
     8b2:	c1 e0 0a             	shl    $0xa,%eax
     8b5:	0f b7 15 00 00 00 00 	movzwl 0x0(%rip),%edx        # 8bc <draw_tg_intro_with_rolling_rotation+0x1db>
     8bc:	0f bf d2             	movswl %dx,%edx
     8bf:	81 c2 00 04 00 00    	add    $0x400,%edx
     8c5:	89 55 d8             	mov    %edx,-0x28(%rbp)
     8c8:	89 c2                	mov    %eax,%edx
     8ca:	c1 fa 1f             	sar    $0x1f,%edx
     8cd:	f7 7d d8             	idivl  -0x28(%rbp)
     8d0:	66 89 45 fe          	mov    %ax,-0x2(%rbp)

    // ultimately would prefer to get rid of pen up/down/gotoxy and call vectrex code directly
    putPenDown (); gotoxy (intro_x + screenx, intro_y + screeny); putPenUp ();
     8d4:	e8 58 f7 ff ff       	callq  31 <putPenDown>
     8d9:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 8e0 <draw_tg_intro_with_rolling_rotation+0x1ff>
     8e0:	89 c2                	mov    %eax,%edx
     8e2:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     8e6:	01 d0                	add    %edx,%eax
     8e8:	0f bf d0             	movswl %ax,%edx
     8eb:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 8f2 <draw_tg_intro_with_rolling_rotation+0x211>
     8f2:	89 c1                	mov    %eax,%ecx
     8f4:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     8f8:	01 c8                	add    %ecx,%eax
     8fa:	98                   	cwtl   
     8fb:	89 d6                	mov    %edx,%esi
     8fd:	89 c7                	mov    %eax,%edi
     8ff:	e8 47 f7 ff ff       	callq  4b <gotoxy>
     904:	e8 35 f7 ff ff       	callq  3e <putPenUp>
  }
}
     909:	c9                   	leaveq 
     90a:	c3                   	retq   

000000000000090b <starplot>:

//***************

static void starplot(short x, short y) // At some point add distance fading to the starfield
{
     90b:	55                   	push   %rbp
     90c:	48 89 e5             	mov    %rsp,%rbp
     90f:	48 83 ec 10          	sub    $0x10,%rsp
     913:	89 fa                	mov    %edi,%edx
     915:	89 f0                	mov    %esi,%eax
     917:	66 89 55 fc          	mov    %dx,-0x4(%rbp)
     91b:	66 89 45 f8          	mov    %ax,-0x8(%rbp)
  // x,y based on coords with screen center at 0,0
  // While debugging, draw a cross instead of a star so I can find them! (58yr old eyesight :-( )
  //Display_Vectrex_vector((ScreenWidth>>1)+x-10, (ScreenHeight>>1)+y-10, (ScreenWidth>>1)+x+10, (ScreenHeight>>1)+y+10);
  //Display_Vectrex_vector((ScreenWidth>>1)+x-10, (ScreenHeight>>1)+y+10, (ScreenWidth>>1)+x+10, (ScreenHeight>>1)+y-10);
  Display_Vectrex_point((ScreenWidth>>1)+x, (ScreenHeight>>1)+y);
     91f:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 925 <starplot+0x1a>
     925:	89 c2                	mov    %eax,%edx
     927:	d1 fa                	sar    %edx
     929:	0f bf 45 f8          	movswl -0x8(%rbp),%eax
     92d:	01 c2                	add    %eax,%edx
     92f:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 935 <starplot+0x2a>
     935:	89 c1                	mov    %eax,%ecx
     937:	d1 f9                	sar    %ecx
     939:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
     93d:	01 c8                	add    %ecx,%eax
     93f:	89 d6                	mov    %edx,%esi
     941:	89 c7                	mov    %eax,%edi
     943:	b8 00 00 00 00       	mov    $0x0,%eax
     948:	e8 00 00 00 00       	callq  94d <starplot+0x42>
}
     94d:	c9                   	leaveq 
     94e:	c3                   	retq   

000000000000094f <clipoff>:


static unsigned char /* boolean */ clipoff(short x, short y)
{
     94f:	55                   	push   %rbp
     950:	48 89 e5             	mov    %rsp,%rbp
     953:	89 fa                	mov    %edi,%edx
     955:	89 f0                	mov    %esi,%eax
     957:	66 89 55 fc          	mov    %dx,-0x4(%rbp)
     95b:	66 89 45 f8          	mov    %ax,-0x8(%rbp)
  /* Stars never reach center of screen */
  // size of rectangle still hard-coded
  return ( -0x50 <= x && x < 0x50 && -0x40 <= y && y < 0x40);
     95f:	66 83 7d fc b0       	cmpw   $0xffb0,-0x4(%rbp)
     964:	7c 1c                	jl     982 <clipoff+0x33>
     966:	66 83 7d fc 4f       	cmpw   $0x4f,-0x4(%rbp)
     96b:	7f 15                	jg     982 <clipoff+0x33>
     96d:	66 83 7d f8 c0       	cmpw   $0xffc0,-0x8(%rbp)
     972:	7c 0e                	jl     982 <clipoff+0x33>
     974:	66 83 7d f8 3f       	cmpw   $0x3f,-0x8(%rbp)
     979:	7f 07                	jg     982 <clipoff+0x33>
     97b:	b8 01 00 00 00       	mov    $0x1,%eax
     980:	eb 05                	jmp    987 <clipoff+0x38>
     982:	b8 00 00 00 00       	mov    $0x0,%eax
}
     987:	5d                   	pop    %rbp
     988:	c3                   	retq   

0000000000000989 <star_x1>:

 */

static short pxa[16], pya[16];

static unsigned short star_x1(unsigned char idx) {
     989:	55                   	push   %rbp
     98a:	48 89 e5             	mov    %rsp,%rbp
     98d:	48 83 ec 18          	sub    $0x18,%rsp
     991:	89 f8                	mov    %edi,%eax
     993:	88 45 ec             	mov    %al,-0x14(%rbp)
  unsigned char xtype = (idx>>2)&3, ytype = idx&3;
     996:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
     99a:	c0 e8 02             	shr    $0x2,%al
     99d:	83 e0 03             	and    $0x3,%eax
     9a0:	88 45 fe             	mov    %al,-0x2(%rbp)
     9a3:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
     9a7:	83 e0 03             	and    $0x3,%eax
     9aa:	88 45 ff             	mov    %al,-0x1(%rbp)

  idx = xtype ^ ytype; // four types of star trail ...
     9ad:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
     9b1:	0f b6 55 fe          	movzbl -0x2(%rbp),%edx
     9b5:	31 d0                	xor    %edx,%eax
     9b7:	88 45 ec             	mov    %al,-0x14(%rbp)
  if (idx == 0) { // left edge
     9ba:	80 7d ec 00          	cmpb   $0x0,-0x14(%rbp)
     9be:	75 0c                	jne    9cc <star_x1+0x43>
    return -(ScreenWidth>>1);
     9c0:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 9c6 <star_x1+0x3d>
     9c6:	d1 f8                	sar    %eax
     9c8:	f7 d8                	neg    %eax
     9ca:	eb 35                	jmp    a01 <star_x1+0x78>
  } else if (idx == 2) { // right edge
     9cc:	80 7d ec 02          	cmpb   $0x2,-0x14(%rbp)
     9d0:	75 0d                	jne    9df <star_x1+0x56>
    return (ScreenWidth>>1)-1;
     9d2:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 9d8 <star_x1+0x4f>
     9d8:	d1 f8                	sar    %eax
     9da:	83 e8 01             	sub    $0x1,%eax
     9dd:	eb 22                	jmp    a01 <star_x1+0x78>
  } else { // top or bottom edges
    return pickrandom(-(ScreenWidth>>1), (ScreenWidth>>1)-1);
     9df:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 9e5 <star_x1+0x5c>
     9e5:	d1 f8                	sar    %eax
     9e7:	83 e8 01             	sub    $0x1,%eax
     9ea:	0f bf d0             	movswl %ax,%edx
     9ed:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 9f3 <star_x1+0x6a>
     9f3:	d1 f8                	sar    %eax
     9f5:	f7 d8                	neg    %eax
     9f7:	98                   	cwtl   
     9f8:	89 d6                	mov    %edx,%esi
     9fa:	89 c7                	mov    %eax,%edi
     9fc:	e8 cc f6 ff ff       	callq  cd <pickrandom>
  }
}
     a01:	c9                   	leaveq 
     a02:	c3                   	retq   

0000000000000a03 <star_y1>:

static unsigned short star_y1(unsigned char idx) {
     a03:	55                   	push   %rbp
     a04:	48 89 e5             	mov    %rsp,%rbp
     a07:	48 83 ec 18          	sub    $0x18,%rsp
     a0b:	89 f8                	mov    %edi,%eax
     a0d:	88 45 ec             	mov    %al,-0x14(%rbp)
  unsigned char xtype = (idx>>2)&3, ytype = idx&3;
     a10:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
     a14:	c0 e8 02             	shr    $0x2,%al
     a17:	83 e0 03             	and    $0x3,%eax
     a1a:	88 45 fe             	mov    %al,-0x2(%rbp)
     a1d:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
     a21:	83 e0 03             	and    $0x3,%eax
     a24:	88 45 ff             	mov    %al,-0x1(%rbp)

  idx = xtype ^ ytype; // four types of star trail ...
     a27:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
     a2b:	0f b6 55 fe          	movzbl -0x2(%rbp),%edx
     a2f:	31 d0                	xor    %edx,%eax
     a31:	88 45 ec             	mov    %al,-0x14(%rbp)
  if (idx == 1) { // top edge
     a34:	80 7d ec 01          	cmpb   $0x1,-0x14(%rbp)
     a38:	75 0d                	jne    a47 <star_y1+0x44>
    return (ScreenHeight>>1)-1; // right edge
     a3a:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # a40 <star_y1+0x3d>
     a40:	d1 f8                	sar    %eax
     a42:	83 e8 01             	sub    $0x1,%eax
     a45:	eb 34                	jmp    a7b <star_y1+0x78>
  } else if (idx == 3) { // bottom edge
     a47:	80 7d ec 03          	cmpb   $0x3,-0x14(%rbp)
     a4b:	75 0c                	jne    a59 <star_y1+0x56>
    return -(ScreenHeight>>1);
     a4d:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # a53 <star_y1+0x50>
     a53:	d1 f8                	sar    %eax
     a55:	f7 d8                	neg    %eax
     a57:	eb 22                	jmp    a7b <star_y1+0x78>
  } else {
    return pickrandom(-(ScreenHeight>>1), (ScreenHeight>>1)-1);
     a59:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # a5f <star_y1+0x5c>
     a5f:	d1 f8                	sar    %eax
     a61:	83 e8 01             	sub    $0x1,%eax
     a64:	0f bf d0             	movswl %ax,%edx
     a67:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # a6d <star_y1+0x6a>
     a6d:	d1 f8                	sar    %eax
     a6f:	f7 d8                	neg    %eax
     a71:	98                   	cwtl   
     a72:	89 d6                	mov    %edx,%esi
     a74:	89 c7                	mov    %eax,%edi
     a76:	e8 52 f6 ff ff       	callq  cd <pickrandom>
  }
}
     a7b:	c9                   	leaveq 
     a7c:	c3                   	retq   

0000000000000a7d <move_star>:
// modify it to do that, and I probably will once I've finished with
// other areas of the code that are demanding more attention.  In the
// meantime, this has reclaimed *huge* amounts of RAM... :-)

static void move_star(unsigned char starno)
{
     a7d:	55                   	push   %rbp
     a7e:	48 89 e5             	mov    %rsp,%rbp
     a81:	48 83 ec 18          	sub    $0x18,%rsp
     a85:	89 f8                	mov    %edi,%eax
     a87:	88 45 ec             	mov    %al,-0x14(%rbp)
  short x = pxa[starno], y=pya[starno];
     a8a:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
     a8e:	48 98                	cltq   
     a90:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
     a97:	00 
     a98:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
     a9c:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
     aa0:	48 98                	cltq   
     aa2:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
     aa9:	00 
     aaa:	66 89 45 fe          	mov    %ax,-0x2(%rbp)

  // coordinate space is 0,0 center!
  x = ((x<<6)-x)>>6; y = ((y<<6)-y)>>6;  // move stars closer to the center, ie towards 0
     aae:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
     ab2:	89 c2                	mov    %eax,%edx
     ab4:	c1 e2 06             	shl    $0x6,%edx
     ab7:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
     abb:	89 d1                	mov    %edx,%ecx
     abd:	29 c1                	sub    %eax,%ecx
     abf:	89 c8                	mov    %ecx,%eax
     ac1:	c1 f8 06             	sar    $0x6,%eax
     ac4:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
     ac8:	0f bf 45 fe          	movswl -0x2(%rbp),%eax
     acc:	89 c2                	mov    %eax,%edx
     ace:	c1 e2 06             	shl    $0x6,%edx
     ad1:	0f bf 45 fe          	movswl -0x2(%rbp),%eax
     ad5:	89 d1                	mov    %edx,%ecx
     ad7:	29 c1                	sub    %eax,%ecx
     ad9:	89 c8                	mov    %ecx,%eax
     adb:	c1 f8 06             	sar    $0x6,%eax
     ade:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
  if (clipoff(x,y)) {
     ae2:	0f bf 55 fe          	movswl -0x2(%rbp),%edx
     ae6:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
     aea:	89 d6                	mov    %edx,%esi
     aec:	89 c7                	mov    %eax,%edi
     aee:	e8 5c fe ff ff       	callq  94f <clipoff>
     af3:	84 c0                	test   %al,%al
     af5:	74 1e                	je     b15 <move_star+0x98>
    x = star_x1(starno); y = star_y1(starno); // reset when they disappear
     af7:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
     afb:	89 c7                	mov    %eax,%edi
     afd:	e8 87 fe ff ff       	callq  989 <star_x1>
     b02:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
     b06:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
     b0a:	89 c7                	mov    %eax,%edi
     b0c:	e8 f2 fe ff ff       	callq  a03 <star_y1>
     b11:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
  }
  pxa[starno] = x; pya[starno] = y;
     b15:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
     b19:	48 98                	cltq   
     b1b:	0f b7 55 fc          	movzwl -0x4(%rbp),%edx
     b1f:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     b26:	00 
     b27:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
     b2b:	48 98                	cltq   
     b2d:	0f b7 55 fe          	movzwl -0x2(%rbp),%edx
     b31:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     b38:	00 

}
     b39:	c9                   	leaveq 
     b3a:	c3                   	retq   

0000000000000b3b <plot_star>:

static inline void plot_star(unsigned int starno)
{
     b3b:	55                   	push   %rbp
     b3c:	48 89 e5             	mov    %rsp,%rbp
     b3f:	48 83 ec 10          	sub    $0x10,%rsp
     b43:	89 7d fc             	mov    %edi,-0x4(%rbp)
  starplot(pxa[starno],pya[starno]);
     b46:	8b 45 fc             	mov    -0x4(%rbp),%eax
     b49:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
     b50:	00 
     b51:	0f bf d0             	movswl %ax,%edx
     b54:	8b 45 fc             	mov    -0x4(%rbp),%eax
     b57:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
     b5e:	00 
     b5f:	98                   	cwtl   
     b60:	89 d6                	mov    %edx,%esi
     b62:	89 c7                	mov    %eax,%edi
     b64:	e8 a2 fd ff ff       	callq  90b <starplot>
}
     b69:	c9                   	leaveq 
     b6a:	c3                   	retq   

0000000000000b6b <init_stars>:

static inline void init_stars(void)
{
     b6b:	55                   	push   %rbp
     b6c:	48 89 e5             	mov    %rsp,%rbp
     b6f:	53                   	push   %rbx
     b70:	48 83 ec 10          	sub    $0x10,%rsp
  unsigned char i, star;

  for (star = 0U; star < 16U; star++) {
     b74:	c6 45 f7 00          	movb   $0x0,-0x9(%rbp)
     b78:	eb 68                	jmp    be2 <init_stars+0x77>
    pxa[star] = star_x1(star); pya[star] = star_y1(star);
     b7a:	0f b6 5d f7          	movzbl -0x9(%rbp),%ebx
     b7e:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
     b82:	89 c7                	mov    %eax,%edi
     b84:	e8 00 fe ff ff       	callq  989 <star_x1>
     b89:	89 c2                	mov    %eax,%edx
     b8b:	48 63 c3             	movslq %ebx,%rax
     b8e:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     b95:	00 
     b96:	0f b6 5d f7          	movzbl -0x9(%rbp),%ebx
     b9a:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
     b9e:	89 c7                	mov    %eax,%edi
     ba0:	e8 5e fe ff ff       	callq  a03 <star_y1>
     ba5:	89 c2                	mov    %eax,%edx
     ba7:	48 63 c3             	movslq %ebx,%rax
     baa:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     bb1:	00 
    for (i=0; i < star*13; i++) move_star(star); // skew the starting points (QUICK HACK)
     bb2:	c6 45 f6 00          	movb   $0x0,-0xa(%rbp)
     bb6:	eb 0f                	jmp    bc7 <init_stars+0x5c>
     bb8:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
     bbc:	89 c7                	mov    %eax,%edi
     bbe:	e8 ba fe ff ff       	callq  a7d <move_star>
     bc3:	80 45 f6 01          	addb   $0x1,-0xa(%rbp)
     bc7:	0f b6 4d f6          	movzbl -0xa(%rbp),%ecx
     bcb:	0f b6 55 f7          	movzbl -0x9(%rbp),%edx
     bcf:	89 d0                	mov    %edx,%eax
     bd1:	01 c0                	add    %eax,%eax
     bd3:	01 d0                	add    %edx,%eax
     bd5:	c1 e0 02             	shl    $0x2,%eax
     bd8:	01 d0                	add    %edx,%eax
     bda:	39 c1                	cmp    %eax,%ecx
     bdc:	7c da                	jl     bb8 <init_stars+0x4d>

static inline void init_stars(void)
{
  unsigned char i, star;

  for (star = 0U; star < 16U; star++) {
     bde:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
     be2:	80 7d f7 0f          	cmpb   $0xf,-0x9(%rbp)
     be6:	76 92                	jbe    b7a <init_stars+0xf>
    pxa[star] = star_x1(star); pya[star] = star_y1(star);
    for (i=0; i < star*13; i++) move_star(star); // skew the starting points (QUICK HACK)
  }
}
     be8:	48 83 c4 10          	add    $0x10,%rsp
     bec:	5b                   	pop    %rbx
     bed:	5d                   	pop    %rbp
     bee:	c3                   	retq   

0000000000000bef <stars>:

static inline void stars(unsigned char speed)
{
     bef:	55                   	push   %rbp
     bf0:	48 89 e5             	mov    %rsp,%rbp
     bf3:	48 83 ec 20          	sub    $0x20,%rsp
     bf7:	89 f8                	mov    %edi,%eax
     bf9:	88 45 ec             	mov    %al,-0x14(%rbp)
  unsigned char i, star;
  for (star = 0U; star < 16U; star++) {
     bfc:	c6 45 ff 00          	movb   $0x0,-0x1(%rbp)
     c00:	eb 2d                	jmp    c2f <stars+0x40>
    for (i = 0U; i < speed; i++) move_star(star);
     c02:	c6 45 fe 00          	movb   $0x0,-0x2(%rbp)
     c06:	eb 0f                	jmp    c17 <stars+0x28>
     c08:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
     c0c:	89 c7                	mov    %eax,%edi
     c0e:	e8 6a fe ff ff       	callq  a7d <move_star>
     c13:	80 45 fe 01          	addb   $0x1,-0x2(%rbp)
     c17:	0f b6 45 fe          	movzbl -0x2(%rbp),%eax
     c1b:	3a 45 ec             	cmp    -0x14(%rbp),%al
     c1e:	72 e8                	jb     c08 <stars+0x19>
    plot_star(star);
     c20:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
     c24:	89 c7                	mov    %eax,%edi
     c26:	e8 10 ff ff ff       	callq  b3b <plot_star>
}

static inline void stars(unsigned char speed)
{
  unsigned char i, star;
  for (star = 0U; star < 16U; star++) {
     c2b:	80 45 ff 01          	addb   $0x1,-0x1(%rbp)
     c2f:	80 7d ff 0f          	cmpb   $0xf,-0x1(%rbp)
     c33:	76 cd                	jbe    c02 <stars+0x13>
    for (i = 0U; i < speed; i++) move_star(star);
    plot_star(star);
  }
}
     c35:	c9                   	leaveq 
     c36:	c3                   	retq   

0000000000000c37 <plot_fire>:
#define sgn(x) ((x<0)?-1:((x>0)?1:0)) /* macro to return the sign of a number */
// might switch over to using s16_nabs() ..?
#define abs(x) (((x)>=0)?(x):-(x))

static unsigned char /* boolean */ plot_fire(short lr, short x1, short y1, short x2, short y2) // lr = 0,1 for left/right laser
{
     c37:	55                   	push   %rbp
     c38:	48 89 e5             	mov    %rsp,%rbp
     c3b:	48 83 ec 40          	sub    $0x40,%rsp
     c3f:	89 c8                	mov    %ecx,%eax
     c41:	44 89 c1             	mov    %r8d,%ecx
     c44:	66 89 7d dc          	mov    %di,-0x24(%rbp)
     c48:	66 89 75 d8          	mov    %si,-0x28(%rbp)
     c4c:	66 89 55 d4          	mov    %dx,-0x2c(%rbp)
     c50:	66 89 45 d0          	mov    %ax,-0x30(%rbp)
     c54:	66 89 4d cc          	mov    %cx,-0x34(%rbp)
// up a flag.  The ships themselves can check to see if they've been hit,
// if the point intersects a line *or* is contained within a face.
// (This problem is already handled in the Scratch version of the code...)

  short i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py;
  dx=x2-x1;      /* the horizontal distance of the line */
     c58:	0f b7 55 d0          	movzwl -0x30(%rbp),%edx
     c5c:	0f b7 45 d8          	movzwl -0x28(%rbp),%eax
     c60:	89 d1                	mov    %edx,%ecx
     c62:	66 29 c1             	sub    %ax,%cx
     c65:	89 c8                	mov    %ecx,%eax
     c67:	66 89 45 f4          	mov    %ax,-0xc(%rbp)
  dy=y2-y1;      /* the vertical distance of the line */
     c6b:	0f b7 55 cc          	movzwl -0x34(%rbp),%edx
     c6f:	0f b7 45 d4          	movzwl -0x2c(%rbp),%eax
     c73:	89 d1                	mov    %edx,%ecx
     c75:	66 29 c1             	sub    %ax,%cx
     c78:	89 c8                	mov    %ecx,%eax
     c7a:	66 89 45 f6          	mov    %ax,-0xa(%rbp)
  dxabs=abs(dx);
     c7e:	0f bf 45 f4          	movswl -0xc(%rbp),%eax
     c82:	89 c2                	mov    %eax,%edx
     c84:	c1 fa 1f             	sar    $0x1f,%edx
     c87:	31 d0                	xor    %edx,%eax
     c89:	29 d0                	sub    %edx,%eax
     c8b:	66 89 45 f8          	mov    %ax,-0x8(%rbp)
  dyabs=abs(dy);
     c8f:	0f bf 45 f6          	movswl -0xa(%rbp),%eax
     c93:	89 c2                	mov    %eax,%edx
     c95:	c1 fa 1f             	sar    $0x1f,%edx
     c98:	31 d0                	xor    %edx,%eax
     c9a:	29 d0                	sub    %edx,%eax
     c9c:	66 89 45 fa          	mov    %ax,-0x6(%rbp)
  sdx=sgn(dx);
     ca0:	66 83 7d f4 00       	cmpw   $0x0,-0xc(%rbp)
     ca5:	78 0d                	js     cb4 <plot_fire+0x7d>
     ca7:	66 83 7d f4 00       	cmpw   $0x0,-0xc(%rbp)
     cac:	0f 9f c0             	setg   %al
     caf:	0f b6 c0             	movzbl %al,%eax
     cb2:	eb 05                	jmp    cb9 <plot_fire+0x82>
     cb4:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
     cb9:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
  sdy=sgn(dy);
     cbd:	66 83 7d f6 00       	cmpw   $0x0,-0xa(%rbp)
     cc2:	78 0d                	js     cd1 <plot_fire+0x9a>
     cc4:	66 83 7d f6 00       	cmpw   $0x0,-0xa(%rbp)
     cc9:	0f 9f c0             	setg   %al
     ccc:	0f b6 c0             	movzbl %al,%eax
     ccf:	eb 05                	jmp    cd6 <plot_fire+0x9f>
     cd1:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
     cd6:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
  x=dyabs>>1;
     cda:	0f b7 45 fa          	movzwl -0x6(%rbp),%eax
     cde:	66 d1 f8             	sar    %ax
     ce1:	66 89 45 ec          	mov    %ax,-0x14(%rbp)
  y=dxabs>>1;
     ce5:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     ce9:	66 d1 f8             	sar    %ax
     cec:	66 89 45 ee          	mov    %ax,-0x12(%rbp)
  px=x1;
     cf0:	0f b7 45 d8          	movzwl -0x28(%rbp),%eax
     cf4:	66 89 45 f0          	mov    %ax,-0x10(%rbp)
  py=y1;
     cf8:	0f b7 45 d4          	movzwl -0x2c(%rbp),%eax
     cfc:	66 89 45 f2          	mov    %ax,-0xe(%rbp)
  // with the firing x,y and target x,y is likely to be faster than
  // this all-integer bresenham, even with the overhead of multiplying
  // and dividing.  But there's only one way to know for sure and that
  // is to implement both and compare... :-(

  Display_Vectrex_point(px, py);
     d00:	0f bf 55 f2          	movswl -0xe(%rbp),%edx
     d04:	0f bf 45 f0          	movswl -0x10(%rbp),%eax
     d08:	89 d6                	mov    %edx,%esi
     d0a:	89 c7                	mov    %eax,%edi
     d0c:	b8 00 00 00 00       	mov    $0x0,%eax
     d11:	e8 00 00 00 00       	callq  d16 <plot_fire+0xdf>

  if (dxabs>=dyabs) /* the line is more horizontal than vertical */
     d16:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     d1a:	66 3b 45 fa          	cmp    -0x6(%rbp),%ax
     d1e:	0f 8c d6 00 00 00    	jl     dfa <plot_fire+0x1c3>
  {
    for(i=0;i<dxabs;i++)
     d24:	66 c7 45 ea 00 00    	movw   $0x0,-0x16(%rbp)
     d2a:	e9 b8 00 00 00       	jmpq   de7 <plot_fire+0x1b0>
    {
      y+=dyabs;
     d2f:	0f b7 55 ee          	movzwl -0x12(%rbp),%edx
     d33:	0f b7 45 fa          	movzwl -0x6(%rbp),%eax
     d37:	01 d0                	add    %edx,%eax
     d39:	66 89 45 ee          	mov    %ax,-0x12(%rbp)
      if (y>=dxabs)
     d3d:	0f b7 45 ee          	movzwl -0x12(%rbp),%eax
     d41:	66 3b 45 f8          	cmp    -0x8(%rbp),%ax
     d45:	7c 21                	jl     d68 <plot_fire+0x131>
      {
        y-=dxabs;
     d47:	0f b7 55 ee          	movzwl -0x12(%rbp),%edx
     d4b:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     d4f:	89 d1                	mov    %edx,%ecx
     d51:	66 29 c1             	sub    %ax,%cx
     d54:	89 c8                	mov    %ecx,%eax
     d56:	66 89 45 ee          	mov    %ax,-0x12(%rbp)
        py+=sdy;
     d5a:	0f b7 55 f2          	movzwl -0xe(%rbp),%edx
     d5e:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     d62:	01 d0                	add    %edx,%eax
     d64:	66 89 45 f2          	mov    %ax,-0xe(%rbp)
      }
      px+=sdx;
     d68:	0f b7 55 f0          	movzwl -0x10(%rbp),%edx
     d6c:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     d70:	01 d0                	add    %edx,%eax
     d72:	66 89 45 f0          	mov    %ax,-0x10(%rbp)
      if (i <= 25) {
     d76:	66 83 7d ea 19       	cmpw   $0x19,-0x16(%rbp)
     d7b:	7f 3a                	jg     db7 <plot_fire+0x180>
        Display_Vectrex_point(px, py);
     d7d:	0f bf 55 f2          	movswl -0xe(%rbp),%edx
     d81:	0f bf 45 f0          	movswl -0x10(%rbp),%eax
     d85:	89 d6                	mov    %edx,%esi
     d87:	89 c7                	mov    %eax,%edi
     d89:	b8 00 00 00 00       	mov    $0x0,%eax
     d8e:	e8 00 00 00 00       	callq  d93 <plot_fire+0x15c>
        firex[lr] = px; firey[lr] = py;
     d93:	0f bf 45 dc          	movswl -0x24(%rbp),%eax
     d97:	48 98                	cltq   
     d99:	0f b7 55 f0          	movzwl -0x10(%rbp),%edx
     d9d:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     da4:	00 
     da5:	0f bf 45 dc          	movswl -0x24(%rbp),%eax
     da9:	48 98                	cltq   
     dab:	0f b7 55 f2          	movzwl -0xe(%rbp),%edx
     daf:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     db6:	00 
      }
      if (i == 50) {firex[lr] = px; firey[lr] = py;}  /* draw next line 100 pixels in from this one */
     db7:	66 83 7d ea 32       	cmpw   $0x32,-0x16(%rbp)
     dbc:	75 24                	jne    de2 <plot_fire+0x1ab>
     dbe:	0f bf 45 dc          	movswl -0x24(%rbp),%eax
     dc2:	48 98                	cltq   
     dc4:	0f b7 55 f0          	movzwl -0x10(%rbp),%edx
     dc8:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     dcf:	00 
     dd0:	0f bf 45 dc          	movswl -0x24(%rbp),%eax
     dd4:	48 98                	cltq   
     dd6:	0f b7 55 f2          	movzwl -0xe(%rbp),%edx
     dda:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     de1:	00 

  Display_Vectrex_point(px, py);

  if (dxabs>=dyabs) /* the line is more horizontal than vertical */
  {
    for(i=0;i<dxabs;i++)
     de2:	66 83 45 ea 01       	addw   $0x1,-0x16(%rbp)
     de7:	0f b7 45 ea          	movzwl -0x16(%rbp),%eax
     deb:	66 3b 45 f8          	cmp    -0x8(%rbp),%ax
     def:	0f 8c 3a ff ff ff    	jl     d2f <plot_fire+0xf8>
     df5:	e9 d1 00 00 00       	jmpq   ecb <plot_fire+0x294>
      if (i == 50) {firex[lr] = px; firey[lr] = py;}  /* draw next line 100 pixels in from this one */
    }
  }
  else /* the line is more vertical than horizontal */
  {
    for(i=0;i<dyabs;i++)
     dfa:	66 c7 45 ea 00 00    	movw   $0x0,-0x16(%rbp)
     e00:	e9 b8 00 00 00       	jmpq   ebd <plot_fire+0x286>
    {
      x+=dxabs;
     e05:	0f b7 55 ec          	movzwl -0x14(%rbp),%edx
     e09:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
     e0d:	01 d0                	add    %edx,%eax
     e0f:	66 89 45 ec          	mov    %ax,-0x14(%rbp)
      if (x>=dyabs)
     e13:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
     e17:	66 3b 45 fa          	cmp    -0x6(%rbp),%ax
     e1b:	7c 21                	jl     e3e <plot_fire+0x207>
      {
        x-=dyabs;
     e1d:	0f b7 55 ec          	movzwl -0x14(%rbp),%edx
     e21:	0f b7 45 fa          	movzwl -0x6(%rbp),%eax
     e25:	89 d1                	mov    %edx,%ecx
     e27:	66 29 c1             	sub    %ax,%cx
     e2a:	89 c8                	mov    %ecx,%eax
     e2c:	66 89 45 ec          	mov    %ax,-0x14(%rbp)
        px+=sdx;
     e30:	0f b7 55 f0          	movzwl -0x10(%rbp),%edx
     e34:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
     e38:	01 d0                	add    %edx,%eax
     e3a:	66 89 45 f0          	mov    %ax,-0x10(%rbp)
      }
      py+=sdy;
     e3e:	0f b7 55 f2          	movzwl -0xe(%rbp),%edx
     e42:	0f b7 45 fe          	movzwl -0x2(%rbp),%eax
     e46:	01 d0                	add    %edx,%eax
     e48:	66 89 45 f2          	mov    %ax,-0xe(%rbp)
      if (i <= 25) {
     e4c:	66 83 7d ea 19       	cmpw   $0x19,-0x16(%rbp)
     e51:	7f 3a                	jg     e8d <plot_fire+0x256>
        Display_Vectrex_point(px, py);
     e53:	0f bf 55 f2          	movswl -0xe(%rbp),%edx
     e57:	0f bf 45 f0          	movswl -0x10(%rbp),%eax
     e5b:	89 d6                	mov    %edx,%esi
     e5d:	89 c7                	mov    %eax,%edi
     e5f:	b8 00 00 00 00       	mov    $0x0,%eax
     e64:	e8 00 00 00 00       	callq  e69 <plot_fire+0x232>
        firex[lr] = px; firey[lr] = py;
     e69:	0f bf 45 dc          	movswl -0x24(%rbp),%eax
     e6d:	48 98                	cltq   
     e6f:	0f b7 55 f0          	movzwl -0x10(%rbp),%edx
     e73:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     e7a:	00 
     e7b:	0f bf 45 dc          	movswl -0x24(%rbp),%eax
     e7f:	48 98                	cltq   
     e81:	0f b7 55 f2          	movzwl -0xe(%rbp),%edx
     e85:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     e8c:	00 
      }
      if (i == 50) {firex[lr] = px; firey[lr] = py;}
     e8d:	66 83 7d ea 32       	cmpw   $0x32,-0x16(%rbp)
     e92:	75 24                	jne    eb8 <plot_fire+0x281>
     e94:	0f bf 45 dc          	movswl -0x24(%rbp),%eax
     e98:	48 98                	cltq   
     e9a:	0f b7 55 f0          	movzwl -0x10(%rbp),%edx
     e9e:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     ea5:	00 
     ea6:	0f bf 45 dc          	movswl -0x24(%rbp),%eax
     eaa:	48 98                	cltq   
     eac:	0f b7 55 f2          	movzwl -0xe(%rbp),%edx
     eb0:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
     eb7:	00 
      if (i == 50) {firex[lr] = px; firey[lr] = py;}  /* draw next line 100 pixels in from this one */
    }
  }
  else /* the line is more vertical than horizontal */
  {
    for(i=0;i<dyabs;i++)
     eb8:	66 83 45 ea 01       	addw   $0x1,-0x16(%rbp)
     ebd:	0f b7 45 ea          	movzwl -0x16(%rbp),%eax
     ec1:	66 3b 45 fa          	cmp    -0x6(%rbp),%ax
     ec5:	0f 8c 3a ff ff ff    	jl     e05 <plot_fire+0x1ce>
        firex[lr] = px; firey[lr] = py;
      }
      if (i == 50) {firex[lr] = px; firey[lr] = py;}
    }
  }
  return(i <= 30);
     ecb:	66 83 7d ea 1e       	cmpw   $0x1e,-0x16(%rbp)
     ed0:	0f 9e c0             	setle  %al
}
     ed3:	c9                   	leaveq 
     ed4:	c3                   	retq   

0000000000000ed5 <draw_shields>:

//***************

// shields now modified to scale according to screen dimensions.  Previous implementation was fixed size.
static inline void draw_shields(void)
{
     ed5:	55                   	push   %rbp
     ed6:	48 89 e5             	mov    %rsp,%rbp
     ed9:	48 83 ec 10          	sub    $0x10,%rsp
  /* add rotation and scaling to simulate approach.  Should recode shields as X/Y/Z for simpler manipulation. */
  unsigned char i;
  if (pickrandom (0, 3) > 0) {
     edd:	be 03 00 00 00       	mov    $0x3,%esi
     ee2:	bf 00 00 00 00       	mov    $0x0,%edi
     ee7:	e8 e1 f1 ff ff       	callq  cd <pickrandom>
     eec:	66 85 c0             	test   %ax,%ax
     eef:	0f 8e ed 00 00 00    	jle    fe2 <draw_shields+0x10d>
    // deliberate flicker, should go with electrical crackling noise.  Might skip this in the Vectrex version?
    setintensity((unsigned char)pickrandom (80, 127));
     ef5:	be 7f 00 00 00       	mov    $0x7f,%esi
     efa:	bf 50 00 00 00       	mov    $0x50,%edi
     eff:	e8 c9 f1 ff ff       	callq  cd <pickrandom>
     f04:	0f b6 c0             	movzbl %al,%eax
     f07:	89 c7                	mov    %eax,%edi
     f09:	e8 f5 f1 ff ff       	callq  103 <setintensity>
    for (i = 0U; i < 12U; i++) {
     f0e:	c6 45 ff 00          	movb   $0x0,-0x1(%rbp)
     f12:	e9 b7 00 00 00       	jmpq   fce <draw_shields+0xf9>
      // recalculate using shieldvec[] treated as 8th's of the screen width and height
      Display_Vectrex_vector(((shieldvec[i*2]*ScreenWidth) / 8), // +0x20 originally had an offset here for some reason
                             (shieldvec[i*2+1]*ScreenHeight) / 8,
                             ((shieldvec[i*2+2]*ScreenWidth) / 8), // +0x20
                             (shieldvec[i*2+3]*ScreenHeight) / 8
     f17:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
     f1b:	01 c0                	add    %eax,%eax
     f1d:	83 c0 03             	add    $0x3,%eax
     f20:	48 98                	cltq   
     f22:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
     f29:	0f b6 d0             	movzbl %al,%edx
     f2c:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # f32 <draw_shields+0x5d>
     f32:	0f af c2             	imul   %edx,%eax
  if (pickrandom (0, 3) > 0) {
    // deliberate flicker, should go with electrical crackling noise.  Might skip this in the Vectrex version?
    setintensity((unsigned char)pickrandom (80, 127));
    for (i = 0U; i < 12U; i++) {
      // recalculate using shieldvec[] treated as 8th's of the screen width and height
      Display_Vectrex_vector(((shieldvec[i*2]*ScreenWidth) / 8), // +0x20 originally had an offset here for some reason
     f35:	8d 50 07             	lea    0x7(%rax),%edx
     f38:	85 c0                	test   %eax,%eax
     f3a:	0f 48 c2             	cmovs  %edx,%eax
     f3d:	c1 f8 03             	sar    $0x3,%eax
     f40:	89 c1                	mov    %eax,%ecx
                             (shieldvec[i*2+1]*ScreenHeight) / 8,
                             ((shieldvec[i*2+2]*ScreenWidth) / 8), // +0x20
     f42:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
     f46:	83 c0 01             	add    $0x1,%eax
     f49:	01 c0                	add    %eax,%eax
     f4b:	48 98                	cltq   
     f4d:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
     f54:	0f b6 d0             	movzbl %al,%edx
     f57:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # f5d <draw_shields+0x88>
     f5d:	0f af c2             	imul   %edx,%eax
  if (pickrandom (0, 3) > 0) {
    // deliberate flicker, should go with electrical crackling noise.  Might skip this in the Vectrex version?
    setintensity((unsigned char)pickrandom (80, 127));
    for (i = 0U; i < 12U; i++) {
      // recalculate using shieldvec[] treated as 8th's of the screen width and height
      Display_Vectrex_vector(((shieldvec[i*2]*ScreenWidth) / 8), // +0x20 originally had an offset here for some reason
     f60:	8d 50 07             	lea    0x7(%rax),%edx
     f63:	85 c0                	test   %eax,%eax
     f65:	0f 48 c2             	cmovs  %edx,%eax
     f68:	c1 f8 03             	sar    $0x3,%eax
     f6b:	89 c2                	mov    %eax,%edx
                             (shieldvec[i*2+1]*ScreenHeight) / 8,
     f6d:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
     f71:	01 c0                	add    %eax,%eax
     f73:	83 c0 01             	add    $0x1,%eax
     f76:	48 98                	cltq   
     f78:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
     f7f:	0f b6 f0             	movzbl %al,%esi
     f82:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # f88 <draw_shields+0xb3>
     f88:	0f af c6             	imul   %esi,%eax
  if (pickrandom (0, 3) > 0) {
    // deliberate flicker, should go with electrical crackling noise.  Might skip this in the Vectrex version?
    setintensity((unsigned char)pickrandom (80, 127));
    for (i = 0U; i < 12U; i++) {
      // recalculate using shieldvec[] treated as 8th's of the screen width and height
      Display_Vectrex_vector(((shieldvec[i*2]*ScreenWidth) / 8), // +0x20 originally had an offset here for some reason
     f8b:	8d 70 07             	lea    0x7(%rax),%esi
     f8e:	85 c0                	test   %eax,%eax
     f90:	0f 48 c6             	cmovs  %esi,%eax
     f93:	c1 f8 03             	sar    $0x3,%eax
     f96:	89 c6                	mov    %eax,%esi
     f98:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
     f9c:	01 c0                	add    %eax,%eax
     f9e:	48 98                	cltq   
     fa0:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
     fa7:	0f b6 f8             	movzbl %al,%edi
     faa:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # fb0 <draw_shields+0xdb>
     fb0:	0f af c7             	imul   %edi,%eax
     fb3:	8d 78 07             	lea    0x7(%rax),%edi
     fb6:	85 c0                	test   %eax,%eax
     fb8:	0f 48 c7             	cmovs  %edi,%eax
     fbb:	c1 f8 03             	sar    $0x3,%eax
     fbe:	89 c7                	mov    %eax,%edi
     fc0:	b8 00 00 00 00       	mov    $0x0,%eax
     fc5:	e8 00 00 00 00       	callq  fca <draw_shields+0xf5>
  /* add rotation and scaling to simulate approach.  Should recode shields as X/Y/Z for simpler manipulation. */
  unsigned char i;
  if (pickrandom (0, 3) > 0) {
    // deliberate flicker, should go with electrical crackling noise.  Might skip this in the Vectrex version?
    setintensity((unsigned char)pickrandom (80, 127));
    for (i = 0U; i < 12U; i++) {
     fca:	80 45 ff 01          	addb   $0x1,-0x1(%rbp)
     fce:	80 7d ff 0b          	cmpb   $0xb,-0x1(%rbp)
     fd2:	0f 86 3f ff ff ff    	jbe    f17 <draw_shields+0x42>
                             (shieldvec[i*2+1]*ScreenHeight) / 8,
                             ((shieldvec[i*2+2]*ScreenWidth) / 8), // +0x20
                             (shieldvec[i*2+3]*ScreenHeight) / 8
                            );
    }
    setintensity(110);
     fd8:	bf 6e 00 00 00       	mov    $0x6e,%edi
     fdd:	e8 21 f1 ff ff       	callq  103 <setintensity>
  }
}
     fe2:	c9                   	leaveq 
     fe3:	c3                   	retq   

0000000000000fe4 <draw_crosshair>:

static inline void draw_crosshair(short x, short y)
{
     fe4:	55                   	push   %rbp
     fe5:	48 89 e5             	mov    %rsp,%rbp
     fe8:	48 83 ec 20          	sub    $0x20,%rsp
     fec:	89 fa                	mov    %edi,%edx
     fee:	89 f0                	mov    %esi,%eax
     ff0:	66 89 55 ec          	mov    %dx,-0x14(%rbp)
     ff4:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
  unsigned char i;
  for (i = 0U; i < 10U; i++) {
     ff8:	c6 45 ff 00          	movb   $0x0,-0x1(%rbp)
     ffc:	e9 89 00 00 00       	jmpq   108a <draw_crosshair+0xa6>
    // will need to tweak x,y origins to suit Vectrex screen.  Maybe use relative vectors instead...
    Display_Vectrex_vector(x + (crosshair[i*4]) - 0x80,   y + crosshair[i*4+1] - 0x80,
                           x + (crosshair[i*4+2]) - 0x80, y + crosshair[i*4+3] - 0x80);
    1001:	0f bf 55 e8          	movswl -0x18(%rbp),%edx
    1005:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    1009:	c1 e0 02             	shl    $0x2,%eax
    100c:	83 c0 03             	add    $0x3,%eax
    100f:	48 98                	cltq   
    1011:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    1018:	0f b6 c0             	movzbl %al,%eax
    101b:	01 d0                	add    %edx,%eax
static inline void draw_crosshair(short x, short y)
{
  unsigned char i;
  for (i = 0U; i < 10U; i++) {
    // will need to tweak x,y origins to suit Vectrex screen.  Maybe use relative vectors instead...
    Display_Vectrex_vector(x + (crosshair[i*4]) - 0x80,   y + crosshair[i*4+1] - 0x80,
    101d:	8d 48 80             	lea    -0x80(%rax),%ecx
                           x + (crosshair[i*4+2]) - 0x80, y + crosshair[i*4+3] - 0x80);
    1020:	0f bf 55 ec          	movswl -0x14(%rbp),%edx
    1024:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    1028:	c1 e0 02             	shl    $0x2,%eax
    102b:	83 c0 02             	add    $0x2,%eax
    102e:	48 98                	cltq   
    1030:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    1037:	0f b6 c0             	movzbl %al,%eax
    103a:	01 d0                	add    %edx,%eax
static inline void draw_crosshair(short x, short y)
{
  unsigned char i;
  for (i = 0U; i < 10U; i++) {
    // will need to tweak x,y origins to suit Vectrex screen.  Maybe use relative vectors instead...
    Display_Vectrex_vector(x + (crosshair[i*4]) - 0x80,   y + crosshair[i*4+1] - 0x80,
    103c:	8d 50 80             	lea    -0x80(%rax),%edx
    103f:	0f bf 75 e8          	movswl -0x18(%rbp),%esi
    1043:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    1047:	c1 e0 02             	shl    $0x2,%eax
    104a:	83 c0 01             	add    $0x1,%eax
    104d:	48 98                	cltq   
    104f:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    1056:	0f b6 c0             	movzbl %al,%eax
    1059:	01 f0                	add    %esi,%eax
    105b:	8d 70 80             	lea    -0x80(%rax),%esi
    105e:	0f bf 7d ec          	movswl -0x14(%rbp),%edi
    1062:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    1066:	c1 e0 02             	shl    $0x2,%eax
    1069:	48 98                	cltq   
    106b:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    1072:	0f b6 c0             	movzbl %al,%eax
    1075:	01 f8                	add    %edi,%eax
    1077:	83 c0 80             	add    $0xffffff80,%eax
    107a:	89 c7                	mov    %eax,%edi
    107c:	b8 00 00 00 00       	mov    $0x0,%eax
    1081:	e8 00 00 00 00       	callq  1086 <draw_crosshair+0xa2>
}

static inline void draw_crosshair(short x, short y)
{
  unsigned char i;
  for (i = 0U; i < 10U; i++) {
    1086:	80 45 ff 01          	addb   $0x1,-0x1(%rbp)
    108a:	80 7d ff 09          	cmpb   $0x9,-0x1(%rbp)
    108e:	0f 86 6d ff ff ff    	jbe    1001 <draw_crosshair+0x1d>
    // will need to tweak x,y origins to suit Vectrex screen.  Maybe use relative vectors instead...
    Display_Vectrex_vector(x + (crosshair[i*4]) - 0x80,   y + crosshair[i*4+1] - 0x80,
                           x + (crosshair[i*4+2]) - 0x80, y + crosshair[i*4+3] - 0x80);
  }
}
    1094:	c9                   	leaveq 
    1095:	c3                   	retq   

0000000000001096 <drawtgintro>:

static inline void drawtgintro(void) {
    1096:	55                   	push   %rbp
    1097:	48 89 e5             	mov    %rsp,%rbp
    109a:	48 83 ec 10          	sub    $0x10,%rsp
  unsigned char objects;

  if (stopintroflag == 2) return;
    109e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 10a5 <drawtgintro+0xf>
    10a5:	66 83 f8 02          	cmp    $0x2,%ax
    10a9:	0f 84 13 01 00 00    	je     11c2 <drawtgintro+0x12c>

  if (fp2_14_cos (intro_rot) > 0) { // are we looking at the front of the tumbling intro placard?
    10af:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 10b6 <drawtgintro+0x20>
    10b6:	0f b6 c0             	movzbl %al,%eax
    10b9:	89 c7                	mov    %eax,%edi
    10bb:	e8 1a f5 ff ff       	callq  5da <fp2_14_cos>
    10c0:	66 85 c0             	test   %ax,%ax
    10c3:	7e 06                	jle    10cb <drawtgintro+0x35>
               /* (this should be a compile-time constant)                 */
    objects = ((sizeof (tg_intro_placard) / sizeof (tg_intro_placard[0])) / 4); // yes - draw rectangles and text together
    10c5:	c6 45 fe 27          	movb   $0x27,-0x2(%rbp)
    10c9:	eb 04                	jmp    10cf <drawtgintro+0x39>
  } else {
    objects = 8; // no - just draw the rectangles
    10cb:	c6 45 fe 08          	movb   $0x8,-0x2(%rbp)
  }

  {unsigned char i; short tgfrom_x, tgfrom_y, tgto_x, tgto_y;
    tgi = 0;
    10cf:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 10d8 <drawtgintro+0x42>
    10d6:	00 00 
    for (i = 0; i < objects; i++) {
    10d8:	c6 45 ff 00          	movb   $0x0,-0x1(%rbp)
    10dc:	e9 c8 00 00 00       	jmpq   11a9 <drawtgintro+0x113>
      tgfrom_x = tg_intro_placard[tgi++]-128;
    10e1:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 10e8 <drawtgintro+0x52>
    10e8:	0f bf d0             	movswl %ax,%edx
    10eb:	48 63 d2             	movslq %edx,%rdx
    10ee:	0f b6 92 00 00 00 00 	movzbl 0x0(%rdx),%edx
    10f5:	0f b6 d2             	movzbl %dl,%edx
    10f8:	83 c2 80             	add    $0xffffff80,%edx
    10fb:	66 89 55 f6          	mov    %dx,-0xa(%rbp)
    10ff:	83 c0 01             	add    $0x1,%eax
    1102:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1109 <drawtgintro+0x73>
      tgfrom_y = tg_intro_placard[tgi++]-128;
    1109:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1110 <drawtgintro+0x7a>
    1110:	0f bf d0             	movswl %ax,%edx
    1113:	48 63 d2             	movslq %edx,%rdx
    1116:	0f b6 92 00 00 00 00 	movzbl 0x0(%rdx),%edx
    111d:	0f b6 d2             	movzbl %dl,%edx
    1120:	83 c2 80             	add    $0xffffff80,%edx
    1123:	66 89 55 f8          	mov    %dx,-0x8(%rbp)
    1127:	83 c0 01             	add    $0x1,%eax
    112a:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1131 <drawtgintro+0x9b>
      tgto_x = tg_intro_placard[tgi++]-128;
    1131:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1138 <drawtgintro+0xa2>
    1138:	0f bf d0             	movswl %ax,%edx
    113b:	48 63 d2             	movslq %edx,%rdx
    113e:	0f b6 92 00 00 00 00 	movzbl 0x0(%rdx),%edx
    1145:	0f b6 d2             	movzbl %dl,%edx
    1148:	83 c2 80             	add    $0xffffff80,%edx
    114b:	66 89 55 fa          	mov    %dx,-0x6(%rbp)
    114f:	83 c0 01             	add    $0x1,%eax
    1152:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1159 <drawtgintro+0xc3>
      tgto_y = tg_intro_placard[tgi++]-128;
    1159:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1160 <drawtgintro+0xca>
    1160:	0f bf d0             	movswl %ax,%edx
    1163:	48 63 d2             	movslq %edx,%rdx
    1166:	0f b6 92 00 00 00 00 	movzbl 0x0(%rdx),%edx
    116d:	0f b6 d2             	movzbl %dl,%edx
    1170:	83 c2 80             	add    $0xffffff80,%edx
    1173:	66 89 55 fc          	mov    %dx,-0x4(%rbp)
    1177:	83 c0 01             	add    $0x1,%eax
    117a:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1181 <drawtgintro+0xeb>
      // somewhere the x,y,z coordinates got a bit messed up...
      draw_tg_intro_with_rolling_rotation (tgfrom_y, tgfrom_x, tgto_y, tgto_x, intro_rot);
    1181:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 1188 <drawtgintro+0xf2>
    1188:	0f b6 f8             	movzbl %al,%edi
    118b:	0f bf 4d fa          	movswl -0x6(%rbp),%ecx
    118f:	0f bf 55 fc          	movswl -0x4(%rbp),%edx
    1193:	0f bf 75 f6          	movswl -0xa(%rbp),%esi
    1197:	0f bf 45 f8          	movswl -0x8(%rbp),%eax
    119b:	41 89 f8             	mov    %edi,%r8d
    119e:	89 c7                	mov    %eax,%edi
    11a0:	e8 3c f5 ff ff       	callq  6e1 <draw_tg_intro_with_rolling_rotation>
    objects = 8; // no - just draw the rectangles
  }

  {unsigned char i; short tgfrom_x, tgfrom_y, tgto_x, tgto_y;
    tgi = 0;
    for (i = 0; i < objects; i++) {
    11a5:	80 45 ff 01          	addb   $0x1,-0x1(%rbp)
    11a9:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    11ad:	3a 45 fe             	cmp    -0x2(%rbp),%al
    11b0:	0f 82 2b ff ff ff    	jb     10e1 <drawtgintro+0x4b>
      // somewhere the x,y,z coordinates got a bit messed up...
      draw_tg_intro_with_rolling_rotation (tgfrom_y, tgfrom_x, tgto_y, tgto_x, intro_rot);
    }
  }
  // restore intensity to 110 after drawing flashing intro placard
  setintensity(110);
    11b6:	bf 6e 00 00 00       	mov    $0x6e,%edi
    11bb:	e8 43 ef ff ff       	callq  103 <setintensity>
    11c0:	eb 01                	jmp    11c3 <drawtgintro+0x12d>
}

static inline void drawtgintro(void) {
  unsigned char objects;

  if (stopintroflag == 2) return;
    11c2:	90                   	nop
      draw_tg_intro_with_rolling_rotation (tgfrom_y, tgfrom_x, tgto_y, tgto_x, intro_rot);
    }
  }
  // restore intensity to 110 after drawing flashing intro placard
  setintensity(110);
}
    11c3:	c9                   	leaveq 
    11c4:	c3                   	retq   

00000000000011c5 <Playintro>:

static inline void Playintro(void)
{
    11c5:	55                   	push   %rbp
    11c6:	48 89 e5             	mov    %rsp,%rbp
  intro_z = 206; intro_rot = 64; //90; // not sure about Z.  still to test the approach of the placard.
    11c9:	66 c7 05 00 00 00 00 	movw   $0xce,0x0(%rip)        # 11d2 <Playintro+0xd>
    11d0:	ce 00 
    11d2:	c6 05 00 00 00 00 40 	movb   $0x40,0x0(%rip)        # 11d9 <Playintro+0x14>
  flashing_intro_timer = 0; hide_intro_timer = 0;
    11d9:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 11e2 <Playintro+0x1d>
    11e0:	00 00 
    11e2:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 11eb <Playintro+0x26>
    11e9:	00 00 
  stopintroflag = 0;
    11eb:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 11f4 <Playintro+0x2f>
    11f2:	00 00 
}
    11f4:	5d                   	pop    %rbp
    11f5:	c3                   	retq   

00000000000011f6 <initialise_ship>:

static inline void initialise_ship(unsigned char id, unsigned char model_type, short x, short y, short z, short Xrot, short Yrot, short Zrot, short scale_fp)
{
    11f6:	55                   	push   %rbp
    11f7:	48 89 e5             	mov    %rsp,%rbp
    11fa:	53                   	push   %rbx
    11fb:	48 83 ec 38          	sub    $0x38,%rsp
    11ff:	89 c8                	mov    %ecx,%eax
    1201:	45 89 c3             	mov    %r8d,%r11d
    1204:	45 89 ca             	mov    %r9d,%r10d
    1207:	44 8b 4d 10          	mov    0x10(%rbp),%r9d
    120b:	44 8b 45 18          	mov    0x18(%rbp),%r8d
    120f:	8b 4d 20             	mov    0x20(%rbp),%ecx
    1212:	40 88 7d e4          	mov    %dil,-0x1c(%rbp)
    1216:	40 88 75 e0          	mov    %sil,-0x20(%rbp)
    121a:	66 89 55 dc          	mov    %dx,-0x24(%rbp)
    121e:	66 89 45 d8          	mov    %ax,-0x28(%rbp)
    1222:	66 44 89 5d d4       	mov    %r11w,-0x2c(%rbp)
    1227:	66 44 89 55 d0       	mov    %r10w,-0x30(%rbp)
    122c:	66 44 89 4d cc       	mov    %r9w,-0x34(%rbp)
    1231:	66 44 89 45 c8       	mov    %r8w,-0x38(%rbp)
    1236:	66 89 4d c4          	mov    %cx,-0x3c(%rbp)
  unsigned char ship_next = id/*0..3*/ * SHIP_RECORD_LENGTH;
    123a:	0f b6 45 e4          	movzbl -0x1c(%rbp),%eax
    123e:	01 c0                	add    %eax,%eax
    1240:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    1247:	89 d1                	mov    %edx,%ecx
    1249:	28 c1                	sub    %al,%cl
    124b:	89 c8                	mov    %ecx,%eax
    124d:	88 45 f7             	mov    %al,-0x9(%rbp)

  /* Set up all the fields in the ship struct */
  ships[ship_next++] = model_type;  // (was model 1 to 4, now model 0 to 3)    SHIP_TYPE 0U
    1250:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
    1254:	0f b6 55 e0          	movzbl -0x20(%rbp),%edx
    1258:	48 98                	cltq   
    125a:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    1261:	00 
    1262:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
  ships[ship_next++] = x;     // SHIP_X 1U
    1266:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
    126a:	48 98                	cltq   
    126c:	0f b7 55 dc          	movzwl -0x24(%rbp),%edx
    1270:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    1277:	00 
    1278:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
  ships[ship_next++] = y;     // SHIP_Y 2U
    127c:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
    1280:	48 98                	cltq   
    1282:	0f b7 55 d8          	movzwl -0x28(%rbp),%edx
    1286:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    128d:	00 
    128e:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
  ships[ship_next++] = z;     // SHIP_Z 3U
    1292:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
    1296:	48 98                	cltq   
    1298:	0f b7 55 d4          	movzwl -0x2c(%rbp),%edx
    129c:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    12a3:	00 
    12a4:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
  ships[ship_next++] = Xrot;  // SHIP_X_ROTATION 4U
    12a8:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
    12ac:	48 98                	cltq   
    12ae:	0f b7 55 d0          	movzwl -0x30(%rbp),%edx
    12b2:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    12b9:	00 
    12ba:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
  ships[ship_next++] = Yrot;  // SHIP_Y_ROTATION 5U
    12be:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
    12c2:	48 98                	cltq   
    12c4:	0f b7 55 cc          	movzwl -0x34(%rbp),%edx
    12c8:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    12cf:	00 
    12d0:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
  ships[ship_next++] = Zrot;  // SHIP_Z_ROTATION 6U
    12d4:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
    12d8:	48 98                	cltq   
    12da:	0f b7 55 c8          	movzwl -0x38(%rbp),%edx
    12de:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    12e5:	00 
    12e6:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
  ships[ship_next++] = scale_fp; // (see comment by this_scale_fp declaration)    SHIP_SCALE_FP 7U
    12ea:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
    12ee:	48 98                	cltq   
    12f0:	0f b7 55 c4          	movzwl -0x3c(%rbp),%edx
    12f4:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    12fb:	00 
    12fc:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
  ships[ship_next++] = ((SHIP_MAXVEL * pickrandom (80, 120)) / 100); // integer, range roughly 16:24?    SHIP_SPEED 8U
    1300:	0f b6 5d f7          	movzbl -0x9(%rbp),%ebx
    1304:	be 78 00 00 00       	mov    $0x78,%esi
    1309:	bf 50 00 00 00       	mov    $0x50,%edi
    130e:	e8 ba ed ff ff       	callq  cd <pickrandom>
    1313:	0f bf d0             	movswl %ax,%edx
    1316:	89 d0                	mov    %edx,%eax
    1318:	c1 e0 02             	shl    $0x2,%eax
    131b:	01 d0                	add    %edx,%eax
    131d:	c1 e0 02             	shl    $0x2,%eax
    1320:	89 c1                	mov    %eax,%ecx
    1322:	ba 1f 85 eb 51       	mov    $0x51eb851f,%edx
    1327:	89 c8                	mov    %ecx,%eax
    1329:	f7 ea                	imul   %edx
    132b:	c1 fa 05             	sar    $0x5,%edx
    132e:	89 c8                	mov    %ecx,%eax
    1330:	c1 f8 1f             	sar    $0x1f,%eax
    1333:	89 d1                	mov    %edx,%ecx
    1335:	29 c1                	sub    %eax,%ecx
    1337:	89 c8                	mov    %ecx,%eax
    1339:	89 c2                	mov    %eax,%edx
    133b:	48 63 c3             	movslq %ebx,%rax
    133e:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    1345:	00 
    1346:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
                                                             // change to a range that encourages /128 instead 
  ships[ship_next++] = 0;     // SHIP_TIME 9U
    134a:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
    134e:	48 98                	cltq   
    1350:	66 c7 84 00 00 00 00 	movw   $0x0,0x0(%rax,%rax,1)
    1357:	00 00 00 
    135a:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
  ships[ship_next++] = pickrandom (-400, 400); // SHIP_TARGET_X 10U
    135e:	0f b6 5d f7          	movzbl -0x9(%rbp),%ebx
    1362:	be 90 01 00 00       	mov    $0x190,%esi
    1367:	bf 70 fe ff ff       	mov    $0xfffffe70,%edi
    136c:	e8 5c ed ff ff       	callq  cd <pickrandom>
    1371:	48 63 d3             	movslq %ebx,%rdx
    1374:	66 89 84 12 00 00 00 	mov    %ax,0x0(%rdx,%rdx,1)
    137b:	00 
    137c:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
  ships[ship_next++] = pickrandom (-300, 300); // SHIP_TARGET_Y 11U
    1380:	0f b6 5d f7          	movzbl -0x9(%rbp),%ebx
    1384:	be 2c 01 00 00       	mov    $0x12c,%esi
    1389:	bf d4 fe ff ff       	mov    $0xfffffed4,%edi
    138e:	e8 3a ed ff ff       	callq  cd <pickrandom>
    1393:	48 63 d3             	movslq %ebx,%rdx
    1396:	66 89 84 12 00 00 00 	mov    %ax,0x0(%rdx,%rdx,1)
    139d:	00 
    139e:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
  ships[ship_next++] = z;                      // SHIP_TARGET_Z 12U
    13a2:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
    13a6:	48 98                	cltq   
    13a8:	0f b7 55 d4          	movzwl -0x2c(%rbp),%edx
    13ac:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    13b3:	00 
    13b4:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
    // Initial phase is with ships viewed from above, flying in 2D in the plane Z=max depth,
    // hence why target z is initially same as ship.z
    // Later, they turn and head towards the viewer at z=0.
  ships[ship_next++] = SHIP_STATUS_ALIVE;      // SHIP_STATUS 13U
    13b8:	0f b6 45 f7          	movzbl -0x9(%rbp),%eax
    13bc:	48 98                	cltq   
    13be:	66 c7 84 00 00 00 00 	movw   $0x0,0x0(%rax,%rax,1)
    13c5:	00 00 00 
    13c8:	80 45 f7 01          	addb   $0x1,-0x9(%rbp)
}
    13cc:	48 83 c4 38          	add    $0x38,%rsp
    13d0:	5b                   	pop    %rbx
    13d1:	5d                   	pop    %rbp
    13d2:	c3                   	retq   

00000000000013d3 <debug_ship>:

static inline void debug_ship(unsigned char id)
{
    13d3:	55                   	push   %rbp
    13d4:	48 89 e5             	mov    %rsp,%rbp
    13d7:	89 f8                	mov    %edi,%eax
    13d9:	88 45 dc             	mov    %al,-0x24(%rbp)
  short model_type, x, y, z, Xrot, Yrot, Zrot, scale_fp, speed, shiptime, tgx_, tgy_, tgz_, status;
  short ship_next = id/*0..3*/ * SHIP_RECORD_LENGTH;
    13dc:	0f b6 45 dc          	movzbl -0x24(%rbp),%eax
    13e0:	01 c0                	add    %eax,%eax
    13e2:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    13e9:	89 d1                	mov    %edx,%ecx
    13eb:	66 29 c1             	sub    %ax,%cx
    13ee:	89 c8                	mov    %ecx,%eax
    13f0:	66 89 45 e2          	mov    %ax,-0x1e(%rbp)

  /* Set up all the fields in the ship struct */
  model_type = ships[ship_next++];  // (was model 1 to 4, now model 0 to 3)    SHIP_TYPE 0U
    13f4:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    13f8:	48 98                	cltq   
    13fa:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    1401:	00 
    1402:	66 89 45 e4          	mov    %ax,-0x1c(%rbp)
    1406:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  x = ships[ship_next++];     // SHIP_X 1U
    140b:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    140f:	48 98                	cltq   
    1411:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    1418:	00 
    1419:	66 89 45 e6          	mov    %ax,-0x1a(%rbp)
    141d:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  y = ships[ship_next++];     // SHIP_Y 2U
    1422:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    1426:	48 98                	cltq   
    1428:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    142f:	00 
    1430:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
    1434:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  z = ships[ship_next++];     // SHIP_Z 3U
    1439:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    143d:	48 98                	cltq   
    143f:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    1446:	00 
    1447:	66 89 45 ea          	mov    %ax,-0x16(%rbp)
    144b:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  Xrot = ships[ship_next++];  // SHIP_X_ROTATION 4U
    1450:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    1454:	48 98                	cltq   
    1456:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    145d:	00 
    145e:	66 89 45 ec          	mov    %ax,-0x14(%rbp)
    1462:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  Yrot = ships[ship_next++];  // SHIP_Y_ROTATION 5U
    1467:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    146b:	48 98                	cltq   
    146d:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    1474:	00 
    1475:	66 89 45 ee          	mov    %ax,-0x12(%rbp)
    1479:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  Zrot = ships[ship_next++];  // SHIP_Z_ROTATION 6U
    147e:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    1482:	48 98                	cltq   
    1484:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    148b:	00 
    148c:	66 89 45 f0          	mov    %ax,-0x10(%rbp)
    1490:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  scale_fp = ships[ship_next++]; // (see comment by this_scale_fp declaration)    SHIP_SCALE_FP 7U
    1495:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    1499:	48 98                	cltq   
    149b:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    14a2:	00 
    14a3:	66 89 45 f2          	mov    %ax,-0xe(%rbp)
    14a7:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  speed = ships[ship_next++];    // integer, range roughly 16:24?    SHIP_SPEED 8U
    14ac:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    14b0:	48 98                	cltq   
    14b2:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    14b9:	00 
    14ba:	66 89 45 f4          	mov    %ax,-0xc(%rbp)
    14be:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  shiptime = ships[ship_next++]; // SHIP_TIME 9U
    14c3:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    14c7:	48 98                	cltq   
    14c9:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    14d0:	00 
    14d1:	66 89 45 f6          	mov    %ax,-0xa(%rbp)
    14d5:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  tgx_ = ships[ship_next++];   // SHIP_TARGET_X 10U
    14da:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    14de:	48 98                	cltq   
    14e0:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    14e7:	00 
    14e8:	66 89 45 f8          	mov    %ax,-0x8(%rbp)
    14ec:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  tgy_ = ships[ship_next++];   // SHIP_TARGET_Y 11U
    14f1:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    14f5:	48 98                	cltq   
    14f7:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    14fe:	00 
    14ff:	66 89 45 fa          	mov    %ax,-0x6(%rbp)
    1503:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  tgz_ = ships[ship_next++];   // SHIP_TARGET_Z 12U
    1508:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    150c:	48 98                	cltq   
    150e:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    1515:	00 
    1516:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
    151a:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  status = ships[ship_next++];      // SHIP_STATUS 13U
    151f:	0f bf 45 e2          	movswl -0x1e(%rbp),%eax
    1523:	48 98                	cltq   
    1525:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    152c:	00 
    152d:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
    1531:	66 83 45 e2 01       	addw   $0x1,-0x1e(%rbp)
  fprintf(stdout, "  speed %d\n", speed);
  fprintf(stdout, "  target location %d %d %d\n", tgx_,tgy_,tgz_);
  fprintf(stdout, "  ships time %d\n", shiptime);
  fprintf(stdout, "}\n");
#endif
}
    1536:	5d                   	pop    %rbp
    1537:	c3                   	retq   

0000000000001538 <Start_attack_wave>:

static void Start_attack_wave(void)
{
    1538:	55                   	push   %rbp
    1539:	48 89 e5             	mov    %rsp,%rbp
    153c:	48 83 ec 28          	sub    $0x28,%rsp
  short randomedge, X, Y, Z = SHIP_SPAWN_Z, Zrot, scale_fp = div_int_by_int_returning_fp2_14(1999, 5000);// Orig:1000 DEBUG!!!!
    1540:	66 c7 45 f8 d0 07    	movw   $0x7d0,-0x8(%rbp)
    1546:	be 88 13 00 00       	mov    $0x1388,%esi
    154b:	bf cf 07 00 00       	mov    $0x7cf,%edi
    1550:	e8 19 f1 ff ff       	callq  66e <div_int_by_int_returning_fp2_14>
    1555:	66 89 45 fa          	mov    %ax,-0x6(%rbp)
                                                             // 2 may not be in range! trying 1.999 instead...
  unsigned char i;

  for (i = 0; i < SHIPSPERWAVE; i++) {
    1559:	c6 45 ff 00          	movb   $0x0,-0x1(%rbp)
    155d:	e9 ca 00 00 00       	jmpq   162c <Start_attack_wave+0xf4>
    randomedge = pickrandom (1, 3); // sides and top only.
    1562:	be 03 00 00 00       	mov    $0x3,%esi
    1567:	bf 01 00 00 00       	mov    $0x1,%edi
    156c:	e8 5c eb ff ff       	callq  cd <pickrandom>
    1571:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
    if (randomedge == 1) {
    1575:	66 83 7d fc 01       	cmpw   $0x1,-0x4(%rbp)
    157a:	75 21                	jne    159d <Start_attack_wave+0x65>
      X = -900; Y = pickrandom (-500, 500); Zrot = 64; // 90 degrees
    157c:	66 c7 45 f2 7c fc    	movw   $0xfc7c,-0xe(%rbp)
    1582:	be f4 01 00 00       	mov    $0x1f4,%esi
    1587:	bf 0c fe ff ff       	mov    $0xfffffe0c,%edi
    158c:	e8 3c eb ff ff       	callq  cd <pickrandom>
    1591:	66 89 45 f4          	mov    %ax,-0xc(%rbp)
    1595:	66 c7 45 f6 40 00    	movw   $0x40,-0xa(%rbp)
    159b:	eb 47                	jmp    15e4 <Start_attack_wave+0xac>
    } else if (randomedge == 2) {
    159d:	66 83 7d fc 02       	cmpw   $0x2,-0x4(%rbp)
    15a2:	75 21                	jne    15c5 <Start_attack_wave+0x8d>
      X = pickrandom (-500, 500); Y = 700; Zrot = 0;
    15a4:	be f4 01 00 00       	mov    $0x1f4,%esi
    15a9:	bf 0c fe ff ff       	mov    $0xfffffe0c,%edi
    15ae:	e8 1a eb ff ff       	callq  cd <pickrandom>
    15b3:	66 89 45 f2          	mov    %ax,-0xe(%rbp)
    15b7:	66 c7 45 f4 bc 02    	movw   $0x2bc,-0xc(%rbp)
    15bd:	66 c7 45 f6 00 00    	movw   $0x0,-0xa(%rbp)
    15c3:	eb 1f                	jmp    15e4 <Start_attack_wave+0xac>
    } else {
      X = 900; Y = pickrandom (-500, 500); Zrot = 128+64; // -90 degrees
    15c5:	66 c7 45 f2 84 03    	movw   $0x384,-0xe(%rbp)
    15cb:	be f4 01 00 00       	mov    $0x1f4,%esi
    15d0:	bf 0c fe ff ff       	mov    $0xfffffe0c,%edi
    15d5:	e8 f3 ea ff ff       	callq  cd <pickrandom>
    15da:	66 89 45 f4          	mov    %ax,-0xc(%rbp)
    15de:	66 c7 45 f6 c0 00    	movw   $0xc0,-0xa(%rbp)
    }
    initialise_ship (i, nextwaveshiptype, X, Y, Z, 128+64 /*270 degrees*/, 128 /*180 degrees*/, Zrot, scale_fp);
    15e4:	44 0f bf 45 fa       	movswl -0x6(%rbp),%r8d
    15e9:	0f bf 7d f6          	movswl -0xa(%rbp),%edi
    15ed:	44 0f bf 55 f8       	movswl -0x8(%rbp),%r10d
    15f2:	0f bf 4d f4          	movswl -0xc(%rbp),%ecx
    15f6:	0f bf 55 f2          	movswl -0xe(%rbp),%edx
    15fa:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 1601 <Start_attack_wave+0xc9>
    1601:	0f b6 f0             	movzbl %al,%esi
    1604:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    1608:	44 89 44 24 10       	mov    %r8d,0x10(%rsp)
    160d:	89 7c 24 08          	mov    %edi,0x8(%rsp)
    1611:	c7 04 24 80 00 00 00 	movl   $0x80,(%rsp)
    1618:	41 b9 c0 00 00 00    	mov    $0xc0,%r9d
    161e:	45 89 d0             	mov    %r10d,%r8d
    1621:	89 c7                	mov    %eax,%edi
    1623:	e8 ce fb ff ff       	callq  11f6 <initialise_ship>
{
  short randomedge, X, Y, Z = SHIP_SPAWN_Z, Zrot, scale_fp = div_int_by_int_returning_fp2_14(1999, 5000);// Orig:1000 DEBUG!!!!
                                                             // 2 may not be in range! trying 1.999 instead...
  unsigned char i;

  for (i = 0; i < SHIPSPERWAVE; i++) {
    1628:	80 45 ff 01          	addb   $0x1,-0x1(%rbp)
    162c:	80 7d ff 02          	cmpb   $0x2,-0x1(%rbp)
    1630:	0f 86 2c ff ff ff    	jbe    1562 <Start_attack_wave+0x2a>
    initialise_ship (i, nextwaveshiptype, X, Y, Z, 128+64 /*270 degrees*/, 128 /*180 degrees*/, Zrot, scale_fp);
  }

  // TO DO: !! watch out for a Scratch off-by-1 here.  this was 1..4, change to 0..3? (watch for init to ship #1)
  // nextwaveshiptype = ((nextwaveshiptype % 4) + 1);
  nextwaveshiptype = (nextwaveshiptype + 1)&3;
    1636:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 163d <Start_attack_wave+0x105>
    163d:	83 c0 01             	add    $0x1,%eax
    1640:	83 e0 03             	and    $0x3,%eax
    1643:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 1649 <Start_attack_wave+0x111>

  ShipsPassedThisWave = 0;
    1649:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 1652 <Start_attack_wave+0x11a>
    1650:	00 00 
}
    1652:	c9                   	leaveq 
    1653:	c3                   	retq   

0000000000001654 <Start_new_game>:

static inline void Start_new_game (void) // ie a whole coin's worth, not just 3 ships
{
    1654:	55                   	push   %rbp
    1655:	48 89 e5             	mov    %rsp,%rbp
  stopintroflag = 2; // Kill banner
    1658:	66 c7 05 00 00 00 00 	movw   $0x2,0x0(%rip)        # 1661 <Start_new_game+0xd>
    165f:	02 00 
  Score = 0;
    1661:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 166a <Start_new_game+0x16>
    1668:	00 00 

  Shields = 80;
    166a:	66 c7 05 00 00 00 00 	movw   $0x50,0x0(%rip)        # 1673 <Start_new_game+0x1f>
    1671:	50 00 
  ShipsPassedTotal = 0;
    1673:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 167c <Start_new_game+0x28>
    167a:	00 00 

  nextwaveshiptype = 0;
    167c:	c6 05 00 00 00 00 00 	movb   $0x0,0x0(%rip)        # 1683 <Start_new_game+0x2f>

  //projectile_next = 0;
  Start_attack_wave ();
    1683:	e8 b0 fe ff ff       	callq  1538 <Start_attack_wave>

  // TO DO: This is probably the place to reset millis to 0!  Because on a 16 bit system,
  // it is going to wrap, well within the length of a game session.
  lastfiringtime = millis();
    1688:	b8 00 00 00 00       	mov    $0x0,%eax
    168d:	e8 00 00 00 00       	callq  1692 <Start_new_game+0x3e>
    1692:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1699 <Start_new_game+0x45>
}
    1699:	5d                   	pop    %rbp
    169a:	c3                   	retq   

000000000000169b <draw_text_line>:

static inline void draw_text_line(short fromx, short fromy, short tox, short toy)
{
    169b:	55                   	push   %rbp
    169c:	48 89 e5             	mov    %rsp,%rbp
    169f:	48 83 ec 10          	sub    $0x10,%rsp
    16a3:	89 c8                	mov    %ecx,%eax
    16a5:	66 89 7d fc          	mov    %di,-0x4(%rbp)
    16a9:	66 89 75 f8          	mov    %si,-0x8(%rbp)
    16ad:	66 89 55 f4          	mov    %dx,-0xc(%rbp)
    16b1:	66 89 45 f0          	mov    %ax,-0x10(%rbp)
  Display_Vectrex_vector(fromx + textx + ScreenWidth / 2, fromy + texty + ScreenHeight / 2, tox + textx + ScreenWidth / 2, toy + texty + ScreenHeight / 2);
    16b5:	0f bf 55 f0          	movswl -0x10(%rbp),%edx
    16b9:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 16c0 <draw_text_line+0x25>
    16c0:	98                   	cwtl   
    16c1:	01 c2                	add    %eax,%edx
    16c3:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 16c9 <draw_text_line+0x2e>
    16c9:	89 c1                	mov    %eax,%ecx
    16cb:	c1 e9 1f             	shr    $0x1f,%ecx
    16ce:	01 c8                	add    %ecx,%eax
    16d0:	d1 f8                	sar    %eax
    16d2:	8d 0c 02             	lea    (%rdx,%rax,1),%ecx
    16d5:	0f bf 55 f4          	movswl -0xc(%rbp),%edx
    16d9:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 16e0 <draw_text_line+0x45>
    16e0:	98                   	cwtl   
    16e1:	01 c2                	add    %eax,%edx
    16e3:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 16e9 <draw_text_line+0x4e>
    16e9:	89 c6                	mov    %eax,%esi
    16eb:	c1 ee 1f             	shr    $0x1f,%esi
    16ee:	01 f0                	add    %esi,%eax
    16f0:	d1 f8                	sar    %eax
    16f2:	01 c2                	add    %eax,%edx
    16f4:	0f bf 75 f8          	movswl -0x8(%rbp),%esi
    16f8:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 16ff <draw_text_line+0x64>
    16ff:	98                   	cwtl   
    1700:	01 c6                	add    %eax,%esi
    1702:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 1708 <draw_text_line+0x6d>
    1708:	89 c7                	mov    %eax,%edi
    170a:	c1 ef 1f             	shr    $0x1f,%edi
    170d:	01 f8                	add    %edi,%eax
    170f:	d1 f8                	sar    %eax
    1711:	01 c6                	add    %eax,%esi
    1713:	0f bf 7d fc          	movswl -0x4(%rbp),%edi
    1717:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 171e <draw_text_line+0x83>
    171e:	98                   	cwtl   
    171f:	01 c7                	add    %eax,%edi
    1721:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 1727 <draw_text_line+0x8c>
    1727:	41 89 c0             	mov    %eax,%r8d
    172a:	41 c1 e8 1f          	shr    $0x1f,%r8d
    172e:	44 01 c0             	add    %r8d,%eax
    1731:	d1 f8                	sar    %eax
    1733:	01 f8                	add    %edi,%eax
    1735:	89 c7                	mov    %eax,%edi
    1737:	b8 00 00 00 00       	mov    $0x0,%eax
    173c:	e8 00 00 00 00       	callq  1741 <draw_text_line+0xa6>
 // coords based on 0,0 screen center?
}
    1741:	c9                   	leaveq 
    1742:	c3                   	retq   

0000000000001743 <segment>:

static inline void segment(unsigned char coords, short textscale)
{
    1743:	55                   	push   %rbp
    1744:	48 89 e5             	mov    %rsp,%rbp
    1747:	48 83 ec 20          	sub    $0x20,%rsp
    174b:	89 fa                	mov    %edi,%edx
    174d:	89 f0                	mov    %esi,%eax
    174f:	88 55 ec             	mov    %dl,-0x14(%rbp)
    1752:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
  short from, to;

  // remember to use shifts instead of divides (unless GCC does it for us?)

  // clever packing may be undone by overhead of div&modulo 5 ... reconsider using less dense tables?
  to = coords & 15;
    1756:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    175a:	83 e0 0f             	and    $0xf,%eax
    175d:	66 89 45 f4          	mov    %ax,-0xc(%rbp)
  tox = ((to % 5) *  4 * textscale) >> 7; // / 128;
    1761:	0f b7 4d f4          	movzwl -0xc(%rbp),%ecx
    1765:	0f bf c1             	movswl %cx,%eax
    1768:	69 c0 67 66 00 00    	imul   $0x6667,%eax,%eax
    176e:	c1 e8 10             	shr    $0x10,%eax
    1771:	89 c2                	mov    %eax,%edx
    1773:	66 d1 fa             	sar    %dx
    1776:	89 c8                	mov    %ecx,%eax
    1778:	66 c1 f8 0f          	sar    $0xf,%ax
    177c:	66 29 c2             	sub    %ax,%dx
    177f:	89 d0                	mov    %edx,%eax
    1781:	c1 e0 02             	shl    $0x2,%eax
    1784:	01 d0                	add    %edx,%eax
    1786:	89 ca                	mov    %ecx,%edx
    1788:	66 29 c2             	sub    %ax,%dx
    178b:	0f bf c2             	movswl %dx,%eax
    178e:	8d 14 85 00 00 00 00 	lea    0x0(,%rax,4),%edx
    1795:	0f bf 45 e8          	movswl -0x18(%rbp),%eax
    1799:	0f af c2             	imul   %edx,%eax
    179c:	c1 f8 07             	sar    $0x7,%eax
    179f:	66 89 45 f6          	mov    %ax,-0xa(%rbp)
  toy = ((to / 5) * 12 * textscale) >> 7; // / 128;
    17a3:	0f b7 45 f4          	movzwl -0xc(%rbp),%eax
    17a7:	0f bf d0             	movswl %ax,%edx
    17aa:	69 d2 67 66 00 00    	imul   $0x6667,%edx,%edx
    17b0:	c1 ea 10             	shr    $0x10,%edx
    17b3:	66 d1 fa             	sar    %dx
    17b6:	66 c1 f8 0f          	sar    $0xf,%ax
    17ba:	89 d1                	mov    %edx,%ecx
    17bc:	66 29 c1             	sub    %ax,%cx
    17bf:	89 c8                	mov    %ecx,%eax
    17c1:	0f bf d0             	movswl %ax,%edx
    17c4:	89 d0                	mov    %edx,%eax
    17c6:	01 c0                	add    %eax,%eax
    17c8:	01 d0                	add    %edx,%eax
    17ca:	c1 e0 02             	shl    $0x2,%eax
    17cd:	89 c2                	mov    %eax,%edx
    17cf:	0f bf 45 e8          	movswl -0x18(%rbp),%eax
    17d3:	0f af c2             	imul   %edx,%eax
    17d6:	c1 f8 07             	sar    $0x7,%eax
    17d9:	66 89 45 f8          	mov    %ax,-0x8(%rbp)

  from = coords >> 4;
    17dd:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    17e1:	c0 e8 04             	shr    $0x4,%al
    17e4:	0f b6 c0             	movzbl %al,%eax
    17e7:	66 89 45 fa          	mov    %ax,-0x6(%rbp)
  fromx = ((from % 5) *  4 * textscale) >> 7; // / 128;
    17eb:	0f b7 4d fa          	movzwl -0x6(%rbp),%ecx
    17ef:	0f bf c1             	movswl %cx,%eax
    17f2:	69 c0 67 66 00 00    	imul   $0x6667,%eax,%eax
    17f8:	c1 e8 10             	shr    $0x10,%eax
    17fb:	89 c2                	mov    %eax,%edx
    17fd:	66 d1 fa             	sar    %dx
    1800:	89 c8                	mov    %ecx,%eax
    1802:	66 c1 f8 0f          	sar    $0xf,%ax
    1806:	66 29 c2             	sub    %ax,%dx
    1809:	89 d0                	mov    %edx,%eax
    180b:	c1 e0 02             	shl    $0x2,%eax
    180e:	01 d0                	add    %edx,%eax
    1810:	89 ca                	mov    %ecx,%edx
    1812:	66 29 c2             	sub    %ax,%dx
    1815:	0f bf c2             	movswl %dx,%eax
    1818:	8d 14 85 00 00 00 00 	lea    0x0(,%rax,4),%edx
    181f:	0f bf 45 e8          	movswl -0x18(%rbp),%eax
    1823:	0f af c2             	imul   %edx,%eax
    1826:	c1 f8 07             	sar    $0x7,%eax
    1829:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
  fromy = ((from / 5) * 12 * textscale) >> 7; // / 128;
    182d:	0f b7 45 fa          	movzwl -0x6(%rbp),%eax
    1831:	0f bf d0             	movswl %ax,%edx
    1834:	69 d2 67 66 00 00    	imul   $0x6667,%edx,%edx
    183a:	c1 ea 10             	shr    $0x10,%edx
    183d:	66 d1 fa             	sar    %dx
    1840:	66 c1 f8 0f          	sar    $0xf,%ax
    1844:	89 d1                	mov    %edx,%ecx
    1846:	66 29 c1             	sub    %ax,%cx
    1849:	89 c8                	mov    %ecx,%eax
    184b:	0f bf d0             	movswl %ax,%edx
    184e:	89 d0                	mov    %edx,%eax
    1850:	01 c0                	add    %eax,%eax
    1852:	01 d0                	add    %edx,%eax
    1854:	c1 e0 02             	shl    $0x2,%eax
    1857:	89 c2                	mov    %eax,%edx
    1859:	0f bf 45 e8          	movswl -0x18(%rbp),%eax
    185d:	0f af c2             	imul   %edx,%eax
    1860:	c1 f8 07             	sar    $0x7,%eax
    1863:	66 89 45 fe          	mov    %ax,-0x2(%rbp)

  draw_text_line (fromx, fromy, tox, toy);
    1867:	0f bf 4d f8          	movswl -0x8(%rbp),%ecx
    186b:	0f bf 55 f6          	movswl -0xa(%rbp),%edx
    186f:	0f bf 75 fe          	movswl -0x2(%rbp),%esi
    1873:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
    1877:	89 c7                	mov    %eax,%edi
    1879:	e8 1d fe ff ff       	callq  169b <draw_text_line>
}
    187e:	c9                   	leaveq 
    187f:	c3                   	retq   

0000000000001880 <ch>:

static void ch(unsigned char charno, short textscale)
{
    1880:	55                   	push   %rbp
    1881:	48 89 e5             	mov    %rsp,%rbp
    1884:	48 83 ec 20          	sub    $0x20,%rsp
    1888:	89 fa                	mov    %edi,%edx
    188a:	89 f0                	mov    %esi,%eax
    188c:	88 55 ec             	mov    %dl,-0x14(%rbp)
    188f:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
  if (charno /* > 0U */) { // 0 is blank space
    1893:	80 7d ec 00          	cmpb   $0x0,-0x14(%rbp)
    1897:	74 66                	je     18ff <ch+0x7f>
    {unsigned char i;
      // If the array indexes, and calculations, in the for loop test comparison are recalculated on every loop, perhaps
      // we should pre-calculate them before entering the loop, and use the cached values?
      for (i = font_index[charno-1]; i < font_index[charno-1]+font_length[charno-1]; i++) {
    1899:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    189d:	83 e8 01             	sub    $0x1,%eax
    18a0:	48 98                	cltq   
    18a2:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    18a9:	88 45 ff             	mov    %al,-0x1(%rbp)
    18ac:	eb 21                	jmp    18cf <ch+0x4f>
        segment(font_points[i], textscale);
    18ae:	0f bf 55 e8          	movswl -0x18(%rbp),%edx
    18b2:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    18b6:	48 98                	cltq   
    18b8:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    18bf:	0f b6 c0             	movzbl %al,%eax
    18c2:	89 d6                	mov    %edx,%esi
    18c4:	89 c7                	mov    %eax,%edi
    18c6:	e8 78 fe ff ff       	callq  1743 <segment>
{
  if (charno /* > 0U */) { // 0 is blank space
    {unsigned char i;
      // If the array indexes, and calculations, in the for loop test comparison are recalculated on every loop, perhaps
      // we should pre-calculate them before entering the loop, and use the cached values?
      for (i = font_index[charno-1]; i < font_index[charno-1]+font_length[charno-1]; i++) {
    18cb:	80 45 ff 01          	addb   $0x1,-0x1(%rbp)
    18cf:	0f b6 55 ff          	movzbl -0x1(%rbp),%edx
    18d3:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    18d7:	83 e8 01             	sub    $0x1,%eax
    18da:	48 98                	cltq   
    18dc:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    18e3:	0f b6 c8             	movzbl %al,%ecx
    18e6:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    18ea:	83 e8 01             	sub    $0x1,%eax
    18ed:	48 98                	cltq   
    18ef:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    18f6:	0f b6 c0             	movzbl %al,%eax
    18f9:	01 c8                	add    %ecx,%eax
    18fb:	39 c2                	cmp    %eax,%edx
    18fd:	7c af                	jl     18ae <ch+0x2e>
        segment(font_points[i], textscale);
      }
    }
  }
  textx += (24 * textscale) / 128;
    18ff:	0f bf 55 e8          	movswl -0x18(%rbp),%edx
    1903:	89 d0                	mov    %edx,%eax
    1905:	01 c0                	add    %eax,%eax
    1907:	01 d0                	add    %edx,%eax
    1909:	c1 e0 03             	shl    $0x3,%eax
    190c:	8d 50 7f             	lea    0x7f(%rax),%edx
    190f:	85 c0                	test   %eax,%eax
    1911:	0f 48 c2             	cmovs  %edx,%eax
    1914:	c1 f8 07             	sar    $0x7,%eax
    1917:	89 c2                	mov    %eax,%edx
    1919:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1920 <ch+0xa0>
    1920:	01 d0                	add    %edx,%eax
    1922:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1929 <ch+0xa9>
}
    1929:	c9                   	leaveq 
    192a:	c3                   	retq   

000000000000192b <ch96>:

// DO NOT INLINE OR MACROFY THESE TWO!
static void ch96(unsigned char charno)
{
    192b:	55                   	push   %rbp
    192c:	48 89 e5             	mov    %rsp,%rbp
    192f:	48 83 ec 10          	sub    $0x10,%rsp
    1933:	89 f8                	mov    %edi,%eax
    1935:	88 45 fc             	mov    %al,-0x4(%rbp)
  ch(charno, 96);
    1938:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    193c:	be 60 00 00 00       	mov    $0x60,%esi
    1941:	89 c7                	mov    %eax,%edi
    1943:	e8 38 ff ff ff       	callq  1880 <ch>
}
    1948:	c9                   	leaveq 
    1949:	c3                   	retq   

000000000000194a <ch96str>:

static void ch96str(const unsigned char *text)
{unsigned char i;
    194a:	55                   	push   %rbp
    194b:	48 89 e5             	mov    %rsp,%rbp
    194e:	48 83 ec 20          	sub    $0x20,%rsp
    1952:	48 89 7d e8          	mov    %rdi,-0x18(%rbp)
  for (i = 1; i <= text[0]; i++) ch96(text[i]);
    1956:	c6 45 ff 01          	movb   $0x1,-0x1(%rbp)
    195a:	eb 19                	jmp    1975 <ch96str+0x2b>
    195c:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    1960:	48 03 45 e8          	add    -0x18(%rbp),%rax
    1964:	0f b6 00             	movzbl (%rax),%eax
    1967:	0f b6 c0             	movzbl %al,%eax
    196a:	89 c7                	mov    %eax,%edi
    196c:	e8 ba ff ff ff       	callq  192b <ch96>
    1971:	80 45 ff 01          	addb   $0x1,-0x1(%rbp)
    1975:	48 8b 45 e8          	mov    -0x18(%rbp),%rax
    1979:	0f b6 00             	movzbl (%rax),%eax
    197c:	3a 45 ff             	cmp    -0x1(%rbp),%al
    197f:	73 db                	jae    195c <ch96str+0x12>
}
    1981:	c9                   	leaveq 
    1982:	c3                   	retq   

0000000000001983 <ch128>:

static void ch128(unsigned char charno)
{
    1983:	55                   	push   %rbp
    1984:	48 89 e5             	mov    %rsp,%rbp
    1987:	48 83 ec 10          	sub    $0x10,%rsp
    198b:	89 f8                	mov    %edi,%eax
    198d:	88 45 fc             	mov    %al,-0x4(%rbp)
  ch(charno, 128);
    1990:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    1994:	be 80 00 00 00       	mov    $0x80,%esi
    1999:	89 c7                	mov    %eax,%edi
    199b:	e8 e0 fe ff ff       	callq  1880 <ch>
}
    19a0:	c9                   	leaveq 
    19a1:	c3                   	retq   

00000000000019a2 <ch128str>:

static void ch128str(const unsigned char *text)
{unsigned char i;
    19a2:	55                   	push   %rbp
    19a3:	48 89 e5             	mov    %rsp,%rbp
    19a6:	48 83 ec 20          	sub    $0x20,%rsp
    19aa:	48 89 7d e8          	mov    %rdi,-0x18(%rbp)
  for (i = 1; i <= text[0]; i++) ch128(text[i]);
    19ae:	c6 45 ff 01          	movb   $0x1,-0x1(%rbp)
    19b2:	eb 19                	jmp    19cd <ch128str+0x2b>
    19b4:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    19b8:	48 03 45 e8          	add    -0x18(%rbp),%rax
    19bc:	0f b6 00             	movzbl (%rax),%eax
    19bf:	0f b6 c0             	movzbl %al,%eax
    19c2:	89 c7                	mov    %eax,%edi
    19c4:	e8 ba ff ff ff       	callq  1983 <ch128>
    19c9:	80 45 ff 01          	addb   $0x1,-0x1(%rbp)
    19cd:	48 8b 45 e8          	mov    -0x18(%rbp),%rax
    19d1:	0f b6 00             	movzbl (%rax),%eax
    19d4:	3a 45 ff             	cmp    -0x1(%rbp),%al
    19d7:	73 db                	jae    19b4 <ch128str+0x12>
}
    19d9:	c9                   	leaveq 
    19da:	c3                   	retq   

00000000000019db <Drawnum>:

static void Drawnum(short num, unsigned char size) // Up to 32767, no negative numbers.  (Not needed)
{
    19db:	55                   	push   %rbp
    19dc:	48 89 e5             	mov    %rsp,%rbp
    19df:	48 83 ec 20          	sub    $0x20,%rsp
    19e3:	89 fa                	mov    %edi,%edx
    19e5:	89 f0                	mov    %esi,%eax
    19e7:	66 89 55 ec          	mov    %dx,-0x14(%rbp)
    19eb:	88 45 e8             	mov    %al,-0x18(%rbp)
  unsigned char i;
  short tens = 10000;
    19ee:	66 c7 45 fc 10 27    	movw   $0x2710,-0x4(%rbp)

  i = 4U;
    19f4:	c6 45 ff 04          	movb   $0x4,-0x1(%rbp)
  for (;;) { // handle leading-zero suppression
    if ((num >= tens) || (i == 0)) {
    19f8:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
    19fc:	66 3b 45 fc          	cmp    -0x4(%rbp),%ax
    1a00:	7d 06                	jge    1a08 <Drawnum+0x2d>
    1a02:	80 7d ff 00          	cmpb   $0x0,-0x1(%rbp)
    1a06:	75 48                	jne    1a50 <Drawnum+0x75>
      // ch(1+...) because Digits are encoded as 1..10, not 0..9
      ch((unsigned char)(1+(num / tens) % 10), size); // i==0 for single digit 0 case
    1a08:	0f b6 75 e8          	movzbl -0x18(%rbp),%esi
    1a0c:	0f bf 45 ec          	movswl -0x14(%rbp),%eax
    1a10:	0f bf 55 fc          	movswl -0x4(%rbp),%edx
    1a14:	89 55 e4             	mov    %edx,-0x1c(%rbp)
    1a17:	89 c2                	mov    %eax,%edx
    1a19:	c1 fa 1f             	sar    $0x1f,%edx
    1a1c:	f7 7d e4             	idivl  -0x1c(%rbp)
    1a1f:	89 c1                	mov    %eax,%ecx
    1a21:	ba 67 66 66 66       	mov    $0x66666667,%edx
    1a26:	89 c8                	mov    %ecx,%eax
    1a28:	f7 ea                	imul   %edx
    1a2a:	c1 fa 02             	sar    $0x2,%edx
    1a2d:	89 c8                	mov    %ecx,%eax
    1a2f:	c1 f8 1f             	sar    $0x1f,%eax
    1a32:	29 c2                	sub    %eax,%edx
    1a34:	89 d0                	mov    %edx,%eax
    1a36:	c1 e0 02             	shl    $0x2,%eax
    1a39:	01 d0                	add    %edx,%eax
    1a3b:	01 c0                	add    %eax,%eax
    1a3d:	89 ca                	mov    %ecx,%edx
    1a3f:	29 c2                	sub    %eax,%edx
    1a41:	89 d0                	mov    %edx,%eax
    1a43:	83 c0 01             	add    $0x1,%eax
    1a46:	0f b6 c0             	movzbl %al,%eax
    1a49:	89 c7                	mov    %eax,%edi
    1a4b:	e8 30 fe ff ff       	callq  1880 <ch>
    }
    tens = tens / 10;
    1a50:	0f b7 45 fc          	movzwl -0x4(%rbp),%eax
    1a54:	0f bf d0             	movswl %ax,%edx
    1a57:	69 d2 67 66 00 00    	imul   $0x6667,%edx,%edx
    1a5d:	c1 ea 10             	shr    $0x10,%edx
    1a60:	66 c1 fa 02          	sar    $0x2,%dx
    1a64:	66 c1 f8 0f          	sar    $0xf,%ax
    1a68:	89 d1                	mov    %edx,%ecx
    1a6a:	66 29 c1             	sub    %ax,%cx
    1a6d:	89 c8                	mov    %ecx,%eax
    1a6f:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
    if (i == 0) return;
    1a73:	80 7d ff 00          	cmpb   $0x0,-0x1(%rbp)
    1a77:	74 09                	je     1a82 <Drawnum+0xa7>
    i -= 1;
    1a79:	80 6d ff 01          	subb   $0x1,-0x1(%rbp)
  }
    1a7d:	e9 76 ff ff ff       	jmpq   19f8 <Drawnum+0x1d>
    if ((num >= tens) || (i == 0)) {
      // ch(1+...) because Digits are encoded as 1..10, not 0..9
      ch((unsigned char)(1+(num / tens) % 10), size); // i==0 for single digit 0 case
    }
    tens = tens / 10;
    if (i == 0) return;
    1a82:	90                   	nop
    i -= 1;
  }
}
    1a83:	c9                   	leaveq 
    1a84:	c3                   	retq   

0000000000001a85 <Drawsmallnum>:


// DO NOT inline or turn these into macros.  Keep the code size small.
static void Drawsmallnum(short num)
{
    1a85:	55                   	push   %rbp
    1a86:	48 89 e5             	mov    %rsp,%rbp
    1a89:	48 83 ec 10          	sub    $0x10,%rsp
    1a8d:	89 f8                	mov    %edi,%eax
    1a8f:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
  Drawnum(num, 96);
    1a93:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
    1a97:	be 60 00 00 00       	mov    $0x60,%esi
    1a9c:	89 c7                	mov    %eax,%edi
    1a9e:	e8 38 ff ff ff       	callq  19db <Drawnum>
}
    1aa3:	c9                   	leaveq 
    1aa4:	c3                   	retq   

0000000000001aa5 <Drawbignum>:

static void Drawbignum(short num)
{
    1aa5:	55                   	push   %rbp
    1aa6:	48 89 e5             	mov    %rsp,%rbp
    1aa9:	48 83 ec 10          	sub    $0x10,%rsp
    1aad:	89 f8                	mov    %edi,%eax
    1aaf:	66 89 45 fc          	mov    %ax,-0x4(%rbp)
  Drawnum(num, 128);
    1ab3:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
    1ab7:	be 80 00 00 00       	mov    $0x80,%esi
    1abc:	89 c7                	mov    %eax,%edi
    1abe:	e8 18 ff ff ff       	callq  19db <Drawnum>
}
    1ac3:	c9                   	leaveq 
    1ac4:	c3                   	retq   

0000000000001ac5 <Drawbignumat>:

static void Drawbignumat(short num, short x, short y)
{
    1ac5:	55                   	push   %rbp
    1ac6:	48 89 e5             	mov    %rsp,%rbp
    1ac9:	48 83 ec 10          	sub    $0x10,%rsp
    1acd:	89 f1                	mov    %esi,%ecx
    1acf:	89 d0                	mov    %edx,%eax
    1ad1:	66 89 7d fc          	mov    %di,-0x4(%rbp)
    1ad5:	66 89 4d f8          	mov    %cx,-0x8(%rbp)
    1ad9:	66 89 45 f4          	mov    %ax,-0xc(%rbp)
  textx = x; texty = y;
    1add:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
    1ae1:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1ae8 <Drawbignumat+0x23>
    1ae8:	0f b7 45 f4          	movzwl -0xc(%rbp),%eax
    1aec:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1af3 <Drawbignumat+0x2e>
  Drawbignum(num);
    1af3:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
    1af7:	89 c7                	mov    %eax,%edi
    1af9:	e8 a7 ff ff ff       	callq  1aa5 <Drawbignum>
}
    1afe:	c9                   	leaveq 
    1aff:	c3                   	retq   

0000000000001b00 <Drawsmallnumat>:

static void Drawsmallnumat(short num, short x, short y)
{
    1b00:	55                   	push   %rbp
    1b01:	48 89 e5             	mov    %rsp,%rbp
    1b04:	48 83 ec 10          	sub    $0x10,%rsp
    1b08:	89 f1                	mov    %esi,%ecx
    1b0a:	89 d0                	mov    %edx,%eax
    1b0c:	66 89 7d fc          	mov    %di,-0x4(%rbp)
    1b10:	66 89 4d f8          	mov    %cx,-0x8(%rbp)
    1b14:	66 89 45 f4          	mov    %ax,-0xc(%rbp)
  textx = x; texty = y;
    1b18:	0f b7 45 f8          	movzwl -0x8(%rbp),%eax
    1b1c:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1b23 <Drawsmallnumat+0x23>
    1b23:	0f b7 45 f4          	movzwl -0xc(%rbp),%eax
    1b27:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1b2e <Drawsmallnumat+0x2e>
  Drawsmallnum(num);
    1b2e:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
    1b32:	89 c7                	mov    %eax,%edi
    1b34:	e8 4c ff ff ff       	callq  1a85 <Drawsmallnum>
}
    1b39:	c9                   	leaveq 
    1b3a:	c3                   	retq   

0000000000001b3b <Draw_shields_left>:

static inline void Draw_shields_left(void)
{
    1b3b:	55                   	push   %rbp
    1b3c:	48 89 e5             	mov    %rsp,%rbp
  Drawbignumat (Shields, -10, 140);
    1b3f:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1b46 <Draw_shields_left+0xb>
    1b46:	98                   	cwtl   
    1b47:	ba 8c 00 00 00       	mov    $0x8c,%edx
    1b4c:	be f6 ff ff ff       	mov    $0xfffffff6,%esi
    1b51:	89 c7                	mov    %eax,%edi
    1b53:	e8 6d ff ff ff       	callq  1ac5 <Drawbignumat>
}
    1b58:	5d                   	pop    %rbp
    1b59:	c3                   	retq   

0000000000001b5a <Draw_score>:

static inline void Draw_score(void)
{
    1b5a:	55                   	push   %rbp
    1b5b:	48 89 e5             	mov    %rsp,%rbp
  Drawbignumat (Score, -220, 130);
    1b5e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1b65 <Draw_score+0xb>
    1b65:	98                   	cwtl   
    1b66:	ba 82 00 00 00       	mov    $0x82,%edx
    1b6b:	be 24 ff ff ff       	mov    $0xffffff24,%esi
    1b70:	89 c7                	mov    %eax,%edi
    1b72:	e8 4e ff ff ff       	callq  1ac5 <Drawbignumat>
}
    1b77:	5d                   	pop    %rbp
    1b78:	c3                   	retq   

0000000000001b79 <Draw_highscore>:

static inline void Draw_highscore(void)
{
    1b79:	55                   	push   %rbp
    1b7a:	48 89 e5             	mov    %rsp,%rbp
  textx = 42;
    1b7d:	66 c7 05 00 00 00 00 	movw   $0x2a,0x0(%rip)        # 1b86 <Draw_highscore+0xd>
    1b84:	2a 00 
  texty = 130;
    1b86:	66 c7 05 00 00 00 00 	movw   $0x82,0x0(%rip)        # 1b8f <Draw_highscore+0x16>
    1b8d:	82 00 
  // HIGH_SCORE
  ch96str(HIGH_SCORE_STR96);
    1b8f:	bf 00 00 00 00       	mov    $0x0,%edi
    1b94:	e8 b1 fd ff ff       	callq  194a <ch96str>
                                                  // remember, char width is (24 * textscale) / 128
  Drawsmallnumat (HighScore, (/* WAS: 208*/204 - ((24 * 96 * (numdigits (HighScore)-1)) >> 7 /* / 128 */)), 105);
    1b99:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1ba0 <Draw_highscore+0x27>
    1ba0:	98                   	cwtl   
    1ba1:	89 c7                	mov    %eax,%edi
    1ba3:	e8 78 e9 ff ff       	callq  520 <numdigits>
    1ba8:	0f b6 c0             	movzbl %al,%eax
    1bab:	8d 50 ff             	lea    -0x1(%rax),%edx
    1bae:	89 d0                	mov    %edx,%eax
    1bb0:	c1 e0 03             	shl    $0x3,%eax
    1bb3:	01 d0                	add    %edx,%eax
    1bb5:	c1 e0 08             	shl    $0x8,%eax
    1bb8:	c1 f8 07             	sar    $0x7,%eax
    1bbb:	ba cc 00 00 00       	mov    $0xcc,%edx
    1bc0:	89 d1                	mov    %edx,%ecx
    1bc2:	66 29 c1             	sub    %ax,%cx
    1bc5:	89 c8                	mov    %ecx,%eax
    1bc7:	0f bf c8             	movswl %ax,%ecx
    1bca:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1bd1 <Draw_highscore+0x58>
    1bd1:	98                   	cwtl   
    1bd2:	ba 69 00 00 00       	mov    $0x69,%edx
    1bd7:	89 ce                	mov    %ecx,%esi
    1bd9:	89 c7                	mov    %eax,%edi
    1bdb:	e8 20 ff ff ff       	callq  1b00 <Drawsmallnumat>
}
    1be0:	5d                   	pop    %rbp
    1be1:	c3                   	retq   

0000000000001be2 <InsertCoin>:

static inline void InsertCoin(void) // Not yet used
{
    1be2:	55                   	push   %rbp
    1be3:	48 89 e5             	mov    %rsp,%rbp
  textx = -135;
    1be6:	66 c7 05 00 00 00 00 	movw   $0xff79,0x0(%rip)        # 1bef <InsertCoin+0xd>
    1bed:	79 ff 
  texty = -120;
    1bef:	66 c7 05 00 00 00 00 	movw   $0xff88,0x0(%rip)        # 1bf8 <InsertCoin+0x16>
    1bf6:	88 ff 
  setintensity(global_flashing_intensity);
    1bf8:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 1bff <InsertCoin+0x1d>
    1bff:	0f b6 c0             	movzbl %al,%eax
    1c02:	89 c7                	mov    %eax,%edi
    1c04:	e8 fa e4 ff ff       	callq  103 <setintensity>
  ch128str(INSERT_COIN_STR128);
    1c09:	bf 00 00 00 00       	mov    $0x0,%edi
    1c0e:	e8 8f fd ff ff       	callq  19a2 <ch128str>
  setintensity(110);
    1c13:	bf 6e 00 00 00       	mov    $0x6e,%edi
    1c18:	e8 e6 e4 ff ff       	callq  103 <setintensity>
}
    1c1d:	5d                   	pop    %rbp
    1c1e:	c3                   	retq   

0000000000001c1f <Draw_ShipsPassedTotal>:

static inline void Draw_ShipsPassedTotal(void) {
    1c1f:	55                   	push   %rbp
    1c20:	48 89 e5             	mov    %rsp,%rbp
  Drawbignumat (ShipsPassedTotal, 200, 130);
    1c23:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1c2a <Draw_ShipsPassedTotal+0xb>
    1c2a:	98                   	cwtl   
    1c2b:	ba 82 00 00 00       	mov    $0x82,%edx
    1c30:	be c8 00 00 00       	mov    $0xc8,%esi
    1c35:	89 c7                	mov    %eax,%edi
    1c37:	e8 89 fe ff ff       	callq  1ac5 <Drawbignumat>
}
    1c3c:	5d                   	pop    %rbp
    1c3d:	c3                   	retq   

0000000000001c3e <Press_start>:
#ifdef NEVER
  InsertCoin ();
#endif

static inline void Press_start(void)
{
    1c3e:	55                   	push   %rbp
    1c3f:	48 89 e5             	mov    %rsp,%rbp
  textx = -120;
    1c42:	66 c7 05 00 00 00 00 	movw   $0xff88,0x0(%rip)        # 1c4b <Press_start+0xd>
    1c49:	88 ff 
  texty = -10;
    1c4b:	66 c7 05 00 00 00 00 	movw   $0xfff6,0x0(%rip)        # 1c54 <Press_start+0x16>
    1c52:	f6 ff 
  setintensity(global_flashing_intensity);
    1c54:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 1c5b <Press_start+0x1d>
    1c5b:	0f b6 c0             	movzbl %al,%eax
    1c5e:	89 c7                	mov    %eax,%edi
    1c60:	e8 9e e4 ff ff       	callq  103 <setintensity>
  ch128str(PRESS_START_STR128);
    1c65:	bf 00 00 00 00       	mov    $0x0,%edi
    1c6a:	e8 33 fd ff ff       	callq  19a2 <ch128str>
  setintensity(110);
    1c6f:	bf 6e 00 00 00       	mov    $0x6e,%edi
    1c74:	e8 8a e4 ff ff       	callq  103 <setintensity>
}
    1c79:	5d                   	pop    %rbp
    1c7a:	c3                   	retq   

0000000000001c7b <Draw_credits>:

static inline void Draw_credits(void)
{
    1c7b:	55                   	push   %rbp
    1c7c:	48 89 e5             	mov    %rsp,%rbp
  textx = -100;
    1c7f:	66 c7 05 00 00 00 00 	movw   $0xff9c,0x0(%rip)        # 1c88 <Draw_credits+0xd>
    1c86:	9c ff 
  texty = -120;
    1c88:	66 c7 05 00 00 00 00 	movw   $0xff88,0x0(%rip)        # 1c91 <Draw_credits+0x16>
    1c8f:	88 ff 
  ch128str(CREDITS_STR128);
    1c91:	bf 00 00 00 00       	mov    $0x0,%edi
    1c96:	e8 07 fd ff ff       	callq  19a2 <ch128str>
  if (Credits > 9U) {
    1c9b:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 1ca2 <Draw_credits+0x27>
    1ca2:	3c 09                	cmp    $0x9,%al
    1ca4:	76 0c                	jbe    1cb2 <Draw_credits+0x37>
    ch128 (10);  // display any more than 9 as 9. (This is what many arcade machines did in real life)
    1ca6:	bf 0a 00 00 00       	mov    $0xa,%edi
    1cab:	e8 d3 fc ff ff       	callq  1983 <ch128>
    1cb0:	eb 14                	jmp    1cc6 <Draw_credits+0x4b>
  } else {
    ch128 (Credits + 1);
    1cb2:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 1cb9 <Draw_credits+0x3e>
    1cb9:	83 c0 01             	add    $0x1,%eax
    1cbc:	0f b6 c0             	movzbl %al,%eax
    1cbf:	89 c7                	mov    %eax,%edi
    1cc1:	e8 bd fc ff ff       	callq  1983 <ch128>
  }
}
    1cc6:	5d                   	pop    %rbp
    1cc7:	c3                   	retq   

0000000000001cc8 <Draw_last_game_score>:

static inline void Draw_last_game_score(void)
{
    1cc8:	55                   	push   %rbp
    1cc9:	48 89 e5             	mov    %rsp,%rbp
  textx = -220;
    1ccc:	66 c7 05 00 00 00 00 	movw   $0xff24,0x0(%rip)        # 1cd5 <Draw_last_game_score+0xd>
    1cd3:	24 ff 
  texty = 130;
    1cd5:	66 c7 05 00 00 00 00 	movw   $0x82,0x0(%rip)        # 1cde <Draw_last_game_score+0x16>
    1cdc:	82 00 
  ch96str(SCORE_STR96);
    1cde:	bf 00 00 00 00       	mov    $0x0,%edi
    1ce3:	e8 62 fc ff ff       	callq  194a <ch96str>
  Drawsmallnumat (LastScore, -220, 105);
    1ce8:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1cef <Draw_last_game_score+0x27>
    1cef:	98                   	cwtl   
    1cf0:	ba 69 00 00 00       	mov    $0x69,%edx
    1cf5:	be 24 ff ff ff       	mov    $0xffffff24,%esi
    1cfa:	89 c7                	mov    %eax,%edi
    1cfc:	e8 ff fd ff ff       	callq  1b00 <Drawsmallnumat>
}
    1d01:	5d                   	pop    %rbp
    1d02:	c3                   	retq   

0000000000001d03 <Shield>:

static inline void Shield(void)
{
    1d03:	55                   	push   %rbp
    1d04:	48 89 e5             	mov    %rsp,%rbp
  if (shieldsubticksleft == 0) {
    1d07:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1d0e <Shield+0xb>
    1d0e:	66 85 c0             	test   %ax,%ax
    1d11:	75 38                	jne    1d4b <Shield+0x48>
    startAsyncSound(SOUND_SHIELD);
    1d13:	bf 04 00 00 00       	mov    $0x4,%edi
    1d18:	b8 00 00 00 00       	mov    $0x0,%eax
    1d1d:	e8 00 00 00 00       	callq  1d22 <Shield+0x1f>
      // Start sound only when shields start and repeat after appropriate delay
      // rather than multiple overlapping sounds that start on each frame tick!
    shieldsubticksleft = div_int_by_int_returning_fp2_14(10, 3);
    1d22:	be 03 00 00 00       	mov    $0x3,%esi
    1d27:	bf 0a 00 00 00       	mov    $0xa,%edi
    1d2c:	e8 3d e9 ff ff       	callq  66e <div_int_by_int_returning_fp2_14>
    1d31:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1d38 <Shield+0x35>
                         // was fp2_14_ceiling ((0.1 / 0.03333)); - real numbers not needed here anyway.  recode the timing stuff.
                         // substitute the actual constant?
    Shields -= 1;
    1d38:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1d3f <Shield+0x3c>
    1d3f:	83 e8 01             	sub    $0x1,%eax
    1d42:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1d49 <Shield+0x46>
    1d49:	eb 11                	jmp    1d5c <Shield+0x59>
  } else {
    shieldsubticksleft -= 1;
    1d4b:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1d52 <Shield+0x4f>
    1d52:	83 e8 01             	sub    $0x1,%eax
    1d55:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1d5c <Shield+0x59>
  }
  draw_shields();
    1d5c:	e8 74 f1 ff ff       	callq  ed5 <draw_shields>
}
    1d61:	5d                   	pop    %rbp
    1d62:	c3                   	retq   

0000000000001d63 <Get_ship_pos>:
  }
}
#endif

static void Get_ship_pos(unsigned char id)
{
    1d63:	55                   	push   %rbp
    1d64:	48 89 e5             	mov    %rsp,%rbp
    1d67:	89 f8                	mov    %edi,%eax
    1d69:	88 45 fc             	mov    %al,-0x4(%rbp)
  // can optimise by setting int idx = ((id * SHIP_RECORD_LENGTH) + SHIP_X)
  // and using ++idx twice
  // at some point it looks like I was moving from using this_X to this_X_Pos etc
  this_X = ships[((id * SHIP_RECORD_LENGTH) + SHIP_X)];
    1d6c:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    1d70:	01 c0                	add    %eax,%eax
    1d72:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    1d79:	89 d1                	mov    %edx,%ecx
    1d7b:	29 c1                	sub    %eax,%ecx
    1d7d:	89 c8                	mov    %ecx,%eax
    1d7f:	83 c0 01             	add    $0x1,%eax
    1d82:	89 c0                	mov    %eax,%eax
    1d84:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    1d8b:	00 
    1d8c:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1d93 <Get_ship_pos+0x30>
  this_Y = ships[((id * SHIP_RECORD_LENGTH) + SHIP_Y)];
    1d93:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    1d97:	01 c0                	add    %eax,%eax
    1d99:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    1da0:	89 d1                	mov    %edx,%ecx
    1da2:	29 c1                	sub    %eax,%ecx
    1da4:	89 c8                	mov    %ecx,%eax
    1da6:	83 c0 02             	add    $0x2,%eax
    1da9:	89 c0                	mov    %eax,%eax
    1dab:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    1db2:	00 
    1db3:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1dba <Get_ship_pos+0x57>
  this_Z = ships[((id * SHIP_RECORD_LENGTH) + SHIP_Z)];
    1dba:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    1dbe:	01 c0                	add    %eax,%eax
    1dc0:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    1dc7:	89 d1                	mov    %edx,%ecx
    1dc9:	29 c1                	sub    %eax,%ecx
    1dcb:	89 c8                	mov    %ecx,%eax
    1dcd:	83 c0 03             	add    $0x3,%eax
    1dd0:	89 c0                	mov    %eax,%eax
    1dd2:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    1dd9:	00 
    1dda:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1de1 <Get_ship_pos+0x7e>
}
    1de1:	5d                   	pop    %rbp
    1de2:	c3                   	retq   

0000000000001de3 <Get_ship_scale>:

static void Get_ship_scale(unsigned char id)
{
    1de3:	55                   	push   %rbp
    1de4:	48 89 e5             	mov    %rsp,%rbp
    1de7:	89 f8                	mov    %edi,%eax
    1de9:	88 45 fc             	mov    %al,-0x4(%rbp)
  this_scale_fp = ships[((id * SHIP_RECORD_LENGTH) + SHIP_SCALE_FP)];
    1dec:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    1df0:	01 c0                	add    %eax,%eax
    1df2:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    1df9:	89 d1                	mov    %edx,%ecx
    1dfb:	29 c1                	sub    %eax,%ecx
    1dfd:	89 c8                	mov    %ecx,%eax
    1dff:	83 c0 07             	add    $0x7,%eax
    1e02:	89 c0                	mov    %eax,%eax
    1e04:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    1e0b:	00 
    1e0c:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1e13 <Get_ship_scale+0x30>
}
    1e13:	5d                   	pop    %rbp
    1e14:	c3                   	retq   

0000000000001e15 <Get_ship_status>:

static void Get_ship_status(unsigned char id)
{
    1e15:	55                   	push   %rbp
    1e16:	48 89 e5             	mov    %rsp,%rbp
    1e19:	89 f8                	mov    %edi,%eax
    1e1b:	88 45 fc             	mov    %al,-0x4(%rbp)
  this_status = (unsigned char)ships[((id * SHIP_RECORD_LENGTH) + SHIP_STATUS)];
    1e1e:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    1e22:	01 c0                	add    %eax,%eax
    1e24:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    1e2b:	89 d1                	mov    %edx,%ecx
    1e2d:	29 c1                	sub    %eax,%ecx
    1e2f:	89 c8                	mov    %ecx,%eax
    1e31:	83 c0 0d             	add    $0xd,%eax
    1e34:	89 c0                	mov    %eax,%eax
    1e36:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    1e3d:	00 
    1e3e:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 1e44 <Get_ship_status+0x2f>
}
    1e44:	5d                   	pop    %rbp
    1e45:	c3                   	retq   

0000000000001e46 <Get_screenpos>:
static short screen_y;

// inline this for speed rather than size?  (Since 6809 parameter passing
// has quite a high overhead...)
static void Get_screenpos(short x, short y, short z)
{
    1e46:	55                   	push   %rbp
    1e47:	48 89 e5             	mov    %rsp,%rbp
    1e4a:	89 f1                	mov    %esi,%ecx
    1e4c:	89 d0                	mov    %edx,%eax
    1e4e:	66 89 7d fc          	mov    %di,-0x4(%rbp)
    1e52:	66 89 4d f8          	mov    %cx,-0x8(%rbp)
    1e56:	66 89 45 f4          	mov    %ax,-0xc(%rbp)
  screen_x = (FOCAL_LENGTH * x) / z; screen_y = (FOCAL_LENGTH * y) / z;
    1e5a:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
    1e5e:	c1 e0 0a             	shl    $0xa,%eax
    1e61:	0f bf 55 f4          	movswl -0xc(%rbp),%edx
    1e65:	89 55 f0             	mov    %edx,-0x10(%rbp)
    1e68:	89 c2                	mov    %eax,%edx
    1e6a:	c1 fa 1f             	sar    $0x1f,%edx
    1e6d:	f7 7d f0             	idivl  -0x10(%rbp)
    1e70:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1e77 <Get_screenpos+0x31>
    1e77:	0f bf 45 f8          	movswl -0x8(%rbp),%eax
    1e7b:	c1 e0 0a             	shl    $0xa,%eax
    1e7e:	0f bf 55 f4          	movswl -0xc(%rbp),%edx
    1e82:	89 55 f0             	mov    %edx,-0x10(%rbp)
    1e85:	89 c2                	mov    %eax,%edx
    1e87:	c1 fa 1f             	sar    $0x1f,%edx
    1e8a:	f7 7d f0             	idivl  -0x10(%rbp)
    1e8d:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1e94 <Get_screenpos+0x4e>
  // Wait - is this a bug?  Shouldn't it be:
  //   screen_x = (FOCAL_LENGTH * x) / (FOCAL_LENGTH + z);
  //   screen_y = (FOCAL_LENGTH * y) / (FOCAL_LENGTH + z);
  // If there is a problem with hit detection when the game is working,
  // this should be the first place to check...
}
    1e94:	5d                   	pop    %rbp
    1e95:	c3                   	retq   

0000000000001e96 <Set_ship_status>:

static void Set_ship_status(unsigned char id, unsigned char NewStatus)
{
    1e96:	55                   	push   %rbp
    1e97:	48 89 e5             	mov    %rsp,%rbp
    1e9a:	89 fa                	mov    %edi,%edx
    1e9c:	89 f0                	mov    %esi,%eax
    1e9e:	88 55 fc             	mov    %dl,-0x4(%rbp)
    1ea1:	88 45 f8             	mov    %al,-0x8(%rbp)
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_STATUS)] = NewStatus;
    1ea4:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    1ea8:	01 c0                	add    %eax,%eax
    1eaa:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    1eb1:	89 d1                	mov    %edx,%ecx
    1eb3:	29 c1                	sub    %eax,%ecx
    1eb5:	89 c8                	mov    %ecx,%eax
    1eb7:	83 c0 0d             	add    $0xd,%eax
    1eba:	0f b6 55 f8          	movzbl -0x8(%rbp),%edx
    1ebe:	89 c0                	mov    %eax,%eax
    1ec0:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    1ec7:	00 
}
    1ec8:	5d                   	pop    %rbp
    1ec9:	c3                   	retq   

0000000000001eca <Transform_point>:
    this_ += 1;
  }
}

static void Transform_point(short x, short y, short z)
{
    1eca:	55                   	push   %rbp
    1ecb:	48 89 e5             	mov    %rsp,%rbp
    1ece:	53                   	push   %rbx
    1ecf:	48 83 ec 10          	sub    $0x10,%rsp
    1ed3:	89 f1                	mov    %esi,%ecx
    1ed5:	89 d0                	mov    %edx,%eax
    1ed7:	66 89 7d f4          	mov    %di,-0xc(%rbp)
    1edb:	66 89 4d f0          	mov    %cx,-0x10(%rbp)
    1edf:	66 89 45 ec          	mov    %ax,-0x14(%rbp)
  // mul_short_by_fp2_14_returning_short
  XY = (mul_short_by_fp2_14_returning_short(y, cosX) - mul_short_by_fp2_14_returning_short(z, sinX));
    1ee3:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1eea <Transform_point+0x20>
    1eea:	0f bf d0             	movswl %ax,%edx
    1eed:	0f bf 45 f0          	movswl -0x10(%rbp),%eax
    1ef1:	89 d6                	mov    %edx,%esi
    1ef3:	89 c7                	mov    %eax,%edi
    1ef5:	e8 ff e6 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    1efa:	89 c3                	mov    %eax,%ebx
    1efc:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1f03 <Transform_point+0x39>
    1f03:	0f bf d0             	movswl %ax,%edx
    1f06:	0f bf 45 ec          	movswl -0x14(%rbp),%eax
    1f0a:	89 d6                	mov    %edx,%esi
    1f0c:	89 c7                	mov    %eax,%edi
    1f0e:	e8 e6 e6 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    1f13:	89 da                	mov    %ebx,%edx
    1f15:	66 29 c2             	sub    %ax,%dx
    1f18:	89 d0                	mov    %edx,%eax
    1f1a:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1f21 <Transform_point+0x57>
  XZ = (mul_short_by_fp2_14_returning_short(y, sinX) + mul_short_by_fp2_14_returning_short(z, cosX));
    1f21:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1f28 <Transform_point+0x5e>
    1f28:	0f bf d0             	movswl %ax,%edx
    1f2b:	0f bf 45 f0          	movswl -0x10(%rbp),%eax
    1f2f:	89 d6                	mov    %edx,%esi
    1f31:	89 c7                	mov    %eax,%edi
    1f33:	e8 c1 e6 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    1f38:	89 c3                	mov    %eax,%ebx
    1f3a:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1f41 <Transform_point+0x77>
    1f41:	0f bf d0             	movswl %ax,%edx
    1f44:	0f bf 45 ec          	movswl -0x14(%rbp),%eax
    1f48:	89 d6                	mov    %edx,%esi
    1f4a:	89 c7                	mov    %eax,%edi
    1f4c:	e8 a8 e6 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    1f51:	01 d8                	add    %ebx,%eax
    1f53:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1f5a <Transform_point+0x90>
  transformed_Z = (mul_short_by_fp2_14_returning_short(XZ, cosY) - mul_short_by_fp2_14_returning_short(x, sinY));
    1f5a:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1f61 <Transform_point+0x97>
    1f61:	0f bf d0             	movswl %ax,%edx
    1f64:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1f6b <Transform_point+0xa1>
    1f6b:	98                   	cwtl   
    1f6c:	89 d6                	mov    %edx,%esi
    1f6e:	89 c7                	mov    %eax,%edi
    1f70:	e8 84 e6 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    1f75:	89 c3                	mov    %eax,%ebx
    1f77:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1f7e <Transform_point+0xb4>
    1f7e:	0f bf d0             	movswl %ax,%edx
    1f81:	0f bf 45 f4          	movswl -0xc(%rbp),%eax
    1f85:	89 d6                	mov    %edx,%esi
    1f87:	89 c7                	mov    %eax,%edi
    1f89:	e8 6b e6 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    1f8e:	89 da                	mov    %ebx,%edx
    1f90:	66 29 c2             	sub    %ax,%dx
    1f93:	89 d0                	mov    %edx,%eax
    1f95:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1f9c <Transform_point+0xd2>
  YX = (mul_short_by_fp2_14_returning_short(XZ, sinY) + mul_short_by_fp2_14_returning_short(x, cosY));
    1f9c:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1fa3 <Transform_point+0xd9>
    1fa3:	0f bf d0             	movswl %ax,%edx
    1fa6:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1fad <Transform_point+0xe3>
    1fad:	98                   	cwtl   
    1fae:	89 d6                	mov    %edx,%esi
    1fb0:	89 c7                	mov    %eax,%edi
    1fb2:	e8 42 e6 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    1fb7:	89 c3                	mov    %eax,%ebx
    1fb9:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1fc0 <Transform_point+0xf6>
    1fc0:	0f bf d0             	movswl %ax,%edx
    1fc3:	0f bf 45 f4          	movswl -0xc(%rbp),%eax
    1fc7:	89 d6                	mov    %edx,%esi
    1fc9:	89 c7                	mov    %eax,%edi
    1fcb:	e8 29 e6 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    1fd0:	01 d8                	add    %ebx,%eax
    1fd2:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 1fd9 <Transform_point+0x10f>
  transformed_X = (mul_short_by_fp2_14_returning_short(YX, cosZ) - mul_short_by_fp2_14_returning_short(XY, sinZ));
    1fd9:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1fe0 <Transform_point+0x116>
    1fe0:	0f bf d0             	movswl %ax,%edx
    1fe3:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1fea <Transform_point+0x120>
    1fea:	98                   	cwtl   
    1feb:	89 d6                	mov    %edx,%esi
    1fed:	89 c7                	mov    %eax,%edi
    1fef:	e8 05 e6 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    1ff4:	89 c3                	mov    %eax,%ebx
    1ff6:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 1ffd <Transform_point+0x133>
    1ffd:	0f bf d0             	movswl %ax,%edx
    2000:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2007 <Transform_point+0x13d>
    2007:	98                   	cwtl   
    2008:	89 d6                	mov    %edx,%esi
    200a:	89 c7                	mov    %eax,%edi
    200c:	e8 e8 e5 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    2011:	89 da                	mov    %ebx,%edx
    2013:	66 29 c2             	sub    %ax,%dx
    2016:	89 d0                	mov    %edx,%eax
    2018:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 201f <Transform_point+0x155>
  transformed_Y = (mul_short_by_fp2_14_returning_short(YX, sinZ) + mul_short_by_fp2_14_returning_short(XY, cosZ));
    201f:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2026 <Transform_point+0x15c>
    2026:	0f bf d0             	movswl %ax,%edx
    2029:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2030 <Transform_point+0x166>
    2030:	98                   	cwtl   
    2031:	89 d6                	mov    %edx,%esi
    2033:	89 c7                	mov    %eax,%edi
    2035:	e8 bf e5 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    203a:	89 c3                	mov    %eax,%ebx
    203c:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2043 <Transform_point+0x179>
    2043:	0f bf d0             	movswl %ax,%edx
    2046:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 204d <Transform_point+0x183>
    204d:	98                   	cwtl   
    204e:	89 d6                	mov    %edx,%esi
    2050:	89 c7                	mov    %eax,%edi
    2052:	e8 a2 e5 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    2057:	01 d8                	add    %ebx,%eax
    2059:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2060 <Transform_point+0x196>
}
    2060:	48 83 c4 10          	add    $0x10,%rsp
    2064:	5b                   	pop    %rbx
    2065:	5d                   	pop    %rbp
    2066:	c3                   	retq   

0000000000002067 <Change_ship_pos_by>:

static inline void Change_ship_pos_by(unsigned char id, short dx, short dy, short dz)
{
    2067:	55                   	push   %rbp
    2068:	48 89 e5             	mov    %rsp,%rbp
    206b:	53                   	push   %rbx
    206c:	89 c8                	mov    %ecx,%eax
    206e:	40 88 7d f4          	mov    %dil,-0xc(%rbp)
    2072:	66 89 75 f0          	mov    %si,-0x10(%rbp)
    2076:	66 89 55 ec          	mov    %dx,-0x14(%rbp)
    207a:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
#ifdef OPENGL_DEBUGGING
  fprintf(stderr, "ship[%d] += (%d,%d,%d)\n", id, dx,dy,dz);
#endif
  // can optimise with an index and increments
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_X)] += dx;
    207e:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    2082:	01 c0                	add    %eax,%eax
    2084:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    208b:	89 d1                	mov    %edx,%ecx
    208d:	29 c1                	sub    %eax,%ecx
    208f:	89 c8                	mov    %ecx,%eax
    2091:	8d 48 01             	lea    0x1(%rax),%ecx
    2094:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    2098:	01 c0                	add    %eax,%eax
    209a:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    20a1:	89 d3                	mov    %edx,%ebx
    20a3:	29 c3                	sub    %eax,%ebx
    20a5:	89 d8                	mov    %ebx,%eax
    20a7:	83 c0 01             	add    $0x1,%eax
    20aa:	89 c0                	mov    %eax,%eax
    20ac:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    20b3:	00 
    20b4:	89 c2                	mov    %eax,%edx
    20b6:	0f b7 45 f0          	movzwl -0x10(%rbp),%eax
    20ba:	01 d0                	add    %edx,%eax
    20bc:	89 c2                	mov    %eax,%edx
    20be:	89 c8                	mov    %ecx,%eax
    20c0:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    20c7:	00 
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_Y)] += dy;
    20c8:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    20cc:	01 c0                	add    %eax,%eax
    20ce:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    20d5:	89 d1                	mov    %edx,%ecx
    20d7:	29 c1                	sub    %eax,%ecx
    20d9:	89 c8                	mov    %ecx,%eax
    20db:	8d 48 02             	lea    0x2(%rax),%ecx
    20de:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    20e2:	01 c0                	add    %eax,%eax
    20e4:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    20eb:	89 d3                	mov    %edx,%ebx
    20ed:	29 c3                	sub    %eax,%ebx
    20ef:	89 d8                	mov    %ebx,%eax
    20f1:	83 c0 02             	add    $0x2,%eax
    20f4:	89 c0                	mov    %eax,%eax
    20f6:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    20fd:	00 
    20fe:	89 c2                	mov    %eax,%edx
    2100:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
    2104:	01 d0                	add    %edx,%eax
    2106:	89 c2                	mov    %eax,%edx
    2108:	89 c8                	mov    %ecx,%eax
    210a:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    2111:	00 
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_Z)] += dz;
    2112:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    2116:	01 c0                	add    %eax,%eax
    2118:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    211f:	89 d1                	mov    %edx,%ecx
    2121:	29 c1                	sub    %eax,%ecx
    2123:	89 c8                	mov    %ecx,%eax
    2125:	8d 48 03             	lea    0x3(%rax),%ecx
    2128:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    212c:	01 c0                	add    %eax,%eax
    212e:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    2135:	89 d3                	mov    %edx,%ebx
    2137:	29 c3                	sub    %eax,%ebx
    2139:	89 d8                	mov    %ebx,%eax
    213b:	83 c0 03             	add    $0x3,%eax
    213e:	89 c0                	mov    %eax,%eax
    2140:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    2147:	00 
    2148:	89 c2                	mov    %eax,%edx
    214a:	0f b7 45 e8          	movzwl -0x18(%rbp),%eax
    214e:	01 d0                	add    %edx,%eax
    2150:	89 c2                	mov    %eax,%edx
    2152:	89 c8                	mov    %ecx,%eax
    2154:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    215b:	00 
}
    215c:	5b                   	pop    %rbx
    215d:	5d                   	pop    %rbp
    215e:	c3                   	retq   

000000000000215f <Change_ship_rotation_by>:

static inline void Change_ship_rotation_by(unsigned char id, short X_rotation, short Y_rotation, short Z_rotation)
{
    215f:	55                   	push   %rbp
    2160:	48 89 e5             	mov    %rsp,%rbp
    2163:	53                   	push   %rbx
    2164:	89 c8                	mov    %ecx,%eax
    2166:	40 88 7d f4          	mov    %dil,-0xc(%rbp)
    216a:	66 89 75 f0          	mov    %si,-0x10(%rbp)
    216e:	66 89 55 ec          	mov    %dx,-0x14(%rbp)
    2172:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
  // can optimise with an index and increments
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_X_ROTATION)] += X_rotation;
    2176:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    217a:	01 c0                	add    %eax,%eax
    217c:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    2183:	89 d1                	mov    %edx,%ecx
    2185:	29 c1                	sub    %eax,%ecx
    2187:	89 c8                	mov    %ecx,%eax
    2189:	8d 48 04             	lea    0x4(%rax),%ecx
    218c:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    2190:	01 c0                	add    %eax,%eax
    2192:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    2199:	89 d3                	mov    %edx,%ebx
    219b:	29 c3                	sub    %eax,%ebx
    219d:	89 d8                	mov    %ebx,%eax
    219f:	83 c0 04             	add    $0x4,%eax
    21a2:	89 c0                	mov    %eax,%eax
    21a4:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    21ab:	00 
    21ac:	89 c2                	mov    %eax,%edx
    21ae:	0f b7 45 f0          	movzwl -0x10(%rbp),%eax
    21b2:	01 d0                	add    %edx,%eax
    21b4:	89 c2                	mov    %eax,%edx
    21b6:	89 c8                	mov    %ecx,%eax
    21b8:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    21bf:	00 
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_Y_ROTATION)] += Y_rotation;
    21c0:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    21c4:	01 c0                	add    %eax,%eax
    21c6:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    21cd:	89 d1                	mov    %edx,%ecx
    21cf:	29 c1                	sub    %eax,%ecx
    21d1:	89 c8                	mov    %ecx,%eax
    21d3:	8d 48 05             	lea    0x5(%rax),%ecx
    21d6:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    21da:	01 c0                	add    %eax,%eax
    21dc:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    21e3:	89 d3                	mov    %edx,%ebx
    21e5:	29 c3                	sub    %eax,%ebx
    21e7:	89 d8                	mov    %ebx,%eax
    21e9:	83 c0 05             	add    $0x5,%eax
    21ec:	89 c0                	mov    %eax,%eax
    21ee:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    21f5:	00 
    21f6:	89 c2                	mov    %eax,%edx
    21f8:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
    21fc:	01 d0                	add    %edx,%eax
    21fe:	89 c2                	mov    %eax,%edx
    2200:	89 c8                	mov    %ecx,%eax
    2202:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    2209:	00 
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_Z_ROTATION)] += Z_rotation;
    220a:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    220e:	01 c0                	add    %eax,%eax
    2210:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    2217:	89 d1                	mov    %edx,%ecx
    2219:	29 c1                	sub    %eax,%ecx
    221b:	89 c8                	mov    %ecx,%eax
    221d:	8d 48 06             	lea    0x6(%rax),%ecx
    2220:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    2224:	01 c0                	add    %eax,%eax
    2226:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    222d:	89 d3                	mov    %edx,%ebx
    222f:	29 c3                	sub    %eax,%ebx
    2231:	89 d8                	mov    %ebx,%eax
    2233:	83 c0 06             	add    $0x6,%eax
    2236:	89 c0                	mov    %eax,%eax
    2238:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    223f:	00 
    2240:	89 c2                	mov    %eax,%edx
    2242:	0f b7 45 e8          	movzwl -0x18(%rbp),%eax
    2246:	01 d0                	add    %edx,%eax
    2248:	89 c2                	mov    %eax,%edx
    224a:	89 c8                	mov    %ecx,%eax
    224c:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    2253:	00 
}
    2254:	5b                   	pop    %rbx
    2255:	5d                   	pop    %rbp
    2256:	c3                   	retq   

0000000000002257 <Get_ship_rotation>:

static inline void Get_ship_rotation(unsigned char id)
{
    2257:	55                   	push   %rbp
    2258:	48 89 e5             	mov    %rsp,%rbp
    225b:	89 f8                	mov    %edi,%eax
    225d:	88 45 fc             	mov    %al,-0x4(%rbp)
  // can optimise with an index and increments
  this_X_rotation = ships[((id * SHIP_RECORD_LENGTH) + SHIP_X_ROTATION)];
    2260:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    2264:	01 c0                	add    %eax,%eax
    2266:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    226d:	89 d1                	mov    %edx,%ecx
    226f:	29 c1                	sub    %eax,%ecx
    2271:	89 c8                	mov    %ecx,%eax
    2273:	83 c0 04             	add    $0x4,%eax
    2276:	89 c0                	mov    %eax,%eax
    2278:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    227f:	00 
    2280:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2287 <Get_ship_rotation+0x30>
  this_Y_rotation = ships[((id * SHIP_RECORD_LENGTH) + SHIP_Y_ROTATION)];
    2287:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    228b:	01 c0                	add    %eax,%eax
    228d:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    2294:	89 d1                	mov    %edx,%ecx
    2296:	29 c1                	sub    %eax,%ecx
    2298:	89 c8                	mov    %ecx,%eax
    229a:	83 c0 05             	add    $0x5,%eax
    229d:	89 c0                	mov    %eax,%eax
    229f:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    22a6:	00 
    22a7:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 22ae <Get_ship_rotation+0x57>
  this_Z_rotation = ships[((id * SHIP_RECORD_LENGTH) + SHIP_Z_ROTATION)];
    22ae:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    22b2:	01 c0                	add    %eax,%eax
    22b4:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    22bb:	89 d1                	mov    %edx,%ecx
    22bd:	29 c1                	sub    %eax,%ecx
    22bf:	89 c8                	mov    %ecx,%eax
    22c1:	83 c0 06             	add    $0x6,%eax
    22c4:	89 c0                	mov    %eax,%eax
    22c6:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    22cd:	00 
    22ce:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 22d5 <Get_ship_rotation+0x7e>
}
    22d5:	5d                   	pop    %rbp
    22d6:	c3                   	retq   

00000000000022d7 <Get_ship_time>:

static void Get_ship_time(unsigned char id) // called twice so don't inline currently
{
    22d7:	55                   	push   %rbp
    22d8:	48 89 e5             	mov    %rsp,%rbp
    22db:	89 f8                	mov    %edi,%eax
    22dd:	88 45 fc             	mov    %al,-0x4(%rbp)
  this_ship_time = ships[((id * SHIP_RECORD_LENGTH) + SHIP_TIME)];
    22e0:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    22e4:	01 c0                	add    %eax,%eax
    22e6:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    22ed:	89 d1                	mov    %edx,%ecx
    22ef:	29 c1                	sub    %eax,%ecx
    22f1:	89 c8                	mov    %ecx,%eax
    22f3:	83 c0 09             	add    $0x9,%eax
    22f6:	89 c0                	mov    %eax,%eax
    22f8:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    22ff:	00 
    2300:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2307 <Get_ship_time+0x30>
}
    2307:	5d                   	pop    %rbp
    2308:	c3                   	retq   

0000000000002309 <Get_ship_destination>:

static void Get_ship_destination(unsigned char id)
{
    2309:	55                   	push   %rbp
    230a:	48 89 e5             	mov    %rsp,%rbp
    230d:	89 f8                	mov    %edi,%eax
    230f:	88 45 fc             	mov    %al,-0x4(%rbp)
  // can optimise with an index and increments
  // I DO NOT KNOW WHY this_X ETC IS ASSIGNED HERE!
  /*this_X =*/ this_X_destination = ships[((id * SHIP_RECORD_LENGTH) + SHIP_TARGET_X)];
    2312:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    2316:	01 c0                	add    %eax,%eax
    2318:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    231f:	89 d1                	mov    %edx,%ecx
    2321:	29 c1                	sub    %eax,%ecx
    2323:	89 c8                	mov    %ecx,%eax
    2325:	83 c0 0a             	add    $0xa,%eax
    2328:	89 c0                	mov    %eax,%eax
    232a:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    2331:	00 
    2332:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2339 <Get_ship_destination+0x30>
  /*this_Y =*/ this_Y_destination = ships[((id * SHIP_RECORD_LENGTH) + SHIP_TARGET_Y)];
    2339:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    233d:	01 c0                	add    %eax,%eax
    233f:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    2346:	89 d1                	mov    %edx,%ecx
    2348:	29 c1                	sub    %eax,%ecx
    234a:	89 c8                	mov    %ecx,%eax
    234c:	83 c0 0b             	add    $0xb,%eax
    234f:	89 c0                	mov    %eax,%eax
    2351:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    2358:	00 
    2359:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2360 <Get_ship_destination+0x57>
  /*this_Z =*/ this_Z_destination = ships[((id * SHIP_RECORD_LENGTH) + SHIP_TARGET_Z)];
    2360:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    2364:	01 c0                	add    %eax,%eax
    2366:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    236d:	89 d1                	mov    %edx,%ecx
    236f:	29 c1                	sub    %eax,%ecx
    2371:	89 c8                	mov    %ecx,%eax
    2373:	83 c0 0c             	add    $0xc,%eax
    2376:	89 c0                	mov    %eax,%eax
    2378:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    237f:	00 
    2380:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2387 <Get_ship_destination+0x7e>
}
    2387:	5d                   	pop    %rbp
    2388:	c3                   	retq   

0000000000002389 <Change_ship_velocity_by>:

static inline void Change_ship_velocity_by(unsigned char id, fp2_14 accel) // accel is broken.  It might work better as a scaling factor rather than a delta-V
{
    2389:	55                   	push   %rbp
    238a:	48 89 e5             	mov    %rsp,%rbp
    238d:	89 fa                	mov    %edi,%edx
    238f:	89 f0                	mov    %esi,%eax
    2391:	88 55 ec             	mov    %dl,-0x14(%rbp)
    2394:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
  // save index and reuse
  short this_speed = (id * SHIP_RECORD_LENGTH) + SHIP_SPEED;
    2398:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    239c:	01 c0                	add    %eax,%eax
    239e:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    23a5:	89 d1                	mov    %edx,%ecx
    23a7:	66 29 c1             	sub    %ax,%cx
    23aa:	89 c8                	mov    %ecx,%eax
    23ac:	83 c0 08             	add    $0x8,%eax
    23af:	66 89 45 fe          	mov    %ax,-0x2(%rbp)
  // TO DO: NO ACCELERATION FOR NOW!!!   ships[this_speed] += accel;
  // fp is in a restricted range 2.0 <= fp <= -2.0 at best.  So cannot add to an int - even if
  // implemented correctly, the fp value would truncate down to 0.  A possible solution
  // would be to multiply by something like 1.05 or 0.95 rather than adding a fixed value
  if (ships[this_speed] > SHIP_MAXVEL) ships[this_speed] = SHIP_MAXVEL;
    23b3:	0f bf 45 fe          	movswl -0x2(%rbp),%eax
    23b7:	48 98                	cltq   
    23b9:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    23c0:	00 
    23c1:	66 83 f8 14          	cmp    $0x14,%ax
    23c5:	7e 10                	jle    23d7 <Change_ship_velocity_by+0x4e>
    23c7:	0f bf 45 fe          	movswl -0x2(%rbp),%eax
    23cb:	48 98                	cltq   
    23cd:	66 c7 84 00 00 00 00 	movw   $0x14,0x0(%rax,%rax,1)
    23d4:	00 14 00 
}
    23d7:	5d                   	pop    %rbp
    23d8:	c3                   	retq   

00000000000023d9 <Set_rotation_vars>:

static inline void Set_rotation_vars(short Xrot, short Yrot, short Zrot)
{
    23d9:	55                   	push   %rbp
    23da:	48 89 e5             	mov    %rsp,%rbp
    23dd:	48 83 ec 10          	sub    $0x10,%rsp
    23e1:	89 f1                	mov    %esi,%ecx
    23e3:	89 d0                	mov    %edx,%eax
    23e5:	66 89 7d fc          	mov    %di,-0x4(%rbp)
    23e9:	66 89 4d f8          	mov    %cx,-0x8(%rbp)
    23ed:	66 89 45 f4          	mov    %ax,-0xc(%rbp)
  sinX = fp2_14_sin (Xrot);
    23f1:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
    23f5:	89 c7                	mov    %eax,%edi
    23f7:	e8 a0 e1 ff ff       	callq  59c <fp2_14_sin>
    23fc:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2403 <Set_rotation_vars+0x2a>
  cosX = fp2_14_cos (Xrot);
    2403:	0f bf 45 fc          	movswl -0x4(%rbp),%eax
    2407:	89 c7                	mov    %eax,%edi
    2409:	e8 cc e1 ff ff       	callq  5da <fp2_14_cos>
    240e:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2415 <Set_rotation_vars+0x3c>
  sinY = fp2_14_sin (Yrot);
    2415:	0f bf 45 f8          	movswl -0x8(%rbp),%eax
    2419:	89 c7                	mov    %eax,%edi
    241b:	e8 7c e1 ff ff       	callq  59c <fp2_14_sin>
    2420:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2427 <Set_rotation_vars+0x4e>
  cosY = fp2_14_cos (Yrot);
    2427:	0f bf 45 f8          	movswl -0x8(%rbp),%eax
    242b:	89 c7                	mov    %eax,%edi
    242d:	e8 a8 e1 ff ff       	callq  5da <fp2_14_cos>
    2432:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2439 <Set_rotation_vars+0x60>
  sinZ = fp2_14_sin (Zrot);
    2439:	0f bf 45 f4          	movswl -0xc(%rbp),%eax
    243d:	89 c7                	mov    %eax,%edi
    243f:	e8 58 e1 ff ff       	callq  59c <fp2_14_sin>
    2444:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 244b <Set_rotation_vars+0x72>
  cosZ = fp2_14_cos (Zrot);
    244b:	0f bf 45 f4          	movswl -0xc(%rbp),%eax
    244f:	89 c7                	mov    %eax,%edi
    2451:	e8 84 e1 ff ff       	callq  5da <fp2_14_cos>
    2456:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 245d <Set_rotation_vars+0x84>
}
    245d:	c9                   	leaveq 
    245e:	c3                   	retq   

000000000000245f <Draw_ship_at_rotated_scale>:
// This is never called with a ship id.  The id has been determined by the caller and all the 'this_*' variables
// set up in place already.  I.e. this code does not need to check the ship status to see if it is dead or alive
// - we know it is alive.

static inline void Draw_ship_at_rotated_scale(unsigned char model, short x, short y, short z, short Xrot, short Yrot, short Zrot, short scale_fp)
{
    245f:	55                   	push   %rbp
    2460:	48 89 e5             	mov    %rsp,%rbp
    2463:	41 54                	push   %r12
    2465:	53                   	push   %rbx
    2466:	48 83 ec 30          	sub    $0x30,%rsp
    246a:	89 c8                	mov    %ecx,%eax
    246c:	45 89 c2             	mov    %r8d,%r10d
    246f:	44 8b 45 10          	mov    0x10(%rbp),%r8d
    2473:	8b 4d 18             	mov    0x18(%rbp),%ecx
    2476:	40 88 7d dc          	mov    %dil,-0x24(%rbp)
    247a:	66 89 75 d8          	mov    %si,-0x28(%rbp)
    247e:	66 89 55 d4          	mov    %dx,-0x2c(%rbp)
    2482:	66 89 45 d0          	mov    %ax,-0x30(%rbp)
    2486:	66 44 89 55 cc       	mov    %r10w,-0x34(%rbp)
    248b:	66 44 89 4d c8       	mov    %r9w,-0x38(%rbp)
    2490:	66 44 89 45 c4       	mov    %r8w,-0x3c(%rbp)
    2495:	66 89 4d c0          	mov    %cx,-0x40(%rbp)
  unsigned char meshIndex; // shipmeshpointers are in range 0..82 so using a byte for the index is OK

  setintensity(85);
    2499:	bf 55 00 00 00       	mov    $0x55,%edi
    249e:	e8 60 dc ff ff       	callq  103 <setintensity>

  // ship mesh array (of shorts) contains from_x,y,z and to_x,y,z

  Set_rotation_vars (Xrot, Yrot, Zrot);
    24a3:	0f bf 55 c4          	movswl -0x3c(%rbp),%edx
    24a7:	0f bf 4d c8          	movswl -0x38(%rbp),%ecx
    24ab:	0f bf 45 cc          	movswl -0x34(%rbp),%eax
    24af:	89 ce                	mov    %ecx,%esi
    24b1:	89 c7                	mov    %eax,%edi
    24b3:	e8 21 ff ff ff       	callq  23d9 <Set_rotation_vars>
  for (meshIndex = ShipMeshPointers[model]; meshIndex < ShipMeshPointers[model+1]; meshIndex++) {
    24b8:	0f b6 45 dc          	movzbl -0x24(%rbp),%eax
    24bc:	48 98                	cltq   
    24be:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    24c5:	88 45 ef             	mov    %al,-0x11(%rbp)
    24c8:	e9 13 02 00 00       	jmpq   26e0 <Draw_ship_at_rotated_scale+0x281>
    // Transform_point updates XY, XZ, YX and this_X,Y,Z
                                                                                     // (already tweaked offsets from +1:+6 to +0:+5
                                                                                     //  to sort Scratch array base issue)
    Transform_point (mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 0)], scale_fp),
                     mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 1)], scale_fp),
                     mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 2)], scale_fp)); // -> transformed_X,Y,Z
    24cd:	0f bf 4d c0          	movswl -0x40(%rbp),%ecx
    24d1:	0f b6 55 ef          	movzbl -0x11(%rbp),%edx
    24d5:	89 d0                	mov    %edx,%eax
    24d7:	01 c0                	add    %eax,%eax
    24d9:	01 d0                	add    %edx,%eax
    24db:	01 c0                	add    %eax,%eax
    24dd:	83 c0 02             	add    $0x2,%eax
    24e0:	48 98                	cltq   
    24e2:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    24e9:	0f be c0             	movsbl %al,%eax
    24ec:	89 ce                	mov    %ecx,%esi
    24ee:	89 c7                	mov    %eax,%edi
    24f0:	e8 04 e1 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
                                                                           // +1 is the start of the *next* set of data (or past the array end)
                                                                           // We could have used ship_mesh_length instead
    // Transform_point updates XY, XZ, YX and this_X,Y,Z
                                                                                     // (already tweaked offsets from +1:+6 to +0:+5
                                                                                     //  to sort Scratch array base issue)
    Transform_point (mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 0)], scale_fp),
    24f5:	44 0f bf e0          	movswl %ax,%r12d
                     mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 1)], scale_fp),
    24f9:	0f bf 4d c0          	movswl -0x40(%rbp),%ecx
    24fd:	0f b6 55 ef          	movzbl -0x11(%rbp),%edx
    2501:	89 d0                	mov    %edx,%eax
    2503:	01 c0                	add    %eax,%eax
    2505:	01 d0                	add    %edx,%eax
    2507:	01 c0                	add    %eax,%eax
    2509:	83 c0 01             	add    $0x1,%eax
    250c:	48 98                	cltq   
    250e:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    2515:	0f be c0             	movsbl %al,%eax
    2518:	89 ce                	mov    %ecx,%esi
    251a:	89 c7                	mov    %eax,%edi
    251c:	e8 d8 e0 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
                                                                           // +1 is the start of the *next* set of data (or past the array end)
                                                                           // We could have used ship_mesh_length instead
    // Transform_point updates XY, XZ, YX and this_X,Y,Z
                                                                                     // (already tweaked offsets from +1:+6 to +0:+5
                                                                                     //  to sort Scratch array base issue)
    Transform_point (mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 0)], scale_fp),
    2521:	0f bf d8             	movswl %ax,%ebx
    2524:	0f bf 4d c0          	movswl -0x40(%rbp),%ecx
    2528:	0f b6 55 ef          	movzbl -0x11(%rbp),%edx
    252c:	89 d0                	mov    %edx,%eax
    252e:	01 c0                	add    %eax,%eax
    2530:	01 d0                	add    %edx,%eax
    2532:	01 c0                	add    %eax,%eax
    2534:	48 98                	cltq   
    2536:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    253d:	0f be c0             	movsbl %al,%eax
    2540:	89 ce                	mov    %ecx,%esi
    2542:	89 c7                	mov    %eax,%edi
    2544:	e8 b0 e0 ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    2549:	98                   	cwtl   
    254a:	44 89 e2             	mov    %r12d,%edx
    254d:	89 de                	mov    %ebx,%esi
    254f:	89 c7                	mov    %eax,%edi
    2551:	e8 74 f9 ff ff       	callq  1eca <Transform_point>
                     mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 1)], scale_fp),
                     mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 2)], scale_fp)); // -> transformed_X,Y,Z
    Get_screenpos (x + transformed_X, y + transformed_Y, z + transformed_Z); // -> screen_x,y  (was previously -> this_X,Y)
    2556:	0f b7 55 d0          	movzwl -0x30(%rbp),%edx
    255a:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2561 <Draw_ship_at_rotated_scale+0x102>
    2561:	01 d0                	add    %edx,%eax
    2563:	0f bf d0             	movswl %ax,%edx
    2566:	0f b7 4d d4          	movzwl -0x2c(%rbp),%ecx
    256a:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2571 <Draw_ship_at_rotated_scale+0x112>
    2571:	01 c8                	add    %ecx,%eax
    2573:	0f bf c8             	movswl %ax,%ecx
    2576:	0f b7 75 d8          	movzwl -0x28(%rbp),%esi
    257a:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2581 <Draw_ship_at_rotated_scale+0x122>
    2581:	01 f0                	add    %esi,%eax
    2583:	98                   	cwtl   
    2584:	89 ce                	mov    %ecx,%esi
    2586:	89 c7                	mov    %eax,%edi
    2588:	e8 b9 f8 ff ff       	callq  1e46 <Get_screenpos>
    // original: gotoxy (screen_x, screen_y);
    // currently being hacked:
    gotoxy (screen_x+ScreenWidth / 2, screen_y+ScreenHeight / 2);
    258d:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 2593 <Draw_ship_at_rotated_scale+0x134>
    2593:	89 c2                	mov    %eax,%edx
    2595:	c1 ea 1f             	shr    $0x1f,%edx
    2598:	01 d0                	add    %edx,%eax
    259a:	d1 f8                	sar    %eax
    259c:	89 c2                	mov    %eax,%edx
    259e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 25a5 <Draw_ship_at_rotated_scale+0x146>
    25a5:	01 d0                	add    %edx,%eax
    25a7:	0f bf d0             	movswl %ax,%edx
    25aa:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 25b0 <Draw_ship_at_rotated_scale+0x151>
    25b0:	89 c1                	mov    %eax,%ecx
    25b2:	c1 e9 1f             	shr    $0x1f,%ecx
    25b5:	01 c8                	add    %ecx,%eax
    25b7:	d1 f8                	sar    %eax
    25b9:	89 c1                	mov    %eax,%ecx
    25bb:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 25c2 <Draw_ship_at_rotated_scale+0x163>
    25c2:	01 c8                	add    %ecx,%eax
    25c4:	98                   	cwtl   
    25c5:	89 d6                	mov    %edx,%esi
    25c7:	89 c7                	mov    %eax,%edi
    25c9:	e8 7d da ff ff       	callq  4b <gotoxy>
    putPenDown ();
    25ce:	e8 5e da ff ff       	callq  31 <putPenDown>

    Transform_point (mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 3)], scale_fp),
                     mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 4)], scale_fp),
                     mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 5)], scale_fp)); // -> transformed_X,Y,Z
    25d3:	0f bf 4d c0          	movswl -0x40(%rbp),%ecx
    25d7:	0f b6 55 ef          	movzbl -0x11(%rbp),%edx
    25db:	89 d0                	mov    %edx,%eax
    25dd:	01 c0                	add    %eax,%eax
    25df:	01 d0                	add    %edx,%eax
    25e1:	01 c0                	add    %eax,%eax
    25e3:	83 c0 05             	add    $0x5,%eax
    25e6:	48 98                	cltq   
    25e8:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    25ef:	0f be c0             	movsbl %al,%eax
    25f2:	89 ce                	mov    %ecx,%esi
    25f4:	89 c7                	mov    %eax,%edi
    25f6:	e8 fe df ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    // original: gotoxy (screen_x, screen_y);
    // currently being hacked:
    gotoxy (screen_x+ScreenWidth / 2, screen_y+ScreenHeight / 2);
    putPenDown ();

    Transform_point (mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 3)], scale_fp),
    25fb:	44 0f bf e0          	movswl %ax,%r12d
                     mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 4)], scale_fp),
    25ff:	0f bf 4d c0          	movswl -0x40(%rbp),%ecx
    2603:	0f b6 55 ef          	movzbl -0x11(%rbp),%edx
    2607:	89 d0                	mov    %edx,%eax
    2609:	01 c0                	add    %eax,%eax
    260b:	01 d0                	add    %edx,%eax
    260d:	01 c0                	add    %eax,%eax
    260f:	83 c0 04             	add    $0x4,%eax
    2612:	48 98                	cltq   
    2614:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    261b:	0f be c0             	movsbl %al,%eax
    261e:	89 ce                	mov    %ecx,%esi
    2620:	89 c7                	mov    %eax,%edi
    2622:	e8 d2 df ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    // original: gotoxy (screen_x, screen_y);
    // currently being hacked:
    gotoxy (screen_x+ScreenWidth / 2, screen_y+ScreenHeight / 2);
    putPenDown ();

    Transform_point (mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 3)], scale_fp),
    2627:	0f bf d8             	movswl %ax,%ebx
    262a:	0f bf 4d c0          	movswl -0x40(%rbp),%ecx
    262e:	0f b6 55 ef          	movzbl -0x11(%rbp),%edx
    2632:	89 d0                	mov    %edx,%eax
    2634:	01 c0                	add    %eax,%eax
    2636:	01 d0                	add    %edx,%eax
    2638:	01 c0                	add    %eax,%eax
    263a:	83 c0 03             	add    $0x3,%eax
    263d:	48 98                	cltq   
    263f:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    2646:	0f be c0             	movsbl %al,%eax
    2649:	89 ce                	mov    %ecx,%esi
    264b:	89 c7                	mov    %eax,%edi
    264d:	e8 a7 df ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    2652:	98                   	cwtl   
    2653:	44 89 e2             	mov    %r12d,%edx
    2656:	89 de                	mov    %ebx,%esi
    2658:	89 c7                	mov    %eax,%edi
    265a:	e8 6b f8 ff ff       	callq  1eca <Transform_point>
                     mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 4)], scale_fp),
                     mul_short_by_fp2_14_returning_short(ShipMesh[((meshIndex * 6) + 5)], scale_fp)); // -> transformed_X,Y,Z
    Get_screenpos (x + transformed_X, y + transformed_Y, z + transformed_Z); // -> screen_x,y  (was previously -> this_X,Y)
    265f:	0f b7 55 d0          	movzwl -0x30(%rbp),%edx
    2663:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 266a <Draw_ship_at_rotated_scale+0x20b>
    266a:	01 d0                	add    %edx,%eax
    266c:	0f bf d0             	movswl %ax,%edx
    266f:	0f b7 4d d4          	movzwl -0x2c(%rbp),%ecx
    2673:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 267a <Draw_ship_at_rotated_scale+0x21b>
    267a:	01 c8                	add    %ecx,%eax
    267c:	0f bf c8             	movswl %ax,%ecx
    267f:	0f b7 75 d8          	movzwl -0x28(%rbp),%esi
    2683:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 268a <Draw_ship_at_rotated_scale+0x22b>
    268a:	01 f0                	add    %esi,%eax
    268c:	98                   	cwtl   
    268d:	89 ce                	mov    %ecx,%esi
    268f:	89 c7                	mov    %eax,%edi
    2691:	e8 b0 f7 ff ff       	callq  1e46 <Get_screenpos>
    // original: gotoxy (screen_x, screen_y); // TO DO: clip the ends of these vectors! ONLY WHEN SHIPS ARE VERY CLOSE
                                              // http://malban.de/oldies/vectrex/vectrex-clipping
    // currently being hacked:
    gotoxy (screen_x+ScreenWidth / 2, screen_y+ScreenHeight / 2);
    2696:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 269c <Draw_ship_at_rotated_scale+0x23d>
    269c:	89 c2                	mov    %eax,%edx
    269e:	c1 ea 1f             	shr    $0x1f,%edx
    26a1:	01 d0                	add    %edx,%eax
    26a3:	d1 f8                	sar    %eax
    26a5:	89 c2                	mov    %eax,%edx
    26a7:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 26ae <Draw_ship_at_rotated_scale+0x24f>
    26ae:	01 d0                	add    %edx,%eax
    26b0:	0f bf d0             	movswl %ax,%edx
    26b3:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 26b9 <Draw_ship_at_rotated_scale+0x25a>
    26b9:	89 c1                	mov    %eax,%ecx
    26bb:	c1 e9 1f             	shr    $0x1f,%ecx
    26be:	01 c8                	add    %ecx,%eax
    26c0:	d1 f8                	sar    %eax
    26c2:	89 c1                	mov    %eax,%ecx
    26c4:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 26cb <Draw_ship_at_rotated_scale+0x26c>
    26cb:	01 c8                	add    %ecx,%eax
    26cd:	98                   	cwtl   
    26ce:	89 d6                	mov    %edx,%esi
    26d0:	89 c7                	mov    %eax,%edi
    26d2:	e8 74 d9 ff ff       	callq  4b <gotoxy>
     // ultimately get rid of pen up/down/gotoxy and call vectrex code directly with from/to vectors?
    putPenUp ();
    26d7:	e8 62 d9 ff ff       	callq  3e <putPenUp>
  setintensity(85);

  // ship mesh array (of shorts) contains from_x,y,z and to_x,y,z

  Set_rotation_vars (Xrot, Yrot, Zrot);
  for (meshIndex = ShipMeshPointers[model]; meshIndex < ShipMeshPointers[model+1]; meshIndex++) {
    26dc:	80 45 ef 01          	addb   $0x1,-0x11(%rbp)
    26e0:	0f b6 45 dc          	movzbl -0x24(%rbp),%eax
    26e4:	83 c0 01             	add    $0x1,%eax
    26e7:	48 98                	cltq   
    26e9:	0f b6 80 00 00 00 00 	movzbl 0x0(%rax),%eax
    26f0:	3a 45 ef             	cmp    -0x11(%rbp),%al
    26f3:	0f 87 d4 fd ff ff    	ja     24cd <Draw_ship_at_rotated_scale+0x6e>
    gotoxy (screen_x+ScreenWidth / 2, screen_y+ScreenHeight / 2);
     // ultimately get rid of pen up/down/gotoxy and call vectrex code directly with from/to vectors?
    putPenUp ();
  }

  setintensity(110);
    26f9:	bf 6e 00 00 00       	mov    $0x6e,%edi
    26fe:	e8 00 da ff ff       	callq  103 <setintensity>
}
    2703:	48 83 c4 30          	add    $0x30,%rsp
    2707:	5b                   	pop    %rbx
    2708:	41 5c                	pop    %r12
    270a:	5d                   	pop    %rbp
    270b:	c3                   	retq   

000000000000270c <Change_ship_time_by>:

static void Change_ship_time_by(unsigned char id, short dt) /* maybe dt should be 8 bits */
{
    270c:	55                   	push   %rbp
    270d:	48 89 e5             	mov    %rsp,%rbp
    2710:	53                   	push   %rbx
    2711:	89 fa                	mov    %edi,%edx
    2713:	89 f0                	mov    %esi,%eax
    2715:	88 55 f4             	mov    %dl,-0xc(%rbp)
    2718:	66 89 45 f0          	mov    %ax,-0x10(%rbp)
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_TIME)] += dt;
    271c:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    2720:	01 c0                	add    %eax,%eax
    2722:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    2729:	89 d1                	mov    %edx,%ecx
    272b:	29 c1                	sub    %eax,%ecx
    272d:	89 c8                	mov    %ecx,%eax
    272f:	8d 48 09             	lea    0x9(%rax),%ecx
    2732:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    2736:	01 c0                	add    %eax,%eax
    2738:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    273f:	89 d3                	mov    %edx,%ebx
    2741:	29 c3                	sub    %eax,%ebx
    2743:	89 d8                	mov    %ebx,%eax
    2745:	83 c0 09             	add    $0x9,%eax
    2748:	89 c0                	mov    %eax,%eax
    274a:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    2751:	00 
    2752:	89 c2                	mov    %eax,%edx
    2754:	0f b7 45 f0          	movzwl -0x10(%rbp),%eax
    2758:	01 d0                	add    %edx,%eax
    275a:	89 c2                	mov    %eax,%edx
    275c:	89 c8                	mov    %ecx,%eax
    275e:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    2765:	00 
}
    2766:	5b                   	pop    %rbx
    2767:	5d                   	pop    %rbp
    2768:	c3                   	retq   

0000000000002769 <Get_ship_vel>:

static void Get_ship_vel(unsigned char id)
{
    2769:	55                   	push   %rbp
    276a:	48 89 e5             	mov    %rsp,%rbp
    276d:	89 f8                	mov    %edi,%eax
    276f:	88 45 fc             	mov    %al,-0x4(%rbp)
  this_vel = ships[((id * SHIP_RECORD_LENGTH) + SHIP_SPEED)];
    2772:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    2776:	01 c0                	add    %eax,%eax
    2778:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    277f:	89 d1                	mov    %edx,%ecx
    2781:	29 c1                	sub    %eax,%ecx
    2783:	89 c8                	mov    %ecx,%eax
    2785:	83 c0 08             	add    $0x8,%eax
    2788:	89 c0                	mov    %eax,%eax
    278a:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    2791:	00 
    2792:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2799 <Get_ship_vel+0x30>
}
    2799:	5d                   	pop    %rbp
    279a:	c3                   	retq   

000000000000279b <Apply_vel_to_ship_pos>:

static void Apply_vel_to_ship_pos(unsigned char id)
{
    279b:	55                   	push   %rbp
    279c:	48 89 e5             	mov    %rsp,%rbp
    279f:	41 55                	push   %r13
    27a1:	41 54                	push   %r12
    27a3:	53                   	push   %rbx
    27a4:	48 83 ec 08          	sub    $0x8,%rsp
    27a8:	89 f8                	mov    %edi,%eax
    27aa:	88 45 e4             	mov    %al,-0x1c(%rbp)
  Get_ship_vel (id);
    27ad:	0f b6 45 e4          	movzbl -0x1c(%rbp),%eax
    27b1:	89 c7                	mov    %eax,%edi
    27b3:	e8 b1 ff ff ff       	callq  2769 <Get_ship_vel>
  Get_ship_rotation (id);
    27b8:	0f b6 45 e4          	movzbl -0x1c(%rbp),%eax
    27bc:	89 c7                	mov    %eax,%edi
    27be:	e8 94 fa ff ff       	callq  2257 <Get_ship_rotation>
  Change_ship_pos_by (id,
		      mul_short_by_fp2_14_returning_short(mul_short_by_fp2_14_returning_short(this_vel, fp2_14_sin (this_Y_rotation)), fp2_14_cos (this_X_rotation)),
		      mul_short_by_fp2_14_returning_short(this_vel, fp2_14_sin (this_X_rotation)),
		      mul_short_by_fp2_14_returning_short(mul_short_by_fp2_14_returning_short(this_vel, fp2_14_cos (this_Y_rotation)), fp2_14_cos (this_X_rotation)));
    27c3:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 27ca <Apply_vel_to_ship_pos+0x2f>
    27ca:	98                   	cwtl   
    27cb:	89 c7                	mov    %eax,%edi
    27cd:	e8 08 de ff ff       	callq  5da <fp2_14_cos>
    27d2:	0f bf d8             	movswl %ax,%ebx
    27d5:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 27dc <Apply_vel_to_ship_pos+0x41>
    27dc:	98                   	cwtl   
    27dd:	89 c7                	mov    %eax,%edi
    27df:	e8 f6 dd ff ff       	callq  5da <fp2_14_cos>
    27e4:	0f bf d0             	movswl %ax,%edx
    27e7:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 27ee <Apply_vel_to_ship_pos+0x53>
    27ee:	98                   	cwtl   
    27ef:	89 d6                	mov    %edx,%esi
    27f1:	89 c7                	mov    %eax,%edi
    27f3:	e8 01 de ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    27f8:	98                   	cwtl   
    27f9:	89 de                	mov    %ebx,%esi
    27fb:	89 c7                	mov    %eax,%edi
    27fd:	e8 f7 dd ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>

static void Apply_vel_to_ship_pos(unsigned char id)
{
  Get_ship_vel (id);
  Get_ship_rotation (id);
  Change_ship_pos_by (id,
    2802:	44 0f bf e0          	movswl %ax,%r12d
		      mul_short_by_fp2_14_returning_short(mul_short_by_fp2_14_returning_short(this_vel, fp2_14_sin (this_Y_rotation)), fp2_14_cos (this_X_rotation)),
		      mul_short_by_fp2_14_returning_short(this_vel, fp2_14_sin (this_X_rotation)),
    2806:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 280d <Apply_vel_to_ship_pos+0x72>
    280d:	98                   	cwtl   
    280e:	89 c7                	mov    %eax,%edi
    2810:	e8 87 dd ff ff       	callq  59c <fp2_14_sin>
    2815:	0f bf d0             	movswl %ax,%edx
    2818:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 281f <Apply_vel_to_ship_pos+0x84>
    281f:	98                   	cwtl   
    2820:	89 d6                	mov    %edx,%esi
    2822:	89 c7                	mov    %eax,%edi
    2824:	e8 d0 dd ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>

static void Apply_vel_to_ship_pos(unsigned char id)
{
  Get_ship_vel (id);
  Get_ship_rotation (id);
  Change_ship_pos_by (id,
    2829:	0f bf d8             	movswl %ax,%ebx
		      mul_short_by_fp2_14_returning_short(mul_short_by_fp2_14_returning_short(this_vel, fp2_14_sin (this_Y_rotation)), fp2_14_cos (this_X_rotation)),
    282c:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2833 <Apply_vel_to_ship_pos+0x98>
    2833:	98                   	cwtl   
    2834:	89 c7                	mov    %eax,%edi
    2836:	e8 9f dd ff ff       	callq  5da <fp2_14_cos>
    283b:	44 0f bf e8          	movswl %ax,%r13d
    283f:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2846 <Apply_vel_to_ship_pos+0xab>
    2846:	98                   	cwtl   
    2847:	89 c7                	mov    %eax,%edi
    2849:	e8 4e dd ff ff       	callq  59c <fp2_14_sin>
    284e:	0f bf d0             	movswl %ax,%edx
    2851:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2858 <Apply_vel_to_ship_pos+0xbd>
    2858:	98                   	cwtl   
    2859:	89 d6                	mov    %edx,%esi
    285b:	89 c7                	mov    %eax,%edi
    285d:	e8 97 dd ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>
    2862:	98                   	cwtl   
    2863:	44 89 ee             	mov    %r13d,%esi
    2866:	89 c7                	mov    %eax,%edi
    2868:	e8 8c dd ff ff       	callq  5f9 <mul_short_by_fp2_14_returning_short>

static void Apply_vel_to_ship_pos(unsigned char id)
{
  Get_ship_vel (id);
  Get_ship_rotation (id);
  Change_ship_pos_by (id,
    286d:	0f bf f0             	movswl %ax,%esi
    2870:	0f b6 45 e4          	movzbl -0x1c(%rbp),%eax
    2874:	44 89 e1             	mov    %r12d,%ecx
    2877:	89 da                	mov    %ebx,%edx
    2879:	89 c7                	mov    %eax,%edi
    287b:	e8 e7 f7 ff ff       	callq  2067 <Change_ship_pos_by>
		      mul_short_by_fp2_14_returning_short(mul_short_by_fp2_14_returning_short(this_vel, fp2_14_sin (this_Y_rotation)), fp2_14_cos (this_X_rotation)),
		      mul_short_by_fp2_14_returning_short(this_vel, fp2_14_sin (this_X_rotation)),
		      mul_short_by_fp2_14_returning_short(mul_short_by_fp2_14_returning_short(this_vel, fp2_14_cos (this_Y_rotation)), fp2_14_cos (this_X_rotation)));
}
    2880:	48 83 c4 08          	add    $0x8,%rsp
    2884:	5b                   	pop    %rbx
    2885:	41 5c                	pop    %r12
    2887:	41 5d                	pop    %r13
    2889:	5d                   	pop    %rbp
    288a:	c3                   	retq   

000000000000288b <Get_eigenvector_to>:
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_Y)] = y;
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_Z)] = z;
}

static inline void Get_eigenvector_to(short dx, short dy, short dz)
{
    288b:	55                   	push   %rbp
    288c:	48 89 e5             	mov    %rsp,%rbp
    288f:	53                   	push   %rbx
    2890:	48 83 ec 10          	sub    $0x10,%rsp
    2894:	89 f1                	mov    %esi,%ecx
    2896:	89 d0                	mov    %edx,%eax
    2898:	66 89 7d f4          	mov    %di,-0xc(%rbp)
    289c:	66 89 4d f0          	mov    %cx,-0x10(%rbp)
    28a0:	66 89 45 ec          	mov    %ax,-0x14(%rbp)
  // WAS: dirXZ = (fp2_14_atan ((dx / dz)) + (128 * (dz < 0)));

  // TO DO (Well, new code is in place for the atan.  UNTESTED in context)
  //dirXZ = atan_of_fp2_14(dx / dz);  // not entirely sure what values to expect for the parameter

  dirXZ = Scratch_atan2_fakedegrees(dx, dz);  // not entirely sure what values to expect for the parameter
    28a4:	0f bf 55 ec          	movswl -0x14(%rbp),%edx
    28a8:	0f bf 45 f4          	movswl -0xc(%rbp),%eax
    28ac:	89 d6                	mov    %edx,%esi
    28ae:	89 c7                	mov    %eax,%edi
    28b0:	e8 14 dc ff ff       	callq  4c9 <Scratch_atan2_fakedegrees>
    28b5:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 28bc <Get_eigenvector_to+0x31>

  if (dz < 0) dirXZ += 128;
    28bc:	66 83 7d ec 00       	cmpw   $0x0,-0x14(%rbp)
    28c1:	79 12                	jns    28d5 <Get_eigenvector_to+0x4a>
    28c3:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 28ca <Get_eigenvector_to+0x3f>
    28ca:	66 83 e8 80          	sub    $0xff80,%ax
    28ce:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 28d5 <Get_eigenvector_to+0x4a>

  // TO DO: still to write asin
  dirY = asin_of_fp2_14( dy / isqrt(dx*dx + dy*dy + dz*dz) );  // The parameter should be an fp2_14 fixed point?
    28d5:	0f bf 5d f0          	movswl -0x10(%rbp),%ebx
    28d9:	0f b7 55 f4          	movzwl -0xc(%rbp),%edx
    28dd:	0f b7 45 f4          	movzwl -0xc(%rbp),%eax
    28e1:	0f af d0             	imul   %eax,%edx
    28e4:	0f b7 4d f0          	movzwl -0x10(%rbp),%ecx
    28e8:	0f b7 45 f0          	movzwl -0x10(%rbp),%eax
    28ec:	0f af c1             	imul   %ecx,%eax
    28ef:	8d 0c 02             	lea    (%rdx,%rax,1),%ecx
    28f2:	0f b7 55 ec          	movzwl -0x14(%rbp),%edx
    28f6:	0f b7 45 ec          	movzwl -0x14(%rbp),%eax
    28fa:	0f af c2             	imul   %edx,%eax
    28fd:	01 c8                	add    %ecx,%eax
    28ff:	0f b7 c0             	movzwl %ax,%eax
    2902:	89 c7                	mov    %eax,%edi
    2904:	e8 12 d8 ff ff       	callq  11b <isqrt>
    2909:	0f b7 c0             	movzwl %ax,%eax
    290c:	89 45 e8             	mov    %eax,-0x18(%rbp)
    290f:	89 d8                	mov    %ebx,%eax
    2911:	89 c2                	mov    %eax,%edx
    2913:	c1 fa 1f             	sar    $0x1f,%edx
    2916:	f7 7d e8             	idivl  -0x18(%rbp)
    2919:	98                   	cwtl   
    291a:	89 c7                	mov    %eax,%edi
    291c:	e8 69 d8 ff ff       	callq  18a <asin_of_fp2_14>
    2921:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2928 <Get_eigenvector_to+0x9d>
}
    2928:	48 83 c4 10          	add    $0x10,%rsp
    292c:	5b                   	pop    %rbx
    292d:	5d                   	pop    %rbp
    292e:	c3                   	retq   

000000000000292f <Rotate_ship_toward_by_fakepercent>:
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_Y_ROTATION)] = Y_rotation;
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_Z_ROTATION)] = Z_rotation;
}

static inline void Rotate_ship_toward_by_fakepercent(unsigned char id, short x, short y, short z, short fakepercent /* or unsigned char? */)
{
    292f:	55                   	push   %rbp
    2930:	48 89 e5             	mov    %rsp,%rbp
    2933:	53                   	push   %rbx
    2934:	48 83 ec 18          	sub    $0x18,%rsp
    2938:	89 c8                	mov    %ecx,%eax
    293a:	44 89 c1             	mov    %r8d,%ecx
    293d:	40 88 7d f4          	mov    %dil,-0xc(%rbp)
    2941:	66 89 75 f0          	mov    %si,-0x10(%rbp)
    2945:	66 89 55 ec          	mov    %dx,-0x14(%rbp)
    2949:	66 89 45 e8          	mov    %ax,-0x18(%rbp)
    294d:	66 89 4d e4          	mov    %cx,-0x1c(%rbp)
  // If we use 0..127 (128) instead of 0..99 (100) then divides can be implemented
  // with a shift rather than an actual divide which doesn't exist on the 6809.
  Get_ship_pos (id);
    2951:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    2955:	89 c7                	mov    %eax,%edi
    2957:	e8 07 f4 ff ff       	callq  1d63 <Get_ship_pos>
  Get_eigenvector_to ((x - this_X), (y - this_Y), (z - this_Z));
    295c:	0f b7 55 e8          	movzwl -0x18(%rbp),%edx
    2960:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2967 <Rotate_ship_toward_by_fakepercent+0x38>
    2967:	89 d1                	mov    %edx,%ecx
    2969:	66 29 c1             	sub    %ax,%cx
    296c:	89 c8                	mov    %ecx,%eax
    296e:	0f bf d0             	movswl %ax,%edx
    2971:	0f b7 4d ec          	movzwl -0x14(%rbp),%ecx
    2975:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 297c <Rotate_ship_toward_by_fakepercent+0x4d>
    297c:	89 cb                	mov    %ecx,%ebx
    297e:	66 29 c3             	sub    %ax,%bx
    2981:	89 d8                	mov    %ebx,%eax
    2983:	0f bf c8             	movswl %ax,%ecx
    2986:	0f b7 75 f0          	movzwl -0x10(%rbp),%esi
    298a:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2991 <Rotate_ship_toward_by_fakepercent+0x62>
    2991:	89 f3                	mov    %esi,%ebx
    2993:	66 29 c3             	sub    %ax,%bx
    2996:	89 d8                	mov    %ebx,%eax
    2998:	98                   	cwtl   
    2999:	89 ce                	mov    %ecx,%esi
    299b:	89 c7                	mov    %eax,%edi
    299d:	e8 e9 fe ff ff       	callq  288b <Get_eigenvector_to>
  Get_ship_rotation (id);
    29a2:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    29a6:	89 c7                	mov    %eax,%edi
    29a8:	e8 aa f8 ff ff       	callq  2257 <Get_ship_rotation>

  // &255 is really % 256 which is the number of angles in a circle
  Change_ship_rotation_by (id,
			   (fakepercent * ((((dirY  - this_X_rotation) + 128) & 255) - 128)) >> 7 /* / FAKE100 */,
			   (fakepercent * ((((dirXZ - this_Y_rotation) + 128) & 255) - 128)) >> 7 /* / FAKE100 */,
                           (fakepercent * -this_Z_rotation) >> 7 /* / FAKE100 */);
    29ad:	0f bf 45 e4          	movswl -0x1c(%rbp),%eax
    29b1:	0f b7 15 00 00 00 00 	movzwl 0x0(%rip),%edx        # 29b8 <Rotate_ship_toward_by_fakepercent+0x89>
    29b8:	0f bf d2             	movswl %dx,%edx
    29bb:	f7 da                	neg    %edx
    29bd:	0f af c2             	imul   %edx,%eax
    29c0:	c1 f8 07             	sar    $0x7,%eax
  Get_ship_pos (id);
  Get_eigenvector_to ((x - this_X), (y - this_Y), (z - this_Z));
  Get_ship_rotation (id);

  // &255 is really % 256 which is the number of angles in a circle
  Change_ship_rotation_by (id,
    29c3:	0f bf c8             	movswl %ax,%ecx
			   (fakepercent * ((((dirY  - this_X_rotation) + 128) & 255) - 128)) >> 7 /* / FAKE100 */,
			   (fakepercent * ((((dirXZ - this_Y_rotation) + 128) & 255) - 128)) >> 7 /* / FAKE100 */,
    29c6:	0f bf 45 e4          	movswl -0x1c(%rbp),%eax
    29ca:	0f b7 15 00 00 00 00 	movzwl 0x0(%rip),%edx        # 29d1 <Rotate_ship_toward_by_fakepercent+0xa2>
    29d1:	0f bf f2             	movswl %dx,%esi
    29d4:	0f b7 15 00 00 00 00 	movzwl 0x0(%rip),%edx        # 29db <Rotate_ship_toward_by_fakepercent+0xac>
    29db:	0f bf d2             	movswl %dx,%edx
    29de:	89 f3                	mov    %esi,%ebx
    29e0:	29 d3                	sub    %edx,%ebx
    29e2:	89 da                	mov    %ebx,%edx
    29e4:	83 ea 80             	sub    $0xffffff80,%edx
    29e7:	81 e2 ff 00 00 00    	and    $0xff,%edx
    29ed:	83 c2 80             	add    $0xffffff80,%edx
    29f0:	0f af c2             	imul   %edx,%eax
    29f3:	c1 f8 07             	sar    $0x7,%eax
  Get_ship_pos (id);
  Get_eigenvector_to ((x - this_X), (y - this_Y), (z - this_Z));
  Get_ship_rotation (id);

  // &255 is really % 256 which is the number of angles in a circle
  Change_ship_rotation_by (id,
    29f6:	0f bf d0             	movswl %ax,%edx
			   (fakepercent * ((((dirY  - this_X_rotation) + 128) & 255) - 128)) >> 7 /* / FAKE100 */,
    29f9:	0f bf 45 e4          	movswl -0x1c(%rbp),%eax
    29fd:	0f b7 35 00 00 00 00 	movzwl 0x0(%rip),%esi        # 2a04 <Rotate_ship_toward_by_fakepercent+0xd5>
    2a04:	0f bf fe             	movswl %si,%edi
    2a07:	0f b7 35 00 00 00 00 	movzwl 0x0(%rip),%esi        # 2a0e <Rotate_ship_toward_by_fakepercent+0xdf>
    2a0e:	0f bf f6             	movswl %si,%esi
    2a11:	89 fb                	mov    %edi,%ebx
    2a13:	29 f3                	sub    %esi,%ebx
    2a15:	89 de                	mov    %ebx,%esi
    2a17:	83 ee 80             	sub    $0xffffff80,%esi
    2a1a:	81 e6 ff 00 00 00    	and    $0xff,%esi
    2a20:	83 c6 80             	add    $0xffffff80,%esi
    2a23:	0f af c6             	imul   %esi,%eax
    2a26:	c1 f8 07             	sar    $0x7,%eax
  Get_ship_pos (id);
  Get_eigenvector_to ((x - this_X), (y - this_Y), (z - this_Z));
  Get_ship_rotation (id);

  // &255 is really % 256 which is the number of angles in a circle
  Change_ship_rotation_by (id,
    2a29:	0f bf f0             	movswl %ax,%esi
    2a2c:	0f b6 45 f4          	movzbl -0xc(%rbp),%eax
    2a30:	89 c7                	mov    %eax,%edi
    2a32:	e8 28 f7 ff ff       	callq  215f <Change_ship_rotation_by>
			   (fakepercent * ((((dirY  - this_X_rotation) + 128) & 255) - 128)) >> 7 /* / FAKE100 */,
			   (fakepercent * ((((dirXZ - this_Y_rotation) + 128) & 255) - 128)) >> 7 /* / FAKE100 */,
                           (fakepercent * -this_Z_rotation) >> 7 /* / FAKE100 */);
                           // since these parameters are shorts, not bytes, there is
                           // no need for MULDIV here.  16 bit arithmetic should be OK.
}
    2a37:	48 83 c4 18          	add    $0x18,%rsp
    2a3b:	5b                   	pop    %rbx
    2a3c:	5d                   	pop    %rbp
    2a3d:	c3                   	retq   

0000000000002a3e <Head_ship_towards_destination>:
//{
//  distance = isqrt (((x * x) + ((y * y) + (z * z))));
//}

static void Head_ship_towards_destination(unsigned char id)
{
    2a3e:	55                   	push   %rbp
    2a3f:	48 89 e5             	mov    %rsp,%rbp
    2a42:	48 83 ec 08          	sub    $0x8,%rsp
    2a46:	89 f8                	mov    %edi,%eax
    2a48:	88 45 fc             	mov    %al,-0x4(%rbp)
  Get_ship_pos (id);
    2a4b:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    2a4f:	89 c7                	mov    %eax,%edi
    2a51:	e8 0d f3 ff ff       	callq  1d63 <Get_ship_pos>
  Get_ship_destination (id);
    2a56:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    2a5a:	89 c7                	mov    %eax,%edi
    2a5c:	e8 a8 f8 ff ff       	callq  2309 <Get_ship_destination>
  //Getlengthof ((this_X_destination - this_X), (this_Y_destination - this_Y), (this_Z_destination - this_Z)); // result is placed in 'distance' and does not appear to be used???
  Rotate_ship_toward_by_fakepercent(id, this_X_destination, this_Y_destination, this_Z_destination, 16); // was 10%  Now 16/128 (1/8, or about 12%)
    2a61:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2a68 <Head_ship_towards_destination+0x2a>
    2a68:	0f bf c8             	movswl %ax,%ecx
    2a6b:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2a72 <Head_ship_towards_destination+0x34>
    2a72:	0f bf d0             	movswl %ax,%edx
    2a75:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2a7c <Head_ship_towards_destination+0x3e>
    2a7c:	0f bf f0             	movswl %ax,%esi
    2a7f:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    2a83:	41 b8 10 00 00 00    	mov    $0x10,%r8d
    2a89:	89 c7                	mov    %eax,%edi
    2a8b:	e8 9f fe ff ff       	callq  292f <Rotate_ship_toward_by_fakepercent>
#ifdef NEVER // did this get here by accident in translation from Scratch?
  this_Z = (SHIP_SPAWN_Z - 1); // (I have forgotten why I did this. Z is set to a smidgeon closer to us than the spawn point)
  // I think it may be that when the ship's Z is exactly equal to SHIP_SPAWN_Z, the ship is still in a sort of 2D mode
  // as viewed from above, and hasn't yet turned to face us on the level.
#endif
}
    2a90:	c9                   	leaveq 
    2a91:	c3                   	retq   

0000000000002a92 <Set_ship_velocityto>:

static void Set_ship_velocityto(unsigned char id, short vel)
{
    2a92:	55                   	push   %rbp
    2a93:	48 89 e5             	mov    %rsp,%rbp
    2a96:	89 fa                	mov    %edi,%edx
    2a98:	89 f0                	mov    %esi,%eax
    2a9a:	88 55 fc             	mov    %dl,-0x4(%rbp)
    2a9d:	66 89 45 f8          	mov    %ax,-0x8(%rbp)
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_SPEED)] = vel;
    2aa1:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    2aa5:	01 c0                	add    %eax,%eax
    2aa7:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    2aae:	89 d1                	mov    %edx,%ecx
    2ab0:	29 c1                	sub    %eax,%ecx
    2ab2:	89 c8                	mov    %ecx,%eax
    2ab4:	83 c0 08             	add    $0x8,%eax
    2ab7:	89 c0                	mov    %eax,%eax
    2ab9:	0f b7 55 f8          	movzwl -0x8(%rbp),%edx
    2abd:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    2ac4:	00 
}
    2ac5:	5d                   	pop    %rbp
    2ac6:	c3                   	retq   

0000000000002ac7 <Set_ship_destinationto>:

static void Set_ship_destinationto(unsigned char id, short x, short y, short z)
{
    2ac7:	55                   	push   %rbp
    2ac8:	48 89 e5             	mov    %rsp,%rbp
    2acb:	89 c8                	mov    %ecx,%eax
    2acd:	40 88 7d fc          	mov    %dil,-0x4(%rbp)
    2ad1:	66 89 75 f8          	mov    %si,-0x8(%rbp)
    2ad5:	66 89 55 f4          	mov    %dx,-0xc(%rbp)
    2ad9:	66 89 45 f0          	mov    %ax,-0x10(%rbp)
  // can optimise with an index and increments
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_TARGET_X)] = x;
    2add:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    2ae1:	01 c0                	add    %eax,%eax
    2ae3:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    2aea:	89 d1                	mov    %edx,%ecx
    2aec:	29 c1                	sub    %eax,%ecx
    2aee:	89 c8                	mov    %ecx,%eax
    2af0:	83 c0 0a             	add    $0xa,%eax
    2af3:	89 c0                	mov    %eax,%eax
    2af5:	0f b7 55 f8          	movzwl -0x8(%rbp),%edx
    2af9:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    2b00:	00 
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_TARGET_Y)] = y;
    2b01:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    2b05:	01 c0                	add    %eax,%eax
    2b07:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    2b0e:	89 d1                	mov    %edx,%ecx
    2b10:	29 c1                	sub    %eax,%ecx
    2b12:	89 c8                	mov    %ecx,%eax
    2b14:	83 c0 0b             	add    $0xb,%eax
    2b17:	89 c0                	mov    %eax,%eax
    2b19:	0f b7 55 f4          	movzwl -0xc(%rbp),%edx
    2b1d:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    2b24:	00 
  ships[((id * SHIP_RECORD_LENGTH) + SHIP_TARGET_Z)] = z;
    2b25:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    2b29:	01 c0                	add    %eax,%eax
    2b2b:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    2b32:	89 d1                	mov    %edx,%ecx
    2b34:	29 c1                	sub    %eax,%ecx
    2b36:	89 c8                	mov    %ecx,%eax
    2b38:	83 c0 0c             	add    $0xc,%eax
    2b3b:	89 c0                	mov    %eax,%eax
    2b3d:	0f b7 55 f0          	movzwl -0x10(%rbp),%edx
    2b41:	66 89 94 00 00 00 00 	mov    %dx,0x0(%rax,%rax,1)
    2b48:	00 
}
    2b49:	5d                   	pop    %rbp
    2b4a:	c3                   	retq   

0000000000002b4b <Update_ship>:

static inline void Update_ship(unsigned char id)
{
    2b4b:	55                   	push   %rbp
    2b4c:	48 89 e5             	mov    %rsp,%rbp
    2b4f:	53                   	push   %rbx
    2b50:	48 83 ec 18          	sub    $0x18,%rsp
    2b54:	89 f8                	mov    %edi,%eax
    2b56:	88 45 ec             	mov    %al,-0x14(%rbp)
  Get_ship_pos (id);
    2b59:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2b5d:	89 c7                	mov    %eax,%edi
    2b5f:	e8 ff f1 ff ff       	callq  1d63 <Get_ship_pos>
  Apply_vel_to_ship_pos (id);   // MOVE THE SHIP
    2b64:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2b68:	89 c7                	mov    %eax,%edi
    2b6a:	e8 2c fc ff ff       	callq  279b <Apply_vel_to_ship_pos>

  Change_ship_velocity_by (id, SHIP_ACCEL_FP); // THIS IS BROKEN.  velocity is an int, accel is FP.  CANNOT ADD THEM, can only multiply.
    2b6f:	be 0a 00 00 00       	mov    $0xa,%esi
    2b74:	bf 01 00 00 00       	mov    $0x1,%edi
    2b79:	e8 f0 da ff ff       	callq  66e <div_int_by_int_returning_fp2_14>
    2b7e:	0f bf d0             	movswl %ax,%edx
    2b81:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2b85:	89 d6                	mov    %edx,%esi
    2b87:	89 c7                	mov    %eax,%edi
    2b89:	e8 fb f7 ff ff       	callq  2389 <Change_ship_velocity_by>
  if (((this_Z < 100) && (UsingShields == 1))) { // 100 is near the screen where the notional shields are.  (lower Z is close, high Z is distant)
    2b8e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2b95 <Update_ship+0x4a>
    2b95:	66 83 f8 63          	cmp    $0x63,%ax
    2b99:	0f 8f ab 00 00 00    	jg     2c4a <Update_ship+0xff>
    2b9f:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2ba6 <Update_ship+0x5b>
    2ba6:	66 83 f8 01          	cmp    $0x1,%ax
    2baa:	0f 85 9a 00 00 00    	jne    2c4a <Update_ship+0xff>
    startAsyncSound(SOUND_BOUNCE);
    2bb0:	bf 01 00 00 00       	mov    $0x1,%edi
    2bb5:	b8 00 00 00 00       	mov    $0x0,%eax
    2bba:	e8 00 00 00 00       	callq  2bbf <Update_ship+0x74>
    Set_ship_destinationto (id,
                            pickrandom (-100, 100),
                            pickrandom (-100, 100),
    2bbf:	be 64 00 00 00       	mov    $0x64,%esi
    2bc4:	bf 9c ff ff ff       	mov    $0xffffff9c,%edi
    2bc9:	e8 ff d4 ff ff       	callq  cd <pickrandom>
  Apply_vel_to_ship_pos (id);   // MOVE THE SHIP

  Change_ship_velocity_by (id, SHIP_ACCEL_FP); // THIS IS BROKEN.  velocity is an int, accel is FP.  CANNOT ADD THEM, can only multiply.
  if (((this_Z < 100) && (UsingShields == 1))) { // 100 is near the screen where the notional shields are.  (lower Z is close, high Z is distant)
    startAsyncSound(SOUND_BOUNCE);
    Set_ship_destinationto (id,
    2bce:	0f bf d8             	movswl %ax,%ebx
                            pickrandom (-100, 100),
    2bd1:	be 64 00 00 00       	mov    $0x64,%esi
    2bd6:	bf 9c ff ff ff       	mov    $0xffffff9c,%edi
    2bdb:	e8 ed d4 ff ff       	callq  cd <pickrandom>
  Apply_vel_to_ship_pos (id);   // MOVE THE SHIP

  Change_ship_velocity_by (id, SHIP_ACCEL_FP); // THIS IS BROKEN.  velocity is an int, accel is FP.  CANNOT ADD THEM, can only multiply.
  if (((this_Z < 100) && (UsingShields == 1))) { // 100 is near the screen where the notional shields are.  (lower Z is close, high Z is distant)
    startAsyncSound(SOUND_BOUNCE);
    Set_ship_destinationto (id,
    2be0:	0f bf f0             	movswl %ax,%esi
    2be3:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2be7:	b9 b8 0b 00 00       	mov    $0xbb8,%ecx
    2bec:	89 da                	mov    %ebx,%edx
    2bee:	89 c7                	mov    %eax,%edi
    2bf0:	e8 d2 fe ff ff       	callq  2ac7 <Set_ship_destinationto>
                            pickrandom (-100, 100),
                            pickrandom (-100, 100),
                            (SHIP_SPAWN_Z + 1000));  // This is a point in the far far distance - the ship has bounced off
                                                     // our shields and is receding backwards into the distance
    Get_ship_vel (id);
    2bf5:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2bf9:	89 c7                	mov    %eax,%edi
    2bfb:	e8 69 fb ff ff       	callq  2769 <Get_ship_vel>
    Set_ship_velocityto (id, -this_vel); // BoUnCe!
    2c00:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2c07 <Update_ship+0xbc>
    2c07:	f7 d8                	neg    %eax
    2c09:	0f bf d0             	movswl %ax,%edx
    2c0c:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2c10:	89 d6                	mov    %edx,%esi
    2c12:	89 c7                	mov    %eax,%edi
    2c14:	e8 79 fe ff ff       	callq  2a92 <Set_ship_velocityto>
    Apply_vel_to_ship_pos (id);
    2c19:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2c1d:	89 c7                	mov    %eax,%edi
    2c1f:	e8 77 fb ff ff       	callq  279b <Apply_vel_to_ship_pos>
    Head_ship_towards_destination (id);
    2c24:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2c28:	89 c7                	mov    %eax,%edi
    2c2a:	e8 0f fe ff ff       	callq  2a3e <Head_ship_towards_destination>
    Change_ship_time_by (id, 1);  // so ship's time is effectively a frame count - not real time - and will mess up with different FPS's on other platforms
    2c2f:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2c33:	be 01 00 00 00       	mov    $0x1,%esi
    2c38:	89 c7                	mov    %eax,%edi
    2c3a:	e8 cd fa ff ff       	callq  270c <Change_ship_time_by>
    Get_ship_pos (id);
    2c3f:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2c43:	89 c7                	mov    %eax,%edi
    2c45:	e8 19 f1 ff ff       	callq  1d63 <Get_ship_pos>
  }
  if ((this_Z > (SHIP_SPAWN_Z + 500))) { // The only way Z can be greater than the spawn point is if the ship is falling backwards (ie bouncing off shields)
    2c4a:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2c51 <Update_ship+0x106>
    2c51:	66 3d c4 09          	cmp    $0x9c4,%ax
    2c55:	7e 15                	jle    2c6c <Update_ship+0x121>
    Set_ship_status (id, SHIP_STATUS_DEAD); // so remove it from the field of play, same as if it had been shot
    2c57:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2c5b:	be 02 00 00 00       	mov    $0x2,%esi
    2c60:	89 c7                	mov    %eax,%edi
    2c62:	e8 2f f2 ff ff       	callq  1e96 <Set_ship_status>
    2c67:	e9 25 02 00 00       	jmpq   2e91 <Update_ship+0x346>
  } else {
    if ((this_Z < 50 /* DEBIGGING: Was 30*/) || (this_X < -1900 || this_X > 1900 || this_Y < -1900 || this_Y > 1900)) {
    2c6c:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2c73 <Update_ship+0x128>
    2c73:	66 83 f8 31          	cmp    $0x31,%ax
    2c77:	7e 34                	jle    2cad <Update_ship+0x162>
    2c79:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2c80 <Update_ship+0x135>
    2c80:	66 3d 94 f8          	cmp    $0xf894,%ax
    2c84:	7c 27                	jl     2cad <Update_ship+0x162>
    2c86:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2c8d <Update_ship+0x142>
    2c8d:	66 3d 6c 07          	cmp    $0x76c,%ax
    2c91:	7f 1a                	jg     2cad <Update_ship+0x162>
    2c93:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2c9a <Update_ship+0x14f>
    2c9a:	66 3d 94 f8          	cmp    $0xf894,%ax
    2c9e:	7c 0d                	jl     2cad <Update_ship+0x162>
    2ca0:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2ca7 <Update_ship+0x15c>
    2ca7:	66 3d 6c 07          	cmp    $0x76c,%ax
    2cab:	7e 56                	jle    2d03 <Update_ship+0x1b8>
      if (this_Z < 50 /* DEBIGGING: Was 30*/) {
    2cad:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2cb4 <Update_ship+0x169>
    2cb4:	66 83 f8 31          	cmp    $0x31,%ax
    2cb8:	7f 12                	jg     2ccc <Update_ship+0x181>
        Set_ship_status (id, SHIP_STATUS_PASSED); // effectively the same as DEAD
    2cba:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2cbe:	be 03 00 00 00       	mov    $0x3,%esi
    2cc3:	89 c7                	mov    %eax,%edi
    2cc5:	e8 cc f1 ff ff       	callq  1e96 <Set_ship_status>
    2cca:	eb 10                	jmp    2cdc <Update_ship+0x191>
      } else {
        Set_ship_status (id, SHIP_STATUS_LOST); // debugging movement problems
    2ccc:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2cd0:	be 04 00 00 00       	mov    $0x4,%esi
    2cd5:	89 c7                	mov    %eax,%edi
    2cd7:	e8 ba f1 ff ff       	callq  1e96 <Set_ship_status>
      }
      ShipsPassedThisWave += 1; // TO DO: "whoosh" sound, scroll stars past fast for a short time.  Not entirely handled yet.
    2cdc:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2ce3 <Update_ship+0x198>
    2ce3:	83 c0 01             	add    $0x1,%eax
    2ce6:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2ced <Update_ship+0x1a2>
      ShipsPassedTotal += 1; // TO DO: "whoosh" sound, scroll stars past fast for a short time.  Not entirely handled yet.
    2ced:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2cf4 <Update_ship+0x1a9>
    2cf4:	83 c0 01             	add    $0x1,%eax
    2cf7:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 2cfe <Update_ship+0x1b3>
    2cfe:	e9 8e 01 00 00       	jmpq   2e91 <Update_ship+0x346>
    } else { // active ship chasing us.  default action here.
      Get_ship_destination (id);
    2d03:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2d07:	89 c7                	mov    %eax,%edi
    2d09:	e8 fb f5 ff ff       	callq  2309 <Get_ship_destination>
      if (! ((((this_X == 0) && (this_Y == 0)) && (this_Z > SHIP_SPAWN_Z)))) {
    2d0e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2d15 <Update_ship+0x1ca>
    2d15:	66 85 c0             	test   %ax,%ax
    2d18:	75 1d                	jne    2d37 <Update_ship+0x1ec>
    2d1a:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2d21 <Update_ship+0x1d6>
    2d21:	66 85 c0             	test   %ax,%ax
    2d24:	75 11                	jne    2d37 <Update_ship+0x1ec>
    2d26:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2d2d <Update_ship+0x1e2>
    2d2d:	66 3d d0 07          	cmp    $0x7d0,%ax
    2d31:	0f 8f 3f 01 00 00    	jg     2e76 <Update_ship+0x32b>
      // can I rewrite the above as: if (this_X || this_Y || (this_Z <= SHIP_SPAWN_Z)) {
        Get_ship_time (id);
    2d37:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2d3b:	89 c7                	mov    %eax,%edi
    2d3d:	e8 95 f5 ff ff       	callq  22d7 <Get_ship_time>
        if (((this_ship_time % 40) == 39)) {  // this is where this_ship_time is used - to change flightpath - should probably use millis so that it remains independent of FPS
    2d42:	0f b7 0d 00 00 00 00 	movzwl 0x0(%rip),%ecx        # 2d49 <Update_ship+0x1fe>
    2d49:	0f bf c1             	movswl %cx,%eax
    2d4c:	69 c0 67 66 00 00    	imul   $0x6667,%eax,%eax
    2d52:	c1 e8 10             	shr    $0x10,%eax
    2d55:	89 c2                	mov    %eax,%edx
    2d57:	66 c1 fa 04          	sar    $0x4,%dx
    2d5b:	89 c8                	mov    %ecx,%eax
    2d5d:	66 c1 f8 0f          	sar    $0xf,%ax
    2d61:	66 29 c2             	sub    %ax,%dx
    2d64:	89 d0                	mov    %edx,%eax
    2d66:	c1 e0 02             	shl    $0x2,%eax
    2d69:	01 d0                	add    %edx,%eax
    2d6b:	c1 e0 03             	shl    $0x3,%eax
    2d6e:	89 ca                	mov    %ecx,%edx
    2d70:	66 29 c2             	sub    %ax,%dx
    2d73:	66 83 fa 27          	cmp    $0x27,%dx
    2d77:	0f 85 f9 00 00 00    	jne    2e76 <Update_ship+0x32b>
          Get_ship_pos (id);
    2d7d:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2d81:	89 c7                	mov    %eax,%edi
    2d83:	e8 db ef ff ff       	callq  1d63 <Get_ship_pos>
          if (this_Z < 1000) {
    2d88:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2d8f <Update_ship+0x244>
    2d8f:	66 3d e7 03          	cmp    $0x3e7,%ax
    2d93:	7f 1f                	jg     2db4 <Update_ship+0x269>
            Set_ship_destinationto (id, 0, 0, 0);
    2d95:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2d99:	b9 00 00 00 00       	mov    $0x0,%ecx
    2d9e:	ba 00 00 00 00       	mov    $0x0,%edx
    2da3:	be 00 00 00 00       	mov    $0x0,%esi
    2da8:	89 c7                	mov    %eax,%edi
    2daa:	e8 18 fd ff ff       	callq  2ac7 <Set_ship_destinationto>
    2daf:	e9 c2 00 00 00       	jmpq   2e76 <Update_ship+0x32b>
          } else {
            // Can I make this 2048 and use a shift?  Yes, almost certainly!
            Set_ship_destinationto (id,
                                  pickrandom (((-300 * this_Z) / 2000), ((300 * this_Z) / 2000)),
                                  pickrandom (((-200 * this_Z) / 2000), ((200 * this_Z) / 2000)),
    2db4:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2dbb <Update_ship+0x270>
    2dbb:	98                   	cwtl   
    2dbc:	69 c8 c8 00 00 00    	imul   $0xc8,%eax,%ecx
    2dc2:	ba d3 4d 62 10       	mov    $0x10624dd3,%edx
    2dc7:	89 c8                	mov    %ecx,%eax
    2dc9:	f7 ea                	imul   %edx
    2dcb:	c1 fa 07             	sar    $0x7,%edx
    2dce:	89 c8                	mov    %ecx,%eax
    2dd0:	c1 f8 1f             	sar    $0x1f,%eax
    2dd3:	89 d1                	mov    %edx,%ecx
    2dd5:	29 c1                	sub    %eax,%ecx
    2dd7:	89 c8                	mov    %ecx,%eax
    2dd9:	0f bf f0             	movswl %ax,%esi
    2ddc:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2de3 <Update_ship+0x298>
    2de3:	98                   	cwtl   
    2de4:	69 c8 38 ff ff ff    	imul   $0xffffff38,%eax,%ecx
    2dea:	ba d3 4d 62 10       	mov    $0x10624dd3,%edx
    2def:	89 c8                	mov    %ecx,%eax
    2df1:	f7 ea                	imul   %edx
    2df3:	c1 fa 07             	sar    $0x7,%edx
    2df6:	89 c8                	mov    %ecx,%eax
    2df8:	c1 f8 1f             	sar    $0x1f,%eax
    2dfb:	89 d1                	mov    %edx,%ecx
    2dfd:	29 c1                	sub    %eax,%ecx
    2dff:	89 c8                	mov    %ecx,%eax
    2e01:	98                   	cwtl   
    2e02:	89 c7                	mov    %eax,%edi
    2e04:	e8 c4 d2 ff ff       	callq  cd <pickrandom>
          Get_ship_pos (id);
          if (this_Z < 1000) {
            Set_ship_destinationto (id, 0, 0, 0);
          } else {
            // Can I make this 2048 and use a shift?  Yes, almost certainly!
            Set_ship_destinationto (id,
    2e09:	0f bf d8             	movswl %ax,%ebx
                                  pickrandom (((-300 * this_Z) / 2000), ((300 * this_Z) / 2000)),
    2e0c:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2e13 <Update_ship+0x2c8>
    2e13:	98                   	cwtl   
    2e14:	69 c8 2c 01 00 00    	imul   $0x12c,%eax,%ecx
    2e1a:	ba d3 4d 62 10       	mov    $0x10624dd3,%edx
    2e1f:	89 c8                	mov    %ecx,%eax
    2e21:	f7 ea                	imul   %edx
    2e23:	c1 fa 07             	sar    $0x7,%edx
    2e26:	89 c8                	mov    %ecx,%eax
    2e28:	c1 f8 1f             	sar    $0x1f,%eax
    2e2b:	89 d1                	mov    %edx,%ecx
    2e2d:	29 c1                	sub    %eax,%ecx
    2e2f:	89 c8                	mov    %ecx,%eax
    2e31:	0f bf f0             	movswl %ax,%esi
    2e34:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2e3b <Update_ship+0x2f0>
    2e3b:	98                   	cwtl   
    2e3c:	69 c8 d4 fe ff ff    	imul   $0xfffffed4,%eax,%ecx
    2e42:	ba d3 4d 62 10       	mov    $0x10624dd3,%edx
    2e47:	89 c8                	mov    %ecx,%eax
    2e49:	f7 ea                	imul   %edx
    2e4b:	c1 fa 07             	sar    $0x7,%edx
    2e4e:	89 c8                	mov    %ecx,%eax
    2e50:	c1 f8 1f             	sar    $0x1f,%eax
    2e53:	89 d1                	mov    %edx,%ecx
    2e55:	29 c1                	sub    %eax,%ecx
    2e57:	89 c8                	mov    %ecx,%eax
    2e59:	98                   	cwtl   
    2e5a:	89 c7                	mov    %eax,%edi
    2e5c:	e8 6c d2 ff ff       	callq  cd <pickrandom>
          Get_ship_pos (id);
          if (this_Z < 1000) {
            Set_ship_destinationto (id, 0, 0, 0);
          } else {
            // Can I make this 2048 and use a shift?  Yes, almost certainly!
            Set_ship_destinationto (id,
    2e61:	0f bf f0             	movswl %ax,%esi
    2e64:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2e68:	b9 38 ff ff ff       	mov    $0xffffff38,%ecx
    2e6d:	89 da                	mov    %ebx,%edx
    2e6f:	89 c7                	mov    %eax,%edi
    2e71:	e8 51 fc ff ff       	callq  2ac7 <Set_ship_destinationto>
                                  pickrandom (((-200 * this_Z) / 2000), ((200 * this_Z) / 2000)),
                                  -200);
          }
        }
      }
      Head_ship_towards_destination (id);
    2e76:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2e7a:	89 c7                	mov    %eax,%edi
    2e7c:	e8 bd fb ff ff       	callq  2a3e <Head_ship_towards_destination>
      Change_ship_time_by (id, 1);
    2e81:	0f b6 45 ec          	movzbl -0x14(%rbp),%eax
    2e85:	be 01 00 00 00       	mov    $0x1,%esi
    2e8a:	89 c7                	mov    %eax,%edi
    2e8c:	e8 7b f8 ff ff       	callq  270c <Change_ship_time_by>
    }
  }
}
    2e91:	48 83 c4 18          	add    $0x18,%rsp
    2e95:	5b                   	pop    %rbx
    2e96:	5d                   	pop    %rbp
    2e97:	c3                   	retq   

0000000000002e98 <Render_lasers>:

static unsigned char /* boolean */ firing, firedone1, firedone2, reloaded; // to be worked on...
static inline void Render_lasers(void)
{
    2e98:	55                   	push   %rbp
    2e99:	48 89 e5             	mov    %rsp,%rbp
  // sort of works on OpenGL but really needs a major rewrite before using on the Vectrex...
  if (Pressed_Key == '\n' || Pressed_Key == '\r' || mouse_fire) {
    2e9c:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 2ea3 <Render_lasers+0xb>
    2ea3:	3c 0a                	cmp    $0xa,%al
    2ea5:	74 1a                	je     2ec1 <Render_lasers+0x29>
    2ea7:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 2eae <Render_lasers+0x16>
    2eae:	3c 0d                	cmp    $0xd,%al
    2eb0:	74 0f                	je     2ec1 <Render_lasers+0x29>
    2eb2:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 2eb9 <Render_lasers+0x21>
    2eb9:	84 c0                	test   %al,%al
    2ebb:	0f 84 4f 01 00 00    	je     3010 <Render_lasers+0x178>
    Pressed_Key = 0;
    2ec1:	c6 05 00 00 00 00 00 	movb   $0x0,0x0(%rip)        # 2ec8 <Render_lasers+0x30>
    if (!firing && reloaded) {
    2ec8:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 2ecf <Render_lasers+0x37>
    2ecf:	84 c0                	test   %al,%al
    2ed1:	0f 85 80 00 00 00    	jne    2f57 <Render_lasers+0xbf>
    2ed7:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 2ede <Render_lasers+0x46>
    2ede:	84 c0                	test   %al,%al
    2ee0:	74 75                	je     2f57 <Render_lasers+0xbf>
      /* initiate fire */;
      firing = TRUE; reloaded = FALSE;
    2ee2:	c6 05 00 00 00 00 01 	movb   $0x1,0x0(%rip)        # 2ee9 <Render_lasers+0x51>
    2ee9:	c6 05 00 00 00 00 00 	movb   $0x0,0x0(%rip)        # 2ef0 <Render_lasers+0x58>
      firedone1 = plot_fire(0, 40,40, mouse_x, mouse_y);
    2ef0:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2ef7 <Render_lasers+0x5f>
    2ef7:	0f bf d0             	movswl %ax,%edx
    2efa:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2f01 <Render_lasers+0x69>
    2f01:	98                   	cwtl   
    2f02:	41 89 d0             	mov    %edx,%r8d
    2f05:	89 c1                	mov    %eax,%ecx
    2f07:	ba 28 00 00 00       	mov    $0x28,%edx
    2f0c:	be 28 00 00 00       	mov    $0x28,%esi
    2f11:	bf 00 00 00 00       	mov    $0x0,%edi
    2f16:	e8 1c dd ff ff       	callq  c37 <plot_fire>
    2f1b:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 2f21 <Render_lasers+0x89>
      firedone2 = plot_fire(1, 1000,40, mouse_x, mouse_y);
    2f21:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2f28 <Render_lasers+0x90>
    2f28:	0f bf d0             	movswl %ax,%edx
    2f2b:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2f32 <Render_lasers+0x9a>
    2f32:	98                   	cwtl   
    2f33:	41 89 d0             	mov    %edx,%r8d
    2f36:	89 c1                	mov    %eax,%ecx
    2f38:	ba 28 00 00 00       	mov    $0x28,%edx
    2f3d:	be e8 03 00 00       	mov    $0x3e8,%esi
    2f42:	bf 01 00 00 00       	mov    $0x1,%edi
    2f47:	e8 eb dc ff ff       	callq  c37 <plot_fire>
    2f4c:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 2f52 <Render_lasers+0xba>
static inline void Render_lasers(void)
{
  // sort of works on OpenGL but really needs a major rewrite before using on the Vectrex...
  if (Pressed_Key == '\n' || Pressed_Key == '\r' || mouse_fire) {
    Pressed_Key = 0;
    if (!firing && reloaded) {
    2f52:	e9 85 01 00 00       	jmpq   30dc <Render_lasers+0x244>
      /* initiate fire */;
      firing = TRUE; reloaded = FALSE;
      firedone1 = plot_fire(0, 40,40, mouse_x, mouse_y);
      firedone2 = plot_fire(1, 1000,40, mouse_x, mouse_y);
    } else {
      if (!firedone1) {
    2f57:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 2f5e <Render_lasers+0xc6>
    2f5e:	84 c0                	test   %al,%al
    2f60:	75 3b                	jne    2f9d <Render_lasers+0x105>
        firedone1 = plot_fire(0, firex[0], firey[0], mouse_x, mouse_y);
    2f62:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2f69 <Render_lasers+0xd1>
    2f69:	0f bf f0             	movswl %ax,%esi
    2f6c:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2f73 <Render_lasers+0xdb>
    2f73:	0f bf c8             	movswl %ax,%ecx
    2f76:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2f7d <Render_lasers+0xe5>
    2f7d:	0f bf d0             	movswl %ax,%edx
    2f80:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2f87 <Render_lasers+0xef>
    2f87:	98                   	cwtl   
    2f88:	41 89 f0             	mov    %esi,%r8d
    2f8b:	89 c6                	mov    %eax,%esi
    2f8d:	bf 00 00 00 00       	mov    $0x0,%edi
    2f92:	e8 a0 dc ff ff       	callq  c37 <plot_fire>
    2f97:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 2f9d <Render_lasers+0x105>
      }
      if (!firedone2) {
    2f9d:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 2fa4 <Render_lasers+0x10c>
    2fa4:	84 c0                	test   %al,%al
    2fa6:	75 3b                	jne    2fe3 <Render_lasers+0x14b>
        firedone2 = plot_fire(1, firex[1], firey[1], mouse_x, mouse_y);
    2fa8:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2faf <Render_lasers+0x117>
    2faf:	0f bf f0             	movswl %ax,%esi
    2fb2:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2fb9 <Render_lasers+0x121>
    2fb9:	0f bf c8             	movswl %ax,%ecx
    2fbc:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2fc3 <Render_lasers+0x12b>
    2fc3:	0f bf d0             	movswl %ax,%edx
    2fc6:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 2fcd <Render_lasers+0x135>
    2fcd:	98                   	cwtl   
    2fce:	41 89 f0             	mov    %esi,%r8d
    2fd1:	89 c6                	mov    %eax,%esi
    2fd3:	bf 01 00 00 00       	mov    $0x1,%edi
    2fd8:	e8 5a dc ff ff       	callq  c37 <plot_fire>
    2fdd:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 2fe3 <Render_lasers+0x14b>
      }
      firing = (!firedone1 || !firedone2);
    2fe3:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 2fea <Render_lasers+0x152>
    2fea:	84 c0                	test   %al,%al
    2fec:	74 0b                	je     2ff9 <Render_lasers+0x161>
    2fee:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 2ff5 <Render_lasers+0x15d>
    2ff5:	84 c0                	test   %al,%al
    2ff7:	75 07                	jne    3000 <Render_lasers+0x168>
    2ff9:	b8 01 00 00 00       	mov    $0x1,%eax
    2ffe:	eb 05                	jmp    3005 <Render_lasers+0x16d>
    3000:	b8 00 00 00 00       	mov    $0x0,%eax
    3005:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 300b <Render_lasers+0x173>
static inline void Render_lasers(void)
{
  // sort of works on OpenGL but really needs a major rewrite before using on the Vectrex...
  if (Pressed_Key == '\n' || Pressed_Key == '\r' || mouse_fire) {
    Pressed_Key = 0;
    if (!firing && reloaded) {
    300b:	e9 cc 00 00 00       	jmpq   30dc <Render_lasers+0x244>
        firedone2 = plot_fire(1, firex[1], firey[1], mouse_x, mouse_y);
      }
      firing = (!firedone1 || !firedone2);
    }
  } else {
    if (firing) { /* Finish off the last shot */
    3010:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 3017 <Render_lasers+0x17f>
    3017:	84 c0                	test   %al,%al
    3019:	0f 84 b6 00 00 00    	je     30d5 <Render_lasers+0x23d>
      if (!firedone1) {
    301f:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 3026 <Render_lasers+0x18e>
    3026:	84 c0                	test   %al,%al
    3028:	75 3b                	jne    3065 <Render_lasers+0x1cd>
        firedone1 = plot_fire(0, firex[0], firey[0], mouse_x, mouse_y);
    302a:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3031 <Render_lasers+0x199>
    3031:	0f bf f0             	movswl %ax,%esi
    3034:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 303b <Render_lasers+0x1a3>
    303b:	0f bf c8             	movswl %ax,%ecx
    303e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3045 <Render_lasers+0x1ad>
    3045:	0f bf d0             	movswl %ax,%edx
    3048:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 304f <Render_lasers+0x1b7>
    304f:	98                   	cwtl   
    3050:	41 89 f0             	mov    %esi,%r8d
    3053:	89 c6                	mov    %eax,%esi
    3055:	bf 00 00 00 00       	mov    $0x0,%edi
    305a:	e8 d8 db ff ff       	callq  c37 <plot_fire>
    305f:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 3065 <Render_lasers+0x1cd>
      }
      if (!firedone2) {
    3065:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 306c <Render_lasers+0x1d4>
    306c:	84 c0                	test   %al,%al
    306e:	75 3b                	jne    30ab <Render_lasers+0x213>
        firedone2 = plot_fire(1, firex[1], firey[1], mouse_x, mouse_y);
    3070:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3077 <Render_lasers+0x1df>
    3077:	0f bf f0             	movswl %ax,%esi
    307a:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3081 <Render_lasers+0x1e9>
    3081:	0f bf c8             	movswl %ax,%ecx
    3084:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 308b <Render_lasers+0x1f3>
    308b:	0f bf d0             	movswl %ax,%edx
    308e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3095 <Render_lasers+0x1fd>
    3095:	98                   	cwtl   
    3096:	41 89 f0             	mov    %esi,%r8d
    3099:	89 c6                	mov    %eax,%esi
    309b:	bf 01 00 00 00       	mov    $0x1,%edi
    30a0:	e8 92 db ff ff       	callq  c37 <plot_fire>
    30a5:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 30ab <Render_lasers+0x213>
       }
      firing = !(firedone1 && firedone2);
    30ab:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 30b2 <Render_lasers+0x21a>
    30b2:	84 c0                	test   %al,%al
    30b4:	74 0b                	je     30c1 <Render_lasers+0x229>
    30b6:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 30bd <Render_lasers+0x225>
    30bd:	84 c0                	test   %al,%al
    30bf:	75 07                	jne    30c8 <Render_lasers+0x230>
    30c1:	b8 01 00 00 00       	mov    $0x1,%eax
    30c6:	eb 05                	jmp    30cd <Render_lasers+0x235>
    30c8:	b8 00 00 00 00       	mov    $0x0,%eax
    30cd:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 30d3 <Render_lasers+0x23b>
    30d3:	eb 07                	jmp    30dc <Render_lasers+0x244>
    } else {reloaded = TRUE;}
    30d5:	c6 05 00 00 00 00 01 	movb   $0x1,0x0(%rip)        # 30dc <Render_lasers+0x244>
        }
      }
    }
  }
#endif
}
    30dc:	5d                   	pop    %rbp
    30dd:	c3                   	retq   

00000000000030de <Get_ship_type>:

static inline void Get_ship_type(unsigned char id)
{
    30de:	55                   	push   %rbp
    30df:	48 89 e5             	mov    %rsp,%rbp
    30e2:	89 f8                	mov    %edi,%eax
    30e4:	88 45 fc             	mov    %al,-0x4(%rbp)
  this_model = (unsigned char)ships[((id * SHIP_RECORD_LENGTH) + SHIP_TYPE)]; // WHERE IS THIS SET????
    30e7:	0f b6 45 fc          	movzbl -0x4(%rbp),%eax
    30eb:	01 c0                	add    %eax,%eax
    30ed:	8d 14 c5 00 00 00 00 	lea    0x0(,%rax,8),%edx
    30f4:	89 d1                	mov    %edx,%ecx
    30f6:	29 c1                	sub    %eax,%ecx
    30f8:	89 c8                	mov    %ecx,%eax
    30fa:	89 c0                	mov    %eax,%eax
    30fc:	0f b7 84 00 00 00 00 	movzwl 0x0(%rax,%rax,1),%eax
    3103:	00 
    3104:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 310a <Get_ship_type+0x2c>
}
    310a:	5d                   	pop    %rbp
    310b:	c3                   	retq   

000000000000310c <Render_ships>:

static void Render_ships(void)
{
    310c:	55                   	push   %rbp
    310d:	48 89 e5             	mov    %rsp,%rbp
    3110:	48 83 ec 20          	sub    $0x20,%rsp
  unsigned char id = 0;
    3114:	c6 45 ff 00          	movb   $0x0,-0x1(%rbp)
  for (id = 0; id < SHIPSPERWAVE; id++) {
    3118:	c6 45 ff 00          	movb   $0x0,-0x1(%rbp)
    311c:	e9 af 00 00 00       	jmpq   31d0 <Render_ships+0xc4>
    Get_ship_status (id);
    3121:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    3125:	89 c7                	mov    %eax,%edi
    3127:	e8 e9 ec ff ff       	callq  1e15 <Get_ship_status>
    if (this_status == SHIP_STATUS_ALIVE) { // an exploding ship needs special handling that has not been written yet
    312c:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 3133 <Render_ships+0x27>
    3133:	84 c0                	test   %al,%al
    3135:	0f 85 91 00 00 00    	jne    31cc <Render_ships+0xc0>
      Get_ship_type (id);
    313b:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    313f:	89 c7                	mov    %eax,%edi
    3141:	e8 98 ff ff ff       	callq  30de <Get_ship_type>
      Get_ship_pos (id);
    3146:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    314a:	89 c7                	mov    %eax,%edi
    314c:	e8 12 ec ff ff       	callq  1d63 <Get_ship_pos>
      Get_ship_rotation (id);
    3151:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    3155:	89 c7                	mov    %eax,%edi
    3157:	e8 fb f0 ff ff       	callq  2257 <Get_ship_rotation>
      Get_ship_scale (id);
    315c:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    3160:	89 c7                	mov    %eax,%edi
    3162:	e8 7c ec ff ff       	callq  1de3 <Get_ship_scale>
      // THERE MAY BE A MAJOR BUG HERE (subsequent to the re-implementation, that was not in the original)
      // (and I don't just mean the sign issue that I've temporarily tweaked below)
      //Draw_ship_at_rotated_scale (this_model, this_X, this_Y, this_Z, -this_X_rotation, this_Y_rotation, this_Z_rotation, this_scale_fp);
      Draw_ship_at_rotated_scale (this_model, this_X, this_Y, this_Z, this_X_rotation, this_Y_rotation, this_Z_rotation, this_scale_fp);
    3167:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 316e <Render_ships+0x62>
    316e:	44 0f bf c0          	movswl %ax,%r8d
    3172:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3179 <Render_ships+0x6d>
    3179:	0f bf f8             	movswl %ax,%edi
    317c:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3183 <Render_ships+0x77>
    3183:	44 0f bf c8          	movswl %ax,%r9d
    3187:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 318e <Render_ships+0x82>
    318e:	44 0f bf d0          	movswl %ax,%r10d
    3192:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3199 <Render_ships+0x8d>
    3199:	0f bf c8             	movswl %ax,%ecx
    319c:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 31a3 <Render_ships+0x97>
    31a3:	0f bf d0             	movswl %ax,%edx
    31a6:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 31ad <Render_ships+0xa1>
    31ad:	0f bf f0             	movswl %ax,%esi
    31b0:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 31b7 <Render_ships+0xab>
    31b7:	0f b6 c0             	movzbl %al,%eax
    31ba:	44 89 44 24 08       	mov    %r8d,0x8(%rsp)
    31bf:	89 3c 24             	mov    %edi,(%rsp)
    31c2:	45 89 d0             	mov    %r10d,%r8d
    31c5:	89 c7                	mov    %eax,%edi
    31c7:	e8 93 f2 ff ff       	callq  245f <Draw_ship_at_rotated_scale>
}

static void Render_ships(void)
{
  unsigned char id = 0;
  for (id = 0; id < SHIPSPERWAVE; id++) {
    31cc:	80 45 ff 01          	addb   $0x1,-0x1(%rbp)
    31d0:	80 7d ff 02          	cmpb   $0x2,-0x1(%rbp)
    31d4:	0f 86 47 ff ff ff    	jbe    3121 <Render_ships+0x15>
      // (and I don't just mean the sign issue that I've temporarily tweaked below)
      //Draw_ship_at_rotated_scale (this_model, this_X, this_Y, this_Z, -this_X_rotation, this_Y_rotation, this_Z_rotation, this_scale_fp);
      Draw_ship_at_rotated_scale (this_model, this_X, this_Y, this_Z, this_X_rotation, this_Y_rotation, this_Z_rotation, this_scale_fp);
    }
  }
}
    31da:	c9                   	leaveq 
    31db:	c3                   	retq   

00000000000031dc <Update_ships>:

static void Update_ships(void)
{
    31dc:	55                   	push   %rbp
    31dd:	48 89 e5             	mov    %rsp,%rbp
    31e0:	48 83 ec 10          	sub    $0x10,%rsp
  unsigned char shipid = 0;
    31e4:	c6 45 ff 00          	movb   $0x0,-0x1(%rbp)
  for (shipid = 0; shipid < SHIPSPERWAVE; shipid++) {
    31e8:	c6 45 ff 00          	movb   $0x0,-0x1(%rbp)
    31ec:	eb 25                	jmp    3213 <Update_ships+0x37>
    Get_ship_status(shipid);
    31ee:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    31f2:	89 c7                	mov    %eax,%edi
    31f4:	e8 1c ec ff ff       	callq  1e15 <Get_ship_status>
    if (this_status < SHIP_STATUS_DEAD) {
    31f9:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 3200 <Update_ships+0x24>
    3200:	3c 01                	cmp    $0x1,%al
    3202:	77 0b                	ja     320f <Update_ships+0x33>
      Update_ship (shipid); // Is that the right test?  There are other options...
    3204:	0f b6 45 ff          	movzbl -0x1(%rbp),%eax
    3208:	89 c7                	mov    %eax,%edi
    320a:	e8 3c f9 ff ff       	callq  2b4b <Update_ship>
}

static void Update_ships(void)
{
  unsigned char shipid = 0;
  for (shipid = 0; shipid < SHIPSPERWAVE; shipid++) {
    320f:	80 45 ff 01          	addb   $0x1,-0x1(%rbp)
    3213:	80 7d ff 02          	cmpb   $0x2,-0x1(%rbp)
    3217:	76 d5                	jbe    31ee <Update_ships+0x12>
    Get_ship_status(shipid);
    if (this_status < SHIP_STATUS_DEAD) {
      Update_ship (shipid); // Is that the right test?  There are other options...
    }
  }
}
    3219:	c9                   	leaveq 
    321a:	c3                   	retq   

000000000000321b <playTailgunner>:

//static unsigned char DEBUGrot;
static void playTailgunner(void) { // This is the main workhorse that is executed to draw every frame
    321b:	55                   	push   %rbp
    321c:	48 89 e5             	mov    %rsp,%rbp
    321f:	53                   	push   %rbx
    3220:	48 83 ec 08          	sub    $0x8,%rsp
  // Emulate a hardware intensity pulsing by calculating a pulsed intensity value once
  // here per frame, then any text which pulses uses that value, so that everything on screen
  // pulses at the same rate and the same time.

  // works, but doesn't pulse the way I would like.  The other versions I've written looked nicer.
  global_flashing_intensity = (unsigned char)(95+(fp2_14_sin(flashingtexttimer)>>9)); /* added part is -32..32 */
    3224:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 322b <playTailgunner+0x10>
    322b:	0f b6 c0             	movzbl %al,%eax
    322e:	89 c7                	mov    %eax,%edi
    3230:	e8 67 d3 ff ff       	callq  59c <fp2_14_sin>
    3235:	66 c1 f8 09          	sar    $0x9,%ax
    3239:	83 c0 5f             	add    $0x5f,%eax
    323c:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 3242 <playTailgunner+0x27>
  flashingtexttimer = flashingtexttimer + 8; // faster flashing rate
    3242:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 3249 <playTailgunner+0x2e>
    3249:	83 c0 08             	add    $0x8,%eax
    324c:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 3252 <playTailgunner+0x37>

  // Can accept more coins at any time.
  if (Pressed_Key == '3') {
    3252:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 3259 <playTailgunner+0x3e>
    3259:	3c 33                	cmp    $0x33,%al
    325b:	75 3c                	jne    3299 <playTailgunner+0x7e>
    Pressed_Key = 0;
    325d:	c6 05 00 00 00 00 00 	movb   $0x0,0x0(%rip)        # 3264 <playTailgunner+0x49>
    Credits += 1;
    3264:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 326b <playTailgunner+0x50>
    326b:	83 c0 01             	add    $0x1,%eax
    326e:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 3274 <playTailgunner+0x59>
    startAsyncSound(SOUND_COIN);
    3274:	bf 06 00 00 00       	mov    $0x6,%edi
    3279:	b8 00 00 00 00       	mov    $0x0,%eax
    327e:	e8 00 00 00 00       	callq  3283 <playTailgunner+0x68>
    if (Mode < COINED) {
    3283:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 328a <playTailgunner+0x6f>
    328a:	66 83 f8 03          	cmp    $0x3,%ax
    328e:	7f 09                	jg     3299 <playTailgunner+0x7e>
      Mode = COINED;  // However adding a coin during play etc does nothing *visible*
    3290:	66 c7 05 00 00 00 00 	movw   $0x4,0x0(%rip)        # 3299 <playTailgunner+0x7e>
    3297:	04 00 
    }
  }

  if ((Mode == PASSING) && (ShipsPassedThisWave > 0)) {
    3299:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 32a0 <playTailgunner+0x85>
    32a0:	66 83 f8 06          	cmp    $0x6,%ax
    32a4:	75 18                	jne    32be <playTailgunner+0xa3>
    32a6:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 32ad <playTailgunner+0x92>
    32ad:	66 85 c0             	test   %ax,%ax
    32b0:	7e 0c                	jle    32be <playTailgunner+0xa3>
    stars(4); // stars pass more quickly in this case
    32b2:	bf 04 00 00 00       	mov    $0x4,%edi
    32b7:	e8 33 d9 ff ff       	callq  bef <stars>
    32bc:	eb 0a                	jmp    32c8 <playTailgunner+0xad>
  } else {
    stars(1); // always draw stars regardless of what else is happening
    32be:	bf 01 00 00 00       	mov    $0x1,%edi
    32c3:	e8 27 d9 ff ff       	callq  bef <stars>

  // The game state logic is now cleaned up a little bit, but this is still pretty verbose
  // and could be much improved.  However it is time to move on to handling the ships, so
  // improvements here are on hold until they become critical to the gameplay.

  if (Mode == PREGAME) {
    32c8:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 32cf <playTailgunner+0xb4>
    32cf:	66 85 c0             	test   %ax,%ax
    32d2:	75 13                	jne    32e7 <playTailgunner+0xcc>
    // it happens at the end of a game when there are no coins left)
    // so doing one-time init stuff here would be a bad idea!

    // Also it's not really like power-up status because the high score needs to be retained

    Playintro();
    32d4:	e8 ec de ff ff       	callq  11c5 <Playintro>

    //Draw_ship_at_rotated_scale (0, 0, 0, 1000, DEBUGrot, DEBUGrot, DEBUGrot, ONE_POINT_ZERO);
    //DEBUGrot++;


    Mode = TUMBLING;
    32d9:	66 c7 05 00 00 00 00 	movw   $0x1,0x0(%rip)        # 32e2 <playTailgunner+0xc7>
    32e0:	01 00 
    32e2:	e9 55 04 00 00       	jmpq   373c <playTailgunner+0x521>

  } else if (Mode == TUMBLING) {
    32e7:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 32ee <playTailgunner+0xd3>
    32ee:	66 83 f8 01          	cmp    $0x1,%ax
    32f2:	0f 85 14 01 00 00    	jne    340c <playTailgunner+0x1f1>

    // "Tailgunner" intro placard is tumbling through space, towards player.
    // Until it stops, the only thing that can happen is a coin being inserted
    Draw_highscore ();
    32f8:	e8 7c e8 ff ff       	callq  1b79 <Draw_highscore>
    Draw_last_game_score (); // or not?
    32fd:	e8 c6 e9 ff ff       	callq  1cc8 <Draw_last_game_score>

    if (flashing_intro_timer > 0) {
    3302:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3309 <playTailgunner+0xee>
    3309:	66 85 c0             	test   %ax,%ax
    330c:	7e 47                	jle    3355 <playTailgunner+0x13a>
      flashing_intro_timer -= 1;
    330e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3315 <playTailgunner+0xfa>
    3315:	83 e8 01             	sub    $0x1,%eax
    3318:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 331f <playTailgunner+0x104>
      setintensity(global_flashing_intensity);
    331f:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 3326 <playTailgunner+0x10b>
    3326:	0f b6 c0             	movzbl %al,%eax
    3329:	89 c7                	mov    %eax,%edi
    332b:	e8 d3 cd ff ff       	callq  103 <setintensity>
      if (flashing_intro_timer == 0) {
    3330:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3337 <playTailgunner+0x11c>
    3337:	66 85 c0             	test   %ax,%ax
    333a:	75 19                	jne    3355 <playTailgunner+0x13a>
        intro_rot = 64; // 90 degrees
    333c:	c6 05 00 00 00 00 40 	movb   $0x40,0x0(%rip)        # 3343 <playTailgunner+0x128>
        intro_z = 206;
    3343:	66 c7 05 00 00 00 00 	movw   $0xce,0x0(%rip)        # 334c <playTailgunner+0x131>
    334a:	ce 00 
        hide_intro_timer = 60; // Frames
    334c:	66 c7 05 00 00 00 00 	movw   $0x3c,0x0(%rip)        # 3355 <playTailgunner+0x13a>
    3353:	3c 00 
      }
    }

    if (hide_intro_timer == 0) { // better use of the state machine could do away with this timer altogether
    3355:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 335c <playTailgunner+0x141>
    335c:	66 85 c0             	test   %ax,%ax
    335f:	75 6d                	jne    33ce <playTailgunner+0x1b3>

      drawtgintro (); // side-effect of resetting intensity to 110
    3361:	e8 30 dd ff ff       	callq  1096 <drawtgintro>
      // and then disappears to allow a demo attack wave to pass.
      // It does not yet do these things.
      // Once it does, improve it slightly over the original TG by having it
      // fade in from black in the distance to normal intensity once up close.

      if (flashing_intro_timer == 0) {
    3366:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 336d <playTailgunner+0x152>
    336d:	66 85 c0             	test   %ax,%ax
    3370:	0f 85 c6 03 00 00    	jne    373c <playTailgunner+0x521>
        intro_rot -= 2; // wraps around in 8-bit unsigned.  Can adjust rotation speed here.
    3376:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 337d <playTailgunner+0x162>
    337d:	83 e8 02             	sub    $0x2,%eax
    3380:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 3386 <playTailgunner+0x16b>
        intro_z -= 1;
    3386:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 338d <playTailgunner+0x172>
    338d:	83 e8 01             	sub    $0x1,%eax
    3390:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 3397 <playTailgunner+0x17c>
        if (intro_z < -199) { // this constant may be wrong after the switch from 360 to 256 angles per circle,
    3397:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 339e <playTailgunner+0x183>
    339e:	66 3d 39 ff          	cmp    $0xff39,%ax
    33a2:	0f 8d 94 03 00 00    	jge    373c <playTailgunner+0x521>
                              // however it seems to be working so I'll leave it for now...
          if (stopintroflag == 1) { // NEVER SET TO 1 ANYWHERE SO THIS WILL NEVER HAPPEN!!!
    33a8:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 33af <playTailgunner+0x194>
    33af:	66 83 f8 01          	cmp    $0x1,%ax
    33b3:	0f 84 a3 03 00 00    	je     375c <playTailgunner+0x541>
            return;
          }
          flashing_intro_timer = 129;// was 181 - must have been half a circle plus 1.
    33b9:	66 c7 05 00 00 00 00 	movw   $0x81,0x0(%rip)        # 33c2 <playTailgunner+0x1a7>
    33c0:	81 00 
          intro_rot = 0;
    33c2:	c6 05 00 00 00 00 00 	movb   $0x0,0x0(%rip)        # 33c9 <playTailgunner+0x1ae>
    33c9:	e9 6e 03 00 00       	jmpq   373c <playTailgunner+0x521>
        }
      }
    } else {
      setintensity(110); // undo change of intensity for flashing intro placard which was never drawn...
    33ce:	bf 6e 00 00 00       	mov    $0x6e,%edi
    33d3:	e8 2b cd ff ff       	callq  103 <setintensity>
      hide_intro_timer -= 1; // this is executed on each frame so the timer is variable with the FPS :-(  Needs work
    33d8:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 33df <playTailgunner+0x1c4>
    33df:	83 e8 01             	sub    $0x1,%eax
    33e2:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 33e9 <playTailgunner+0x1ce>
      if (hide_intro_timer == 0) {
    33e9:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 33f0 <playTailgunner+0x1d5>
    33f0:	66 85 c0             	test   %ax,%ax
    33f3:	0f 85 43 03 00 00    	jne    373c <playTailgunner+0x521>
	Start_new_game (); // this is a fake game.  It's like starting a game BUT the user has no inputs.
    33f9:	e8 56 e2 ff ff       	callq  1654 <Start_new_game>
        Mode = DEMOWAVE;
    33fe:	66 c7 05 00 00 00 00 	movw   $0x2,0x0(%rip)        # 3407 <playTailgunner+0x1ec>
    3405:	02 00 
    3407:	e9 30 03 00 00       	jmpq   373c <playTailgunner+0x521>
      }
    }

  } else if (Mode == DEMOWAVE) {
    340c:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3413 <playTailgunner+0x1f8>
    3413:	66 83 f8 02          	cmp    $0x2,%ax
    3417:	75 58                	jne    3471 <playTailgunner+0x256>

    // This mode lasts as long as a wave - once the ships pass you, we switch to INSERTCOIN

    // Mind you, until I get the ship stuff working again, there is no demo wave...

    Update_ships ();
    3419:	e8 be fd ff ff       	callq  31dc <Update_ships>
    Render_ships ();
    341e:	e8 e9 fc ff ff       	callq  310c <Render_ships>
    Draw_highscore ();
    3423:	e8 51 e7 ff ff       	callq  1b79 <Draw_highscore>
    Draw_last_game_score ();
    3428:	e8 9b e8 ff ff       	callq  1cc8 <Draw_last_game_score>

    //Draw_score ();
    //Draw_ShipsPassedTotal ();
    //Draw_shields_left ();

    if (   (unsigned char)ships[((0 * SHIP_RECORD_LENGTH) + SHIP_STATUS)] >= SHIP_STATUS_DEAD
    342d:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3434 <playTailgunner+0x219>
    3434:	3c 01                	cmp    $0x1,%al
    3436:	0f 86 00 03 00 00    	jbe    373c <playTailgunner+0x521>
	&& (unsigned char)ships[((1 * SHIP_RECORD_LENGTH) + SHIP_STATUS)] >= SHIP_STATUS_DEAD
    343c:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3443 <playTailgunner+0x228>
    3443:	3c 01                	cmp    $0x1,%al
    3445:	0f 86 f1 02 00 00    	jbe    373c <playTailgunner+0x521>
	&& (unsigned char)ships[((2 * SHIP_RECORD_LENGTH) + SHIP_STATUS)] >= SHIP_STATUS_DEAD ) {
    344b:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3452 <playTailgunner+0x237>
    3452:	3c 01                	cmp    $0x1,%al
    3454:	0f 86 e2 02 00 00    	jbe    373c <playTailgunner+0x521>
      // Question: do we do the 'passing' thing if we shot all 3 ships or only when one got by us?
      // In other words, do I need some more code to handle the end of a wave in other circumstances
      insertcoin_mode_timer = 200;
    345a:	66 c7 05 00 00 00 00 	movw   $0xc8,0x0(%rip)        # 3463 <playTailgunner+0x248>
    3461:	c8 00 
      Mode = INSERTCOIN;
    3463:	66 c7 05 00 00 00 00 	movw   $0x3,0x0(%rip)        # 346c <playTailgunner+0x251>
    346a:	03 00 
    346c:	e9 cb 02 00 00       	jmpq   373c <playTailgunner+0x521>
    //  At the moment, the state machine code is very verbose and not true to the game -
    //  my expectation is that as I follow the original logic more closely, all the
    //  special cases will disappear and this game loop will shrink considerably.  However
    //  for now I can live with it as I have bigger fish to fry...

  } else if (Mode == INSERTCOIN) {
    3471:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3478 <playTailgunner+0x25d>
    3478:	66 83 f8 03          	cmp    $0x3,%ax
    347c:	75 3e                	jne    34bc <playTailgunner+0x2a1>

    // "Insert Coin" prompt on screen.
    // After a few flashes of INSERTCOIN, we switch back to TUMBLING...

    Draw_highscore ();
    347e:	e8 f6 e6 ff ff       	callq  1b79 <Draw_highscore>
    Draw_last_game_score ();
    3483:	e8 40 e8 ff ff       	callq  1cc8 <Draw_last_game_score>
    InsertCoin();
    3488:	e8 55 e7 ff ff       	callq  1be2 <InsertCoin>
    insertcoin_mode_timer -= 1;
    348d:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3494 <playTailgunner+0x279>
    3494:	83 e8 01             	sub    $0x1,%eax
    3497:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 349e <playTailgunner+0x283>
    if (insertcoin_mode_timer == 0) {
    349e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 34a5 <playTailgunner+0x28a>
    34a5:	66 85 c0             	test   %ax,%ax
    34a8:	0f 85 8e 02 00 00    	jne    373c <playTailgunner+0x521>
      Mode = PREGAME;
    34ae:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 34b7 <playTailgunner+0x29c>
    34b5:	00 00 
    34b7:	e9 80 02 00 00       	jmpq   373c <playTailgunner+0x521>
    }

  } else if (Mode == COINED) {
    34bc:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 34c3 <playTailgunner+0x2a8>
    34c3:	66 83 f8 04          	cmp    $0x4,%ax
    34c7:	75 65                	jne    352e <playTailgunner+0x313>

    // Shows "Press START".  Can accept more coins.  Does not show placard or demo wave.
    // Encourage the player to stop wasting time now they have paid...
    Draw_highscore ();
    34c9:	e8 ab e6 ff ff       	callq  1b79 <Draw_highscore>
    Draw_last_game_score ();
    34ce:	e8 f5 e7 ff ff       	callq  1cc8 <Draw_last_game_score>

    if (Credits /* > 0U */) {
    34d3:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 34da <playTailgunner+0x2bf>
    34da:	84 c0                	test   %al,%al
    34dc:	0f 84 5a 02 00 00    	je     373c <playTailgunner+0x521>
      stopintroflag = 2; // Kill banner
    34e2:	66 c7 05 00 00 00 00 	movw   $0x2,0x0(%rip)        # 34eb <playTailgunner+0x2d0>
    34e9:	02 00 
      Draw_credits ();
    34eb:	e8 8b e7 ff ff       	callq  1c7b <Draw_credits>
      Press_start ();
    34f0:	e8 49 e7 ff ff       	callq  1c3e <Press_start>

      if (Pressed_Key == '1') {
    34f5:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 34fc <playTailgunner+0x2e1>
    34fc:	3c 31                	cmp    $0x31,%al
    34fe:	0f 85 38 02 00 00    	jne    373c <playTailgunner+0x521>
        Pressed_Key = 0;
    3504:	c6 05 00 00 00 00 00 	movb   $0x0,0x0(%rip)        # 350b <playTailgunner+0x2f0>
        Credits -= 1;
    350b:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 3512 <playTailgunner+0x2f7>
    3512:	83 e8 01             	sub    $0x1,%eax
    3515:	88 05 00 00 00 00    	mov    %al,0x0(%rip)        # 351b <playTailgunner+0x300>
	Start_new_game();
    351b:	e8 34 e1 ff ff       	callq  1654 <Start_new_game>
        Mode = PLAYING;
    3520:	66 c7 05 00 00 00 00 	movw   $0x5,0x0(%rip)        # 3529 <playTailgunner+0x30e>
    3527:	05 00 
    3529:	e9 0e 02 00 00       	jmpq   373c <playTailgunner+0x521>
#ifdef OPENGL_DEBUGGING
      fprintf(stderr, "Coined but no credits\?  Is this a bug\?\n");
#endif
    }

  } else if (Mode == PLAYING) {
    352e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3535 <playTailgunner+0x31a>
    3535:	66 83 f8 05          	cmp    $0x5,%ax
    3539:	0f 85 6a 01 00 00    	jne    36a9 <playTailgunner+0x48e>
    // Playing.  Shows crosshair.  Responds to firing, shields.  Can accept more coins (silently)
    draw_crosshair(mouseX(), mouseY());
    353f:	b8 00 00 00 00       	mov    $0x0,%eax
    3544:	e8 00 00 00 00       	callq  3549 <playTailgunner+0x32e>
    3549:	0f bf d8             	movswl %ax,%ebx
    354c:	b8 00 00 00 00       	mov    $0x0,%eax
    3551:	e8 00 00 00 00       	callq  3556 <playTailgunner+0x33b>
    3556:	98                   	cwtl   
    3557:	89 de                	mov    %ebx,%esi
    3559:	89 c7                	mov    %eax,%edi
    355b:	e8 84 da ff ff       	callq  fe4 <draw_crosshair>

    if (((Pressed_Key == ' ') || (Pressed_Key == '\t') || mouse_shields) && (Shields > 0)) {
    3560:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 3567 <playTailgunner+0x34c>
    3567:	3c 20                	cmp    $0x20,%al
    3569:	74 16                	je     3581 <playTailgunner+0x366>
    356b:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 3572 <playTailgunner+0x357>
    3572:	3c 09                	cmp    $0x9,%al
    3574:	74 0b                	je     3581 <playTailgunner+0x366>
    3576:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 357d <playTailgunner+0x362>
    357d:	84 c0                	test   %al,%al
    357f:	74 1e                	je     359f <playTailgunner+0x384>
    3581:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3588 <playTailgunner+0x36d>
    3588:	66 85 c0             	test   %ax,%ax
    358b:	7e 12                	jle    359f <playTailgunner+0x384>
      Pressed_Key = 0;
    358d:	c6 05 00 00 00 00 00 	movb   $0x0,0x0(%rip)        # 3594 <playTailgunner+0x379>
      UsingShields = 1;
    3594:	66 c7 05 00 00 00 00 	movw   $0x1,0x0(%rip)        # 359d <playTailgunner+0x382>
    359b:	01 00 
    359d:	eb 09                	jmp    35a8 <playTailgunner+0x38d>
    } else {
      UsingShields = 0;
    359f:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 35a8 <playTailgunner+0x38d>
    35a6:	00 00 
    }

    /* from the 'shields' sprite... */
    if (UsingShields == 1) { // slowly removing redundancies from merging the two programs
    35a8:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 35af <playTailgunner+0x394>
    35af:	66 83 f8 01          	cmp    $0x1,%ax
    35b3:	75 07                	jne    35bc <playTailgunner+0x3a1>
      Shield();
    35b5:	e8 49 e7 ff ff       	callq  1d03 <Shield>
    35ba:	eb 09                	jmp    35c5 <playTailgunner+0x3aa>
    } else {
      shieldsubticksleft = 0;
    35bc:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 35c5 <playTailgunner+0x3aa>
    35c3:	00 00 
    }

    Update_ships ();
    35c5:	e8 12 fc ff ff       	callq  31dc <Update_ships>

    if (Score > HighScore) HighScore = Score;
    35ca:	0f b7 15 00 00 00 00 	movzwl 0x0(%rip),%edx        # 35d1 <playTailgunner+0x3b6>
    35d1:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 35d8 <playTailgunner+0x3bd>
    35d8:	66 39 c2             	cmp    %ax,%dx
    35db:	7e 0e                	jle    35eb <playTailgunner+0x3d0>
    35dd:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 35e4 <playTailgunner+0x3c9>
    35e4:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 35eb <playTailgunner+0x3d0>
    Render_ships ();
    35eb:	e8 1c fb ff ff       	callq  310c <Render_ships>
    Render_lasers ();
    35f0:	e8 a3 f8 ff ff       	callq  2e98 <Render_lasers>

    Draw_score ();
    35f5:	e8 60 e5 ff ff       	callq  1b5a <Draw_score>
    Draw_ShipsPassedTotal ();
    35fa:	e8 20 e6 ff ff       	callq  1c1f <Draw_ShipsPassedTotal>
    Draw_shields_left ();
    35ff:	e8 37 e5 ff ff       	callq  1b3b <Draw_shields_left>

    // Is this wave over?
    if (   (unsigned char)ships[((0 * SHIP_RECORD_LENGTH) + SHIP_STATUS)] >= SHIP_STATUS_DEAD
    3604:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 360b <playTailgunner+0x3f0>
    360b:	3c 01                	cmp    $0x1,%al
    360d:	0f 86 29 01 00 00    	jbe    373c <playTailgunner+0x521>
	&& (unsigned char)ships[((1 * SHIP_RECORD_LENGTH) + SHIP_STATUS)] >= SHIP_STATUS_DEAD
    3613:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 361a <playTailgunner+0x3ff>
    361a:	3c 01                	cmp    $0x1,%al
    361c:	0f 86 1a 01 00 00    	jbe    373c <playTailgunner+0x521>
	&& (unsigned char)ships[((2 * SHIP_RECORD_LENGTH) + SHIP_STATUS)] >= SHIP_STATUS_DEAD ) {
    3622:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3629 <playTailgunner+0x40e>
    3629:	3c 01                	cmp    $0x1,%al
    362b:	0f 86 0b 01 00 00    	jbe    373c <playTailgunner+0x521>
      // Question: do we do the 'passing' thing if we shot all 3 ships or only when one got by us?
      // In other words, do I need some more code to handle the end of a wave in other circumstances
      if (ShipsPassedThisWave > 0) {
    3631:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3638 <playTailgunner+0x41d>
    3638:	66 85 c0             	test   %ax,%ax
    363b:	7e 17                	jle    3654 <playTailgunner+0x439>
        passing_mode_timer = 50;
    363d:	66 c7 05 00 00 00 00 	movw   $0x32,0x0(%rip)        # 3646 <playTailgunner+0x42b>
    3644:	32 00 
        Mode = PASSING; // and set a timer ...
    3646:	66 c7 05 00 00 00 00 	movw   $0x6,0x0(%rip)        # 364f <playTailgunner+0x434>
    364d:	06 00 
    364f:	e9 e8 00 00 00       	jmpq   373c <playTailgunner+0x521>
      } else {
        // Wrong game logic - game is over as soon as 10 ships get past you - *not* when the wave
	// ends and 10 or more ships have got past you.  Fix this...
        if (ShipsPassedTotal < 10) { // You can keep playing on this coin until 10 ships get past you!
    3654:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 365b <playTailgunner+0x440>
    365b:	66 83 f8 09          	cmp    $0x9,%ax
    365f:	7f 13                	jg     3674 <playTailgunner+0x459>
          Start_attack_wave ();
    3661:	e8 d2 de ff ff       	callq  1538 <Start_attack_wave>
          Mode = PLAYING;
    3666:	66 c7 05 00 00 00 00 	movw   $0x5,0x0(%rip)        # 366f <playTailgunner+0x454>
    366d:	05 00 
    366f:	e9 c8 00 00 00       	jmpq   373c <playTailgunner+0x521>
        } else {
          if (Credits /* > 0U */) { // No!  Don't start automatically - let the user click 'start'...
    3674:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 367b <playTailgunner+0x460>
    367b:	84 c0                	test   %al,%al
    367d:	74 0e                	je     368d <playTailgunner+0x472>
            Mode = COINED;
    367f:	66 c7 05 00 00 00 00 	movw   $0x4,0x0(%rip)        # 3688 <playTailgunner+0x46d>
    3686:	04 00 
    3688:	e9 af 00 00 00       	jmpq   373c <playTailgunner+0x521>
          } else {
            Mode = PREGAME;  // Or TUMBLING????
    368d:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 3696 <playTailgunner+0x47b>
    3694:	00 00 
            LastScore = Score;
    3696:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 369d <playTailgunner+0x482>
    369d:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 36a4 <playTailgunner+0x489>
    36a4:	e9 93 00 00 00       	jmpq   373c <playTailgunner+0x521>
          }
        }
      }
    }

  } else if (Mode == PASSING) {
    36a9:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 36b0 <playTailgunner+0x495>
    36b0:	66 83 f8 06          	cmp    $0x6,%ax
    36b4:	0f 85 82 00 00 00    	jne    373c <playTailgunner+0x521>
    // A wave is complete.  Stars whoosh by at double speed *IF* any attackers got past you.
    // Can't do anything until a couple of seconds later, when next wave starts or game is over. (no coins)

    Draw_score ();
    36ba:	e8 9b e4 ff ff       	callq  1b5a <Draw_score>
    Draw_ShipsPassedTotal ();
    36bf:	e8 5b e5 ff ff       	callq  1c1f <Draw_ShipsPassedTotal>
    Draw_shields_left ();
    36c4:	e8 72 e4 ff ff       	callq  1b3b <Draw_shields_left>

    if (passing_mode_timer > 0) {
    36c9:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 36d0 <playTailgunner+0x4b5>
    36d0:	66 85 c0             	test   %ax,%ax
    36d3:	7e 67                	jle    373c <playTailgunner+0x521>
      passing_mode_timer -= 1;
    36d5:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 36dc <playTailgunner+0x4c1>
    36dc:	83 e8 01             	sub    $0x1,%eax
    36df:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 36e6 <playTailgunner+0x4cb>
      if (passing_mode_timer == 0) { // passing-mode is over
    36e6:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 36ed <playTailgunner+0x4d2>
    36ed:	66 85 c0             	test   %ax,%ax
    36f0:	75 4a                	jne    373c <playTailgunner+0x521>
        if (ShipsPassedTotal < 10) { // You can keep playing on this coin until 10 ships get past you!
    36f2:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 36f9 <playTailgunner+0x4de>
    36f9:	66 83 f8 09          	cmp    $0x9,%ax
    36fd:	7f 10                	jg     370f <playTailgunner+0x4f4>
          Start_attack_wave ();
    36ff:	e8 34 de ff ff       	callq  1538 <Start_attack_wave>
          Mode = PLAYING;
    3704:	66 c7 05 00 00 00 00 	movw   $0x5,0x0(%rip)        # 370d <playTailgunner+0x4f2>
    370b:	05 00 
    370d:	eb 2d                	jmp    373c <playTailgunner+0x521>
        } else {
          if (Credits /* > 0U */) { // No!  Don't start automatically - let the user click 'start'...
    370f:	0f b6 05 00 00 00 00 	movzbl 0x0(%rip),%eax        # 3716 <playTailgunner+0x4fb>
    3716:	84 c0                	test   %al,%al
    3718:	74 0b                	je     3725 <playTailgunner+0x50a>
            Mode = COINED;
    371a:	66 c7 05 00 00 00 00 	movw   $0x4,0x0(%rip)        # 3723 <playTailgunner+0x508>
    3721:	04 00 
    3723:	eb 17                	jmp    373c <playTailgunner+0x521>
          } else {
            Mode = PREGAME;  // Or TUMBLING????
    3725:	66 c7 05 00 00 00 00 	movw   $0x0,0x0(%rip)        # 372e <playTailgunner+0x513>
    372c:	00 00 
            LastScore = Score;
    372e:	0f b7 05 00 00 00 00 	movzwl 0x0(%rip),%eax        # 3735 <playTailgunner+0x51a>
    3735:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 373c <playTailgunner+0x521>
  } else {
    // should not happen.  If it does, take steps during development to find out why and either fix
    // it properly or bodge it here by hackily resetting global variables ;-)  In production games
    // this MUST NOT break the game or lose coins.  (Defensive programming!)
  }
  debug_ship(0);debug_ship(1);debug_ship(2);
    373c:	bf 00 00 00 00       	mov    $0x0,%edi
    3741:	e8 8d dc ff ff       	callq  13d3 <debug_ship>
    3746:	bf 01 00 00 00       	mov    $0x1,%edi
    374b:	e8 83 dc ff ff       	callq  13d3 <debug_ship>
    3750:	bf 02 00 00 00       	mov    $0x2,%edi
    3755:	e8 79 dc ff ff       	callq  13d3 <debug_ship>
    375a:	eb 01                	jmp    375d <playTailgunner+0x542>
        intro_rot -= 2; // wraps around in 8-bit unsigned.  Can adjust rotation speed here.
        intro_z -= 1;
        if (intro_z < -199) { // this constant may be wrong after the switch from 360 to 256 angles per circle,
                              // however it seems to be working so I'll leave it for now...
          if (stopintroflag == 1) { // NEVER SET TO 1 ANYWHERE SO THIS WILL NEVER HAPPEN!!!
            return;
    375c:	90                   	nop
    // should not happen.  If it does, take steps during development to find out why and either fix
    // it properly or bodge it here by hackily resetting global variables ;-)  In production games
    // this MUST NOT break the game or lose coins.  (Defensive programming!)
  }
  debug_ship(0);debug_ship(1);debug_ship(2);
}
    375d:	48 83 c4 08          	add    $0x8,%rsp
    3761:	5b                   	pop    %rbx
    3762:	5d                   	pop    %rbp
    3763:	c3                   	retq   

0000000000003764 <pre_graphics_initialisation>:

static void pre_graphics_initialisation(void)
{
    3764:	55                   	push   %rbp
    3765:	48 89 e5             	mov    %rsp,%rbp
  //0: Pressed_Key = 0; // no key pressed (non-Vectrex implementations)
  //0: millis_time = 0;
  //0: started = 0;

  //0: firing = 0; firedone1 = 0; firedone2 = 0;
  reloaded = 1; // to be worked on...
    3768:	c6 05 00 00 00 00 01 	movb   $0x1,0x0(%rip)        # 376f <pre_graphics_initialisation+0xb>

  //0: last_x = 0; last_y = 0;

  //0: pen = UP;
  vectrex_beam_intensity = 110U;
    376f:	c6 05 00 00 00 00 6e 	movb   $0x6e,0x0(%rip)        # 3776 <pre_graphics_initialisation+0x12>

  //0: nextwaveshiptype = 0;

  //0: Credits = 0;
  //0: Mode = PREGAME;
  ObservedFPS = TargetFPS = 30; // Target for this platform
    3776:	c7 05 00 00 00 00 1e 	movl   $0x1e,0x0(%rip)        # 3780 <pre_graphics_initialisation+0x1c>
    377d:	00 00 00 
    3780:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 3786 <pre_graphics_initialisation+0x22>
    3786:	89 05 00 00 00 00    	mov    %eax,0x0(%rip)        # 378c <pre_graphics_initialisation+0x28>

  //0: Score = HighScore = LastScore = 0;
}
    378c:	5d                   	pop    %rbp
    378d:	c3                   	retq   

000000000000378e <post_graphics_initialisation>:

static void post_graphics_initialisation(void)
{
    378e:	55                   	push   %rbp
    378f:	48 89 e5             	mov    %rsp,%rbp
  intro_x = ScreenWidth / 2; intro_y = ScreenHeight / 2; 
    3792:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 3798 <post_graphics_initialisation+0xa>
    3798:	89 c2                	mov    %eax,%edx
    379a:	c1 ea 1f             	shr    $0x1f,%edx
    379d:	01 d0                	add    %edx,%eax
    379f:	d1 f8                	sar    %eax
    37a1:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 37a8 <post_graphics_initialisation+0x1a>
    37a8:	8b 05 00 00 00 00    	mov    0x0(%rip),%eax        # 37ae <post_graphics_initialisation+0x20>
    37ae:	89 c2                	mov    %eax,%edx
    37b0:	c1 ea 1f             	shr    $0x1f,%edx
    37b3:	01 d0                	add    %edx,%eax
    37b5:	d1 f8                	sar    %eax
    37b7:	66 89 05 00 00 00 00 	mov    %ax,0x0(%rip)        # 37be <post_graphics_initialisation+0x30>
  putPenUp ();
    37be:	e8 7b c8 ff ff       	callq  3e <putPenUp>
  init_stars();
    37c3:	e8 a3 d3 ff ff       	callq  b6b <init_stars>
}
    37c8:	5d                   	pop    %rbp
    37c9:	c3                   	retq   

00000000000037ca <main>:
{
  int argc;
  char **argv;// unused
#else
int main (int argc, char **argv)
{
    37ca:	55                   	push   %rbp
    37cb:	48 89 e5             	mov    %rsp,%rbp
    37ce:	48 83 ec 10          	sub    $0x10,%rsp
    37d2:	89 7d fc             	mov    %edi,-0x4(%rbp)
    37d5:	48 89 75 f0          	mov    %rsi,-0x10(%rbp)
#endif

  pre_graphics_initialisation();
    37d9:	e8 86 ff ff ff       	callq  3764 <pre_graphics_initialisation>

  graphics_initialisation(&argc, argv);
    37de:	48 8b 55 f0          	mov    -0x10(%rbp),%rdx
    37e2:	48 8d 45 fc          	lea    -0x4(%rbp),%rax
    37e6:	48 89 d6             	mov    %rdx,%rsi
    37e9:	48 89 c7             	mov    %rax,%rdi
    37ec:	b8 00 00 00 00       	mov    $0x0,%eax
    37f1:	e8 00 00 00 00       	callq  37f6 <main+0x2c>

  post_graphics_initialisation();
    37f6:	e8 93 ff ff ff       	callq  378e <post_graphics_initialisation>

  Main_loop();
    37fb:	b8 00 00 00 00       	mov    $0x0,%eax
    3800:	e8 00 00 00 00       	callq  3805 <main+0x3b>

  return(0);
    3805:	b8 00 00 00 00       	mov    $0x0,%eax
}
    380a:	c9                   	leaveq 
    380b:	c3                   	retq   
