1: / generate moves
   2: 
   3: .globl  _bgen
   4: 
   5: .globl  _pval, _board, _dir
   6: .globl  _flag, _lmp, _bkpos
   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: _bgen:
  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:         ble     1f
  37:         asl     r0
  38:         jmp     *2f-2(r0)
  39: 
  40: 2:
  41:         pawn
  42:         knight
  43:         bishop
  44:         rook
  45:         queen
  46:         king
  47: 
  48: pawn:
  49:         bit     $dleft,(r4)
  50:         bne     2f
  51:         tst     2*7.(r3)
  52:         bge     3f
  53:         jsr     r5,btry; 0; 7.*2
  54: 3:
  55:         mov     r1,r0
  56:         add     $7,r0
  57:         cmp     r0,_eppos
  58:         bne     2f
  59:         jsr     r5,btry; 0; -1*2
  60: 2:
  61:         bit     $dright,(r4)
  62:         bne     2f
  63:         tst     9.*2(r3)
  64:         bge     3f
  65:         jsr     r5,btry; 0; 2*9.
  66: 3:
  67:         mov     r1,r0
  68:         add     $9,r0
  69:         cmp     r0,_eppos
  70:         bne     2f
  71:         jsr     r5,btry; 0; 2*1
  72: 2:
  73:         tst     2*8.(r3)
  74:         bne     1f
  75:         jsr     r5,btry; 0; 2*8.
  76:         bit     $rank7,(r4)
  77:         beq     1f
  78:         tst     2*16.(r3)
  79:         bne     1f
  80:         jsr     r5,btry; 0; 16.*2
  81:         br      1f
  82: 
  83: knight:
  84:         jsr     r5,btry; u2r1; -15.*2
  85:         jsr     r5,btry; u1r2; -6.*2
  86:         jsr     r5,btry; d1r2; 10.*2
  87:         jsr     r5,btry; d2r1; 17.*2
  88:         jsr     r5,btry; d2l1; 15.*2
  89:         jsr     r5,btry; d1l2; 6.*2
  90:         jsr     r5,btry; u1l2; -10.*2
  91:         jsr     r5,btry; 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,bslide; uleft; -9.*2
 104:         jsr     r5,bslide; uright; -7.*2
 105:         jsr     r5,bslide; dleft; 7.*2
 106:         jsr     r5,bslide; dright; 9.*2
 107:         br      1b
 108: 
 109: rook:
 110:         jsr     r5,bslide; up; -8.*2
 111:         jsr     r5,bslide; down; 8.*2
 112:         jsr     r5,bslide; left; -1.*2.
 113:         jsr     r5,bslide; right; 1.*2
 114:         br      1b
 115: queen:
 116:         jsr     r5,bslide; uleft; -9.*2
 117:         jsr     r5,bslide; uright; -7.*2
 118:         jsr     r5,bslide; dleft; 7.*2
 119:         jsr     r5,bslide; dright; 9.*2
 120:         jsr     r5,bslide; up; -8.*2
 121:         jsr     r5,bslide; left; -1.*2
 122:         jsr     r5,bslide; right; 1.*2
 123:         jsr     r5,bslide; down; 8.*2
 124:         br      1b
 125: 
 126: king:
 127:         jsr     r5,btry; uleft; -9.*2
 128:         jsr     r5,btry; uright; -7.*2
 129:         jsr     r5,btry; dleft; 7.*2
 130:         jsr     r5,btry; dright; 9.*2
 131:         jsr     r5,btry; up; -8.*2
 132:         jsr     r5,btry; left; -1.*2
 133:         jsr     r5,btry; right; 1.*2
 134:         jsr     r5,btry; down; 8.*2
 135:         br      1b
 136: 
 137: btry:
 138:         bit     (r5)+,(r4)
 139:         bne     1f
 140:         mov     r3,r0
 141:         add     (r5),r0
 142:         mov     (r0),r0
 143:         bgt     1f
 144:         asl     r0
 145:         mov     _pval+12.(r0),(r2)
 146:         sub     _value,(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: bslide:
 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:         bgt     1f
 167:         blt     2f
 168:         clr     (r2)
 169:         sub     _value,(r2)+
 170:         mov     r3,r0
 171:         sub     $_board,r0
 172:         asr     r0
 173:         movb    r0,(r2)+
 174:         movb    r1,(r2)+
 175:         tst     -(r5)
 176:         br      1b
 177: 2:
 178:         asl     r0
 179:         mov     _pval+12.(r0),(r2)
 180:         sub     _value,(r2)+
 181:         mov     r3,r0
 182:         sub     $_board,r0
 183:         asr     r0
 184:         movb    r0,(r2)+
 185:         movb    r1,(r2)+
 186: 1:
 187:         tst     (r5)+
 188:         mov     (sp)+,r3
 189:         mov     (sp)+,r4
 190:         rts     r5

Defined functions

bishop defined in line 102; used 1 times
  • in line 43
bslide defined in line 157; used 16 times
btry defined in line 137; used 22 times
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 4 times
down defined in line 17; used 3 times
dright defined in line 13; used 4 times
king defined in line 126; used 1 times
  • in line 46
knight defined in line 83; used 1 times
  • in line 42
left defined in line 14; used 3 times
pawn defined in line 48; used 1 times
  • in line 41
queen defined in line 115; used 1 times
  • in line 45
rank2 defined in line 26; never used
rank7 defined in line 27; used 1 times
  • in line 76
right defined in line 15; used 3 times
rook defined in line 109; used 1 times
  • in line 44
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 3 times
up defined in line 16; used 3 times
uright defined in line 11; used 3 times
Last modified: 1979-05-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2393
Valid CSS Valid XHTML 1.0 Strict