1: / does white/black attack position?
   2: 
   3: .globl  _battack
   4: .globl  _wattack
   5: 
   6: .globl  _dir, _board
   7: 
   8: uleft   = 04040;
   9: uright  = 04004;
  10: dleft   = 00440;
  11: dright  = 00404;
  12: left    = 00040;
  13: right   = 00004;
  14: up      = 04000;
  15: down    = 00400;
  16: u2r1    = 06004;
  17: u1r2    = 04006;
  18: d1r2    = 00406;
  19: d2r1    = 00604;
  20: d2l1    = 00640;
  21: d1l2    = 00460;
  22: u1l2    = 04060;
  23: u2l1    = 06040;
  24: 
  25: _battack:
  26:         mov     2(sp),r0
  27:         asl     r0
  28:         mov     _dir(r0),r1
  29:         mov     $2,r2
  30:         bit     $u2r1,r1
  31:         bne     1f
  32:         cmp     _board+[-15.*2](r0),r2
  33:         beq     2f
  34: 1:
  35:         bit     $u1r2,r1
  36:         bne     1f
  37:         cmp     _board+[-6.*2](r0),r2
  38:         beq     2f
  39: 1:
  40:         bit     $d1r2,r1
  41:         bne     1f
  42:         cmp     _board+[+10.*2](r0),r2
  43:         beq     2f
  44: 1:
  45:         bit     $d2r1,r1
  46:         bne     1f
  47:         cmp     _board+[+17.*2](r0),r2
  48:         beq     2f
  49: 1:
  50:         bit     $d2l1,r1
  51:         bne     1f
  52:         cmp     _board+[+15.*2](r0),r2
  53:         beq     2f
  54: 1:
  55:         bit     $d1l2,r1
  56:         bne     1f
  57:         cmp     _board+[+6.*2](r0),r2
  58:         beq     2f
  59: 1:
  60:         bit     $u1l2,r1
  61:         bne     1f
  62:         cmp     _board+[-10.*2](r0),r2
  63:         beq     2f
  64: 1:
  65:         bit     $u2l1,r1
  66:         bne     1f
  67:         cmp     _board+[-17.*2](r0),r2
  68:         beq     2f
  69: 1:
  70:         jsr     r5,badiag; uleft; -9.*2
  71:         jsr     r5,badiag; uright; -7.*2
  72:         jsr     r5,badiag; dleft; 7.*2
  73:         jsr     r5,badiag; dright; 9.*2
  74:         jsr     r5,barank; up; -8.*2
  75:         jsr     r5,barank; left; -1.*2
  76:         jsr     r5,barank; right; 1.*2
  77:         jsr     r5,barank; down; 8.*2
  78: 
  79:         bit     $uleft,_dir(r0)
  80:         bne     1f
  81:         cmp     _board-18.(r0),$1               / pawn?
  82:         beq     2f
  83: 1:
  84:         bit     $uright,_dir(r0)
  85:         bne     1f
  86:         cmp     _board-14.(r0),$1
  87:         bne     1f
  88: 2:
  89:         clr     r0
  90:         rts     pc
  91: 1:
  92:         mov     $1,r0
  93:         rts     pc
  94: 
  95: badiag:
  96:         mov     r0,r1
  97:         mov     (r5)+,r2
  98:         mov     (r5)+,r3
  99:         bit     r2,_dir(r1)
 100:         bne     1f
 101:         add     r3,r1
 102:         mov     _board(r1),r4
 103:         beq     2f
 104:         cmp     r4,$3
 105:         beq     9f
 106:         cmp     r4,$5
 107:         beq     9f
 108:         cmp     r4,$6
 109:         beq     9f
 110: 1:
 111:         rts     r5
 112: 2:
 113:         bit     r2,_dir(r1)
 114:         bne     2f
 115:         add     r3,r1
 116:         mov     _board(r1),r4
 117:         beq     2b
 118:         cmp     r4,$3
 119:         beq     9f
 120:         cmp     r4,$5
 121:         beq     9f
 122: 2:
 123:         rts     r5
 124: 
 125: barank:
 126:         mov     r0,r1
 127:         mov     (r5)+,r2
 128:         mov     (r5)+,r3
 129:         bit     r2,_dir(r1)
 130:         bne     1f
 131:         add     r3,r1
 132:         mov     _board(r1),r4
 133:         beq     2f
 134:         cmp     r4,$4
 135:         beq     9f
 136:         cmp     r4,$5
 137:         beq     9f
 138:         cmp     r4,$6
 139:         beq     9f
 140: 1:
 141:         rts     r5
 142: 2:
 143:         bit     r2,_dir(r1)
 144:         bne     2f
 145:         add     r3,r1
 146:         mov     _board(r1),r4
 147:         beq     2b
 148:         cmp     r4,$4
 149:         beq     9f
 150:         cmp     r4,$5
 151:         beq     9f
 152: 2:
 153:         rts     r5
 154: 
 155: 9:
 156:         mov     (sp)+,r5
 157:         clr     r0
 158:         rts     pc
 159: 
 160: _wattack:
 161:         mov     2(sp),r0
 162:         asl     r0
 163:         mov     _dir(r0),r1
 164:         mov     $-2,r2
 165:         bit     $u2r1,r1
 166:         bne     1f
 167:         cmp     _board+[-15.*2](r0),r2
 168:         beq     2f
 169: 1:
 170:         bit     $u1r2,r1
 171:         bne     1f
 172:         cmp     _board+[-6.*2](r0),r2
 173:         beq     2f
 174: 1:
 175:         bit     $d1r2,r1
 176:         bne     1f
 177:         cmp     _board+[+10.*2](r0),r2
 178:         beq     2f
 179: 1:
 180:         bit     $d2r1,r1
 181:         bne     1f
 182:         cmp     _board+[+17.*2](r0),r2
 183:         beq     2f
 184: 1:
 185:         bit     $d2l1,r1
 186:         bne     1f
 187:         cmp     _board+[+15.*2](r0),r2
 188:         beq     2f
 189: 1:
 190:         bit     $d1l2,r1
 191:         bne     1f
 192:         cmp     _board+[+6.*2](r0),r2
 193:         beq     2f
 194: 1:
 195:         bit     $u1l2,r1
 196:         bne     1f
 197:         cmp     _board+[-10.*2](r0),r2
 198:         beq     2f
 199: 1:
 200:         bit     $u2l1,r1
 201:         bne     1f
 202:         cmp     _board+[-17.*2](r0),r2
 203:         beq     2f
 204: 1:
 205:         jsr     r5,wadiag; uleft; -9.*2
 206:         jsr     r5,wadiag; uright; -7.*2
 207:         jsr     r5,wadiag; dleft; 7.*2
 208:         jsr     r5,wadiag; dright; 9.*2
 209:         jsr     r5,warank; up; -8.*2
 210:         jsr     r5,warank; left; -1.*2
 211:         jsr     r5,warank; right; 1.*2
 212:         jsr     r5,warank; down; 8.*2
 213: 
 214:         bit     $dleft,_dir(r0)
 215:         bne     1f
 216:         cmp     _board+14.(r0),$-1              / pawn?
 217:         beq     2f
 218: 1:
 219:         bit     $dright,_dir(r0)
 220:         bne     1f
 221:         cmp     _board+18.(r0),$-1
 222:         bne     1f
 223: 2:
 224:         clr     r0
 225:         rts     pc
 226: 1:
 227:         mov     $1,r0
 228:         rts     pc
 229: 
 230: wadiag:
 231:         mov     r0,r1
 232:         mov     (r5)+,r2
 233:         mov     (r5)+,r3
 234:         bit     r2,_dir(r1)
 235:         bne     1f
 236:         add     r3,r1
 237:         mov     _board(r1),r4
 238:         beq     2f
 239:         cmp     r4,$-3
 240:         beq     9f
 241:         cmp     r4,$-5
 242:         beq     9f
 243:         cmp     r4,$-6
 244:         beq     9f
 245: 1:
 246:         rts     r5
 247: 2:
 248:         bit     r2,_dir(r1)
 249:         bne     2f
 250:         add     r3,r1
 251:         mov     _board(r1),r4
 252:         beq     2b
 253:         cmp     r4,$-3
 254:         beq     9f
 255:         cmp     r4,$-5
 256:         beq     9f
 257: 2:
 258:         rts     r5
 259: 
 260: warank:
 261:         mov     r0,r1
 262:         mov     (r5)+,r2
 263:         mov     (r5)+,r3
 264:         bit     r2,_dir(r1)
 265:         bne     1f
 266:         add     r3,r1
 267:         mov     _board(r1),r4
 268:         beq     2f
 269:         cmp     r4,$-4
 270:         beq     9f
 271:         cmp     r4,$-5
 272:         beq     9f
 273:         cmp     r4,$-6
 274:         beq     9f
 275: 1:
 276:         rts     r5
 277: 2:
 278:         bit     r2,_dir(r1)
 279:         bne     2f
 280:         add     r3,r1
 281:         mov     _board(r1),r4
 282:         beq     2b
 283:         cmp     r4,$-4
 284:         beq     9f
 285:         cmp     r4,$-5
 286:         beq     9f
 287: 2:
 288:         rts     r5
 289: 
 290: 9:
 291:         mov     (sp)+,r5
 292:         clr     r0
 293:         rts     pc

Defined functions

badiag defined in line 95; used 4 times
barank defined in line 125; used 4 times
d1l2 defined in line 21; used 2 times
d1r2 defined in line 18; used 2 times
d2l1 defined in line 20; used 2 times
d2r1 defined in line 19; used 2 times
dleft defined in line 10; used 3 times
down defined in line 15; used 2 times
dright defined in line 11; used 3 times
left defined in line 12; used 2 times
right defined in line 13; used 2 times
u1l2 defined in line 22; used 2 times
u1r2 defined in line 17; used 2 times
u2l1 defined in line 23; used 2 times
u2r1 defined in line 16; used 2 times
uleft defined in line 8; used 3 times
up defined in line 14; used 2 times
uright defined in line 9; used 3 times
wadiag defined in line 230; used 4 times
warank defined in line 260; used 4 times
Last modified: 1979-05-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2598
Valid CSS Valid XHTML 1.0 Strict