* 4 by 3 loader
* written by Bill McDaniel in IBM 1130 Assembler
* ~ 1972
*
start equ   *
      ld    b818       form 1703
      sra   3          -
      sto   reset+1    -
*
xr3   ld    d2808      form 1404
      sra   1          -
      sto   iread+1    -
      mdx   down
*
count dc    0
iread dc    lz         addr of level 0 interrupt routine
d2808 dc    /2808      --> 1404
read  dc    word
      dc    /12        --> 1200
reset dc    l4         addr of level 4 interrupt routine
b818  dc    /b818      --> 1703
word  dc
      dc
*
down  ld    read+1   form /1200
      sla   8        -
      sto   read+1   -
*
      ld    xr3      convert 0xC005 to form 0x0050 (which is 80d) 
      sla   4        -
      sto   xr3      -
*
      ld    dc1      0001
      sla   8        0100
      or    h18c0    19c0
      sto   rte1
*
      eor   h683c    71fc
      sto   mdx1
*
      eor   h10ec    6110
      sto   ldx1
*
      a     h00f4    6204
      sto   ldx2
*
      eor   h78c4    1a00
      sto   rte2
*
      eor   h68c4    7204
      sto   mdx2
*
      a     h00fd    7301
      sto   mdx3
*
      eor   ha001    d300
      sto   sto3
begin xio   iread    start card moving
      mdx   h10ec    v
*
*     interrupt level 4 routine
*
l4    dc    *-*
      xio   reset
      bosc  z-+      turn off highest level of priority interrupt & skip 1
kount dc    10       10 cards
      ld    kount    kount = kount - 1
      s     dc1      -
      sto   kount    -
      bsc   z
      mdx   begin
      mdx   cl79+1   goto word 80
*
*     interrupt level 0 routine
*
lz    dc    *-*
      xio   read     read 1 column
      ldd   word
h18c0 dc    /18c0    ->19c0    rte    1
rte1  equ   h18c0
*
ha001 dc    /a001    ->d300    sto  3
sto3  equ   ha001
*
h78c4 dc    /78c4    ->1a00    rte    2
rte2  equ   h78c4
      sto   word
      ld    count    check for 0  OR  1 2 or 3
      rte   2        -
      sla   10       -
      rte   30       -
      bsc   z        -
*
h00fd dc    /00fd    ->7301   mdx  3  1
mdx3  equ   h00fd
      ld    count    count++
      a     dc1      -
      sto   count    -
h6804 dc    /6804    ->7204   mdx  2  4
mdx2  equ   h6804
*
h6830 dc    /6830    ->72fc   mdx  1  -4
mdx1  equ   h6830
      mdx   *+2
*
h10ec dc    /10ec    ->6110   ldx  1  16
ldx1  equ   h10ec
h00f4 dc    /00f4    ->6204   ldx  2  4
ldx2  equ   h00f4
*
      xio   reset
      bosc  z-+      turn off highest level of priority interrupt & skip 1
dc1   dc    1
      wait
*
      dc
      dc
cl79  dc


