1: / generate moves
   2: 
   3: .globl  _wgen
   4: 
   5: .globl  _pval, _board, _dir
   6: .globl  _flag, _lmp, _wkpos
   7: .globl  _eppos
   8: .globl  _value
   9: 
  10: uleft   = 04040
  11: uright  = 04004
  12: dleft   = 00440
  13: dright  = 00404
  14: left    = 00040
  15: right   = 00004
  16: up      = 04000
  17: down    = 00400
  18: u2r1    = 06004
  19: u1r2    = 04006
  20: d1r2    = 00406
  21: d2r1    = 00604
  22: d2l1    = 00640
  23: d1l2    = 00460
  24: u1l2    = 04060
  25: u2l1    = 06040
  26: rank2   = 00200
  27: rank7   = 02000
  28: 
  29: _wgen:
  30:         mov     $_dir+126.,r4
  31:         mov     $_board+126.,r3
  32:         mov     _lmp,r2
  33:         mov     $63.,r1
  34: 0:
  35:         mov     (r3),r0
  36:         bge     1f
  37:         asl     r0
  38:         jmp     *2f(r0)
  39: 
  40:         king
  41:         queen
  42:         rook
  43:         bishop
  44:         knight
  45:         pawn
  46: 2:
  47: 
  48: pawn:
  49:         bit     $uleft,(r4)
  50:         bne     2f
  51:         tst     -2*9.(r3)
  52:         ble     3f
  53:         jsr     r5,wtry; 0; -9.*2
  54: 3:
  55:         mov     r1,r0
  56:         sub     $9,r0
  57:         cmp     r0,_eppos
  58:         bne     2f
  59:         jsr     r5,wtry; 0; -1*2
  60: 2:
  61:         bit     $uright,(r4)
  62:         bne     2f
  63:         tst     -7.*2(r3)
  64:         ble     3f
  65:         jsr     r5,wtry; 0; -7.*2
  66: 3:
  67:         mov     r1,r0
  68:         sub     $7,r0
  69:         cmp     r0,_eppos
  70:         bne     2f
  71:         jsr     r5,wtry; 0; 2*1
  72: 2:
  73:         tst     -2*8.(r3)
  74:         bne     1f
  75:         jsr     r5,wtry; 0; -2*8.
  76:         bit     $rank2,(r4)
  77:         beq     1f
  78:         tst     -2*16.(r3)
  79:         bne     1f
  80:         jsr     r5,wtry; 0; -16.*2
  81:         br      1f
  82: 
  83: knight:
  84:         jsr     r5,wtry; u2r1; -15.*2
  85:         jsr     r5,wtry; u1r2; -6.*2
  86:         jsr     r5,wtry; d1r2; 10.*2
  87:         jsr     r5,wtry; d2r1; 17.*2
  88:         jsr     r5,wtry; d2l1; 15.*2
  89:         jsr     r5,wtry; d1l2; 6.*2
  90:         jsr     r5,wtry; u1l2; -10.*2
  91:         jsr     r5,wtry; u2l1; -17.*2
  92:         br      1f
  93: 
  94: 
  95: 1:
  96:         cmp     -(r4),-(r3)
  97:         dec     r1
  98:         bpl     0b
  99:         mov     r2,_lmp
 100:         rts     pc
 101: 
 102: bishop:
 103:         jsr     r5,wslide; uleft; -9.*2
 104:         jsr     r5,wslide; uright; -7.*2
 105:         jsr     r5,wslide; dleft; 7.*2
 106:         jsr     r5,wslide; dright; 9.*2
 107:         br      1b
 108: 
 109: rook:
 110:         jsr     r5,wslide; up; -8.*2
 111:         jsr     r5,wslide; down; 8.*2
 112:         jsr     r5,wslide; left; -1.*2.
 113:         jsr     r5,wslide; right; 1.*2
 114:         br      1b
 115: queen:
 116:         jsr     r5,wslide; uleft; -9.*2
 117:         jsr     r5,wslide; uright; -7.*2
 118:         jsr     r5,wslide; dleft; 7.*2
 119:         jsr     r5,wslide; dright; 9.*2
 120:         jsr     r5,wslide; up; -8.*2
 121:         jsr     r5,wslide; left; -1.*2
 122:         jsr     r5,wslide; right; 1.*2
 123:         jsr     r5,wslide; down; 8.*2
 124:         br      1b
 125: 
 126: king:
 127:         jsr     r5,wtry; uleft; -9.*2
 128:         jsr     r5,wtry; uright; -7.*2
 129:         jsr     r5,wtry; dleft; 7.*2
 130:         jsr     r5,wtry; dright; 9.*2
 131:         jsr     r5,wtry; up; -8.*2
 132:         jsr     r5,wtry; left; -1.*2
 133:         jsr     r5,wtry; right; 1.*2
 134:         jsr     r5,wtry; down; 8.*2
 135:         br      1b
 136: 
 137: wtry:
 138:         bit     (r5)+,(r4)
 139:         bne     1f
 140:         mov     r3,r0
 141:         add     (r5),r0
 142:         mov     (r0),r0
 143:         blt     1f
 144:         asl     r0
 145:         mov     _value,(r2)
 146:         sub     _pval+12.(r0),(r2)+
 147:         mov     (r5)+,r0
 148:         asr     r0
 149:         add     r1,r0
 150:         movb    r0,(r2)+
 151:         movb    r1,(r2)+
 152:         rts     r5
 153: 1:
 154:         tst     (r5)+
 155:         rts     r5
 156: 
 157: wslide:
 158:         mov     r4,-(sp)
 159:         mov     r3,-(sp)
 160: 1:
 161:         bit     (r5)+,(r4)
 162:         bne     1f
 163:         add     (r5),r3
 164:         add     (r5),r4
 165:         mov     (r3),r0
 166:         blt     1f
 167:         bgt     2f
 168:         mov     _value,(r2)+
 169:         mov     r3,r0
 170:         sub     $_board,r0
 171:         asr     r0
 172:         movb    r0,(r2)+
 173:         movb    r1,(r2)+
 174:         tst     -(r5)
 175:         br      1b
 176: 2:
 177:         asl     r0
 178:         mov     _value,(r2)
 179:         sub     _pval+12.(r0),(r2)+
 180:         mov     r3,r0
 181:         sub     $_board,r0
 182:         asr     r0
 183:         movb    r0,(r2)+
 184:         movb    r1,(r2)+
 185: 1:
 186:         tst     (r5)+
 187:         mov     (sp)+,r3
 188:         mov     (sp)+,r4
 189:         rts     r5

Defined functions

bishop defined in line 102; used 1 times
  • in line 43
d1l2 defined in line 23; used 1 times
  • in line 89
d1r2 defined in line 20; used 1 times
  • in line 86
d2l1 defined in line 22; used 1 times
  • in line 88
d2r1 defined in line 21; used 1 times
  • in line 87
dleft defined in line 12; used 3 times
down defined in line 17; used 3 times
dright defined in line 13; used 3 times
king defined in line 126; used 1 times
  • in line 40
knight defined in line 83; used 1 times
  • in line 44
left defined in line 14; used 3 times
pawn defined in line 48; used 1 times
  • in line 45
queen defined in line 115; used 1 times
  • in line 41
rank2 defined in line 26; used 1 times
  • in line 76
rank7 defined in line 27; never used
right defined in line 15; used 3 times
rook defined in line 109; used 1 times
  • in line 42
u1l2 defined in line 24; used 1 times
  • in line 90
u1r2 defined in line 19; used 1 times
  • in line 85
u2l1 defined in line 25; used 1 times
  • in line 91
u2r1 defined in line 18; used 1 times
  • in line 84
uleft defined in line 10; used 4 times
up defined in line 16; used 3 times
uright defined in line 11; used 4 times
wslide defined in line 157; used 16 times
wtry defined in line 137; used 22 times
Last modified: 1979-05-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2636
Valid CSS Valid XHTML 1.0 Strict