mt.inf     equ      $00                  trap #1
mt.free    equ      $06  
mt.alchp   equ      $18   
mt.rechp   equ      $19                       
mt.liod    equ      $20
io.open    equ      $01                  trap #2
io.close   equ      $02
io.fbyte   equ      $01                  trap #3
io.fstrg   equ      $03
io.sbyte   equ      $05
io.sstrg   equ      $07
sd.extop   equ      $09
sd.wdef    equ      $0d
sd.setin   equ      $29
fs.posab   equ      $42
fs.posre   equ      $43
fs.headr   equ      $47
fs.load    equ      $48
iop_pinf   equ      $70
iop.rptr   equ      $71          
mm.alchp   equ      $c0                  vectored utilities  
mm.rechp   equ      $c2
ut.scr     equ      $c8
ut.mint    equ      $ce
ut.mtext   equ      $d0
bp.init    equ      $110
ca.gtint   equ      $112
ca.gtstr   equ      $116
ca.gtlin   equ      $118 
io.name    equ      $122
bv.chrix   equ      $11a
*
trk        equ      $00
wrd        equ      $10
pad        equ      $20
blk        equ      $30
pol        equ      $90                  polygon not supported
inf        equ      $80
end        equ      $f0
lab_mask   equ      $0fff
lib_mask   equ      $7fff
comp_mask  equ      $8000
ncomp_mask equ      $7fff
type_mask  equ      $f0
lay_mask   equ      $3f
via_mask   equ      $c0
size_mask  equ      $3f                  label text size mask  
ctrl_mask  equ      $c0                  label text control mask
mbit       equ      7                    mirror bit
obit       equ      6                    orientation bit  
inv_lay    equ      $3f
lsw_mask   equ      $80                  label switch bit mask
nlsw_mask  equ      $7f                  not label switch bit mask
bga_len    equ      $02                  minimum x,y size of ball grid array
lab_vert   equ      35                   label vertical spacing
*
mem_ptr    equ      24                   Current MEM pointer 
buff_id    equ      28                   Word ID of buffer
chan_link  equ      30                   Channel list pointer
buff_addr  equ      34                   Buffer start address
buff_flag  equ      38                   Word persistence flag                                                               
*
start      tst.w    d1
           beq.s    auto_scr
           lea      par,a4
           move.w   d1,300(a4)           window width
           move.w   d1,186(a4)           screen width
           move.w   d2,302(a4)           window height
           move.w   d2,188(a4)           screen height
           move.l   d3,18(a4)            screen address
           cmpi.w   #8,258(a4)
           bne.s    ntmde81
           lsr.w    #1,d1
ntmde81    move.w   d1,296(a4)           screen width in pixels
auto_scr   move.w   bp.init,a0           bp.init vector
           lea.l    define,a1
           jsr      (a0)
*
           lea.l    serio_ptrs,a0        set up SERIO linkage
           lea.l    io_ready,a2     
           move.l   a2,(a0)+
           lea.l    fetch_byte,a2
           move.l   a2,(a0)+
           lea.l    send_byte,a2    
           move.l   a2,(a0)+
           lea.l    io_pointer,a0        set up device linkage
           lea.l    io_code,a2
           move.l   a2,(a0)+
           lea.l    open_code,a2
           move.l   a2,(a0)+
           lea.l    close_code,a2
           move.l   a2,(a0)+
           lea.l    linkage,a0           link the MEM device
           moveq    #mt.liod,d0
           trap     #1          
           rts                           return D0 to caller   
*           
linkage    dc.l    0                     link to next device
io_pointer dc.l    0                     pointer to I/O code
           dc.l    0                     pointer to OPEN code
           dc.l    0                     pointer to CLOSE code
*
buff_ptr   dc.l    0                     start of buffer list
chan_ptr   dc.l    0                     start of channel list
*
* code to handle trap #3 calls: io.pend, fbyte, fline,
* fstrg, sbyte, sstrg, extop, posab, posre, load, save
*
io_code    cmp.b   #9,d0                 call to fs.extop?
           beq     vector_a2
           move.l  mem_ptr(a0),a5        a5 -> mem address
           cmp.b   #fs.posab,d0          call to fs.posab?
           beq.s   set_abspos
           cmp.b   #fs.posre,d0          call to fs.posre?
           beq.s   set_relpos
           move.w  234,a2                use io.serio vector
           jsr     (a2)                  do other serial i/o
serio_ptrs dc.l    0                     pointer for io.pend
           dc.l    0                     pointer for io.fetch
           dc.l    0                     pointer for io.send
           rts                           return from serio
*
set_abspos tst.l   d1                    negative parameter?
           bpl.s   use_posn
           move.l  buff_addr(a0),d1      get default base
use_posn   move.l  d1,a5                 set position
           bra.s   set_memptr
set_relpos adda.l  d1,a5                 offset position
           move.l  a5,d1                 return new value
           bra.s   set_memptr
send_byte  move.b  d1,(a5)+
           bra.s   set_memptr
fetch_byte move.b  (a5)+,d1
set_memptr move.l  a5,mem_ptr(a0)        reset mem pointer
io_ready   moveq   #0,d0
           rts
*
* code to handle trap #2 calls: open and close
*
open_code  subq.l  #6,a7                 make space on stack
           move.l  a7,a3                 a3 -> parameters
           move.w  io.name,a2            use io.name vector
           jsr     (a2)
           bra.s   exit_open             name faulty
           bra.s   exit_open             parameters faulty
           bra.s   open_ok               name parsed ok
           dc.w    3                     length of name
           dc.b    'MEM'
           dc.w    3                     max. 3 parameters
           dc.w    -1,-1                 buffer number
           dc.w    ' _',-1               buffer size
           dc.w    2,'PT'                permanent/temporary
*
open_ok    move.l  a3,a5                 a5 -> parameters
           moveq   #40,d1                40 bytes needed
           move.w  mm.alchp,a2           mm.alchp vector
           jsr     (a2)                  allocate memory
           beq.s   do_buffers            go on if ram permits
exit_open  addq.l  #6,a7                 deallocate stack space
           tst.l   d0                    error code is in D0
           rts                      
*
do_buffers move.w  (a5),d7               get buffer id
           move.w  d7,buff_id(a0)        keep buffer id
           bmi.s   exit_open             no buffer, exit
           move.w  4(a5),buff_flag(a0)   keep p/t flag
           move.l  a0,a4                 save channel base
           lea.l   buff_ptr,a3           search buffer list
           bsr.s   scanner               does the buffer exist?
           beq.s   new_one               no it doesn't
           lea.l   6(a3),a0              a0 -> start of buffer
           moveq   #0,d0                 opened without errors 
           bra.s   set_addr              tell the channel
*
new_one    move.w  2(a5),d1              was a size specified?
           bmi.s   no_size               if not, complain!
           addq.w  #8,d1                 allow for a header
           ext.l   d1                    d1 = total buffer size
           moveq   #0,d2                 permanent allocation
           moveq   #mt.alchp,d0          mt.alchp key
           trap    #1                    try to allocate memory
           tst.l   d0                    did that work?
           bne.s   no_room               if not, complain
           move.l  a0,d2                 keep buffer base
           move.w  d7,(a0)+              record buffer id
           lea.l   buff_ptr,a3           extend the buffer list
           move.l  (a3),(a0)+       
           move.l  d2,(a3)               start with new buffer
           sub.w   #24,d1                ignore header bytes
           move.w  d1,(a0)+              store buffer length
set_addr   move.l  a0,buff_addr(a4)      record buffer start
           move.l  a0,mem_ptr(a4)        initialise pointer
           lea.l   chan_ptr,a3           extend channel list
           move.l  (a3),chan_link(a4)
           lea.l   buff_id(a4),a2
           move.l  a2,(a3)
           move.l  a4,a0                 a0 -> channel block
           bra.s   exit_open
*
no_room    move.l  a4,a0                 retrieve channel
           bsr.s   lose_chan
           moveq   #-3,d0                no room for the buffer
           bra.s   exit_open             report out of memory
no_size    bsr.s   lose_chan
           moveq   #-15,d0               size needed but absent
           bra.s   exit_open             report bad parameter
*
scanner    move.l  a3,a2                 find the id in d7.w
           move.l  (a2),d0               try the next link
           beq.s   not_found             no such luck, quit
           move.l  d0,a3                 a3 -> buffer id.w
           cmp.w   (a3)+,d7              is it what we want?         
           bne.s   scanner               if no, try the next
           tst.l   d0                    yes, return a2 & a3   
not_found  rts                           return d0=0 if absent
*
close_code lea.l   buff_id(a0),a4        get list position
           lea.l   chan_ptr,a3           purge channel list
           bsr.s   purge_list
           move.w  (a4),d7               is a buffer in use?
           bmi.s   lose_chan             no, just zap channel
           subq.w  #1,buff_flag(a0)      is buffer permanent?
           beq.s   lose_chan             yes, just zap channel
           lea.l   chan_ptr,a3           is the buffer busy?
           bsr.s   scanner               search channel list
           bne.s   lose_chan             if busy keep buffer
           move.l  buff_addr(a0),a4      find buffer
           subq.l  #8,a4                 include header
           lea.l   buff_ptr,a3           scan buffer list
           bsr.s   purge_list            un-link buffer
           exg     a4,a0                 swap pointers over
           moveq   #mt.rechp,d0          mt.rechp key
           trap    #1                    deallocate buffer
           move.l  a4,a0                 restore channel base
lose_chan  move.w  mm.rechp,a2           mm.rechp vector 
vector_a2  jmp     (a2)                  deallocate channel
*
purge_list move.l  a3,a2                 remove link to (a4) 
           move.l  (a2),d0          
           beq.s   bizarre               no more - abort!
           move.l  d0,a3                 a3 -> buffer id.w
           addq.l  #2,a3                 skip buffer id
           cmp.l   a4,d0                 have we found it?
           bne.s   purge_list            no, look further
           move.l  (a3),(a2)             de-list the entry
bizarre    rts
*
exit01     moveq    #0,d0
           rts
*
startup    lea      par,a4
           tst.l    18(a4)
           bne      allocscr             screen parameters already present
           move.l   #0,a0
           move.w   ut.scr,a0            *****
           lea.l    win1,a1              * initialise window
           jsr      (a0)                 *
           move.l   a0,86(a4)            * store channel id
*
scr_x_size moveq    #sd.wdef,d0
           moveq    #0,d1                border colour
           moveq    #0,d2                border width
           moveq    #-1,d3               timeout
           lea      scr_size,a1
           addi.w   #2,(a1)              increment window width
           trap     #3
           tst.w    d0
           beq.s    scr_x_size
           lea      scr_size,a1
           subi.w   #2,(a1)
scr_y_size
           moveq    #sd.wdef,d0
           moveq    #0,d1
           moveq    #0,d2
           moveq    #-1,d3
           lea      scr_size,a1
           addi.w   #1,2(a1)             increment window height
           trap     #3
           tst.w    d0
           beq.s    scr_y_size
           lea      scr_size,a1
           subi.w   #1,2(a1)
*
           move.w   (a1),d0
           lea      par,a4
           move.w   d0,186(a4)           store screen width
           move.w   d0,300(a4)           store window width
           move.w   2(a1),188(a4)        store screen height
           move.w   2(a1),302(a4)        store window height
           cmpi.w   #8,258(a4)
           bne.s    ntmde82
           lsr.w    #1,d0
ntmde82    move.w   d0,296(a4)           store screen width in pixels
*
           move.l   86(a4),a0            restore channel id
           moveq    #sd.extop,d0         trap code
           moveq    #-1,d3               timeout
           lea      extop,a2             routine to call via sd_extop
           trap     #3
           tst.l    d0
           bne.s    badcall              a1 = rubbish
           lea      par,a4
           move.l   a1,18(a4)
*
           move.l   86(a4),a0            restore channel id
           moveq    #io.close,d0
           trap     #2                   close channel     
*
allocscr   move.w   186(a4),d1           d0 = window width
           muls     188(a4),d1           window height
           asr.l    #2,d1
           tst.b    263(a4)              check for hi colour
           beq.s    nothicol
           asl.l    #3,d1                hi colour needs 8 times more memory 
nothicol   moveq   #0,d2                 permanent allocation
           moveq   #mt.alchp,d0          mt.alchp key
           trap    #1                    try to allocate memory
           tst.l   d0                    did that work?
           bne.s   badcall               if not, complain
           move.l  a0,150(a4)
*
badcall    rts
*
extop      move.l   $32(a0),a1           screen base
           moveq    #0,d0                no errors
           rts
*
badpar1    moveq    #-15,d0
           rts
*
window     move.w   ca.gtlin,a0
           jsr      (a0)
           bne      exit01
           tst.w    d3
           beq.s    nopars
           cmpi.w   #4,d3
           bne.s    badpar1
           lea      par,a4
           tst.w    186(a4)
           beq.s    badpar1
           tst.w    188(a4)
           beq.s    badpar1
           move.w   2(a6,a1.l),d0        width
           move.w   6(a6,a1.l),d1        height
           move.w   10(a6,a1.l),d2       x offset
           move.w   14(a6,a1.l),d3       y offset
           cmp.w    186(a4),d0
           bgt.s    badpar1              window too wide
           cmp.w    188(a4),d1
           bgt.s    badpar1              window too high
           cmp.w    #0,d2
           blt.s    badpar1              window too far left of screen
           cmp.w    #0,d3
           blt.s    badpar1              window too far up screen
           move.w   d0,d4
           add.w    d2,d4
           cmp.w    186(a4),d4
           bgt.s    badpar1              window too far right of screen
           move.w   d1,d4
           add.w    d3,d4
           cmp.w    188(a4),d4
           bgt.s    badpar1              window too far down screen
*
           move.w   d0,300(a4)           save window parameters
           move.w   d1,302(a4)
           move.w   d2,304(a4)
           move.w   d3,306(a4)
           cmpi.w   #8,258(a4)
           bne.s    ntmde83
           lsr.w    #1,d0
           lsr.w    #1,d2
ntmde83    move.w   d0,296(a4)           window width in pixels
           move.w   d2,298(a4)           window offset in pixels    
*
nopars     lea      win1,a2
           move.w   304(a4),d0
           addi.w   #12,d0
           move.w   d0,8(a2)
           move.w   302(a4),d0
           add.w    306(a4),d0
           subi.w   #10,d0
           move.w   d0,10(a2)
*
           lea      win2,a2
           move.w   300(a4),d0
           add.w    304(a4),d0
           subi.w   #144,d0
           move.w   d0,8(a2)
           move.w   302(a4),d0
           add.w    306(a4),d0
           subi.w   #10,d0
           move.w   d0,10(a2)
*
           lea      win3,a2
           move.w   300(a4),d0
           asr.w    #1,d0
           add.w    304(a4),d0
           subi.w   #198,d0
           move.w   d0,8(a2)
           move.w   302(a4),d0
           add.w    306(a4),d0
           subi.w   #10,d0
           move.w   d0,10(a2)
*
           tst.b    260(a4)
           bne.s    windowsop            windows already open
           move.l   #0,a0                *****
           move.w   ut.scr,a0            *
           lea      win1,a1              * open windows
           jsr      (a0)                 *
           move.l   a0,86(a4)            *
           move.l   #0,a0                *
           move.w   ut.scr,a0            *
           lea      win2,a1              *
           jsr      (a0)                 *
           move.l   a0,90(a4)            *
           move.l   #0,a0                *
           move.w   ut.scr,a0            *
           lea      win3,a1              *
           jsr      (a0)                 *
           move.l   a0,158(a4)           *****
           move.b   #1,260(a4)           set windows open flag
           moveq    #0,d0
           rts
*
windowsop  move.l   86(a4),a0            change window parameters
           lea      win1_def,a1
           bsr.s    changewin
           move.l   90(a4),a0
           lea      win2_def,a1
           bsr.s    changewin
           move.l   158(a4),a0
           lea      win3_def,a1
           moveq    #0,d0
           rts
*
changewin  moveq    #sd.wdef,d0
           moveq    #0,d1
           moveq    #0,d2
           moveq    #-1,d3
           trap     #3
           moveq    #7,d1                * set ink needed due to
           bsr      sdsetink             * QDOS bug
           rts
*
shutdown   lea      par,a4
           tst.b    260(a4)
           beq      exit01               windows not open
           moveq    #io.close,d0         *****
           move.l   86(a4),a0            *
           trap     #2                   * close windows
           moveq    #io.close,d0         *
           move.l   90(a4),a0            *
           trap     #2                   *
           moveq    #io.close,d0         *
           move.l   158(a4),a0           *
           trap     #2                   *****
           move.b   #0,260(a4)           windows are closed
           move.l   150(a4),a0
           moveq    #mt.rechp,d0         mt.rechp key
           trap     #1                   deallocate memory
           moveq    #0,d0
           rts                     
*
win1       dc.b     0
           dc.b     0
           dc.b     0
           dc.b     7
win1_def   dc.w     264
           dc.w     10
           dc.w     12
           dc.w     246
*
win2       dc.b     0
           dc.b     0
           dc.b     0
           dc.b     7
win2_def   dc.w     132
           dc.w     10
           dc.w     348
           dc.w     246
*
win3       dc.b     0
           dc.b     0
           dc.b     0
           dc.b     7
win3_def   dc.w     396
           dc.w     10
           dc.w     60
           dc.w     246
*
define     dc.w     228                  seventy four procedures + data space
           dc.w     prt_stat-*           1 (number of procs+number of chars+7)/8
           dc.b     10,'PCBPrtStat'
           dc.w     cursor-*             2
           dc.b     9,'PCBCursor'
           dc.w     scale-*              3
           dc.b     8,'PCBScale'
           dc.w     grid_step-*          4
           dc.b     11,'PCBGridStep'
           dc.w     set_grid-*           5
           dc.b     9,'PCBGridOn'
           dc.w     fast-*               6
           dc.b     7,'PCBFast'
           dc.w     text-*               7
           dc.b     7,'PCBText'
           dc.w     update-*             8
           dc.b     9,'PCBUpdate'
           dc.w     relocate-*           9
           dc.b     11,'PCBRelocate'
           dc.w     origin-*             10
           dc.b     9,'PCBOrigin'
           dc.w     cad_edit-*           11
           dc.b     7,'PCBEdit'
           dc.w     set_edit-*           12
           dc.b     10,'PCBSetEdit'
           dc.w     edit_del-*           13
           dc.b     10,'PCBEditDel'
           dc.w     edit_kill-*          14
           dc.b     11,'PCBEditKill'
           dc.w     edit_move-*          15
           dc.b     11,'PCBEditMove'
           dc.w     edit_make-*          16
           dc.b     11,'PCBEditMake'
           dc.w     edit_copy-*          17
           dc.b     11,'PCBEditCopy'
           dc.w     edit_inv-*           18
           dc.b     10,'PCBEditInv'
           dc.w     edit_lay-*           19
           dc.b     12,'PCBEditLayer'
           dc.w     edit_siz-*           20
           dc.b     11,'PCBEditSize'
           dc.w     edit_lab-*           21
           dc.b     12,'PCBEditLabel'
           dc.w     ed_layexg-*          22
           dc.b     10,'PCBEditExg'
           dc.w     edit_rot-*           23
           dc.b     10,'PCBEditRot'
           dc.w     edit_krump-*         24
           dc.b     12,'PCBEditKrump'
           dc.w     edit_dn-*            25
           dc.b     9,'PCBEditDn'
           dc.w     mask-*               26
           dc.b     7,'PCBMask'
           dc.w     area-*               27
           dc.b     7,'PCBArea'
           dc.w     area_inv-*           28
           dc.b     10,'PCBAreaInv'
           dc.w     area_move-*          29
           dc.b     11,'PCBAreaMove'
           dc.w     area_del-*           30
           dc.b     10,'PCBAreaDel'
           dc.w     area_copy-*          31
           dc.b     11,'PCBAreaCopy'            
           dc.w     area_refid-*         32
           dc.b     12,'PCBAreaRefID'
           dc.w     area_make-*          33
           dc.b     11,'PCBAreaMake'
           dc.w     cad_base-*           34
           dc.b     10,'PCBArtBase'
           dc.w     cad_top-*            35
           dc.b     9,'PCBArtTop'
           dc.w     save_base-*          36
           dc.b     11,'PCBSaveBase'
           dc.w     lib_base-*           37
           dc.b     10,'PCBLibBase'
           dc.w     lib_set-*            38
           dc.b     9,'PCBLibSet'
           dc.w     save_scr-*           39
           dc.b     10,'PCBSaveScr'
           dc.w     load_scr-*           40
           dc.b     10,'PCBLoadScr'
           dc.w     do_it-*              41
           dc.b     7,'PCBDoIt'
           dc.w     undo-*               42
           dc.b     7,'PCBUndo'
           dc.w     swaplib-*            43
           dc.b     10,'PCBSwapLib'
           dc.w     pad_s_l-*            44
           dc.b     9,'PCBSetPad'
           dc.w     track_s_l-*          45
           dc.b     11,'PCBSetTrack'
           dc.w     hdens-*              46
           dc.b     11,'PCBSetHDens'
           dc.w     block_s_l-*          47
           dc.b     11,'PCBSetBlock'
           dc.w     circle_s_l-*         48
           dc.b     12,'PCBSetCircle'
           dc.w     via_s-*              49
           dc.b     9,'PCBSetVia'
           dc.w     set_comp-*           50
           dc.b     10,'PCBSetComp'
           dc.w     do_label-*           51
           dc.b     10,'PCBDoLabel'
           dc.w     set_buff-*           52
           dc.b     10,'PCBSetBuff'
           dc.w     whole-*              53
           dc.b     12,'PCBWholeMode'
           dc.w     m_element-*          54
           dc.b     14,'PCBMoveElement'
           dc.w     type_size-*          55
           dc.b     11,'PCBTypeSize'
           dc.w     type-*               56
           dc.b     7,'PCBType'
           dc.w     cad_load-*           57
           dc.b     7,'PCBLoad'
           dc.w     prt_logo-*           58
           dc.b     10,'PCBPrtLogo'
           dc.w     set_key-*            59
           dc.b     9,'PCBSetKey'
           dc.w     tp_size-*            60
           dc.b     9,'PCBTPSize'
           dc.w     snap-*               61
           dc.b     7,'PCBSnap'
           dc.w     setlab-*             62
           dc.b     9,'PCBSetLab'
           dc.w     blklab_off-*         63
           dc.b     12,'PCBBlkLabOff'
           dc.w     layerexg-*           64
           dc.b     9,'PCBLayerX'
           dc.w     therm_bs-*           65
           dc.b     12,'PCBThermalBS'
           dc.w     layers-*             66
           dc.b     8,'PCBLayer'
           dc.w     shutdown-*           67
           dc.b     11,'PCBShutdown'
           dc.w     startup-*            68
           dc.b     10,'PCBStartup'
           dc.w     window-*             69
           dc.b     9,'PCBWindow'       
           dc.w     lay_zero-*           70
           dc.b     10,'PCBLayZero'
           dc.w     holes-*              71
           dc.b     8,'PCBHoles'                  
           dc.w     dpi-*                72
           dc.b     6,'PCBDPI'
           dc.w     pin_inv-*            73
           dc.b     6,'PCBInv'
           dc.w     lab_dens-*           74
           dc.b     10,'PCBLabDens'
           dc.w     0
           dc.w     50                   twenty four functions
           dc.w     cad_rev-*            1
           dc.b     7,'PCBRev$'
           dc.w     file_len-*           2
           dc.b     13,'PCBFileLength'
           dc.w     search-*             3
           dc.b     9,'PCBSearch'
           dc.w     grid-*               4
           dc.b     7,'PCBGrid'
           dc.w     edit_addr-*          5
           dc.b     11,'PCBEditAddr'
           dc.w     text_addr-*          6
           dc.b     11,'PCBTextAddr'
           dc.w     mask_col-*           7
           dc.b     10,'PCBMaskCol'
           dc.w     lib-*                8
           dc.b     6,'PCBLib'
           dc.w     lib_id-*             9
           dc.b     8,'PCBLibID'
           dc.w     fstat-*              10
           dc.b     8,'PCBFStat'
           dc.w     page_sze-*           11
           dc.b     11,'PCBPageSize'
           dc.w     moden-*              12
           dc.b     8,'PCBModeN'
           dc.w     last_key-*           13
           dc.b     10,'PCBLastKey'
           dc.w     editn-*              14
           dc.b     8,'PCBEditN'
           dc.w     fr_mem-*             15
           dc.b     10,'PCBFreeMem'
           dc.w     read_net-*           16
           dc.b     9,'PCBRdNet$'
           dc.w     lab_mode-*           17
           dc.b     10,'PCBLabMode'
           dc.w     edt_size-*           18
           dc.b     10,'PCBEdtSize'
           dc.w     pad_chk-*            19
           dc.b     9,'PCBPadChk'
           dc.w     lay_chk-*            20
           dc.b     9,'PCBLayChk'
           dc.w     states-*             21
           dc.b     9,'PCBStates'
           dc.w     mousebt-*            22
           dc.b     10,'PCBMouseBt'
           dc.w     qptr-*               23
           dc.b     7,'PCBQPTR'
           dc.w     test_ret-*           24
           dc.b     7,'PCBTest'
           dc.w     0
*
scr_size   dc.w     512
           dc.w     256
           dc.w     0
           dc.w     0
*
message    dc.w     30
           dc.b     '   (C) 1989-2011'
           dc.b     '  Malcolm Lear'
*
cad_rev    lea      revision,a4
           bra      str_ret
revision   dc.w     7
           dc.b     'Ver 124'
*
get_ptr    moveq    #mt.inf,d0
           trap     #1                   a0 = system variables
           move.l   $78(a0),a0           a0 = base of channel table
           move.l   (a0),a0              a0 = channel definition block
           move.l   4(a0),a0             a0 = driver linkage address
           move.w   $20(a0),d0           d0 = x mouse position
           move.w   $22(a0),d1           d1 = y mouse position
*
           sub.w    304(a4),d0           x window offset
           blt.s    off_scr1
           sub.w    306(a4),d1           y window offset
           move.w   d1,d4
           move.w   302(a4),d1           window height
           sub.w    #1,d1
           sub.w    d4,d1                invert y coordinates
           blt.s    off_scr1
*
           move.w   300(a4),d4           check inside window
           cmp.w    d4,d0
           bge.s    off_scr1
           move.w   302(a4),d4
           cmp.w    d4,d1
           bge.s    off_scr1
*
           cmpi.w   #8,258(a4)
           bne.s    ntmde85
           asr.w    #1,d0                is mode 8
*
ntmde85    sub.w    6(a4),d0             find cursor offsets
           sub.w    8(a4),d1
           move.b   10(a4),d4
           tst.b    11(a4)
           beq.s    pscale15
           asr.w    d4,d0
           asr.w    d4,d1
           bra.s    nscale15
pscale15   asl.w    d4,d0
           asl.w    d4,d1
nscale15   move.w   82(a4),d2
           ext.l    d0
           ext.l    d1
           divs     d2,d0
           divs     d2,d1
           muls     d2,d0
           muls     d2,d1
           tst.w    d0
           bne.s    on_scr1              d0 = x offset
           tst.w    d1
           bne.s    on_scr1              d1 = y offset
off_scr1   moveq    #-1,d7
           rts
on_scr1    moveq    #0,d7
exit02     rts
*
line       move.w   ca.gtlin,a0
           jsr      (a0)
           bne      exit02
           moveq    #-15,d0
           cmpi.w   #4,d3
           bne      exit02
           lea      par,a4
           move.w   2(a6,a1.l),36(a4)    x source
           move.w   6(a6,a1.l),38(a4)    y source
           move.w   10(a6,a1.l),40(a4)   x destination
           move.w   14(a6,a1.l),42(a4)   y destination
drwline1   bsr      plot01
           move.w   40(a4),d1            d1 = x destination
           move.w   42(a4),d2            d2 = y destination
           move.l   #$10001,d3
           sub.w    36(a4),d1            subtract x source from destination
           beq      vert_plot
           bgt.s    ok01                 if positive then ok
           neg.w    d1                   invert
           neg.w    d3
ok01       swap     d3
           sub.w    38(a4),d2            subtract y source from destination
           beq      draw_h_v
           bgt.s    ok02                 if positive then ok
           neg.w    d2                   invert
           neg.w    d3
ok02       move.w   d1,d0
           or.w     d2,d0
           beq.s    exit03
           move.l   d3,d4
           move.w   d2,d0
           cmp.w    d1,d0
           bcs.s    ok03
           andi.l   #$0000ffff,d4
           exg      d1,d2
           bra.s    ok04
ok03       andi.l   #$ffff0000,d4
ok04       moveq    #0,d7
           move.w   d1,d7
           subq.w   #1,d7
           move.w   d1,d6
           lsr.w    #1,d6
ok08       move.w   d6,d0
           add.w    d2,d0
           bcs.s    ok05
           cmp.w    d1,d0
           bcs.s    ok06
ok05       sub.w    d1,d0
           move.w   d0,d6
           move.l   d3,d5
           bra.s    ok07
ok06       move.w   d0,d6
           move.l   d4,d5
ok07       add.w    d5,38(a4)
           swap     d5
           add.w    d5,36(a4)
           movem.l  d1-d5,-(a7)
           bsr.s    plot01
           movem.l  (a7)+,d1-d5
no_plot    dbra     d7,ok08
exit03     moveq    #0,d0                no error return
           rts
*
*          print point at x y
*
plot01     move.w   36(a4),d1
           blt.s    exit03
           cmp.w    296(a4),d1           x resolution
           bge.s    exit03
           move.w   38(a4),d1
           blt.s    exit03
           cmp.w    302(a4),d1           y resolution
           bge.s    exit03
*
           move.l   18(a4),a5            a5 = screen addr
           move.w   4(a4),d3             d3 = ink
           tst.b    263(a4)
           bne      hi_plot
           cmpi.w   #4,258(a4)           check screen mode
           beq.s    m4_plot
*
m8_plot    move.w   38(a4),d1            d1 = y
           move.w   302(a4),d4
           sub.w    d4,d1
           not.w    d1                   reverse y coord
           add.w    306(a4),d1
           move.w   186(a4),d4           d4 = screen width
           lsr.w    #2,d4
           muls.w   d4,d1                multiply y by bytes per line
           adda.l   d1,a5                add y position
           move.w   36(a4),d1            d1 = x
           add.w    298(a4),d1
           move.w   d1,d4
           lsr.w    #1,d1                divide x by 2 for word boundry
           andi.l   #$fffe,d1            x = even numbers
           adda.l   d1,a5                add x pos to screen memory
           andi.w   #3,d4                calc x pixel pos in word
           lsl.b    #1,d4                multi pixel pos by 2
           ror.w    d4,d3                rotate pixel data
           cmpi.b   #1,184(a4)
           bgt.s    not_xor1
           eor.w    d3,(a5)
           rts
not_xor1   cmpi.b   #2,184(a4)
           bgt.s    not_or1
           or.w     d3,(a5)
           rts
not_or1    not.w    d3
           and.w    d3,(a5)
           rts
*
m4_plot    andi.w   #$8080,d3            extract red and green bits
           move.w   38(a4),d1
           move.w   302(a4),d4
           sub.w    d4,d1
           not.w    d1
           add.w    306(a4),d1
           move.w   186(a4),d4           d4 = screen width
           lsr.w    #2,d4
           muls.w   d4,d1
           adda.l   d1,a5
           move.w   36(a4),d1
           add.w    298(a4),d1
           move.w   d1,d4
           lsr.w    #2,d1
           andi.l   #$fffe,d1
           adda.l   d1,a5
           andi.w   #7,d4
           ror.w    d4,d3
           cmpi.b   #1,184(a4)
           bgt.s    not_xor2
           eor.w    d3,(a5)
           rts
not_xor2   cmpi.b   #2,184(a4)
           bgt.s    not_or2
           or.w     d3,(a5)
           rts
not_or2    not.w    d3
           and.w    d3,(a5)
           rts
*
hi_plot    move.w   38(a4),d1
           move.w   302(a4),d4
           sub.w    d4,d1
           not.w    d1
           add.w    306(a4),d1
           move.w   186(a4),d4           d4 = screen width
           lsl.w    #1,d4
           muls.w   d4,d1
           adda.l   d1,a5
           move.w   36(a4),d1
           add.w    298(a4),d1
           lsl.w    #1,d1
           adda.w   d1,a5
           cmpi.b   #1,184(a4)
           bgt.s    not_xor3
           eor.w    d3,(a5)
           rts
not_xor3   cmpi.b   #2,184(a4)
           bgt.s    not_or3
           or.w     d3,(a5)
           rts
not_or3    not.w    d3
           and.w    d3,(a5)
           rts
*
*********horizontal or vertical fast line  ********************
*
draw_h_v   moveq    #0,d1
           moveq    #0,d2
           move.w   36(a4),d1            d1 = x source
           move.w   40(a4),d2            d2 = x dest
           cmp.w    d1,d2
           beq      vert_plot
           move.w   38(a4),d3
           blt      exit04
           cmp.w    302(a4),d3
           bge      exit04
           cmp.w    d1,d2
           bgt.s    hor_ok
           exg      d1,d2
hor_ok     tst.b    263(a4)
           bne      hi_hor
*
*********ql colour horizontal *********************************
           move.w   38(a4),d0            d0 = y source
           move.w   302(a4),d5
           sub.w    d5,d0
           not.w    d0
           add.w    306(a4),d0
           move.l   18(a4),d5            d5 = screen base
           move.w   186(a4),d3           d3 = screen width
           lsr.w    #2,d3                d3 = bytes per line
           muls.w   d3,d0
           add.l    d0,d5                d5 = screen base + y offset
           move.l   d5,a5                a5 = screen base + y offset
           move.w   4(a4),d3             d3 = colour
*
           tst.w    d1
           bge.s    onscr1               ??
           moveq    #0,d1
*
onscr1     move.w   296(a4),d0           d0 = window width
ntmde4a    cmp.w    d0,d1
           bge.s    offscr1              if smallest to right
           cmp.w    d0,d2
           blt.s    onscr2               ??
           move.w   d0,d2
           subi.w   #1,d2
*
onscr2     tst.w    d2
           blt.s    offscr1              if largest to left
*                                        d1 = line start offset
           add.w    298(a4),d1
           add.w    298(a4),d2
           sub.w    d1,d2                d2 = on screen line length
*
           cmpi.w   #4,258(a4)
           bne.s    ntmde4b
*
           andi.w   #$8080,d3            extract red and green bits
           cmpi.b   #1,184(a4)           check for writing mode
           bgt.s    not_xor4
qlh1       move.w   d1,d0
           lsr.w    #2,d0
           andi.l   #$fffe,d0
           move.l   d5,a5
           adda.l   d0,a5
           move.w   d3,d4
           move.w   d1,d0
           andi.w   #7,d0
           ror.w    d0,d4
           eor.w    d4,(a5)
           addq.w   #1,d1
           dbra     d2,qlh1
offscr1    rts
*
not_xor4   cmpi.b   #2,184(a4)
           bgt.s    not_or4
qlh2       move.w   d1,d0
           lsr.w    #2,d0
           andi.l   #$fffe,d0
           move.l   d5,a5
           adda.l   d0,a5
           move.w   d3,d4
           move.w   d1,d0
           andi.w   #7,d0
           ror.w    d0,d4
           or.w     d4,(a5)
           addq.w   #1,d1
           dbra     d2,qlh2
           rts
*
not_or4    not.w    d3
qlh3       move.w   d1,d0
           lsr.w    #2,d0
           andi.l   #$fffe,d0
           move.l   d5,a5
           adda.l   d0,a5
           move.w   d3,d4
           move.w   d1,d0
           andi.w   #7,d0
           ror.w    d0,d4
           and.w    d4,(a5)
           addq.w   #1,d1
           dbra     d2,qlh3
           rts
*
ntmde4b    cmpi.b   #1,184(a4)           check for writing mode
           bgt.s    not_xor5
qlm8h1     move.w   d1,d0
           lsr.w    #1,d0
           andi.l   #$fffe,d0
           move.l   d5,a5
           adda.l   d0,a5
           move.w   d3,d4
           move.w   d1,d0
           andi.w   #3,d0
           lsl.w    #1,d0
           ror.w    d0,d4
           eor.w    d4,(a5)
           addq.w   #1,d1
           dbra     d2,qlm8h1
           rts
*
not_xor5   cmpi.b   #2,184(a4)
           bgt.s    not_or5
qlm8h2     move.w   d1,d0
           lsr.w    #1,d0
           andi.l   #$fffe,d0
           move.l   d5,a5
           adda.l   d0,a5
           move.w   d3,d4
           move.w   d1,d0
           andi.w   #3,d0
           lsl.w    #1,d0
           ror.w    d0,d4
           or.w     d4,(a5)
           addq.w   #1,d1
           dbra     d2,qlm8h2
           rts
*
not_or5    not.w    d3
qlm8h3     move.w   d1,d0
           lsr.w    #1,d0
           andi.l   #$fffe,d0
           move.l   d5,a5
           adda.l   d0,a5
           move.w   d3,d4
           move.w   d1,d0
           andi.w   #3,d0
           lsl.w    #1,d0
           ror.w    d0,d4
           and.w    d4,(a5)
           addq.w   #1,d1
           dbra     d2,qlm8h3
exit04     rts
*
vert_plot  move.w   36(a4),d3
           blt.s    exit04
           cmp.w    296(a4),d3           x resolution
           bge.s    exit04
           move.w   38(a4),d1            d1 = y source
           move.w   42(a4),d2            d2 = y dest
           cmp.w    d1,d2
           bgt.s    vert_ok
           exg      d1,d2                d1=smaller  d2=larger
vert_ok    tst.b    263(a4)
           bne      hi_vert
*
*********ql colour vertical ***********************************
           move.l   18(a4),d5            d5 = screen addr
           move.w   36(a4),d0            d0 = x
           add.w    298(a4),d0
           move.w   d0,d4
           cmpi.w   #4,258(a4)
           bne.s    nt_mde4c
*
           lsr.w    #2,d0
           andi.l   #$fffe,d0
           add.l    d0,d5
           andi.w   #7,d4
           move.w   4(a4),d3
           andi.w   #$8080,d3
           bra.s    mde4
*
nt_mde4c   lsr.w    #1,d0                divide x by 2 for word boundry
           andi.l   #$fffe,d0            x = even numbers
           add.l    d0,d5                add x pos to screen memory
           andi.w   #3,d4                calc x pixel pos in word
           lsl.b    #1,d4                multi pixel pos by 2
           move.w   4(a4),d3             d3 = ink
mde4       move.l   d5,a5
           ror.w    d4,d3                rotate pixel data
*
*
           move.w   302(a4),d5
           sub.w    d5,d1
           sub.w    d5,d2
           not.w    d1
           not.w    d2
*
           bge.s    onscr3               ??
           moveq    #0,d2
*
onscr3     cmp.w    302(a4),d2
           bge.s    offscr2              if smallest off bottom
           cmp.w    302(a4),d1
           blt.s    onscr4               ??
           move.w   302(a4),d1
           subi.w   #1,d1
*
onscr4     tst.w    d1
           blt.s    offscr2              if largest off top
*
           add.w    306(a4),d1
           add.w    306(a4),d2
           moveq    #0,d0
           move.w   186(a4),d0           d0 = screen width
           lsr.w    #2,d0
           sub.w    d2,d1
           muls.w   d0,d2
           adda.l   d2,a5
*
           cmpi.b   #1,184(a4)           check for writing mode
           bgt.s    not_xor6
qlv1       eor.w    d3,(a5)
           adda.l   d0,a5
           dbra     d1,qlv1
offscr2    rts
*
not_xor6   cmpi.b   #2,184(a4)
           bgt.s    not_or6
qlv2       or.w     d3,(a5)
           adda.l   d0,a5
           dbra     d1,qlv2
           rts
*
not_or6    not.w    d3
qlv3       and.w    d3,(a5)
           adda.l   d0,a5
           dbra     d1,qlv3
exit05     rts
*
*********hi colour vertical ***********************************
hi_vert    moveq    #0,d0
           move.l   18(a4),d5            d5 = screen base
           move.w   36(a4),d0            d0 = x source
           add.w    298(a4),d0
           lsl.w    #1,d0                extend x to word boundary
           add.l    d0,d5                d5 = screen base + x offset
           move.l   d5,a5                a5 = screen base + x offset
           move.w   4(a4),d3             d3 = colour
*
           move.w   302(a4),d5           d5 = y screen size
           sub.w    d5,d1                convert d1 to screen coordinates
           sub.w    d5,d2
           not.w    d1                   they need y inversion
           not.w    d2
*
           bge.s    onscr5               ??
           moveq    #0,d2
*
onscr5     cmp.w    302(a4),d2
           bge.s    offscr3              if smallest off bottom
           cmp.w    302(a4),d1
           blt.s    onscr6               ??
           move.w   302(a4),d1
           subi.w   #1,d1
*
onscr6     tst.w    d1
           blt.s    offscr3              if largest off top
*
           add.w    306(a4),d1
           add.w    306(a4),d2
           move.w   186(a4),d0           d0 = screen width
           lsl.w    #1,d0                d0 = bytes per line
           sub.w    d2,d1                d1 = on screen line length
           muls.w   d0,d2                d2 = line start offset
           adda.l   d2,a5                a5 = screen address + x + offsets
*
           cmpi.b   #1,184(a4)           check for writing mode
           bgt.s    not_xor7
hiv1       eor.w    d3,(a5)
           adda.l   d0,a5
           dbra     d1,hiv1
offscr3    rts
*
not_xor7   cmpi.b   #2,184(a4)
           bgt.s    not_or7
hiv2       or.w     d3,(a5)
           adda.l   d0,a5
           dbra     d1,hiv2
           rts
*
not_or7    not.w    d3
hiv3       and.w    d3,(a5)
           adda.l   d0,a5
           dbra     d1,hiv3
           rts
*
*********hi colour horizontal *********************************
hi_hor     move.w   38(a4),d0            d0 = y source
           move.w   302(a4),d5
           sub.w    d5,d0
           not.w    d0
           add.w    306(a4),d0
           move.l   18(a4),d5            d5 = screen base
           move.w   186(a4),d3           d5 = screen width
           lsl.w    #1,d3                d3 = bytes per line
           muls.w   d3,d0
           add.l    d0,d5                d5 = screen base + y offset
           move.l   d5,a5                a5 = screen base + y offset
           move.w   4(a4),d3             d3 = colour
*
           tst.w    d1
           bge.s    onscr7               ??
           moveq    #0,d1
*
onscr7     move.w   296(a4),d0           d0 = window width
           cmp.w    d0,d1
           bge.s    offscr4              if smallest to right
           cmp.w    d0,d2
           blt.s    onscr8               ??
           move.w   d0,d2
           subi.w   #1,d2
*
onscr8     tst.w    d2
           blt.s    offscr4              if largest to left
*
           add.w    298(a4),d1
           add.w    298(a4),d2
           moveq    #2,d0
           sub.w    d1,d2                d2 = on screen line length
           lsl.w    #1,d1                d1 = line start offset
           adda.l   d1,a5                a5 = screen address + y + offsets
*
           cmpi.b   #1,184(a4)           check for writing mode
           bgt.s    not_xor8
hih1       eor.w    d3,(a5)
           adda.l   d0,a5
           dbra     d2,hih1
offscr4    rts
*
not_xor8   cmpi.b   #2,184(a4)
           bgt.s    not_or8
hih2       or.w     d3,(a5)
           adda.l   d0,a5
           dbra     d2,hih2
           rts
*
not_or8    not.w    d3
hih3       and.w    d3,(a5)
           adda.l   d0,a5
           dbra     d2,hih3
           rts
*  
***************************************************************                                                             
qptr       move.w   ca.gtlin,a0
           jsr      (a0)
           bne      exit06
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne      exit06
           moveq    #0,d1
           moveq    #0,d4
           btst.b   #0,3(a6,a1.l)
           bne.s    qptr_det
           moveq    #0,d4
           bra.s    noqptr01             force qptr off
qptr_det   moveq    #0,d0                channel zero
           add.l    $30(a6),d0           add table start address
           cmp.l    $34(a6),d0           valid ?
           bge.s    ch_err               no, channel # off end of table
           move.l   (a6,d0.l),d0         channel id
           blt.s    ch_err               channel closed
           move.l   d0,a0
           moveq    #0,d2                no extra space required
           moveq    #iop_pinf,d0
           moveq    #-1,d3
           trap     #3
           moveq    #0,d4
           tst.l    d0                   is trap ok
           bne.s    noqptr01             no
           moveq    #1,d4                qptr ok
noqptr01   lea      par,a4
           move.b   d4,135(a4)           save flag
           bra      int_ret2
ch_err     moveq    #-6,d4               channel error
           bra      int_ret2
*    
ink_mask   dc.w     8                    layer 0  b
           dc.w     26                   layer 1  g
           dc.w     4                    layer 2  t
           dc.w     16                   layer 3  p
           dc.w     10                   layer 4  s1
           dc.w     22                   layer 5  s2 
*           
           dc.w     20                   layer 6  tsr
           dc.w     2                    layer 7  tss
           dc.w     18                   layer 8  tsp
           dc.w     14                   layer 9  tm
           dc.w     0                    layer 10 tp
           dc.w     0                    layer 11 tre
           dc.w     0                    layer 12 spare
           dc.w     24                   layer 13 bsr
           dc.w     30                   layer 14 bss
           dc.w     6                    layer 15 bsp
           dc.w     28                   layer 16 bm
           dc.w     12                   layer 17 bp
           dc.w     0                    layer 18 bre
           dc.w     0                    layer 19 spare
*
           dc.w     $0000                black + layer 16
           dc.w     $0040                blue
           dc.w     $0080                red
           dc.w     $00c0                purple
           dc.w     $8000                green
           dc.w     $8040                cyan
           dc.w     $8080                yellow
           dc.w     $80c0                white
           dc.w     $4000                black + flash bit
           dc.w     $4040                blue + flash bit
           dc.w     $4080                red + flash bit
           dc.w     $40c0                purple + flash bit
           dc.w     $c000                green + flash bit
           dc.w     $c040                cyan + flash bit
           dc.w     $c080                yellow + flash bit
           dc.w     $c0c0                white + flash bit
*
*          qpc  ggwbbbbbrrrrrggg
*               4307654376543765
*
           dc.w     $2529                near black   qpc2v2 hi colour
           dc.w     $1f00                blue
           dc.w     $00f8                red
           dc.w     $1ff8                purple
           dc.w     $c007                green
           dc.w     $df07                cyan
           dc.w     $c0ff                yellow
           dc.w     $dfff                white
           dc.w     $8a52                dark grey
           dc.w     $1000                blue dark
           dc.w     $0080                red dark
           dc.w     $1080                purple dark
           dc.w     $0004                green dark
           dc.w     $1004                cyan dark
           dc.w     $0084                yellow dark
           dc.w     $55ad                light grey
*
*          q40  gggggrrrrrbbbbbw
*               7654376543765430
*
           dc.w     $294a                near black   q40 hi colour
           dc.w     $003e                blue
           dc.w     $07c0                red
           dc.w     $07fe                purple
           dc.w     $f800                green
           dc.w     $f83e                cyan
           dc.w     $ffc0                yellow
           dc.w     $fffe                white
           dc.w     $5294                dark grey
           dc.w     $0020                blue dark
           dc.w     $0400                red dark
           dc.w     $0420                purple dark
           dc.w     $8000                green dark
           dc.w     $8020                cyan dark
           dc.w     $8400                yellow dark
           dc.w     $ad6a                light grey
*
mask       move.w   ca.gtlin,a0
           jsr      (a0)
           bne      exit05
           moveq    #-15,d0
           cmpi.w   #2,d3
           bne      exit05
           moveq    #0,d1
           move.b   3(a6,a1.l),d1        layer number
           move.b   7(a6,a1.l),d2        colour of that layer
           cmpi.w   #19,d1
           bgt      exit05               twenty layers
           andi.b   #$f,d2               sixteen colours on thor
           lsl.b    #1,d1
           lsl.b    #1,d2
           lea      ink_mask,a4
           move.b   d2,1(a4,d1.w)
           moveq    #0,d0
           rts
*
layers     move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit06
           moveq    #-15,d0
           cmpi.w   #2,d3
           bne.s    exit06
           moveq    #0,d0
           move.w   2(a6,a1.l),d1
           move.w   6(a6,a1.l),d2
           cmpi.w   #19,d1               layer
           bgt.s    exit06
           andi.w   #1,d2                on off
           lea      par,a4
           move.l   518(a4),d3
           tst.b    d2
           beq.s    layer_off
           bset.l   d1,d3
           bra.s    setlay
layer_off  bclr.l   d1,d3
setlay     move.l   d3,518(a4)
exit06     rts
*
mask_col   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit06
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit06
           moveq    #0,d1
           moveq    #0,d4
           move.b   3(a6,a1.l),d1
           cmpi.w   #19,d1               twenty layers
           bgt.s    exit06
           lsl.b    #1,d1
           lea      ink_mask,a4
           move.b   1(a4,d1.w),d4
           lsr.b    #1,d4
int_ret2   moveq    #2,d1
           move.w   bv.chrix,a0
           jsr      (a0)
           move.l   $58(a6),a1
           addq.l   #2,a1
           move.l   a1,$58(a6)
           move.w   d4,0(a1,a6.l)
           moveq    #3,d4
           moveq    #0,d0
           rts
*
hdens      move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit06
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit06
           move.w   2(a6,a1.l),d1
           cmpi.w   #2,d1
           bgt.s    exit06
           lea      par,a4
           move.b   d1,264(a4)
           moveq    #0,d0
           rts
*
set_ink1   btst.b   #0,80(a4)            set ink set colours for tracks etc
           beq.s    ed_off               d4 and d5 ok to use
           cmp.l    350(a4),a2
           blt.s    ed_off
ed_on      moveq    #7,d6                set ink to white
           cmp.w    70(a4),d1
           bne      set_ink2
           cmp.l    72(a4),a2
           blt      set_ink2
           moveq    #5,d6                set ink to cyan
           bra      set_ink2
ed_off     cmpi.b   #inv_lay,d0
           bne.s    layeron
layeroff   moveq    #0,d6
           move.w   d6,4(a4)
           rts
layeron    cmpi.b   #0,d0
           bne.s    notzero
           btst.b   #0,392(a4)           check for view layer zero
           beq.s    notzero
           move.w   388(a4),d6           set ink to dark blue
           bra      set_ink2
notzero    btst.b   #0,394(a4) 
           beq.s    notholes
           btst.b   #0,393(a4)
           beq.s    notholes
           move.w   390(a4),d6
           bra      set_ink2
notholes   lea      ink_mask,a3
           tst.b    263(a4)
           bne.s    not_ql
           move.w   #40,382(a4)          is ql
           bra.s    mode_set
not_ql     cmpi.b   #32,263(a4)
           bne.s    not_qpc
           move.w   #72,382(a4)          is qpc
           bra.s    mode_set
not_qpc    move.w   #104,382(a4)         must be q40
mode_set   moveq    #0,d6                d0 = layer number
*
           move.l   518(a4),d4           d4 = layer on/off mask
           cmpi.b   #10,d0
           bne.s    nt1lay10
           btst.l   #6,d4
           beq.s    layeroff
           move.b   #6,d0  
           bra      mask_lay
nt1lay10   cmpi.b   #11,d0
           bne.s    nt1lay11
           btst.l   #7,d4
           beq      layeroff
           move.b   #7,d0
           bra      mask_lay
nt1lay11   cmpi.b   #14,d0
           bne.s    nt1lay14
           btst.l   #13,d4
           beq      layeroff
           move.b   #13,d0
           bra      mask_lay
nt1lay14   cmpi.b   #15,d0
           bne.s    nt1lay15
           btst.l   #14,d4
           beq      layeroff
           move.b   #14,d0   
           bra      mask_lay
nt1lay15   cmpi.b   #26,d0
           bne.s    nt1lay26
           btst.l   #8,d4
           beq      layeroff
           move.b   #8,d0
           bra      mask_lay
nt1lay26   cmpi.b   #27,d0
           bne.s    nt1lay27
           btst.l   #9,d4
           beq      layeroff
           move.b   #9,d0
           bra      mask_lay
nt1lay27   cmpi.b   #30,d0
           bne.s    nt1lay30
           btst.l   #15,d4
           beq      layeroff
           move.b   #15,d0
           bra      mask_lay
nt1lay30   cmpi.b   #31,d0
           bne.s    nt1lay31
           btst.l   #16,d4
           beq      layeroff
           move.b   #16,d0
           bra      mask_lay
nt1lay31   cmpi.b   #42,d0
           bne.s    nt1lay42
           btst.l   #10,d4
           beq      layeroff
           move.b   #10,d0
           bra      mask_lay
nt1lay42   cmpi.b   #43,d0
           bne.s    nt1lay43
           btst.l   #11,d4
           beq      layeroff
           move.b   #11,d0
           bra      mask_lay  
nt1lay43   cmpi.b   #46,d0
           bne.s    nt1lay46
           btst.l   #17,d4
           beq      layeroff
           move.b   #17,d0
           bra      mask_lay
nt1lay46   cmpi.b   #47,d0
           bne.s    nt1lay47
           btst.l   #18,d4
           beq      layeroff
           move.b   #18,d0
           bra      mask_lay
nt1lay47   cmpi.b   #58,d0
           bne.s    nt1lay58
           btst.l   #12,d4
           beq      layeroff
           move.b   #12,d0
           bra      mask_lay
nt1lay58   cmpi.b   #62,d0
           bne.s    chk_bit0
           btst.l   #19,d4
           beq      layeroff
           move.b   #19,d0
           bra      mask_lay                   
*
chk_bit0   move.w   #0,4(a4)             clear colour
           btst.l   #0,d4
           beq.s    chk_bit1
           btst.l   #0,d0
           beq.s    chk_bit1
           move.w   (a3),d6              d6 colour assigned to layer 1
           add.w    382(a4),d6
           move.w   (a3,d6.w),4(a4)
chk_bit1   btst.l   #1,d4
           beq.s    chk_bit2
           btst.l   #1,d0
           beq.s    chk_bit2
           move.w   2(a3),d6             d6 colour assigned to layer 2
           add.w    382(a4),d6
           move.w   (a3,d6.w),d6
           or.w     d6,4(a4)
chk_bit2   btst.l   #2,d4
           beq.s    chk_bit3
           btst.l   #2,d0
           beq.s    chk_bit3
           move.w   4(a3),d6             d6 colour assigned to layer 4
           add.w    382(a4),d6
           move.w   (a3,d6.w),d6
           or.w     d6,4(a4)
chk_bit3   btst.l   #3,d4
           beq.s    chk_bit4
           btst.l   #3,d0
           beq.s    chk_bit4
           move.w   6(a3),d6             d6 colour assigned to layer 8
           add.w    382(a4),d6
           move.w   (a3,d6.w),d6
           or.w     d6,4(a4)
chk_bit4   btst.l   #4,d4
           beq.s    chk_bit5
           btst.l   #4,d0
           beq.s    chk_bit5
           move.w   8(a3),d6             d6 colour assigned to layer 16
           add.w    382(a4),d6
           move.w   (a3,d6.w),d6
           or.w     d6,4(a4)
chk_bit5   btst.l   #5,d4
           beq.s    col_set
           btst.l   #5,d0
           beq.s    col_set
           move.w   10(a3),d6            d6 colour assigned to layer 32
           add.w    382(a4),d6
           move.w   (a3,d6.w),d6
           or.w     d6,4(a4)
col_set    rts
*
mask_lay   lsl.b    #1,d0
           move.w   (a3,d0.w),d6         d6 colour assigned to the layer
           add.w    382(a4),d6           add table offset
           move.w   (a3,d6.w),4(a4)
           rts
*
set_ink2   lsl.w    #1,d6
           lea      ink_mask,a3
           tst.b    263(a4)
           beq.s    ql_mode2
           cmpi.b   #32,263(a4)
           beq.s    qpc_mode2
q40_mode2  move.w   104(a3,d6.w),4(a4)   q40 hi colour
           rts
qpc_mode2  move.w   72(a3,d6.w),4(a4)    qpc hi colour
           rts
ql_mode2   move.w   40(a3,d6.w),4(a4)    ql colour
           rts
*
lay_zero   move.w   ca.gtint,a0
           jsr      (a0)
           bne.s    exit07
           moveq    #-15,d0
           cmpi.w   #2,d3
           bne.s    exit07
           moveq    #0,d0        
           lea      par,a4
           move.b   1(a6,a1.l),d1
           andi.b   #1,d1
           move.w   2(a6,a1.l),d2
           move.b   d1,392(a4)   
           move.w   d2,388(a4)
exit07     rts     
holes      move.w   ca.gtint,a0
           jsr      (a0)
           bne.s    exit07
           moveq    #-15,d0
           cmpi.w   #2,d3
           bne.s    exit07
           moveq    #0,d0        
           lea      par,a4
           move.w   (a6,a1.l),d1
           cmpi.w   #255,d1
           bgt.s    exit07
           move.w   2(a6,a1.l),d2
           cmpi.w   #0,d1
           bge.s    hole_size
           cmpi.w   #-1,d1
           beq.s    holes_on
           move.b   #0,393(a4)
           bra.s    holes_off
holes_on   move.b   #1,393(a4)   
holes_off  move.w   d2,390(a4)
           rts
hole_size  cmpi.w   #63,d2
           bgt.s    exit07
           lea      hole_dia,a0
           move.b   d2,(a0,d1.w)
           rts
hole_dia   dc.l     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
           dc.l     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
           dc.l     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
           dc.l     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
*
set_over   andi.b   #3,d6                0=norm 1=xor 2=put 3=take
           lea      par,a4
           move.b   d6,184(a4)
           rts
*
cursor     move.w   ca.gtint,a0
           jsr      (a0)
           bne.s    exit08
           moveq    #1,d6
           bsr      set_over
           move.b   #0,117(a4)
           moveq    #7,d6
           bsr      set_ink2
           tst.w    d3
           bgt.s    rel_mve1
*
           tst.b    135(a4)
           beq.s    noqptr02
           bsr      get_ptr
           move.w   #1,d4
           tst.w    d7
           beq.s    abs_mve1
noqptr02   moveq    #0,d0                pointer is off screen
exit08     rts
*
rel_mve1   cmpi.w   #1,d3
           bne.s    not_size
           move.w   (a6,a1.l),(a4)       cursor size
           bra.s    noqptr02
not_size   move.l   (a6,a1.l),d0
           beq.s    no_xy1
           tst.b    135(a4)
           bne.s    noqptr02
no_xy1     move.l   d0,d1
           move.l   d1,d4
           swap     d0
abs_mve1   move.w   (a4),d2
           add.w    d0,58(a4)
           add.w    d1,60(a4)
           move.w   58(a4),d0
           move.w   60(a4),d1
           cmpi.l   #0,d4
           bne.s    move_cur
           bra.s    place
move_cur   movem.l  d0-d1,-(a7)
           bsr.s    blank
           movem.l  (a7)+,d0-d1          new x y
           move.w   (a4),d2              restore size
place      movem.l  d0-d2,-(a7)
           bsr      prt_c
           movem.l  (a7)+,d0-d2
           move.w   12(a4),d4
           add.w    d4,d0
           move.w   14(a4),d4
           add.w    d4,d1
           moveq    #0,d4
           move.b   10(a4),d4
           tst.b    11(a4)
           beq.s    pscale2
           asl.w    d4,d0
           asl.w    d4,d1
           bra.s    nscale2
pscale2    asr.w    d4,d0
           asr.w    d4,d1
nscale2    move.w   d0,6(a4)             store x
           move.w   d1,8(a4)             store y
           move.w   d2,(a4)              store size
           tst.b    135(a4)
           bne.s    isqptr05
           tst.w    d0
           blt      redraw               check if cursor off edge
           cmp.w    296(a4),d0
           bge      redraw               check if cursor off edge
           tst.w    d1
           blt      redraw               check if cursor off edge
           cmp.w    302(a4),d1
           bge      redraw               check if cursor off edge
isqptr05   bra.s    draw_cur
*
blank      move.w   (a4),d2              restore size
           move.w   6(a4),d0             restore x
           move.w   8(a4),d1             restore y
draw_cur   sub.w    d2,d0                subtract from x
           move.w   d0,36(a4)            x source coor
           move.w   d1,38(a4)            y source coor
           add.w    d2,d0
           add.w    d2,d0
           move.w   d0,40(a4)            x dest coor
           move.w   d1,42(a4)            y dest coor
           bsr      draw_h_v
           move.w   6(a4),d0             d0 = x
           move.w   38(a4),d1            d1 = y
           move.w   (a4),d2              d2 = size
           sub.w    d2,d1
           move.w   d0,36(a4)
           move.w   d1,38(a4)
           add.w    d2,d1
           add.w    d2,d1
           move.w   d0,40(a4)
           move.w   d1,42(a4)
           bsr      draw_h_v
           cmpi.b   #3,80(a4)
           beq.s    wh_cursor
           moveq    #0,d0
           rts
wh_cursor  move.w   6(a4),d0             d0 = x coord
           move.w   8(a4),d1             d1 = y coord
           move.w   (a4),d2              d2 = size
           subi.w   #4,d1
           sub.w    d2,d0
           move.w   d0,36(a4)
           move.w   d1,38(a4)
           addi.w   #8,d1
           move.w   d0,40(a4)
           move.w   d1,42(a4)
           bsr      draw_h_v
           move.w   6(a4),d0
           move.w   8(a4),d1
           move.w   (a4),d2
           subi.w   #4,d1
           add.w    d2,d0
           move.w   d0,36(a4)
           move.w   d1,38(a4)
           addi.w   #8,d1
           move.w   d0,40(a4)
           move.w   d1,42(a4)
           bsr      draw_h_v
           moveq    #0,d0
exit09     rts
*
set_grid   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit09
           moveq    #-15,d0
           lea      par,a4  
           cmpi.w   #3,d3
           bne.s    full_upd
           move.w   6(a6,a1.l),386(a4)   grid colour  
           move.b   3(a6,a1.l),171(a4)   grid on off
           moveq    #0,d0
           rts
full_upd   cmpi.w   #2,d3
           bne.s    nogrid_col
           move.w   6(a6,a1.l),d6
           move.w   d6,386(a4)           grid colour
           bra.s    isgrid_col
nogrid_col cmpi.w   #1,d3
           bne.s    exit09
isgrid_col move.b   3(a6,a1.l),d1
           move.b   d1,171(a4)           grid on off
           move.b   #1,d6
           bsr      set_over
           moveq    #7,d6
           bsr      set_ink2
           bsr      blank
           bsr.s    put_grid
           move.b   #1,d6
           bsr      set_over
           moveq    #7,d6
           bsr      set_ink2
           bra      blank
put_grid   move.b   #3,d6
           tst.b    171(a4)
           beq.s    no_grid1
prt_grid   move.b   #2,d6
no_grid1   bsr      set_over
           move.w   386(a4),d6           grid colour
           bsr      set_ink2
           move.b   10(a4),d0            scale
           move.w   #5,d6                5 on scale less than -1
           tst.b    11(a4)
           bne.s    setgrid
           move.w   #50,d6               50 on scales 0 to 3
           cmpi.b   #4,d0
           blt.s    setgrid
           move.w   #500,d6              500 on scale greater than 4
setgrid    move.w   12(a4),d1            x offset
           ext.l    d1
           divs     d6,d1
           muls     d6,d1
           move.w   12(a4),d2
           sub.w    d1,d2
           bgt.s    gt_x
           add.w    d6,d2
gt_x       move.w   14(a4),d1            y offset
           ext.l    d1
           divs     d6,d1
           muls     d6,d1
           move.w   14(a4),d5
           sub.w    d1,d5
           bgt.s    gset_end
           add.w    d6,d5
gset_end   move.w   d2,54(a4)
           move.w   d5,d1
           tst.b    11(a4)
           beq.s    pscale12
           asl.w    d0,d1
           bra.s    nscale12
pscale12   asr.w    d0,d1                ******************
nscale12   move.w   d1,38(a4)
g_loop2    move.w   d2,d1
           tst.b    11(a4)
           beq.s    pscale13
           asl.w    d0,d1
           bra.s    nscale13   
pscale13   asr.w    d0,d1                ******************
nscale13   move.w   d1,36(a4)
           cmp.w    296(a4),d1
           blt.s    g_cont1
           move.w   54(a4),d2
           add.w    d6,d5
           move.w   d5,d1
           tst.b    11(a4)
           beq.s    pscale14
           asl.w    d0,d1
           bra.s    nscale14
pscale14   asr.w    d0,d1                ******************
nscale14   move.w   d1,38(a4)
           cmp.w    302(a4),d1
           bge.s    exit10
           bra.s    g_loop2
g_cont1    bsr      plot01
           add.w    d6,d2
           bra.s    g_loop2
exit10     moveq    #0,d0
           rts
*
scale      move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit11
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit11
           lea      par,a4
           move.w   2(a6,a1.l),d3
           bge.s    pscale1
           move.b   #1,11(a4)
           neg.w    d3
           bra.s    nscale1
pscale1    move.b   #0,11(a4)
nscale1    andi.b   #7,d1
           move.b   d3,10(a4)
           tst.b    135(a4)
           beq.s    exit10
*
           move.w   6(a4),d0             x cursor in pixels
           move.w   8(a4),d1             y cursor in pixels
           tst.b    11(a4)
           beq.s    pscale16
           lsr.w    d3,d0
           lsr.w    d3,d1
           bra.s    nscale16
pscale16   lsl.w    d3,d0                x cursor in mils
           lsl.w    d3,d1                y cursor in mils
nscale16   sub.w    58(a4),d0
           sub.w    60(a4),d1
           move.w   d0,12(a4)
           move.w   d1,14(a4)
           moveq    #0,d0
exit11     rts
int_ret    move.l   #0,a0
           moveq    #2,d1
           move.w   bv.chrix,a0
           jsr      (a0)
           move.l   $58(a6),a1
           subq.l   #2,a1
           move.l   a1,$58(a6)
           move.w   d4,0(a1,a6.l)
           moveq    #3,d4
           moveq    #0,d0
exit12     rts
fast       move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit12
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit12
           lea      par,a4
           move.b   3(a6,a1.l),d0
           andi.b   #3,d0
           move.b   d0,16(a4)
           moveq    #0,d0
exit13     rts
text       move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit13
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit13
           lea      par,a4
           move.b   3(a6,a1.l),d0
           andi.b   #1,d0
           move.b   d0,17(a4)
           moveq    #0,d0
exit14     rts
*
file_len   lea      par,a4
           bsr      findeof
           move.l   76(a4),d1
           sub.l    26(a4),d1
*
* convert d1.l into floating point value
*
flo_ret    move.l   #0,a0
           move.w   d1,d4
           move.l   d1,d5
           beq.s    normal
           move.w   #2079,d4
           add.l    d1,d1
           bvs.s    normal
           subq.w   #1,d4
           move.l   d1,d5
           moveq    #16,d0
*
fix_it     move.l   d5,d1
           asl.l    d0,d1
           bvs.s    too_far
           sub.w    d0,d4
           move.l   d1,d5
too_far    asr.w    #1,d0
           bne.s    fix_it
normal     moveq    #6,d1
           move.w   bv.chrix,a0
           jsr      (a0)
           move.l   $58(a6),a1
           subq.l   #6,a1
           move.l   a1,$58(a6)
           move.l   d5,2(a1,a6.l)
           move.w   d4,0(a1,a6.l)
           moveq    #2,d4                type is floating point
exit15     moveq    #0,d0
           rts
*
cad_top    move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit15
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit15
           move.l   (a6,a1.l),d0
           subi.l   #12,d0
           lea      par,a4
           move.l   d0,198(a4)           upper via address
           moveq    #0,d0
           rts
*
save_base  move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit15
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit15
           move.l   (a6,a1.l),d0
           lea      par,a4
           move.l   d0,108(a4)
           moveq    #0,d0
           rts
*
set_key    move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit15
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit15
           move.b   3(a6,a1.l),d3
           moveq    #mt.inf,d0
           trap     #1
           move.b   d3,$8b(a0)
           moveq    #0,d0
           rts
*
last_key   moveq    #mt.inf,d0
           trap     #1
           moveq    #0,d4
           move.b   $8b(a0),d4
           bra      int_ret
*
editn      lea      par,a4
           moveq    #0,d4
           move.b   80(a4),d4
           andi.b   #2,d4                mask out bit
           bra      int_ret
*
fr_mem     moveq    #mt.free,d0          new smsq version
           trap     #1
           bra      flo_ret
*
elements   moveq    #0,d4
           moveq    #0,d0
           btst.b   #0,80(a4)
           beq.s    ed_off3
           cmp.l    350(a4),a2
           blt.s    ed_off3
           moveq    #1,d6
           bsr      set_over
ed_off3    bsr      segment1             print segments at base a2
           tst.w    d0                   check for error
           bne      exit15
           bra.s    elements
*
update     move.w   ca.gtlin,a0
           jsr      (a0)
           bne      exit16
           moveq    #-15,d0
           lea      par,a4
           cmpi.w   #1,d3
           bgt      exit16
           blt.s    noqptr10    
*
redraw     tst.b    135(a4)
           beq.s    noqptr10
           move.w   12(a4),d0
           move.w   14(a4),d1
           bsr.s    update3
           bra.s    chk4area
noqptr10   bsr.s    update2
chk4area   tst.b    117(a4)              check for area mode
           bne      exit15
put_cur    move.b   #1,d6
           bsr      set_over             set exor
           moveq    #7,d6
           bsr      set_ink2             set ink 7
           move.w   58(a4),d0            retrieve x coor
           move.w   60(a4),d1            retrieve y coor
           move.w   (a4),d2              retrieve size
           bra      place                print new cursor
*
update2    move.b   10(a4),d3
           move.w   296(a4),d0           width in pixels
           move.w   302(a4),d1           height in pixels
           tst.b    11(a4)
           beq.s    pscale3
           lsr.w    d3,d0
           lsr.w    d3,d1
           bra.s    nscale3
pscale3    lsl.w    d3,d0                d0 width in mils
           lsl.w    d3,d1                d1 height in mils
nscale3    asr.w    #1,d0                d0 centre of screen in mils
           asr.w    #1,d1                d1 centre of screen in mils
           move.w   58(a4),d3            cursor x
           sub.w    d3,d0
           move.w   60(a4),d3            cursor y
           sub.w    d3,d1
           move.w   d0,12(a4)            set x offset in mils
           move.w   d1,14(a4)            set y offset in mils
update3    moveq    #2,d6
           bsr      set_over
           bsr      clr_scr
           move.l   26(a4),a2            start address for art file
           bsr      elements
           move.l   a2,76(a4)
           tst.b    116(a4)
           beq.s    no_area
           moveq    #0,d6
           move.b   #1,d6
           bsr      set_over
           moveq    #7,d6
           bsr      set_ink2
           moveq    #0,d6
           bsr      ud_area
no_area    tst.b    171(a4)
           beq.s    no_grid2
           bsr      prt_grid
no_grid2   tst.b    196(a4)             check for logo mode
           bne.s    exit16
           bra      prt_s
*
exit16     rts
cad_edit   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit16
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit16
           move.b   3(a6,a1.l),d0
           lea      par,a4
           andi.b   #1,d0
           beq.s    edit_off
edit_on    btst.b   #0,80(a4)
           bne      mde_ret              edit mode already on
           btst.b   #1,80(a4)            check whole mode
           beq.s    ed_on_ret
           ori.b    #1,80(a4)            set edit bit
           bra      exor_cur             replace cursor
ed_on_ret  ori.b    #1,80(a4)            set edit bit
           bra.s    mde_ret
*
edit_off   btst.b   #0,80(a4)
           beq.s    mde_ret              edit mode already off
           btst.b   #1,80(a4)            check whole mode
           beq.s    ed_off_ret
           andi.b   #$fe,80(a4)          clear edit bit
           bra.s    exor_cur
ed_off_ret andi.b   #$fe,80(a4)          clear edit bit
           bra.s    mde_ret
*
whole_on   btst.b   #1,80(a4)
           bne.s    mde_ret              whole mode already on
           btst.b   #0,80(a4)            check edit mode
           beq.s    wh_on_ret
           ori.b    #2,80(a4)            set whole bit
           bra.s    exor_cur             replace cursor
wh_on_ret  ori.b    #2,80(a4)            set whole bit
           bra.s    mde_ret
*
whole_off  btst.b   #1,80(a4)
           beq.s    mde_ret              whole mode already off
           btst.b   #0,80(a4)            check edit mode
           beq.s    wh_off_ret
           andi.b   #$fd,80(a4)          clear whole bit
           bra.s    exor_cur             replace cursor
wh_off_ret andi.b   #$fd,80(a4)          clear whole bit
           bra.s    mde_ret
*
w_off_e_on cmpi.b   #1,80(a4)
           beq.s    mde_ret              whole off and edit on
           cmpi.b   #3,80(a4)            check for whole and edit mode
           bne.s    w_e_ret
           move.b   #1,80(a4)            set edit and clear whole bits
           bra.s    exor_cur             replace cursor
w_e_ret    move.b   #1,80(a4)            set edit and clear whole bits
mde_ret    moveq    #0,d0
           rts
*
exor_cur   move.b   #1,d6
           bsr      set_over
           moveq    #7,d6
           bsr      set_ink2
           bra      wh_cursor
*
do_label   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    txt_ret1
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    txt_ret1
           lea      par,a4
           move.l   (a6,a1.l),d0
           move.l   d0,376(a4)           save element base
           move.l   d0,a2
           move.w   (a2),d1
           andi.w   #lab_mask,d1         d1 = num of label blocks
           move.w   d1,250(a4)           save num of label blocks
           move.w   #10,482(a4)          ref id label length is 10
           moveq    #0,d0
           rts
*
text_addr  lea      par,a4
           move.l   376(a4),a2           restore element base
           move.w   250(a4),d1
           beq.s    no_txt01             no labels
           move.l   166(a4),a3
           move.b   #0,(a3)              clear first character
           move.b   #1,380(a4)           set plotter flag
           bsr.s    prt_txt2
           move.w   #12,482(a4)          other labels are 12 long
           move.b   #0,380(a4)           clear flag
           subi.w   #3,250(a4)           next label
           move.l   166(a4),d1
           bra      flo_ret
*
no_txt01   nop                           a2 = element base
*
           moveq    #0,d1
           bra      flo_ret
*
txt_ret1   rts
*
prt_txt1   move.w   #10,482(a4)          ref id label length is 10
           move.w   194(a4),d1
           beq.s    no_txt02             no labels
           tst.b    17(a4)
           bne.s    no_txt02             no text
           move.w   d1,250(a4)
txt_lp02   bsr.s    prt_txt2   
           move.w   #12,482(a4)          other labels are 12 long
           subi.w   #3,250(a4)           next label
           bne.s    txt_lp02
no_txt02   rts                           a2 = element base
*
prt_txt2   move.w   2(a2),d1             d1 = element length
           sub.w    250(a4),d1           d1 = num of blocks    
           move.l   a2,a1
           mulu.w   #6,d1
           add.l    d1,a1                a1 = base of label
           move.w   194(a4),510(a4)      save number of label blocks
           move.w   #0,194(a4)           no blocks for text
           move.w   70(a4),512(a4)
           move.w   #0,70(a4)
           move.l   a2,a0                a0 = base of element
           movem.l  a2,-(a7)             save a2
           tst.b    380(a4)
           bne.s    ed_off5
           cmp.l    350(a4),a0
           blt.s    ed_off5
           move.l   198(a4),a2           a2 = upper address for text
           bra.s    ed_on5
ed_off5    move.l   166(a4),a2           a2 = lower address for text
ed_on5     move.l   a2,a5
           moveq    #0,d2
           moveq    #0,d6
           moveq    #12,d0               d0 = offset for label control block
           btst.b   #7,12(a1)
           bne.s    end_lab1             do not print net label
txt_lp01   moveq    #0,d3
           move.b   (a1,d2.w),d3         d3 = asc char
           beq.s    end_lab1             look for last char
           cmpi.b   #1,d3
           bne.s    not_null
           move.b   #192,d3
not_null   subi.w   #33,d3
           blt.s    is_spc01             check for space character
           bsr.s    mv_txt01
is_spc01   addi.w   #1,d2                increment character count
           cmp.w    482(a4),d2 
           bne.s    txt_lp01
*
end_lab1   tst.w    d6
           beq.s    no_txt03
           move.b   #wrd,(a2)            text element
           move.b   #0,1(a2)             no label blocks
           move.w   d6,2(a2)             element length
           move.w   #0,4(a2)             library
           tst.b    380(a4)
           bne.s    no_drawing
           moveq    #0,d0
           moveq    #0,d1
           moveq    #0,d2
           moveq    #0,d3
           bsr      text_type
           moveq    #0,d0
           moveq    #0,d1
           moveq    #0,d2
           moveq    #0,d3
no_txt03   move.w   512(a4),70(a4)       restore segment picked up
           move.w   510(a4),194(a4)      restore label count
no_drawing movem.l  (a7)+,a2             restore a2
           moveq    #0,d0
           rts
*
mv_txt01   andi.l   #$ffff,d3
           lea      txt_dat1,a3
           lsl.w    #1,d3
           move.w   (a3,d3.w),d3
           add.l    d3,a3
           move.w   2(a3),d5             d5 = char element length
           add.l    d5,d6                d6 = total length
           move.b   #inv_lay,(a5)+       * header layer
           tst.b    380(a4)
           bne.s    isplt1
           btst.b   #1,16(a4)
           beq.s    isplt1
           move.b   #0,(a5)+             * header size
           bra.s    ntplt1
isplt1     move.b   262(a4),(a5)+        * header size
ntplt1     move.l   #0,(a5)+             * header x y
           add.l    #6,a3
           subi.w   #1,d5
mv_txt02   cmpi.b   #inv_lay,(a3)        look for invisible layer
           bne.s    nt_inv01
           move.b   #inv_lay,(a5)+
           bra.s    is_inv01
nt_inv01   move.b   (a1,d0.w),(a5)+      layer
is_inv01   tst.b    380(a4)
           bne.s    isplt2
           btst.b   #1,16(a4)
           beq.s    isplt2
           move.b   #0,(a5)+
           bra.s    ntplt2
isplt2     move.b   262(a4),(a5)+        size
ntplt2     add.l    #2,a3
           move.w   (a3)+,d7             x
           btst.b   #mbit,1(a1,d0.w)     check for mirror
           beq.s    nomirr01
           neg.w    d7           
nomirr01   move.b   1(a1,d0.w),d1        get size
           btst.l   #obit,d1
           bne.s    u_d01
*
           andi.w   #size_mask,d1        left right text
           mulu.w   d1,d7  
           asr.w    #2,d7
           mulu.w   d2,d1
           mulu.w   #30,d1
           asr.w    #2,d1
           btst.b   #mbit,1(a1,d0.w)
           beq.s    nomirr02
           sub.w    d1,d7
           bra.s    mirror01
nomirr02   add.w    d1,d7
mirror01   add.w    2(a1,d0.w),d7
           add.w    8(a0),d7             x offset
           move.w   d7,(a5)+
           move.w   (a3)+,d7             y
           move.b   1(a1,d0.w),d1        get size
           andi.w   #size_mask,d1
           mulu.w   d1,d7
           asr.w    #2,d7
           add.w    4(a1,d0.w),d7
           add.w    10(a0),d7            y offset
           bra.s    l_r01
*
u_d01      andi.w   #size_mask,d1        up down text
           mulu.w   d1,d7
           asr.w    #2,d7
           add.w    2(a1,d0.w),d7
           add.w    8(a0),d7             x offset
           move.w   d7,(a5)+
           move.w   (a3)+,d7             y
           move.b   1(a1,d0.w),d1        get size
           andi.w   #size_mask,d1
           mulu.w   d1,d7
           asr.w    #2,d7
           mulu.w   d2,d1
           mulu.w   #30,d1
           asr.w    #2,d1
           sub.w    d1,d7
           add.w    4(a1,d0.w),d7
           add.w    10(a0),d7            y offset
*
l_r01      move.w   d7,(a5)+
           subi.w   #1,d5
           bne      mv_txt02
           move.b   #inv_lay,-6(a5)      last segment is invisible
           rts
*
exit17     rts
segment1   moveq    #0,d0                clear data registers
           moveq    #0,d1
           moveq    #0,d2
           moveq    #0,d3
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d1              d1 element type
           andi.b   #type_mask,d1
           cmpi.b   #pad,d1
           beq.s    pad_type
           cmpi.b   #wrd,d1
           beq      word_type
           cmpi.b   #trk,d1
           beq      track_type
           cmpi.b   #blk,d1
           beq      block_type
           cmpi.b   #end,d1
           beq.s    fle_fin1
           moveq    #0,d1
           move.w   2(a2),d1             element length
           mulu.w   #6,d1                length in bytes
           adda.l   d1,a2
           moveq    #0,d0                exit ok from segments
           rts
fle_fin1   moveq    #-7,d0               file end flag
           rts
*
pad_end1   move.w   194(a4),d0
           mulu.w   #6,d0
           add.l    d0,a2
           addq.l   #6,a2                move base to next element
           moveq    #0,d0                exit ok from segments
           rts
pad_type   bsr      prt_txt1
           move.w   2(a2),d1             d1 = element length
           sub.w    194(a4),d1
next_pad   subi.w   #1,d1
           beq.s    pad_end1
           addq.l   #6,a2                base to next coord
           btst.b   #0,393(a4)
           beq      no_holes 
           moveq    #0,d0
           move.b   (a2),d0              ink colour
           andi.b   #lay_mask,d0
           cmpi.b   #5,d0
           beq.s    hashole
           cmpi.b   #6,d0
           beq.s    hashole
           cmpi.b   #9,d0
           beq.s    hashole
           cmpi.b   #48,d0
           beq.s    hashole
           bra      no_holes
hashole    move.b   #1,394(a4)
           bsr      set_ink1   
           move.b   #0,394(a4)       
           lea      hole_dia,a0
           moveq    #0,d2
           move.b   1(a2),d2             d2 pad size
           move.b   (a0,d2.w),d2         d2 = hole size
           mulu.w   #5,d2
           move.b   10(a4),d0            scale
           tst.b    11(a4)
           beq.s    pscale17
           lsl.w    d0,d2
           bra.s    nscale17
pscale17   lsr.w    d0,d2                size divided by scale
nscale17   lsr.w    #1,d2
           move.w   d2,d3
           lsr.w    #1,d3                d3 pad size divided by two
           move.w   2(a2),d4             x
           move.w   4(a2),d5             y
           move.b   10(a4),d0            scale
           moveq    #0,d6                d6 used in set ink
           move.w   12(a4),d7            x offset
           add.w    d7,d4
           move.w   14(a4),d7            y offset
           add.w    d7,d5
           tst.b    11(a4)
           beq.s    pscale18
           asl.w    d0,d4
           asl.w    d0,d5
           bra.s    nscale18
pscale18   asr.w    d0,d4                scale x
           asr.w    d0,d5                scale y
nscale18   tst.w    d4
           blt.s    no_holes
           cmp.w    296(a4),d4
           bge.s    no_holes
           tst.w    d5
           blt.s    no_holes
           cmp.w    302(a4),d5
           bge.s    no_holes
           sub.w    d3,d4                * rem d3 = half pad size
           sub.w    d2,d5                * rem d2 = pad size
           move.w   d4,40(a4)            first x coord   x start
           move.w   d5,42(a4)            first y coord   y start
           add.w    d2,d4                new d4          x end
           bsr      drw_bit1             draw first line
           add.w    d3,d4
           add.w    d3,d5
           bsr      drw_bit1
           add.w    d2,d5
           bsr      drw_bit1
           sub.w    d3,d4
           add.w    d3,d5
           bsr      drw_bit1
           sub.w    d2,d4
           bsr      drw_bit1
           sub.w    d3,d4
           sub.w    d3,d5
           bsr      drw_bit1
           sub.w    d2,d5
           bsr      drw_bit1
           add.w    d3,d4                * 11/9/94
           sub.w    d3,d5                *
           bsr      drw_bit1             *
no_holes   moveq    #0,d2
           move.b   1(a2),d2             d2 pad size
           cmpi.w   #192,d2
           beq.s    b_pad01              board marker
           blt.s    pads_ok1
           move.w   #10,d2               undefined pads from 193 to 255 are round size 10
pads_ok1   cmpi.w   #64,d2
           blt.s    r_pad01
           cmpi.w   #128,d2
           blt.s    s_pad01
           move.b   #3,34(a4)            3 = thermal pad
           subi.w   #128,d2
           bra.s    n_pad01
s_pad01    move.b   #0,34(a4)            0 = square
           subi.w   #64,d2
           bra.s    n_pad01
b_pad01    move.b   #2,34(a4)            2 = board marker
           move.w   #40,d2
           bra.s    n_pad01
r_pad01    move.b   #1,34(a4)            1 = round
n_pad01    mulu.w   #5,d2
           beq.s    pdnorm1
           cmpi.b   #1,264(a4)
           blt.s    pdnorm1
           bgt.s    shd1
           btst.l   #0,d2                hi density
           bne.s    pdnorm1
           subi.w   #2,d2  
           bra.s    pdnorm1
shd1       btst.l   #0,d2                super hi density
           beq.s    pdnorm1
           subi.w   #1,d2
pdnorm1    move.b   10(a4),d0            scale
           tst.b    11(a4)
           beq.s    pscale4
           lsl.w    d0,d2
           bra.s    nscale4
pscale4    lsr.w    d0,d2                size divided by scale
nscale4    lsr.w    #1,d2
           move.w   d2,d3
           lsr.w    #1,d3                d3 pad size divided by two
           moveq    #0,d0
           move.b   (a2),d0              ink colour
           andi.b   #lay_mask,d0
           bsr      set_ink1
           move.w   2(a2),d4             x
           move.w   4(a2),d5             y
           move.b   10(a4),d0            scale
via_type   moveq    #0,d6                d6 used in set ink
           move.w   12(a4),d7            x offset
           add.w    d7,d4
           move.w   14(a4),d7            y offset
           add.w    d7,d5
           tst.b    11(a4)
           beq.s    pscale5
           asl.w    d0,d4
           asl.w    d0,d5
           bra.s    nscale5
pscale5    asr.w    d0,d4                scale x
           asr.w    d0,d5                scale y
nscale5    tst.w    d4
           blt      next_pad
           cmp.w    296(a4),d4
           bge      next_pad
           tst.w    d5
           blt      next_pad
           cmp.w    302(a4),d5
           bge      next_pad
           tst.b    34(a4)
           beq.s    square_pad
           btst.b   #0,16(a4)
           bne.s    square_pad
           cmpi.b   #3,34(a4)            * thermal pad
           beq      therm_pad            * 11/9/94
           sub.w    d3,d4                * rem d3 = half pad size
           sub.w    d2,d5                * rem d2 = pad size
           move.w   d4,40(a4)            first x coord   x start
           move.w   d5,42(a4)            first y coord   y start
           add.w    d2,d4                new d4          x end
           bsr.s    drw_bit1             draw first line
           add.w    d3,d4
           add.w    d3,d5
           bsr.s    drw_bit1
           add.w    d2,d5
           bsr.s    drw_bit1
           sub.w    d3,d4
           add.w    d3,d5
           bsr.s    drw_bit1
           sub.w    d2,d4
           bsr.s    drw_bit1
           sub.w    d3,d4
           sub.w    d3,d5
           bsr.s    drw_bit1
           sub.w    d2,d5
           bsr.s    drw_bit1
           add.w    d3,d4                * 11/9/94
           sub.w    d3,d5                *
           bsr.s    drw_bit1             *
           cmpi.b   #2,34(a4)
           beq      bomsite1             * short out of range
           bra      next_pad
square_pad move.w   d2,d0
           lsl.w    #1,d0
           sub.w    d2,d4                subtract from x
           sub.w    d2,d5                subtract from y
           move.w   d4,40(a4)
           move.w   d5,42(a4)
           add.w    d0,d4                add to x
           bsr      draw_squ
           add.w    d0,d5                add to y
           bsr      draw_squ
           sub.w    d0,d4                sub from x
           bsr      draw_squ
           sub.w    d0,d5                sub from y
           bsr      draw_squ
           bra      next_pad
drw_bit1   move.l   40(a4),36(a4)
           move.w   d4,40(a4)
           move.w   d5,42(a4)
           movem.l  d0-d5,-(a7)
           bsr      drwline1
           movem.l  (a7)+,d0-d5
           rts
therm_pad  sub.w    d3,d4
           sub.w    d2,d5                *
           move.w   d4,40(a4)            *
           move.w   d5,42(a4)            *
           sub.w    d3,d4                *
           sub.w    d3,d5                *
           bsr.s    drw_bit1             *
           add.w    d2,d4                *
           add.w    d2,d4
           bsr.s    drw_bit1             *
           sub.w    d3,d4                *
           add.w    d3,d5                *
           bsr.s    drw_bit1             *
           sub.w    d2,d4
           bsr.s    drw_bit1
*
           sub.w    d3,d4                *
           add.w    d3,d5                *
           add.w    d2,d5
           move.w   d4,40(a4)            *
           move.w   d5,42(a4)            *
           sub.w    d3,d4                *
           add.w    d3,d5                *
           bsr.s    drw_bit1             *
           sub.w    d2,d5                *
           sub.w    d2,d5
           bsr.s    drw_bit1             *
           add.w    d3,d4                *
           add.w    d3,d5                *
           bsr.s    drw_bit1             *
           add.w    d2,d5
           bsr.s    drw_bit1
*
           add.w    d3,d4                *
           add.w    d2,d4
           add.w    d3,d5                *
           move.w   d4,40(a4)            *
           move.w   d5,42(a4)            *
           add.w    d3,d4                *
           add.w    d3,d5                *
           bsr.s    drw_bit1             *
           sub.w    d2,d4                *
           sub.w    d2,d4
           bsr.s    drw_bit1             *
           add.w    d3,d4                *
           sub.w    d3,d5                *
           bsr      drw_bit1             *
           add.w    d2,d4
           bsr      drw_bit1
*
           add.w    d3,d4                *
           sub.w    d3,d5                *
           sub.w    d2,d5
           move.w   d4,40(a4)            *
           move.w   d5,42(a4)            *
           add.w    d3,d4                *
           sub.w    d3,d5                *
           bsr      drw_bit1             *
           add.w    d2,d5                *
           add.w    d2,d5
           bsr      drw_bit1             *
           sub.w    d3,d4                *
           sub.w    d3,d5                *
           bsr      drw_bit1             *
           sub.w    d2,d5
           bsr      drw_bit1
           bra      next_pad             *
draw_squ   move.l   40(a4),36(a4)
           move.w   d4,40(a4)
           move.w   d5,42(a4)
           movem.l  d0-d5,-(a7)
           bsr      draw_h_v
           movem.l  (a7)+,d0-d5
           rts
bomsite1   add.w    d3,d4
           move.w   d4,40(a4)
           add.w    d3,d5
           add.w    d3,d5
           add.w    d2,d5
           bsr      drw_bit1             horizontal cross wire
           sub.w    d3,d4
           sub.w    d3,d4
           sub.w    d2,d5
           move.w   d4,40(a4)
           move.w   d5,42(a4)
           add.w    d2,d4
           add.w    d3,d4
           add.w    d3,d4
           bsr      drw_bit1             vertical cross wire
           bra      next_pad
*
word_type  tst.b    17(a4)               check if words should be used
           beq      track_type
           move.w   2(a2),d1
           mulu.w   #6,d1                element length
           adda.l   d1,a2                move base to next element
           moveq    #0,d0                exit ok from segments
           rts
*
via01      cmpi.b   #62,84(a4)
           bgt      postvia1
           cmpi.b   #62,d0
           bgt      postvia1
           movem.l  d0-d5,-(a7)
           exg      a2,a1                save base
           cmp.l    350(a4),a1
           blt.s    ed_off4
           cmp.l    72(a4),a1
           bge.s    padnorm
           moveq    #0,d1                ensure pad is white
padnorm    move.l   198(a4),a2           upper pad addr
           bra.s    ed_on4
ed_off4    move.l   166(a4),a2           lower pad addr
ed_on4     bsr      set_ink1
           move.w   4(a4),d2
           move.b   84(a4),d0
           bsr      set_ink1
           or.w     d2,4(a4)             or seg 1  seg 2  colours
           move.w   2(a1),d4             x coord
           move.w   4(a1),d5             y coord
           moveq    #0,d0
           moveq    #0,d1
           moveq    #0,d2
           moveq    #0,d3
           move.b   #1,34(a4)            round pad
           move.b   #25,d2               pad size
           cmpi.b   #0,149(a4)
           beq.s    via_set1
           move.b   #20,d2               via size
           cmpi.b   #1,149(a4)
           beq.s    via_set1
           move.b   #15,d2               via size
           cmpi.b   #2,149(a4)
           beq.s    via_set1
           move.b   #10,d2               via size
via_set1   btst.b   #0,264(a4)
           beq.s    vinorm1
           subi.w   #1,d2   
vinorm1    move.b   10(a4),d0            scale
           tst.b    11(a4)
           beq.s    pscale6
           lsl.w    d0,d2
           bra.s    nscale6
pscale6    lsr.w    d0,d2
nscale6    move.b   d2,d3
           lsr.w    #1,d3
           move.w   #1,d1                element length
           bsr      via_type
           exg      a1,a2                a2 = base
           movem.l  (a7)+,d0-d5
           bra      postvia1
*
trk_end1   move.w   194(a4),d0
           mulu.w   #6,d0
           add.l    d0,a2
           adda.l   #12,a2               move base to next element
           moveq    #0,d0                exit ok from segments
           rts
track_type bsr      prt_txt1
text_type  move.w   2(a2),d1             d1 = element length
           move.b   6(a2),84(a4)         store colour of first segment
           andi.b   #lay_mask,84(a4)
           sub.w    194(a4),d1
next_track subi.w   #1,d1
           cmpi.w   #1,d1
           beq.s    trk_end1
           addq.l   #6,a2                base moved to next coord
           move.b   1(a2),d2             d2 = track size
           mulu.w   #5,d2                multiply by five
           beq.s    trnorm1
           cmpi.b   #1,264(a4)
           blt.s    trnorm1
           bgt.s    shd2
           btst.l   #0,d2                hi density
           bne.s    trnorm1
           subi.w   #2,d2  
           bra.s    trnorm1
shd2       btst.l   #0,d2                super hi density
           beq.s    trnorm1
           subi.w   #1,d2
trnorm1    move.b   10(a4),d0            scale
           tst.b    11(a4)
           beq.s    pscale7
           lsl.w    d0,d2
           bra.s    nscale7
pscale7    lsr.w    d0,d2                size divided by scale
nscale7    lsr.w    #1,d2                divide by two
           moveq    #0,d0
           move.b   (a2),d0
           andi.b   #via_mask,d0
           lsr.b    #6,d0
           move.b   d0,149(a4)           save via size
           move.b   (a2),d0              ink colour
           andi.b   #lay_mask,d0
           cmp.b    84(a4),d0
           bne      via01
postvia1   move.b   d0,84(a4)
           cmpi.b   #62,d0
           bgt.s    next_track
           bsr      set_ink1             d0 d6 d7
*
           moveq    #0,d6
           moveq    #0,d7
           move.w   2(a2),d4             x source
           move.w   8(a2),d5             x dest
           move.b   10(a4),d0            scale
           move.w   12(a4),d7            x offset
           add.w    d7,d4
           add.w    d7,d5
           tst.b    11(a4)
           beq.s    pscale8
           asl.w    d0,d4
           asl.w    d0,d5
           move.w   d4,44(a4)
           move.w   d5,48(a4)
*
           move.w   4(a2),d4
           move.w   10(a2),d5
           move.w   14(a4),d7
           add.w    d7,d4
           add.w    d7,d5
           asl.w    d0,d4
           asl.w    d0,d5
           bra.s    nscale8
pscale8    asr.w    d0,d4
           asr.w    d0,d5
           move.w   d4,44(a4)            save x source , dest
           move.w   d5,48(a4)
*
           move.w   4(a2),d4             y source
           move.w   10(a2),d5            y dest
           move.w   14(a4),d7
           add.w    d7,d4
           add.w    d7,d5
           asr.w    d0,d4
           asr.w    d0,d5
nscale8    move.w   d4,46(a4)            save y source , dest
           move.w   d5,50(a4)
           cmp.w    d4,d5                compare y source , dest
           bgt.s    pol_ok01
           exg      d4,d5                d4=smaller  d5=greater
pol_ok01   tst.w    d5
           blt      next_track
           cmp.w    302(a4),d4
           bge      next_track
           move.w   44(a4),d4            d4 = x source
           move.w   48(a4),d5            d5 = x dest
           cmp.w    d4,d5                compare x source , dest
           bgt.s    pol_ok02
           exg      d4,d5                d4=smaller  d5=greater
pol_ok02   tst.w    d5
           blt      next_track
           cmp.w    296(a4),d4
           bge      next_track
           btst.b   #1,16(a4)
           bne      fastrak1
           tst.w    d2
           beq      fastrak1             if track width = 0 then fast
           move.w   44(a4),d3            d3 = x source
           move.w   46(a4),d4            d4 = y source
           move.w   48(a4),d5            d5 = x dest
           move.w   50(a4),d6            d6 = y dest
           sub.w    d3,d5                sub x source dest
           bgt.s    inverse1
           neg.w    d5
inverse1   sub.w    d4,d6                sub y source dest
           bgt.s    inverse2
           neg.w    d6
inverse2   cmp.w    d5,d6                compare y diff , x diff
           bgt.s    u_d02                d3=xs  d4=ys  d1=length  d2=size
           move.w   48(a4),d5
           cmp.w    d3,d5                compare x source , dest
           bgt.s    inverse3
           move.w   50(a4),d6            retrieve y dest
           exg      d3,d5
           exg      d4,d6
           move.w   d3,44(a4)
           move.w   d4,46(a4)
           move.w   d5,48(a4)
           move.w   d6,50(a4)
inverse3   add.w    d2,d4
           move.w   d3,40(a4)
           move.w   d4,42(a4)
           sub.w    d2,d3
           sub.w    d2,d4
           bsr      drw_bit2
           add.w    d2,d3
           sub.w    d2,d4
           bsr      drw_bit2
           move.w   48(a4),d3
           move.w   50(a4),d4
           sub.w    d2,d4
           bsr.s    drw_bit2
           add.w    d2,d3
           add.w    d2,d4
           bsr.s    drw_bit2
           sub.w    d2,d3
           add.w    d2,d4
           bsr.s    drw_bit2
           move.w   44(a4),d3
           move.w   46(a4),d4
           add.w    d2,d4
           bsr.s    drw_bit2
           bra      next_track
u_d02      move.w   50(a4),d6
           cmp.w    d4,d6
           bgt.s    inverse4
           move.w   48(a4),d5            retrieve x dest
           exg      d3,d5
           exg      d4,d6
           move.w   d3,44(a4)
           move.w   d4,46(a4)
           move.w   d5,48(a4)
           move.w   d6,50(a4)
inverse4   sub.w    d2,d3
           move.w   d3,40(a4)
           move.w   d4,42(a4)
           add.w    d2,d3
           sub.w    d2,d4
           bsr.s    drw_bit2
           add.w    d2,d3
           add.w    d2,d4
           bsr.s    drw_bit2
           move.w   48(a4),d3            retrieve x dest
           move.w   50(a4),d4                     y dest
           add.w    d2,d3
           bsr.s    drw_bit2
           sub.w    d2,d3
           add.w    d2,d4
           bsr.s    drw_bit2
           sub.w    d2,d3
           sub.w    d2,d4
           bsr.s    drw_bit2
           move.w   44(a4),d3
           move.w   46(a4),d4
           sub.w    d2,d3
           bsr.s    drw_bit2
           bra      next_track
drw_bit2   move.l   40(a4),36(a4)
           move.w   d3,40(a4)
           move.w   d4,42(a4)
           movem.l  d1-d4,-(a7)
           bsr      drwline1
           movem.l  (a7)+,d1-d4
           rts
fastrak1   move.w   44(a4),36(a4)
           move.w   46(a4),38(a4)
           move.w   48(a4),40(a4)
           move.w   50(a4),42(a4)
           movem.l  d1-d2,-(a7)          save element length and size
           bsr      drwline1
           movem.l  (a7)+,d1-d2          recall element length ,size
           bra      next_track
*
blk_end1   move.w   194(a4),d0
           mulu.w   #6,d0
           add.l    d0,a2
           adda.l   #6,a2
           moveq    #0,d0
           rts
block_type bsr      prt_txt1
           move.w   2(a2),d1             d1 = element length
           sub.w    194(a4),d1
           move.w   d1,266(a4)
           subq.l   #6,a2                move to first coordinates                                
next_block move.w   266(a4),d1
           addq.l   #6,a2
           subi.w   #1,d1
           beq.s    blk_end1             partly deleted by area delete
           addq.l   #6,a2
           subi.w   #1,d1                                    
           beq.s    blk_end1             end of element
           move.w   d1,266(a4)                                      
           moveq    #0,d6
           moveq    #0,d7
           move.w   2(a2),d4             d4 = first x coordinate                               
           move.w   8(a2),d5             d5 = second x coordinate                      
           move.b   10(a4),d0
           move.w   12(a4),d7
           add.w    d7,d4
           add.w    d7,d5
           tst.b    11(a4)
           beq.s    pscale9
*
           asl.w    d0,d4
           asl.w    d0,d5
           move.w   d4,44(a4)
           move.w   d5,48(a4)
*
           move.w   4(a2),d4             d4 = first y coordinate
           move.w   10(a2),d5            d5 = second y coordinate
           move.w   14(a4),d7
           add.w    d7,d4
           add.w    d7,d5
           asl.w    d0,d4
           asl.w    d0,d5
           bra.s    nscale9
*
pscale9    asr.w    d0,d4
           asr.w    d0,d5
           move.w   d4,44(a4)            x s
           move.w   d5,48(a4)            x d
*
           move.w   4(a2),d4
           move.w   10(a2),d5
           move.w   14(a4),d7
           add.w    d7,d4
           add.w    d7,d5
           asr.w    d0,d4
           asr.w    d0,d5
*
nscale9    move.w   d4,46(a4)            y s
           move.w   d5,50(a4)            y d
           btst.b   #0,80(a4)
           beq.s    ed_off2
           cmp.l    350(a4),a2
           blt.s    ed_off2
           bsr      ed_on
           move.w   44(a4),36(a4)
           move.w   46(a4),38(a4)
           move.w   44(a4),40(a4)
           move.w   50(a4),42(a4)
           bsr      draw_h_v
           move.w   50(a4),38(a4)
           move.w   48(a4),40(a4)
           bsr      draw_h_v
           move.w   48(a4),36(a4)
           move.w   46(a4),42(a4)
           bsr      draw_h_v
           move.w   46(a4),38(a4)
           move.w   44(a4),40(a4)
           bsr      draw_h_v
           bra      next_block
ed_off2    moveq    #0,d0
           move.b   (a2),d0              ink colour
           andi.b   #lay_mask,d0
           bsr      ed_off               set ink
           move.w   44(a4),d0            x  source
           move.w   48(a4),d1            x  dest
           cmp.w    d0,d1
           bgt.s    no_exg01
           exg      d0,d1
           bra.s    no_exg01
fill1      addi.w   #1,d0
no_exg01   tst.b    16(a4)
           beq.s    nt_hashed
           move.w   d0,d3
           andi.w   #3,d3
           bne.s    fill1
           cmp.w    d0,d1
           ble      next_block
nt_hashed  move.w   46(a4),38(a4)
           move.w   50(a4),42(a4)
           move.w   d0,36(a4)
           move.w   d0,40(a4)
           movem.l  d0-d1,-(a7)
           bsr      vert_plot
           movem.l  (a7)+,d0-d1
           cmp.w    d0,d1
           bgt.s    fill1
           bra      next_block
*
relocate   moveq    #0,d0
           lea      par,a4
           move.l   26(a4),a2
           moveq    #0,d5
           move.w   58(a4),d1
           move.w   60(a4),d2
           sub.w    d1,62(a4)            offset area
           sub.w    d2,64(a4)            offset area
           move.l   #0,58(a4)            zero cursor
           move.l   #0,104(a4)           zero area
           tst.b    135(a4)
           beq.s    nxt_el01
           add.w    d1,12(a4)
           add.w    d2,14(a4)
nxt_el01   move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d5              d5 = type
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq.s    t_p_w_b
           cmpi.b   #trk,d5
           beq.s    t_p_w_b
           cmpi.b   #wrd,d5
           beq.s    t_p_w_b
           cmpi.b   #blk,d5
           beq.s    t_p_w_b
           cmpi.b   #end,d5
           beq.s    fle_fin2
           moveq    #0,d5
           move.w   2(a2),d5
           mulu.w   #6,d5
           adda.l   d5,a2
           bra.s    nxt_el01
fle_fin2   tst.b    135(a4)
           bne      prt_c
           bra      redraw
t_p_w_b    move.w   2(a2),d5             d5 = element length
           sub.w    194(a4),d5
next_coor  addq.l   #6,a2                base to next coord
           move.w   2(a2),d3             x
           move.w   4(a2),d4             y
           sub.w    d1,d3                add x offset
           sub.w    d2,d4                add y offset
           move.w   d3,2(a2)
           move.w   d4,4(a2)
           subi.w   #1,d5
           cmpi.w   #1,d5
           bne.s    next_coor
           move.w   194(a4),d0
           mulu.w   #6,d0
           add.l    d0,a2
           moveq    #0,d0
           addq.l   #6,a2
           bra      nxt_el01
*
reassign   cmpi.b   #10,d2               *
           bne.s    nt2lay10             *
           moveq    #6,d2                *
           rts                           *
nt2lay10   cmpi.b   #11,d2               *
           bne.s    nt2lay11             *
           moveq    #7,d2                *
           rts                           *
nt2lay11   cmpi.b   #26,d2               *
           bne.s    nt2lay26             *
           moveq    #8,d2                *
           rts                           *
nt2lay26   cmpi.b   #27,d2               *
           bne.s    nt2lay27             *
           moveq    #9,d2                *
           rts                           *
nt2lay27   cmpi.b   #42,d2               *
           bne.s    nt2lay42             *
           moveq    #10,d2               *
           rts                           *
nt2lay42   cmpi.b   #43,d2               *
           bne.s    nt2lay43             *
           moveq    #11,d2               * 
           rts
nt2lay43   cmpi.b   #58,d2               *
           bne.s    nt2lay58             *
           moveq    #12,d2               *
           rts                           *
nt2lay58   cmpi.b   #14,d2               *
           bne.s    nt2lay14             *
           moveq    #13,d2               *
           rts                           *      
nt2lay14   cmpi.b   #15,d2               *
           bne.s    nt2lay15             *
           moveq    #14,d2               *
           rts                           *
nt2lay15   cmpi.b   #30,d2               *
           bne.s    nt2lay30             *
           moveq    #15,d2               *
           rts                           *
nt2lay30   cmpi.b   #31,d2               *
           bne.s    nt2lay31             *
           moveq    #16,d2               *
           rts                           *
nt2lay31   cmpi.b   #46,d2               *
           bne.s    nt2lay46             *
           moveq    #17,d2               *
           rts                           *
nt2lay46   cmpi.b   #47,d2               *
           bne.s    nt2lay47             *
           moveq    #18,d2               *
           rts                           *
nt2lay47   cmpi.b   #62,d2               *
           bne.s    nt2lay62             *
           moveq    #19,d2               *
           rts                           *   
nt2lay62   and.b    d0,d2                *
           bne.s    visible              *
           moveq    #0,d0                * force off
           moveq    #0,d2                *
           rts                           *
visible    move.w   #1,d0                * force on
           moveq    #0,d2                *
exit18     rts
*
blk_el     move.w   (a2),d5
           andi.w   #lab_mask,d5
           cmpi.w   #3,d5
           bgt.s    has_rf1
           move.w   4(a2),d5
           andi.w   #lib_mask,d5
           bne.s    has_rf1
           move.b   #1,281(a4)
           bra.s    no_rf1
has_rf1    move.b   #0,281(a4)
no_rf1     move.l   a2,276(a4)           save element base for label adjust
           move.w   2(a2),d5
           move.w   d5,30(a4)            save element length for moving
           sub.w    194(a4),d5
           move.w   d5,266(a4)
           subq.l   #6,a2
           move.b   #1,274(a4)
           bra.s    first_co
new_co6    move.b   #0,274(a4)
first_co   move.w   266(a4),d5
           addq.l   #6,a2
           subi.w   #1,d5
           beq      blk_exit
           addq.l   #6,a2
           subi.w   #1,d5
           beq      blk_exit
           move.w   d5,266(a4)
           moveq    #0,d2
           move.b   (a2),d2              ink
           andi.b   #lay_mask,d2
           cmpi.b   #inv_lay,d2          check for invisible layer
           beq.s    invis1               need to pick up invisible layer
*
           move.l   518(a4),d0           *
           tst.b    d2                   ****check for layer 0
           beq.s    invis1               ****layer used for pdf background
           bsr      reassign             *
           btst.l   d2,d0                *
           beq      new_co6              * layer switched off
invis1     move.w   2(a2),d0             d0 = coor x  d4 = grid step
           move.w   58(a4),d3            d3 = x cursor coord
           sub.w    d4,d3                left side
           cmp.w    d0,d3
           bgt.s    swp_x
           add.w    d4,d3                add grid to x cursor
           add.w    d4,d3                right side of cursor
           cmp.w    d0,d3
           blt.s    swp_x
           bra.s    chk_y
*
swp_x      tst.b    274(a4)
           beq.s    ntswplx
           movem.l  d4-d5/a2,-(a7)       save d4, d5 and a2
           move.l   276(a4),a2
           moveq    #0,d5
           move.w   8(a2),d4
           sub.w    14(a2),d4            swap x for labels
           bsr      blkmv_l2
           movem.l  (a7)+,d4-d5/a2       restore d4, d5 and a2
ntswplx    move.w   8(a2),2(a2)          swap x source and x dest coords
           move.w   d0,8(a2)
           move.w   2(a2),d0
*
           move.w   58(a4),d3
           sub.w    d4,d3
           cmp.w    d0,d3
           bgt      new_co6
           add.w    d4,d3
           add.w    d4,d3
           cmp.w    d0,d3
           blt      new_co6
*
chk_y      move.w   4(a2),d0
           move.w   60(a4),d3
           sub.w    d4,d3
           cmp.w    d0,d3
           bgt.s    swp_y
           add.w    d4,d3
           add.w    d4,d3
           cmp.w    d0,d3
           blt.s    swp_y
           bra.s    blk_got
*
swp_y      tst.b    274(a4)
           beq.s    ntswply
           movem.l  d4-d5/a2,-(a7)       save d4, d5 and a2
           move.l   276(a4),a2
           moveq    #0,d4
           move.w   10(a2),d5
           sub.w    16(a2),d5            swap y for labels
           bsr      blkmv_l2
           movem.l  (a7)+,d4-d5/a2       restore d4, d5 and a2
ntswply    move.w   10(a2),4(a2)         swap y source and y dest coords
           move.w   d0,10(a2)
           move.w   4(a2),d0
*
           move.w   60(a4),d3
           sub.w    d4,d3
           cmp.w    d0,d3
           bgt      new_co6
           add.w    d4,d3
           add.w    d4,d3
           cmp.w    d0,d3
           blt      new_co6
*
blk_got    move.b   281(a4),280(a4)
           addi.w   #1,d5
           move.w   2(a2),d0
           move.w   4(a2),d2
           bra      set_offset
*
blk_exit   move.w   194(a4),d0
           mulu.w   #6,d0
           add.l    d0,a2
           addq.l   #6,a2
           moveq    #0,d0
           bra.s    nxt_el02
exit19     moveq    #0,d0
exit20     rts
search     lea      par,a4
           move.l   26(a4),d6
           beq.s    exit20
           move.l   d6,a2
           moveq    #0,d5
           moveq    #0,d4
           bsr.s    nxt_el02
           tst.w    d4
           bne      int_ret
           move.l   26(a4),a2
           moveq    #0,d5
           move.w   82(a4),d4            d4 = grid step
           bsr.s    nxt_el02
           bra      int_ret
nxt_el02   move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.l   a2,d1                d1 = base of element
           move.b   (a2),d5              d5 = type
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq.s    t_p_w2
           cmpi.b   #wrd,d5
           beq.s    w2
           cmpi.b   #trk,d5
           beq.s    t_p_w2
           cmpi.b   #blk,d5
           beq      blk_el
           cmpi.b   #end,d5
           beq.s    fle_fin3
           bra.s    new_el_type
fle_fin3   moveq    #0,d4
           rts
w2         tst.b    17(a4)               check if words are on screen
           beq.s    t_p_w2
new_el_type moveq   #0,d5
           move.w   2(a2),d5
           mulu.w   #6,d5
           adda.l   d5,a2
           bra.s    nxt_el02
t_p_w2     move.w   2(a2),d5
           move.w   d5,30(a4)            save element length for moving
           sub.w    194(a4),d5
new_coord  addq.l   #6,a2
           moveq    #0,d2
           move.b   (a2),d2              ink
           andi.b   #lay_mask,d2
           cmpi.b   #inv_lay,d2          check for invisible layer
           beq.s    invisible            need to pick up invisible layer
*
           move.l   518(a4),d0           *
           bsr      reassign             *
           btst.l   d2,d0                *
           beq.s    cont1                * layer switched off
invisible  move.w   2(a2),d0             d0 = coor x  d4 = grid step
           move.w   58(a4),d3            d3 = x cursor coor
           sub.w    d4,d3                left side
           cmp.w    d0,d3
           bgt.s    cont1
           add.w    d4,d3
           add.w    d4,d3                right side of cursor
           cmp.w    d0,d3
           blt.s    cont1
           move.w   4(a2),d2             d2 = coor y  d1 = grid step
           move.w   60(a4),d3            d3 = y cursor coor
           sub.w    d4,d3                top side
           cmp.w    d2,d3
           bgt.s    cont1
           add.w    d4,d3
           add.w    d4,d3                bottom side
           cmp.w    d2,d3
           blt.s    cont1
           subi.w   #1,d5
set_offset move.w   d5,70(a4)            save section of element
           move.l   d1,72(a4)            save element base           
           tst.b    135(a4)
           beq.s    noqptr07
           move.w   d0,d1
           move.w   d2,d4
           sub.w    58(a4),d1
           sub.w    60(a4),d4
           sub.w    d1,12(a4)
           sub.w    d4,14(a4)
           move.b   #0,294(a4)           unset cursor move flag
           or.w     d1,d4
           beq.s    move_mem
           move.b   #1,294(a4)           set cursor move flag
noqptr07   move.w   d0,58(a4)            d0=x coord
           move.w   d2,60(a4)            d2=y coord
           bra.s    move_mem
*
cont1      subi.w   #1,d5
           cmpi.w   #1,d5
           bne      new_coord
           move.w   194(a4),d0
           mulu.w   #6,d0
           add.l    d0,a2
           moveq    #0,d0
           addq.l   #6,a2
           bra      nxt_el02
*
move_mem   move.l   26(a4),a2            ************
           move.b   #0,291(a4)           * clear flag
nxt_el03   move.b   (a2),d5              * d5 = type
           andi.b   #type_mask,d5        *
           cmpi.b   #end,d5              *
           beq      setcomp              *
           move.w   4(a2),d5             *
           andi.w   #comp_mask,d5        *
           bne      istrailer            *
           btst.b   #0,291(a4)           * test for component
           beq      nocomp               *
           move.b   #0,291(a4)           *
           cmp.l    72(a4),a2            * is end of component
           ble.s    isheader             * if a2<edit address then is component header
           move.l   a2,d0                * d0 = end of component
           move.l   d0,354(a4)           * element picked up is in component
*
           move.l   350(a4),d5           * d5 = start of component
           sub.l    d5,d0                * d0 = component length
           move.l   d0,358(a4)           * store component length
           move.l   76(a4),a0            * a0 = end of file
           move.l   350(a4),a1           * a1 = component start address
to_end2    move.w   (a1)+,(a0)+          *
           subi.l   #2,d0                *
           bne.s    to_end2              *
           move.l   358(a4),d0           * retrieve component length
           move.l   350(a4),a0           * a0 = old component base
           move.l   a0,a1                *
           adda.l   d0,a1                * a1 = end of old element
           move.l   76(a4),d0            * d0 = end of file
           sub.l    350(a4),d0           * d0 = number of shifts required
           add.l    d0,72(a4)            * correct adit address part 1
remove2    move.w   (a1)+,(a0)+          * move file down to fill space
           subi.l   #2,d0                *
           bne.s    remove2              *
*
           move.l   76(a4),350(a4)       *
           move.l   76(a4),354(a4)       *
           move.l   358(a4),d1           *
           sub.l    d1,72(a4)            * correct edit address part 2
           sub.l    d1,350(a4)           * component start address
setcomp    move.l   350(a4),a0           * a0 = start of component
           move.w   4(a0),d0             *
           ori.w    #comp_mask,d0        * make all component flags true
           move.w   d0,4(a0)             *
           bra.s    compend              *
*
isheader   move.l   a2,350(a4)           *
           bra.s    moveon               *
*
istrailer  move.b   #1,291(a4)           * set flag
moveon     moveq    #0,d5                *
           move.w   2(a2),d5             *
           mulu.w   #6,d5                *
           adda.l   d5,a2                *
           bra      nxt_el03             *
*
nocomp     move.l   a2,350(a4)           *
           cmp.l    72(a4),a2            *
           ble.s    isheader             *
           move.l   76(a4),350(a4)       * no component picked up
           move.l   76(a4),354(a4)       *
           move.w   30(a4),d0            *
           mulu.w   #6,d0                *
           sub.l    d0,350(a4)           ************
*
compend    move.l   76(a4),a0            a0 = end of file location
           move.w   30(a4),d0
           mulu.w   #6,d0                d0 = element length
           move.l   d0,30(a4)            store element length
           move.l   72(a4),a1            a1 = element base location
to_end     move.w   (a1)+,(a0)+          move element to end
           subi.l   #2,d0
           bne.s    to_end
           moveq    #0,d0
           move.l   30(a4),d0            retrieve element length
           move.l   72(a4),a0            a0 = old element base
           move.l   a0,a1
           adda.l   d0,a1                a1 = end of old element
           move.l   76(a4),d0            d0 = end of file
           sub.l    72(a4),d0            d0 = number of shifts required
remove     move.w   (a1)+,(a0)+          move file down to fill space
           subi.l   #2,d0
           bne.s    remove
           move.l   76(a4),72(a4)
           moveq    #0,d1
           move.l   30(a4),d1
           sub.l    d1,72(a4)
           move.l   76(a4),a0
           move.l   #$ffffffff,(a0)+
           move.w   #$ffff,(a0)
*
           move.l   350(a4),a0           ************
           move.w   4(a0),d0             * clear component start flag
           andi.w   #ncomp_mask,d0       *
           move.w   d0,4(a0)             ************
*
           tst.b    135(a4)
           beq.s    noqptr08
           tst.b    294(a4)
           beq.s    noqptr08
           bsr      update3              full screen update without cursor
           bra.s    isqptr08
noqptr08   move.b   #1,d6
           bsr      set_over
           moveq    #7,d6
           bsr      set_ink2
           bsr      blank                remove cursor
isqptr08   move.b   #3,d6
           bsr      set_over             take mode
           move.l   350(a4),a2
           bsr      elements             remove elements
           ori.b    #1,80(a4)            edit on
           move.b   #1,d6
           bsr      set_over             xor mode
           move.l   350(a4),a2
           bsr      elements             place elements in edit mode
           bsr      put_cur              move cursor to element
           bsr      prt_s                print scale
           move.w   #1,d4
           rts
*
area       move.w   ca.gtint,a0
           jsr      (a0)
           bne.s    exit21
           moveq    #1,d6
           bsr      set_over
           lea      par,a4
           move.b   #1,117(a4)
           moveq    #7,d6
           bsr      set_ink2
           tst.w    d3
           bgt.s    rel_mve2
*
           tst.b    135(a4)
           beq.s    noqptr03
           bsr      get_ptr
           tst.w    d7
           beq.s    abs_mve2
noqptr03   moveq    #0,d0                pointer is off screen
exit21     rts
*
rel_mve2   moveq    #-15,d0
           cmpi.w   #3,d3
           bne.s    exit21
           move.l   (a6,a1.l),d0
           beq.s    no_xy2
           tst.b    135(a4)
           bne.s    noqptr03
no_xy2     move.l   d0,d1
           swap     d0
           move.b   5(a6,a1.l),d6
           btst.l   #1,d6
           bne.s    new_area
abs_mve2   movem.l  d0-d1,-(a7)
           bsr      blank2
           movem.l  (a7)+,d0-d1
           moveq    #1,d6
           bra.s    place2
new_area   move.b   #0,116(a4)           area update off
           move.b   5(a6,a1.l),d6
           btst.l   #0,d6
           beq.s    ud_area
           move.b   #1,116(a4)           area update on
           move.w   58(a4),62(a4)        old cursor coor to area
           move.w   60(a4),64(a4)
place2     add.w    d0,58(a4)            new area coor to cursor
           add.w    d1,60(a4)
           move.w   58(a4),104(a4)       move area coor
           move.w   60(a4),106(a4)
ud_area    bsr      prt_c
           move.w   104(a4),d0
           move.w   106(a4),d1
           move.w   62(a4),d2            retrieve area x coor
           move.w   64(a4),d3            retrieve area y coor
           move.w   12(a4),d4
           add.w    d4,d0
           add.w    d4,d2
           move.w   14(a4),d4
           add.w    d4,d1
           add.w    d4,d3
           moveq    #0,d4
           move.b   10(a4),d4
           tst.b    11(a4)
           beq.s    pscale10
           asl.w    d4,d0
           asl.w    d4,d1
           asl.w    d4,d2
           asl.w    d4,d3
           bra.s    nscale10
pscale10   asr.w    d4,d0
           asr.w    d4,d1
           asr.w    d4,d2
           asr.w    d4,d3
nscale10   move.w   d0,6(a4)             save cursor x
           move.w   d1,8(a4)             save cursor y
           tst.b    d6
           beq.s    area_rem
           tst.w    d0
           blt      update2
           cmp.w    296(a4),d0
           bge      update2
           tst.w    d1
           blt      update2
           cmp.w    302(a4),d1
           bge      update2
area_rem   move.w   d2,66(a4)            save area x
           move.w   d3,68(a4)            save area y
blank2     move.w   66(a4),36(a4)        area x
           move.w   68(a4),38(a4)        area y
           move.w   66(a4),40(a4)        area x
           move.w   8(a4),42(a4)         cursor y
           bsr      draw_h_v
           move.w   8(a4),38(a4)         cursor y
           move.w   6(a4),40(a4)         cursor x
           bsr      draw_h_v
           move.w   6(a4),36(a4)         cursor x
           move.w   68(a4),42(a4)        area y
           bsr      draw_h_v
           move.w   68(a4),38(a4)        area y
           move.w   66(a4),40(a4)        area x
           bsr      draw_h_v
           moveq    #0,d0
exit22     rts
*
grid_step  move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit22
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit22
           moveq    #0,d0
           move.b   3(a6,a1.l),d0
           cmpi.b   #9,d0
           blt.s    grid_ok
           moveq    #8,d0
grid_ok    lsl.b    #1,d0                convert to word offset
           lea      grid_data,a4
           move.w   (a4,d0.w),d1
           lea      par,a4
           move.w   d1,82(a4)
           bra      prt_s
grid_data  dc.w     1
           dc.w     5
           dc.w     10
           dc.w     20
           dc.w     25
           dc.w     50
           dc.w     100
           dc.w     200
           dc.w     1000
*
grid       moveq    #0,d4
           lea      par,a4
           move.w   82(a4),d4
           bra      int_ret
*
snap       lea      par,a4
           moveq    #0,d0
           btst.b   #0,80(a4)
           beq.s    snapit1
           move.l   72(a4),a2            edit address
           move.b   (a2),d5              element type
           andi.b   #type_mask,d5
           cmpi.b   #wrd,d5
           beq.s    snapon               is word element
           move.w   4(a2),d5
           andi.w   #lib_mask,d5
           bne.s    snapon               has library id
           cmp.l    350(a4),a2           look for component
           bgt.s    snapon
snapoff    move.b   #1,81(a4)            set snapit flag
           rts
snapit1    tst.b    81(a4)
           beq.s    snapit2
snapon     move.b   #0,81(a4)            clear snapit flag
           rts
snapit2    move.b   #1,d6
           bsr      set_over
           moveq    #7,d6
           bsr      set_ink2
           bsr      blank
           move.w   58(a4),d0
           move.w   60(a4),d1
           move.w   82(a4),d2
           ext.l    d0
           ext.l    d1
           divs     d2,d0
           divs     d2,d1
           muls     d2,d0
           muls     d2,d1
           move.w   d0,58(a4)
           move.w   d1,60(a4)
           bra      put_cur
*
origin     lea      par,a4
           tst.b    135(a4)
           beq.s    noqptr09
           btst.b   #0,80(a4)
           beq.s    onlycur1
           moveq    #0,d0
           rts
onlycur1   move.w   58(a4),d0
           move.w   60(a4),d1
           add.w    d0,12(a4)
           add.w    d1,14(a4)
           move.l   #0,58(a4)
           move.w   12(a4),d0
           move.w   14(a4),d1
           bsr      update3
           bra      put_cur
noqptr09   moveq    #0,d0
           moveq    #0,d1
           btst.b   #0,80(a4)
           beq.s    onlycur2
           move.w   58(a4),d0
           move.w   60(a4),d1
           neg.w    d0
           neg.w    d1
           move.w   d0,130(a4)
           move.w   d1,132(a4)
           bra      orig_ret
onlycur2   move.l   #0,58(a4)
           bra      move_cur
*
sort_xy    move.w   104(a4),d0           x cursor coord
           move.w   62(a4),d1            x area coord
           cmp.w    d0,d1
           bgt.s    no_exg02
           exg      d0,d1
no_exg02   move.w   d1,94(a4)            largest x area coord
           move.w   d0,96(a4)            smallest x area coord
           move.w   106(a4),d0           y cursor coord
           move.w   64(a4),d1            y area coord
           cmp.w    d0,d1
           bgt.s    no_exg03
           exg      d0,d1
no_exg03   move.w   d1,98(a4)            largest y area coord
           move.w   d0,100(a4)           smallest y area coord
exit23     rts
*
area_inv   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit23
           moveq    #-15,d0
           cmpi.w   #2,d3
           bne.s    exit23
           move.b   3(a6,a1.l),d0        d0 = rotation type
           move.b   7(a6,a1.l),d1
           andi.b   #7,d0
           lea      par,a4
           move.b   d0,136(a4)
           move.b   d1,137(a4)
           move.l   26(a4),d6
           beq.s    exit23               not found return
           move.l   d6,a2
           moveq    #0,d6
           moveq    #0,d5
           tst.b    137(a4)
           beq.s    nt_global
           move.l   #0,94(a4)
           move.l   #0,98(a4)
           bra.s    nxt_el04
nt_global  bsr      do
           bsr      sort_xy              sets up area boundries in 94,96,98,100(a4)
nxt_el04   move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq      t_p_w_b3
           cmpi.b   #trk,d5
           beq      t_p_w_b3
           cmpi.b   #wrd,d5
           beq      t_p_w_b3
           cmpi.b   #blk,d5
           beq      t_p_w_b3
           cmpi.b   #end,d5
           bne      abort1
********
           tst.b    137(a4)
           beq      rot_rtn2
           move.w   58(a4),d0
           move.w   60(a4),d1
           cmpi.b   #0,136(a4)
           beq.s    x_rot2
           cmpi.b   #1,136(a4)
           beq.s    y_rot2
           cmpi.b   #2,136(a4)
           beq.s    c_rot2
           cmpi.b   #3,136(a4)
           beq.s    a_rot2
           bra.s    rot_rtn2
*
x_rot2     move.w   12(a4),d2
           neg.w    d0
           move.w   d0,58(a4)
           neg.w    d0
           asl.w    #1,d0
           add.w    d0,d2
           move.w   d2,12(a4)
           bra.s    rot_rtn2
*
y_rot2     move.w   14(a4),d3
           neg.w    d1
           move.w   d1,60(a4)
           neg.w    d1
           asl.w    #1,d1
           add.w    d1,d3
           move.w   d3,14(a4)
           bra.s    rot_rtn2
*
c_rot2     add.w    d0,12(a4)
           sub.w    d1,12(a4)
           add.w    d0,14(a4)
           add.w    d1,14(a4)
           neg.w    d0
           move.w   d1,58(a4)
           move.w   d0,60(a4)
           bra.s    rot_rtn2
*
a_rot2     add.w    d0,12(a4)
           add.w    d1,12(a4)
           sub.w    d0,14(a4)
           add.w    d1,14(a4)
           neg.w    d1
           move.w   d1,58(a4)
           move.w   d0,60(a4)
********
rot_rtn2   cmpi.b   #2,136(a4)           check for mirroring
           bge.s    close_area
*
           move.w   #36,d3               d3 parameters count
           move.l   26(a4),a2
           tst.b    117(a4)              check area mode flag
           bne.s    areamde1
           move.b   #1,137(a4)           global flag
           bra.s    ntarea1
areamde1   move.b   #0,137(a4)           non global
ntarea1    lea      layswap,a1           a1 pointer to first layer colour
           bsr      layswap1
close_area move.b   #0,116(a4)           turn off area outline
           tst.b    135(a4)
           bne.s    isqptr04
           bsr      update2
           bra      put_cur
isqptr04   move.w   12(a4),d0
           move.w   14(a4),d1
           bsr      update3
           bra      put_cur
*
layswap    dc.l     1,4,2,8,16,32,10,14,11,15,26,30,27,31,42,46,43,47,58,62
*
abort1     move.w   2(a2),d5
           mulu.w   #6,d5
           adda.l   d5,a2
           bra      nxt_el04
t_p_w_b3   cmpi.b   #4,136(a4)           check for move to grid
           bne.s    grid_ret
grid_chk   cmpi.b   #wrd,d5              global move to grid
           beq      abort1               do not operate on text
           tst.b    170(a4)
           beq.s    grid_ret             library unlocked
           move.w   4(a2),d5
           andi.w   #lib_mask,d5
           bne      abort1               is a library component
grid_ret   tst.b    137(a4)              **************
           bne.s    global6              *            *
           bsr      check_area           *  new code  *
           cmp.l    a2,d6                *            *
           bne      nxt_el04             **************
global6    move.w   2(a2),d5             d5 = element length
           sub.w    194(a4),d5
new_co3    addq.l   #6,a2                base to next coord
           move.w   2(a2),d3             x
           move.w   4(a2),d4             y
           tst.b    137(a4)
           bne.s    global2
           cmp.w    94(a4),d3
           bgt.s    outside              *
           cmp.w    96(a4),d3
           blt.s    outside              *
           cmp.w    98(a4),d4
           bgt.s    outside              *
           cmp.w    100(a4),d4
           blt.s    outside              *
global2    cmpi.b   #0,136(a4)
           beq.s    x_rot1
           cmpi.b   #1,136(a4)
           beq.s    y_rot1
           cmpi.b   #2,136(a4)
           beq.s    c_rot1
           cmpi.b   #3,136(a4)
           beq      a_rot1
           bra      g_set
outside    subi.w   #1,d5                *
           cmpi.w   #1,d5                *
           bne.s    new_co3              *
           addq.l   #6,a2                *
           move.w   194(a4),d2           *
           mulu.w   #6,d2                *
           add.l    d2,a2                *
           bra      nxt_el04             *
rot_rtn1   subi.w   #1,d5
           cmpi.w   #1,d5
           bne.s    new_co3
           addq.l   #6,a2                a2 = base of labels
           cmpi.b   #4,136(a4)           check for grid mode
           beq.s    g_set2
           move.w   194(a4),d2           d2 = num of labels
           beq.s    g_set2
           subi.w   #3,d2
           mulu.w   #6,d2                (a2,d2.l) = base of last label
           bsr      rot_lab
g_set2     move.w   194(a4),d2
           mulu.w   #6,d2
           add.l    d2,a2
           bra      nxt_el04
x_rot1     sub.w    94(a4),d3
           neg.w    d3
           add.w    96(a4),d3
           move.w   d3,2(a2)
           bra.s    rot_rtn1
y_rot1     sub.w    98(a4),d4
           neg.w    d4
           add.w    100(a4),d4
           move.w   d4,4(a2)
           bra.s    rot_rtn1
c_rot1     sub.w    100(a4),d4           subtract smallest y from y
           add.w    96(a4),d4            add y to smallest x
           move.w   d4,2(a2)             save x
           sub.w    96(a4),d3            subtract smallest x from x
           move.w   98(a4),d6            d6 = largest y
           sub.w    d3,d6                subtract x from largest y
           move.w   d6,4(a2)             save y
           bra.s    rot_rtn1
a_rot1     sub.w    100(a4),d4           subtract smallest y from y
           move.w   94(a4),d6            d6 = largest x
           sub.w    d4,d6                subtract y from largest x
           move.w   d6,2(a2)             save x
           sub.w    96(a4),d3            subtract smallest x from x
           add.w    100(a4),d3           add x to smallest y
           move.w   d3,4(a2)             save y
           bra      rot_rtn1
g_set      move.w   82(a4),d6            d6 = grid step
           ext.l    d3                   extend x to long
           ext.l    d4                   extend y to long
           divs     d6,d3                divide x result is word
           muls     d6,d3                mult   x result is long
           divs     #1,d3                return long to word
           move.w   d3,2(a2)             save x
           divs     d6,d4                divide y result is word
           muls     d6,d4                mult   y result is long
           divs     #1,d4                return long to word
           move.w   d4,4(a2)             save y
           bra      rot_rtn1
exit24     rts
*
area_move  lea      par,a4
           bsr      do
           move.l   26(a4),d6
           beq.s    exit24
           move.l   d6,a2
           moveq    #0,d5                clear counter
           bsr      sort_xy
*
           move.w   104(a4),d1
           sub.w    58(a4),d1
           move.w   106(a4),d2
           sub.w    60(a4),d2
nxt_el05   move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq.s    t_p_w_b4
           cmpi.b   #trk,d5
           beq.s    t_p_w_b4
           cmpi.b   #wrd,d5
           beq.s    t_p_w_b4
           cmpi.b   #blk,d5
           beq.s    t_p_w_b4
           cmpi.b   #end,d5
           beq      redraw
           moveq    #0,d5
           move.w   2(a2),d5
           mulu.w   #6,d5
           adda.l   d5,a2
           bra.s    nxt_el05
t_p_w_b4   bsr      check_area
           cmp.l    a2,d6
           bne.s    nxt_el05
           move.w   2(a2),d5
           sub.w    194(a4),d5
new_co4    addq.l   #6,a2
           move.w   2(a2),d3
           move.w   4(a2),d4
           cmp.w    94(a4),d3
           bgt.s    mov_ret
           cmp.w    96(a4),d3
           blt.s    mov_ret
           cmp.w    98(a4),d4
           bgt.s    mov_ret
           cmp.w    100(a4),d4
           blt.s    mov_ret
           sub.w    d1,d3
           sub.w    d2,d4
           move.w   d3,2(a2)
           move.w   d4,4(a2)
mov_ret    subi.w   #1,d5
           cmpi.w   #1,d5
           bne.s    new_co4
           move.w   194(a4),d0
           mulu.w   #6,d0
           add.l    d0,a2
           moveq    #0,d0
           addq.l   #6,a2
           bra      nxt_el05
*
area_make  lea      par,a4
           move.b   #0,116(a4)           area update off
           move.b   #0,261(a4)           clear first element flag
           move.l   26(a4),d6
           beq      exit24
           move.l   76(a4),350(a4)
           move.l   d6,a2
           moveq    #0,d5                clear counter
           bsr      sort_xy
*
           move.w   104(a4),d1
           sub.w    58(a4),d1
           move.w   106(a4),d2
           sub.w    60(a4),d2
nxt_el06   cmp.l    350(a4),a2
           bge      endmake
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq.s    t_p_w_b16
           cmpi.b   #trk,d5
           beq.s    t_p_w_b16
           cmpi.b   #wrd,d5
           beq.s    t_p_w_b16
           cmpi.b   #blk,d5
           beq.s    t_p_w_b16
           moveq    #0,d5
           move.w   2(a2),d5
           mulu.w   #6,d5
           adda.l   d5,a2
           bra.s    nxt_el06
t_p_w_b16  bsr      chck_area2
           cmp.l    a2,d6
           bne.s    nxt_el06
*
           btst.b   #0,261(a4)
           bne.s    trailer   
           andi.w   #ncomp_mask,4(a2)    clear bit           
           bra.s    header
trailer    ori.w    #comp_mask,4(a2)     set bit
*************************************************
header     move.l   76(a4),a0            a0 = end of file location
           move.w   2(a2),d0
           mulu.w   #6,d0                d0 = element length
           move.l   a0,72(a4)
           sub.l    d0,72(a4)
           sub.l    d0,350(a4)
           move.l   d0,d1                store element length
           move.l   a2,a1                a1 = element base location
to_end3    move.w   (a1)+,(a0)+          move element to end
           subi.l   #2,d0
           bne.s    to_end3
           move.l   d1,d0                restore element length
           move.l   a2,a0                a0 = old element base
           move.l   a0,a1
           adda.l   d0,a1                a1 = end of old element
           move.l   76(a4),d0            d0 = end of file
           sub.l    a2,d0                d0 = number of shifts required
remove3    move.w   (a1)+,(a0)+          move file down to fill space
           subi.l   #2,d0
           bne.s    remove3 
*************************************************
           move.b   #1,261(a4)
           move.l   76(a4),a0
           move.l   #$ffffffff,(a0)+
           move.w   #$ffff,(a0) 
           bra      nxt_el06
*
endmake    moveq    #0,d6
           bsr      ud_area              remove area
           move.l   72(a4),a2
           move.w   8(a2),58(a4)         move cursor to first coordinate
           move.w   10(a2),60(a4)
           move.w   2(a2),d4             d4 = element length
           sub.w    194(a4),d4
           subi.w   #1,d4
           move.w   d4,70(a4)            segment picked up
           move.b   #3,d6
           bsr      set_over             take mode
           move.l   350(a4),a2
           bsr      elements             remove elements
           ori.b    #1,80(a4)            edit on
           move.b   #1,d6
           bsr      set_over             xor mode
           move.l   350(a4),a2
           bsr      elements             place elements in edit mode
           bsr      put_cur              move cursor to element
           moveq    #0,d0
           rts
*
chk_min_len
           move.w   #3,d1
           add.w    194(a4),d1
           cmpi.b   #pad,d5
           bne.s    exit25
           subi.w   #1,d1                d1 = minimum length 
exit25     rts
*
area_del   lea      par,a4
           bsr      do
           move.l   26(a4),d6
           beq.s    exit25
           move.l   d6,a2
           move.l   a2,a1
           moveq    #0,d5                clear counter
           moveq    #0,d6
           bsr      sort_xy
*
nxt_el07   move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq.s    t_p_w5
           cmpi.b   #trk,d5
           beq.s    t_p_w5
           cmpi.b   #wrd,d5
           beq.s    t_p_w5
           cmpi.b   #blk,d5
           beq.s    blk_el2
           cmpi.b   #end,d5
           beq.s    end_del
           moveq    #0,d5
           move.w   2(a2),d5
           mulu.w   #3,d5                d5 = number of words in element
*
           subi.l   #1,d5
shft_other move.w   (a2)+,(a1)+
           dbra     d5,shft_other        checks for -1
*
           bra.s    nxt_el07
end_del    move.l   #$ffffffff,(a1)+
           move.w   #$ffff,(a1)
           moveq    #0,d0
           bra      redraw
blk_el2    move.b   #1,274(a4)
           bra.s    nt_blk2
t_p_w5     move.b   #0,274(a4)
nt_blk2    bsr      chk_min_len
           bsr      check_area
           moveq    #0,d0
           cmp.l    a2,d6
           bne.s    lib_char
           moveq    #1,d0
lib_char   move.l   d6,a2
           move.w   2(a2),d5             d5 = element length
           move.w   d5,d6                d6 = element length
           move.l   a2,a3                needed for delete all
           sub.w    194(a4),d5
           move.l   a1,a0                a0 address of current element
           move.l   (a2)+,(a1)+          move header
           move.w   (a2)+,(a1)+            "    "
new_co5    tst.b    d0
           beq.s    del_ret
           move.w   2(a2),d3
           move.w   4(a2),d4
           tst.b    274(a4)
           bne.s    isablk1
           cmp.w    94(a4),d3
           bgt.s    del_ret
           cmp.w    96(a4),d3
           blt.s    del_ret
           cmp.w    98(a4),d4
           bgt.s    del_ret
           cmp.w    100(a4),d4
           blt.s    del_ret
           addq.l   #6,a2
           subi.w   #1,d6                subtract length value
           cmp.w    d1,d6
           blt      del_all
           bra.s    del
del_ret    move.l   (a2)+,(a1)+          move segment
           move.w   (a2)+,(a1)+            "     "
del        subi.w   #1,d5
           cmpi.w   #1,d5
           bne.s    new_co5
           move.w   d6,2(a0)             new length
           move.w   194(a4),d0
           beq      nxt_el07
mv_nl1     move.l   (a2)+,(a1)+          move netlist
           move.w   (a2)+,(a1)+            "     "
           subi.w   #1,d0
           bne.s    mv_nl1
           bra      nxt_el07
*
isablk1    cmp.w    94(a4),d3
           bgt.s    blkdel_ret
           cmp.w    96(a4),d3
           blt.s    blkdel_ret
           cmp.w    98(a4),d4
           bgt.s    blkdel_ret
           cmp.w    100(a4),d4
           blt.s    blkdel_ret
           move.w   8(a2),d3
           move.w   10(a2),d4
           cmp.w    94(a4),d3
           bgt.s    blkdel_ret
           cmp.w    96(a4),d3
           blt.s    blkdel_ret
           cmp.w    98(a4),d4
           bgt.s    blkdel_ret
           cmp.w    100(a4),d4
           blt.s    blkdel_ret
           addq.l   #6,a2
           addq.l   #6,a2
           subi.w   #2,d6
           cmp.w    d1,d6
           blt.s    del_all
           bra.s    blkdel
blkdel_ret move.l   (a2)+,(a1)+
           move.l   (a2)+,(a1)+
           move.l   (a2)+,(a1)+
blkdel     subi.w   #2,d5
           cmpi.w   #1,d5
           bgt      new_co5
           move.w   d6,2(a0)
           move.w   194(a4),d0
           beq      nxt_el07
           bra.s    mv_nl1
*
exit26     rts
*
del_all    move.l   a0,a1
           move.l   a3,a2
           moveq    #0,d5
           move.w   2(a2),d5
           mulu.w   #6,d5
           adda.l   d5,a2
           tst.b    170(a4)              check for library lock
           bne      nxt_el07
           move.w   4(a0),d5
           andi.w   #comp_mask,d5        check current element
           bne      nxt_el07
           andi.w   #ncomp_mask,4(a2)    clear next element
           bra      nxt_el07
*
area_refid move.w   ca.gtint,a0
           jsr      (a0)
           bne.s    exit26
           moveq    #-15,d0
           cmpi.w   #2,d3
           bne.s    exit26
           move.w   (a6,a1.l),d0
           move.b   3(a6,a1.l),d1
           andi.b   #1,d1
           lea      par,a4
           move.w   d0,384(a4)           refid offset
           move.b   d1,137(a4)           global
           move.l   26(a4),d6
           beq.s    exit26               not found return
           move.l   d6,a2
           moveq    #0,d6
           moveq    #0,d5
           bsr      do
           bsr      sort_xy              sets up area boundries in 94,96,98,100(a4)
nxt_el29   move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq.s    t_p_w_b9
           cmpi.b   #trk,d5
           beq.s    t_p_w_b9
           cmpi.b   #blk,d5
           beq.s    t_p_w_b9
           cmpi.b   #end,d5
           bne.s    abort2
           moveq    #0,d0
           rts
*
t_p_w_b9   tst.w    194(a4)
           beq.s    abort2               not a library component
           move.w   4(a2),d5
           andi.w   #lib_mask,d5
           beq.s    abort2               not a library component 
           tst.b    137(a4)
           bne.s    global5
           move.l   a2,d6
           bsr      not_lock1            **************
           cmp.l    a2,d6                *  new code  *
           bne      nxt_el29             **************
global5    move.w   2(a2),d5             d5 = element length
           sub.w    194(a4),d5
           mulu.w   #6,d5
           move.w   384(a4),10(a2,d5.l)  set reference offset
abort2     move.w   2(a2),d5
           mulu.w   #6,d5
           adda.l   d5,a2
           bra      nxt_el29 
*
copy_end   move.l   #$ffffffff,(a1)+
           move.w   #$ffff,(a1)
           moveq    #0,d0
           bra      redraw            
*           
area_copy  lea      par,a4
           bsr      do
           move.l   26(a4),d6
           beq      exit26
           move.l   d6,a2
           move.l   76(a4),d6
           move.l   d6,a1
           moveq    #0,d5
           bsr      sort_xy
           move.w   104(a4),d1
           sub.w    58(a4),d1
           move.w   106(a4),d2
           sub.w    60(a4),d2
nxt_el08   move.l   76(a4),a3
           cmp.l    a2,a3
           beq.s    copy_end
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq.s    t_p_w_b8
           cmpi.b   #trk,d5
           beq.s    t_p_w_b8
           cmpi.b   #wrd,d5
           beq.s    t_p_w_b8
           cmpi.b   #blk,d5
           beq.s    t_p_w_b8
           moveq    #0,d5
           move.w   2(a2),d5
           mulu.w   #6,d5
           adda.l   d5,a2
           bra.s    nxt_el08
t_p_w_b8   bsr      check_area
           cmp.l    a2,d6
           bne.s    nxt_el08
           move.l   a2,a3                store a2
           move.w   2(a2),d5
           moveq    #0,d0                clear flag
           sub.w    194(a4),d5
new_co8    addq.l   #6,a2
           move.w   2(a2),d3             d3 = x
           move.w   4(a2),d4             d4 = y
           cmp.w    94(a4),d3
           bgt.s    cop_ret
           cmp.w    96(a4),d3
           blt.s    cop_ret
           cmp.w    98(a4),d4
           bgt.s    cop_ret
           cmp.w    100(a4),d4
           blt.s    cop_ret
           bra.s    inside
cop_ret    moveq    #1,d0                set flag if coord outside area
inside     subi.w   #1,d5
           cmpi.w   #1,d5
           bne.s    new_co8
           move.w   194(a4),d3
           mulu.w   #6,d3
           add.l    d3,a2
           moveq    #0,d3
           addq.l   #6,a2
           tst.b    d0
           beq.s    copyel1
           tst.b    170(a4)              check for library lock
           bne      nxt_el08
           move.w   4(a3),d5
           andi.w   #comp_mask,d5        check current element
           bne      nxt_el08
           move.b   #1,415(a4)           set component start flag
           bra      nxt_el08
copyel1    move.l   a3,a2                restore a2
           move.w   2(a2),d5
           sub.w    194(a4),d5
           move.l   (a2)+,(a1)+          copy header
           move.w   (a2)+,(a1)+          copy library id
           tst.b    415(a4)
           beq.s    new_co9
           move.b   #0,415(a4)           clear flag
           andi.w   #ncomp_mask,-2(a1)   clear next element
new_co9    move.w   (a2),(a1)            copy layer and size
           move.w   2(a2),d3             d3 = x
           move.w   4(a2),d4             d4 = y
           sub.w    d1,d3
           sub.w    d2,d4
           move.w   d3,2(a1)
           move.w   d4,4(a1)
           addq.l   #6,a2
           addq.l   #6,a1
           subi.w   #1,d5
           cmpi.w   #1,d5
           bne.s    new_co9
           move.w   194(a4),d3
           beq      nxt_el08
mv_nl2     move.l   (a2)+,(a1)+          move netlist
           move.w   (a2)+,(a1)+            "     "
           subi.w   #1,d3
           bne.s    mv_nl2
           bra      nxt_el08
*
check_area move.l   a2,d6                store element addr
           tst.b    170(a4)              check for library lock
           beq.s    not_lock1
           move.w   4(a2),d5
           andi.w   #comp_mask,d5
           bne      is_lib
not_lock1  move.b   #0,508(a4)           clear flag
nxt_el09   move.w   2(a2),d5             d5 = element length
           move.w   (a2),d0
           andi.w   #lab_mask,d0
           sub.w    d0,d5
chk_co1    addq.l   #6,a2
           move.w   2(a2),d3
           move.w   4(a2),d4
           cmp.w    94(a4),d3
           bgt.s    chk_ret
           cmp.w    96(a4),d3
           blt.s    chk_ret
           cmp.w    98(a4),d4
           bgt.s    chk_ret
           cmp.w    100(a4),d4
           blt.s    chk_ret
           bra.s    chk_ret2
chk_ret    move.b   #1,508(a4)           set flag if part outside area
chk_ret2   subi.w   #1,d5
           cmpi.w   #1,d5
           bne.s    chk_co1
           tst.b    170(a4)              check for library lock
           beq.s    libexit
           mulu.w   #6,d0
           add.l    d0,a2
           addq.l   #6,a2
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #end,d5
           beq.s    libexit
           move.w   4(a2),d5
           andi.w   #comp_mask,d5
           bne.s    nxt_el09             is a component
****
libexit    move.l   d6,a2                restore element address
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #wrd,d5
           beq.s    is_lib               check for text
           tst.b    170(a4)              check for library lock
           beq.s    chk_ok1
           tst.w    4(a2)                library label
           beq.s    chk_ok1              check for library element   
is_lib     move.l   d6,a2                restore element address
           tst.b    508(a4)
           beq.s    chk_ok1
           move.w   2(a2),d5
           muls.w   #6,d5
           add.l    d5,a2
chk_ok1    rts                           d6 = a2 if element all in area
*
chck_area2 move.l   a2,d6                store element addr
*
           moveq    #0,d0                reset flag
           move.w   2(a2),d5             d5 = element length
           sub.w    194(a4),d5
chk_co2    addq.l   #6,a2
           move.w   2(a2),d3
           move.w   4(a2),d4
           cmp.w    94(a4),d3
           bgt.s    chk_ret3
           cmp.w    96(a4),d3
           blt.s    chk_ret3
           cmp.w    98(a4),d4
           bgt.s    chk_ret3
           cmp.w    100(a4),d4
           blt.s    chk_ret3
           bra.s    chk_ret4
chk_ret3   moveq    #-1,d0               set flag if part outside area
chk_ret4   subi.w   #1,d5
           cmpi.w   #1,d5
           bne.s    chk_co2
*
           move.w   194(a4),d3
           mulu.w   #6,d3
           add.l    d3,a2
           moveq    #0,d3
           addq.l   #6,a2
           tst.b    d0
           beq.s    chk_ok2
           rts                           d6 = a2 if element all in area
chk_ok2    move.l   d6,a2                restore element addr
check_out  rts
*
sdsetink   move.l   #sd.setin,d0         d1 = ink
           moveq    #0,d3                timeout
           trap     #3
           rts
*
iosbyte    moveq    #io.sbyte,d0         d1 = sent byte
           moveq    #0,d3                timeout
           trap     #3
           rts
*
prt_stat   move.w   ca.gtlin,a0
           jsr      (a0)
           moveq    #-15,d0
           cmpi.b   #1,d3
           bne.s    check_out
           moveq    #0,d0
           lea      par,a4
           move.b   3(a6,a1.l),d0
           beq      prt_c
           move.l   86(a4),a0            channel id
           move.l   72(a4),a2
           move.w   (a2),d5
           andi.w   #lab_mask,d5
           beq.s    prt_elsize           no labels
           move.w   2(a2),d4             element length
           sub.w    d5,d4
           mulu     #6,d4
           add.l    d4,a2
           tst.b    (a2)
           beq.s    prt_elsize           reference id not present
           moveq    #7,d1
           bsr.s    sdsetink
           move.b   #'I',d1
           bsr      iosbyte
           move.b   #'D',d1
           bsr      iosbyte
           moveq    #4,d1
           bsr.s    sdsetink 
           moveq    #0,d2
prt_net    cmpi.b   #0,(a2,d2.w)
           beq.s    ex_prt_net
           cmpi.w   #8,258(a4)
           bne.s    ntmde84
           cmpi.w   #4,d2
           beq.s    ex_prt_net           not enough space in mode 8
ntmde84    cmpi.w   #12,d2
           beq.s    ex_prt_net
           move.b   (a2,d2.w),d1
           bsr.s    iosbyte
           addi.w   #1,d2
           bra.s    prt_net
ex_prt_net move.b   #' ',d1
           bsr      iosbyte
*
prt_elsize moveq    #7,d1
           bsr      sdsetink
           move.l   72(a4),a2
           move.w   2(a2),d2
           move.w   (a2),d5
           andi.w   #lab_mask,d5
           sub.w    d5,d2
           sub.w    70(a4),d2
           mulu.w   #6,d2
           moveq    #0,d4
           move.b   1(a2,d2.l),d4        d4 = element size
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq.s    prt_elsz2
           cmpi.b   #trk,d5
           beq.s    prt_elsz2
           cmpi.b   #wrd,d5
           beq.s    prt_elsz2
           bra      prt_ellay
prt_elsz2  move.b   #'S',d1
           bsr      iosbyte
           moveq    #4,d1
           bsr      sdsetink
           cmpi.b   #trk,d5
           beq.s    prtsize
           cmpi.b   #wrd,d5
           beq.s    prtsize
           cmpi.w   #128,d4
           blt.s    rndsqu_pad
           cmpi.w   #192,d4
           blt.s    thm_pad1
           bra.s    spec_pad
thm_pad1   move.b   #'t',d1
           subi.w   #128,d4
           bra.s    squ_pad
rndsqu_pad cmpi.w   #64,d4
           blt.s    rnd_pad
           move.b   #'s',d1
           subi.w   #64,d4
           bra.s    squ_pad
rnd_pad    move.b   #'r',d1
squ_pad    bsr      iosbyte
prtsize    move.w   d4,d1
           move.l   #0,a1
           move.w   ut.mint,a1
           jsr      (a1)
           bra.s    ex_prt_sz
spec_pad   cmpi.w   #192,d4
           bne.s    ex_prt_sz            undefined pad size
           move.l   #io.sstrg,d0         send string of bytes 
           moveq    #0,d3
           lea      mark_txt,a1
           moveq    #6,d2                6 characters
           trap     #3
ex_prt_sz  moveq    #7,d1
           bsr      sdsetink
           move.l   86(a4),a0            channel id
           move.b   #' ',d1
           bsr      iosbyte
           bra.s    prt_ellay
mark_txt   dc.b     'Marker'
*
name_txt   dc.b     1,1,'b   '
           dc.b     2,1,'g   '
           dc.b     4,1,'t   '
           dc.b     8,1,'p   '
           dc.b     16,2,'s1  '
           dc.b     32,2,'s2  '
           dc.b     10,3,'tsr '
           dc.b     14,3,'bsr '
           dc.b     11,3,'tss '
           dc.b     15,3,'bss '
           dc.b     26,3,'tsp '
           dc.b     30,3,'bsp '
           dc.b     27,2,'tm  '
           dc.b     31,2,'bm  '
           dc.b     42,2,'tp  '
           dc.b     46,2,'bp  '
           dc.b     43,3,'tre '
           dc.b     47,3,'bre '
           dc.b     63,1,'h   '
           dc.w     0
*
prt_ellay  move.l   86(a4),a0            channel id
           move.b   #'L',d1
           bsr      iosbyte
           moveq    #4,d1
           bsr      sdsetink
           move.l   72(a4),a2
           move.w   2(a2),d2
           move.w   (a2),d5
           andi.w   #lab_mask,d5
           sub.w    d5,d2
           sub.w    70(a4),d2
           mulu.w   #6,d2
           moveq    #0,d4
           move.b   (a2,d2.l),d1
           andi.w   #lay_mask,d1         d1 = element layer
           lea      name_txt,a1
           moveq    #0,d2
nxt_name   move.b   (a1),d2
           beq.s    sep_lay5             layer not named
           cmp.b    d2,d1
           beq.s    named_lay
           addq.l   #6,a1
           bra.s    nxt_name
named_lay  move.b   1(a1),d2             number of characters in string
           move.l   #io.sstrg,d0         send string of bytes 
           moveq    #0,d3                timeout
           addq.l   #2,a1                a1 = address of string
           trap     #3                   print string
           bra.s    prt_pin_no
sep_lay5   move.l   #0,a1
           move.w   ut.mint,a1
           jsr      (a1)
*
prt_pin_no moveq    #7,d1
           bsr      sdsetink
           bsr      get_pin
           move.w   282(a4),d2
           beq.s    no_pin
           move.l   86(a4),a0            channel id
           move.b   #' ',d1
           bsr      iosbyte
           move.b   #'P',d1
           bsr      iosbyte
           moveq    #4,d1
           bsr      sdsetink
           move.w   284(a4),d1
           beq.s    no_alpha             no alpha value
           moveq    #0,d2
           moveq    #0,d4
           moveq    #0,d5
           moveq    #0,d6
alphaloop  bsr.s    incalpha
           addi.w   #1,d6               
           cmp.w    d6,d1
           bne.s    alphaloop
           lea      alpha_char,a2
           tst.w    d5
           beq.s    nosig2
           move.b   (a2,d5.w),d1
           bsr      iosbyte
           bra.s    sig2
nosig2     tst.w    d4
           beq.s    nosig1
sig2       move.b   (a2,d4.w),d1
           bsr      iosbyte
           bra.s    sig1
nosig1     tst.w    d2
           beq.s    no_alpha
sig1       move.b   (a2,d2.w),d1
           bsr      iosbyte
no_alpha   move.w   282(a4),d1
           move.l   #0,a1
           move.w   ut.mint,a1
           jsr      (a1)
no_pin     move.l   #10,d1
           bsr      iosbyte
           moveq    #0,d0
           lea      par,a4               not needed
           rts
*
incalpha   addi.w   #1,d2                count up d5 d4 d2 base 20
           cmpi.w   #21,d2
           bne.s    alpharet
           moveq    #1,d2
           addi.w   #1,d4
           cmpi.w   #21,d4
           bne.s    alpharet
           moveq    #1,d4
           addi.w   #1,d5
alpharet   rts
*
prt_c      move.l   86(a4),a0            channel id
           moveq    #7,d1                set ink to white
           bsr      sdsetink
           move.b   #'X',d1
           bsr      iosbyte
           moveq    #4,d1                set ink to green
           bsr      sdsetink
           move.w   58(a4),d1            x cursor coord
           move.l   #0,a1
           move.w   ut.mint,a1
           jsr      (a1)
*
           moveq    #7,d1                set ink to white
           bsr      sdsetink
           move.b   #' ',d1              send space
           bsr      iosbyte
           move.b   #'Y',d1
           bsr      iosbyte
           moveq    #4,d1                set ink to green
           bsr      sdsetink
           move.w   60(a4),d1            y cursor coord
           move.l   #0,a1
           move.w   ut.mint,a1
           jsr      (a1)
*
           btst.b   #0,80(a4)
           beq      no_pin               check edit mode
*
           moveq    #7,d1
           bsr      sdsetink
           bra      prt_pin_no
*
alpha_char dc.b     ' ABCDEFGHJKLMNPRTUVWY'
*
prt_scale  lea      par,a4
prt_s      move.l   90(a4),a0
           move.b   #'G',d1              send 'G'
           bsr      iosbyte
           moveq    #4,d1
           bsr      sdsetink
           move.w   82(a4),d1            grid step
           move.w   ut.mint,a1
           jsr      (a1)
           moveq    #0,d3
           moveq    #32,d1               send space
           bsr      iosbyte
           moveq    #32,d1               send space
           bsr      iosbyte
           moveq    #7,d1
           bsr      sdsetink
           moveq    #'S',d1              send 'S'
           bsr      iosbyte
           moveq    #4,d1
           bsr      sdsetink
           moveq    #0,d3
           lea      par,a4
           moveq    #1,d1
           move.b   10(a4),d3            scale
           beq.s    pscale11             scale 1
           lsl.w    d3,d1
           tst.b    11(a4)
           bne.s    pscale11
           neg.w    d1
pscale11   move.w   ut.mint,a1
           jsr      (a1)
           move.l   #10,d1
           bsr      iosbyte
           moveq    #7,d1
           bsr      sdsetink
           moveq    #0,d0
           lea      par,a4
           rts
cad_base   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit27
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit27
           move.l   (a6,a1.l),d0
           lea      par,a4
           move.l   d0,26(a4)            file start
           move.l   d0,76(a4)            end of file
           move.l   d0,350(a4)
           sub.l    #2000,d0             space for label char generation
           move.l   d0,166(a4)           lower via and label
           moveq    #0,d0
exit27     rts
*
do         movem.l  a0/a1/d0,-(a7)
           bsr.s    do_it
           movem.l  (a7)+,a0/a1/d0
           rts
do_it      lea      par,a4
           move.b   #0,116(a4)           area update off
           move.l   26(a4),a0            file start
           move.l   108(a4),d0           save start
           beq.s    exit29
           move.l   d0,a1
           move.l   76(a4),d0            file end
           sub.l    26(a4),d0            file length
           move.l   d0,112(a4)           save old file length
           addq.l   #8,d0                end flag included
save       move.w   (a0)+,(a1)+
           subi.l   #2,d0
           bne.s    save
exit29     moveq    #0,d0
           rts
*
swaplib    lea      par,a4
           move.l   154(a4),a2           library base
           moveq    #0,d1
lib_seg    cmpi.b   #$ff,(a2)            ******
           beq.s    lib_end              ** find library length
           move.w   2(a2),d2             **
           mulu.w   #6,d2                **
           add.l    d2,a2                ** a2 = top of library file
           add.l    d2,d1                ** d1 = library file length
           bra.s    lib_seg              ******
lib_end    btst.b   #0,80(a4)            check edit mode bit
           beq      edt_off
           move.w   180(a4),d2
           sub.w    58(a4),d2            d2 = x position difference
           move.w   182(a4),d3
           sub.w    60(a4),d3            d3 = y position difference
           move.l   350(a4),a1           a1 = old edit address
           move.l   72(a4),d5
           sub.l    a1,d5                d5 = edit difference
           move.l   d1,d0                d0 = library file length
           add.l    26(a4),d0            d0 = new edit address
           move.l   d0,350(a4)           change edit address
           add.l    d5,d0
           move.l   d0,72(a4)
*
nxt_el10   move.b   (a1),d5
           andi.b   #type_mask,d5
           cmpi.b   #end,d5
           beq.s    mv_edt_end
           move.w   (a1),194(a4)
           andi.w   #lab_mask,194(a4)
           move.w   2(a1),d5             ******
           sub.w    194(a4),d5           **
           move.l   (a1)+,(a2)+          ** move header
           move.w   (a1)+,(a2)+          **  "    "
           subi.w   #1,d5                **
           addq.l   #6,d1                ******
*
move_edt   move.w   (a1),(a2)            ****** layer and size
           move.w   2(a1),d4             **
           add.w    d2,d4                **
           move.w   d4,2(a2)             **    move segment
           move.w   4(a1),d4             **
           add.w    d3,d4                **
           move.w   d4,4(a2)             ******
           addq.l   #6,a1
           addq.l   #6,a2
           addq.l   #6,d1                d1 = library file length
           subi.w   #1,d5
           bne.s    move_edt
           move.w   194(a4),d5
           beq.s    nxt_el10
*
mv_nl3     move.l   (a1)+,(a2)+          ******
           move.w   (a1)+,(a2)+          ** move labels
           addq.l   #6,d1                **
           subi.w   #1,d5                **
           bne.s    mv_nl3               ******
           bra.s    nxt_el10
*
mv_edt_end move.l   #$ffffffff,(a2)+
           move.w   #$ffff,(a2)
*
edt_off    move.l   76(a4),d0
           sub.l    26(a4),d0            d0 = art file length
           cmp.l    d1,d0
           bgt.s    big_fil2
           move.l   d1,d0                d0 = longest file
big_fil2   addq.l   #8,d0
           move.l   26(a4),a0            a0 = art file base
           move.l   154(a4),a1           a1 = lib file base
           move.l   58(a4),d1            d1 = temp x y coordinates
           move.l   180(a4),58(a4)       swap coordinates from lib to norm
           move.l   d1,180(a4)           vice versa
           bsr.s    load
           bra      do
*
undo       lea      par,a4
           moveq    #0,d0
           move.l   108(a4),d1           save start
           beq.s    exit30
           move.l   d1,a1
           move.l   76(a4),d0            file end
           sub.l    26(a4),d0            file length
           move.l   d0,d1
           cmp.l    112(a4),d0           compare file sizes
           bgt.s    big_file
           move.l   112(a4),d0
big_file   move.l   d1,112(a4)
           move.l   26(a4),a0            file start
           addq.l   #8,d0
load       move.w   (a0),d1
           move.w   (a1),(a0)+
           move.w   d1,(a1)+
           subi.l   #2,d0
           bne.s    load
           bra      redraw
*
exit30     rts
lib_id     lea      par,a4
           move.l   72(a4),a2
           moveq    #0,d4
           move.w   4(a2),d4
           andi.w   #lib_mask,d4         mask control bit
           bra      int_ret
edit_addr  lea      par,a4
           move.l   72(a4),d1
           bra      flo_ret
*
set_edit   lea      par,a4
           move.l   76(a4),72(a4)
           move.l   76(a4),350(a4)
           move.w   #1,70(a4)
           moveq    #0,d0
exit31     rts
*
test_ret   lea      par,a4
           move.l   a4,d1
           bra      flo_ret
*
states     move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit31
           moveq    #-15,d0
           cmpi.w   #2,d3
           bgt.s    exit31
           lea      par,a4
           move.w   2(a6,a1.l),d4
           cmpi.w   #1,d3
           beq.s    no_wrt
           move.w   6(a6,a1.l),d5
no_wrt     moveq    #0,d1
           tst.w    d4
           bne.s    chk_y_cur
           move.w   58(a4),d1
           cmpi.w   #1,d3
           beq      flo_ret
           move.w   d5,58(a4)
           bra      flo_ret
chk_y_cur  cmpi.w   #1,d4
           bne.s    chk_x_off
           move.w   60(a4),d1
           cmpi.w   #1,d3
           beq      flo_ret
           move.w   d5,60(a4)
           bra      flo_ret
chk_x_off  cmpi.w   #2,d4
           bne.s    chk_y_off
           move.w   12(a4),d1
           cmpi.w   #1,d3
           beq      flo_ret
           move.w   d5,12(a4)
           bra      flo_ret
chk_y_off  cmpi.w   #3,d4
           bne      exit31
           move.w   14(a4),d1
           cmpi.w   #1,d3
           beq      flo_ret
           move.w   d5,14(a4)
           bra      flo_ret
*
whole      move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit32
           moveq    #-15,d0
           cmpi.w   #1,d3
           bgt.s    exit32
           lea      par,a4
           tst.w    d3
           beq.s    flip_mode
           move.b   3(a6,a1.l),d0
           andi.b   #1,d0
           beq      whole_off
           bra      whole_on
           rts
flip_mode  move.b   80(a4),d0
           andi.b   #2,d0
           beq      whole_on
           bra      whole_off
move_lib   tst.b    170(a4)              lib lock
           bne      move_all
           bra      lib_ret
*
m_element  move.w   ca.gtint,a0
           jsr      (a0)
           bne.s    exit32
           moveq    #1,d6
           bsr      set_over             set exor print mode
           lea      par,a4               optional find screen sets a4
           tst.w    d3
           bgt.s    rel_mve3
*
           tst.b    135(a4)
           beq.s    noqptr04
           bsr      get_ptr
           tst.w    d7
           beq.s    abs_mve3
noqptr04   moveq    #0,d0                pointer is off screen
exit32     rts
*
rel_mve3   moveq    #-15,d0
           cmpi.w   #2,d3
           bne.s    exit32
           move.l   (a6,a1.l),d0
           beq.s    no_xy3
           tst.b    135(a4)
           bne.s    noqptr04
no_xy3     move.l   d0,d1
           swap     d0
abs_mve3   move.w   d0,130(a4)           save x offset
           move.w   d1,132(a4)           save y offset
orig_ret   move.l   350(a4),a2           set edit base for print
           bsr      elements             delete edit elements (sets netlist flag)
           move.w   130(a4),d0
           move.w   132(a4),d1
           move.l   72(a4),a2
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmp.b    #wrd,d5
           beq.s    move_all             move all text
           btst.b   #1,80(a4)            check whole mode
           bne.s    move_all
           move.w   4(a2),d2
           andi.w   #lib_mask,d2         look for library
           bne      move_lib
           cmp.l    350(a4),a2           look for component
           bgt      move_lib
lib_ret    moveq    #0,d2
           move.w   2(a2),d2             d2 = element length
           sub.w    194(a4),d2
           sub.w    70(a4),d2            d2=segment picked up
           cmpi.w   #1,d2
           bne.s    nt_strt2
           bsr      mve_lab3
nt_strt2   mulu.w   #6,d2
           adda.l   d2,a2                a2=address of segment to move
           move.w   2(a2),d3             d3 = x coord
           move.w   4(a2),d4             d4 = y coord
           add.w    d0,d3                add x offset
           add.w    d1,d4                add y offset
           move.w   d3,2(a2)             return x coord
           move.w   d4,4(a2)             return y coord
           cmpi.b   #blk,d5
           bne.s    end_move
           btst.b   #0,71(a4)
           bne.s    end_move
           tst.b    280(a4)              check block edit mode
           bne.s    end_move
           move.w   8(a2),d3
           move.w   10(a2),d4
           add.w    d0,d3
           add.w    d1,d4
           move.w   d3,8(a2)
           move.w   d4,10(a2)   
           bra.s    end_move
move_all   move.l   350(a4),a2
           move.l   a2,a1
nxt_el11   move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #end,d5
           beq.s    end_move
           move.w   2(a2),d2             d2 = element length
           move.w   d2,d3
           mulu.w   #6,d3                d3 = element length in bytes
           add.l    d3,a1                a1 = next element
           move.w   (a2),d3
           andi.w   #lab_mask,d3
           sub.w    d3,d2
move1      addq.l   #6,a2                move to first coord
           subi.w   #1,d2
           move.w   2(a2),d3
           move.w   4(a2),d4
           add.w    d0,d3                add x offset
           add.w    d1,d4                add y offset
           move.w   d3,2(a2)
           move.w   d4,4(a2)
           cmpi.w   #1,d2
           bne.s    move1
           move.l   a1,a2
           bra.s    nxt_el11
end_move   add.w    d0,58(a4)            add to cursor x coord
           add.w    d1,60(a4)            add to cursor y coord
*
draw_els   move.l   350(a4),a2           set a2 to elements base
           bsr      elements             print elements
           bra.s    draw_done
draw_segs  move.l   72(a4),a2
           bsr      segment1             print segments
draw_done  moveq    #7,d6                set ink 7
           bsr      set_ink2
           move.w   58(a4),d0
           move.w   60(a4),d1
           bsr      move_cur             move cursor
           moveq    #0,d0
           rts
*
mve_lab3   move.w   194(a4),d6           d6 = labels
           beq.s    exit33
           move.w   2(a2),d3             d3 = element length
           sub.w    d6,d3
           mulu.w   #6,d3
           add.l    d3,a2                a2 = base of labels
           subi.w   #3,d6
           mulu.w   #6,d6                (a2,d6.l) = base of last label
mve_lab4   move.w   14(a2,d6.l),d3
           sub.w    d0,d3
           move.w   d3,14(a2,d6.l)
           move.w   16(a2,d6.l),d3
           sub.w    d1,d3
           move.w   d3,16(a2,d6.l)
           subi.l   #18,d6
           bge.s    mve_lab4
           move.l   72(a4),a2
*
exit33     rts
type_size  move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit33
           moveq    #-15,d0
           cmpi.w   #4,d3
           bne.s    exit33
           lea      par,a4
           move.w   2(a6,a1.l),d1
           move.w   6(a6,a1.l),d2
           move.b   11(a6,a1.l),d3
           move.b   15(a6,a1.l),d4
           cmpi.b   #63,d3               text size 0 to 63
           bgt.s    exit33
           cmpi.b   #62,d4               layer 0 to 62
           bgt.s    exit33 
           tst.b    d4
           beq.s    exit33
           move.w   d1,118(a4)
           move.w   d2,120(a4)
           move.b   d3,122(a4)
           move.b   d4,123(a4)
           moveq    #0,d0
exit34     rts
track_s_l  move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit34
           moveq    #-15,d0
           tst.w    d3
           beq.s    new_track
           cmpi.w   #2,d3
           bgt.s    exit34
           moveq    #0,d0
           move.b   3(a6,a1.l),d1
           move.b   7(a6,a1.l),d2
           cmpi.b   #63,d1               sixty four sizes 0.001" - 0.315"
           bgt.s    exit34
           cmpi.b   #62,d2
           bgt.s    exit34   
           tst.b    d2
           beq.s    exit34
           lea      par,a4
           move.b   d1,124(a4)
           move.b   d2,125(a4)
           moveq    #0,d0
           rts
new_track  lea      par,a4
           bsr      w_off_e_on           corner edit mode
           bsr      set_edit             set edit base to end of file
           move.w   58(a4),d0            cursor x
           move.w   60(a4),d1            cursor y
           move.l   72(a4),a2            a2 = edit base
           move.b   #trk,(a2)            t
           move.b   #0,1(a2)             no blocks
           move.w   #3,2(a2)             length
           move.w   #0,4(a2)             library
           move.b   125(a4),6(a2)        layer segment1
           move.b   125(a4),12(a2)         "   segment2
           move.b   124(a4),7(a2)        size segment1
           move.b   124(a4),13(a2)       size segment2
           move.w   d0,8(a2)             x segment1
           move.w   d0,14(a2)            x segment2
           move.w   d1,10(a2)            y segment1
           move.w   d1,16(a2)            y segment2
           adda.l   #18,a2
           move.l   a2,76(a4)
           move.l   #$ffffffff,(a2)+
           move.w   #$ffff,(a2)
           moveq    #0,d0
           move.l   72(a4),a2
           bra      segment1
exit35     rts
pad_s_l    move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit35
           moveq    #-15,d0
           tst.w    d3
           beq.s    new_pad
           cmpi.w   #2,d3
           bgt.s    exit35
           moveq    #0,d0
           move.w   2(a6,a1.l),d1
           move.b   7(a6,a1.l),d2
           cmpi.w   #256,d1
           bge.s    exit35
           cmpi.b   #62,d2
           bgt.s    exit35
           tst.b    d2
           beq.s    exit35
siz_ok1    lea      par,a4
           move.b   d1,126(a4)
           move.b   d2,127(a4)
           moveq    #0,d0
           rts
new_pad    lea      par,a4
           bsr      w_off_e_on           corner edit mode
           bsr      set_edit             set edit base to end of file
           move.w   58(a4),d0            cursor x
           move.w   60(a4),d1            cursor y
           move.l   72(a4),a2            a2 = edit base
           move.b   #pad,(a2)            p
           move.b   #0,1(a2)             no blocks
           move.w   #2,2(a2)             length
           move.w   #0,4(a2)             library
           move.b   127(a4),6(a2)        layer
           move.b   126(a4),7(a2)        size
           move.w   d0,8(a2)             x
           move.w   d1,10(a2)            y
           adda.l   #12,a2
           move.l   a2,76(a4)
           move.l   #$ffffffff,(a2)+
           move.w   #$ffff,(a2)
           moveq    #0,d0
           move.l   72(a4),a2
           bra      segment1
exit36     rts
block_s_l  move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit36
           moveq    #-15,d0
           tst.w    d3
           beq.s    new_block
           cmpi.w   #3,d3
           bgt.s    exit36
           moveq    #0,d0
           move.w   2(a6,a1.l),d1        d1 = block x size
           move.w   6(a6,a1.l),d2        d2 = block y size
           move.b   11(a6,a1.l),d3       d3 = block layer
           cmpi.b   #62,d3
           bgt.s    exit36
           lea      par,a4
           move.w   d1,268(a4)
           move.w   d2,270(a4)
           move.b   d3,272(a4)
           moveq    #0,d0
           rts
new_block  lea      par,a4
           move.b   #0,280(a4)
           bsr      w_off_e_on           corner edit mode
           bsr      set_edit             set edit base to end of file
           move.w   58(a4),d0            cursor x
           move.w   60(a4),d1            cursor y
           move.l   72(a4),a2            a2 = edit base
           move.b   #blk,(a2)            b
           move.b   #0,1(a2)             no blocks
           move.w   #3,2(a2)             length
           move.w   #0,4(a2)             library
           move.b   272(a4),6(a2)        layer segment1
           move.b   272(a4),12(a2)         "   segment2
           move.b   #0,7(a2)             size segment1
           move.b   #0,13(a2)              "  segment2
           move.w   d0,8(a2)             x segment1
           move.w   268(a4),d3           d3 = x size
           add.w    d3,d0 
           move.w   d0,14(a2)            x segment2
           move.w   d1,10(a2)            y segment1
           move.w   270(a4),d3
           add.w    d3,d1
           move.w   d1,16(a2)            y segment2
           adda.l   #18,a2
           move.l   a2,76(a4)
           move.l   #$ffffffff,(a2)+
           move.w   #$ffff,(a2)
           moveq    #0,d0
           move.l   72(a4),a2
           move.w   #2,70(a4)
           bsr      segment1
           rts
*
circle_s_l move.w   ca.gtlin,a0
           jsr      (a0)
           bne      exit37
           moveq    #-15,d0
           lea      par,a4
           lea      sinetab,a0           a0 = pointer to sine table
           move.w   -2(a0),d6            d6 = table samples per 360 degrees
           tst.w    d3
           beq.s    new_circle
           cmpi.w   #2,d3
           bne      exit37
           moveq    #0,d0
           move.w   2(a6,a1.l),d3        x radius
           move.w   6(a6,a1.l),d4        y radius
           cmpi.w   #16,d3
           bge.s    chkxrad
           move.w   #16,d3
chkxrad    cmpi.w   #16,d4
           bge.s    chkyrad
           move.w   #16,d4
chkyrad    move.w   d3,408(a4)           x radius
           move.w   d4,410(a4)           y radius
           move.w   d3,d7
           cmp.w    d3,d4
           blt.s    xgreater
           move.w   d4,d7
xgreater   lsr.w    #2,d7
           addi.w   #2,d7
           andi.w   #$fffc,d7
           cmp.w    d7,d6
           bge.s    siz_ok2
           move.w   d6,d7
siz_ok2    move.w   d7,412(a4)           points per 360 degrees
           moveq    #0,d0
           rts
new_circle bsr      w_off_e_on           corner edit mode
           bsr      set_edit             set edit base to end of file
           move.l   72(a4),a2            a2 = edit base
           move.w   412(a4),d7
           move.w   d7,d5
           addi.w   #1,d5                account for header
           move.w   d5,70(a4)            set edit to start of element
           addi.w   #1,d5                extra coordinate at end
           move.b   #trk,(a2)+           track
           move.b   #0,(a2)+             no labels
           move.w   d5,(a2)+             length
           move.w   #0,(a2)+             library
*
           subi.w   #2,d5                d5 = counter
           move.w   d6,d1
           lsr.w    #2,d1                d1 = table values per quadrant
           move.b   #1,414(a4)           set offset flag
*
circlelp   move.w   d6,d0
           mulu     d5,d0
           divu     d7,d0
           move.w   d1,d2
           cmp.w    d1,d0
           ble.s    q4
           move.w   d1,d3
           lsl.w    #1,d3                d3 = d3 * 2
           cmp.w    d3,d0
           ble.s    q3
           move.w   d1,d3
           mulu     #3,d3
           cmp.w    d3,d0
           ble.s    q2
q1         sub.w    d1,d0
           sub.w    d1,d0
           sub.w    d1,d0
           sub.w    d0,d2
           lsl.w    #1,d0
           lsl.w    #1,d2
           move.w   (a0,d0.w),d3
           move.w   (a0,d2.w),d4
           neg.w    d3
           bra.s    q_ret
q2         sub.w    d1,d0
           sub.w    d1,d0
           move.w   d1,d2
           sub.w    d0,d2
           lsl.w    #1,d0
           lsl.w    #1,d2
           move.w   (a0,d2.w),d3
           move.w   (a0,d0.w),d4
           bra.s    q_ret
q3         sub.w    d1,d0
           sub.w    d0,d2
           lsl.w    #1,d0
           lsl.w    #1,d2
           move.w   (a0,d0.w),d3
           move.w   (a0,d2.w),d4
           neg.w    d4
           bra.s    q_ret
q4         sub.w    d0,d2
           lsl.w    #1,d0
           lsl.w    #1,d2
           move.w   (a0,d2.w),d3
           move.w   (a0,d0.w),d4
           neg.w    d3
           neg.w    d4
q_ret      move.w   408(a4),d2           x radius
           muls     d2,d3                d3 and d4 now long
           move.w   410(a4),d2           y radius
           muls     d2,d4
           divs     #$7fff,d3            d3 and d4 back to word
           divs     #$7fff,d4
           tst.b    414(a4)              check flag
           beq.s    offsetok
           move.w   58(a4),d0            cursor x
           move.w   60(a4),d2            cursor y
           sub.w    d3,d0
           sub.w    d4,d2
           move.w   d0,416(a4)
           move.w   d2,418(a4)
           move.b   #0,414(a4)           clear flag
offsetok   move.w   416(a4),d0
           move.w   418(a4),d2
           add.w    d0,d3
           add.w    d2,d4
           move.b   125(a4),(a2)+        layer
           move.b   124(a4),(a2)+        size
           move.w   d3,(a2)+             x
           move.w   d4,(a2)+             y
           subi.w   #1,d5
           bge      circlelp
*
           move.l   a2,76(a4)
           move.l   #$ffffffff,(a2)+
           move.w   #$ffff,(a2)
           moveq    #0,d0
           move.l   72(a4),a2
           bra      segment1
exit37     rts
*
via_s      move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit37
           moveq    #-15,d0
           cmpi.w   #1,d3
           bgt.s    exit37
           moveq    #0,d0
           move.b   3(a6,a1.l),d1
           cmpi.b   #3,d1
           bgt.s    exit37
           move.b   #3,d2
           sub.b    d1,d2
           lea      par,a4
           move.b   d2,148(a4)
           rts
*
set_comp   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit37
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit37
           lea      par,a4
           move.b   3(a6,a1.l),d1
           lea      bus,a1
           cmpi.b   #1,d1
           beq.s    place_el
           lea      pwr,a1
           cmpi.b   #2,d1
           beq.s    place_el
           lea      gnd,a1
           cmpi.b   #3,d1
           beq.s    place_el
           lea      port,a1
           cmpi.b   #4,d1
           beq.s    place_el
           lea      marker,a1
           cmpi.b   #5,d1
           beq.s    place_el
           lea      fiducial,a1  
           cmpi.b   #6,d1
           beq.s    place_el
           lea      bridge,a1
place_el   bsr      set_edit             set edit base to end of file
           move.w   58(a4),d3            cursor x
           move.w   60(a4),d4            cursor y
           move.l   76(a4),a2            a2 = base
*
           move.b   (a1)+,d0             * length
mve_el1    move.b   (a1)+,d1             * coordinate flag
           cmpi.b   #2,d1
           bne.s    not_comp
           move.l   a2,72(a4)            element edit base
not_comp   move.b   (a1)+,(a2)+
           move.l   (a1)+,(a2)+
           move.b   (a1)+,(a2)+
           tst.b    d1
           bne.s    not_coord
           move.w   -4(a2),d5
           add.w    d3,d5
           move.w   d5,-4(a2)
           move.w   -2(a2),d5
           add.w    d4,d5
           move.w   d5,-2(a2)
not_coord  subi.w   #1,d0
           bne.s    mve_el1
*
mve_end    move.l   a2,76(a4)
           move.l   #$ffffffff,(a2)+
           move.w   #$ffff,(a2)
           moveq    #7,d6
           bsr      set_ink2
           bsr      blank                blank cursor
           ori.b    #1,80(a4)            edit mode on
           move.l   350(a4),a2
           bsr      elements
           moveq    #7,d6
           bsr      set_ink2
           bsr      blank                replace cursor
           moveq    #0,d0
           rts
*
bus        dc.b     6
           dc.b     1,0,0,0,6,125,0
           dc.b     0,63,1,0,0,0,0
           dc.b     0,7,1,0,0,0,0
           dc.b     0,7,1,255,206,0,0
           dc.b     0,7,1,255,156,255,206
           dc.b     0,7,1,255,156,255,156
*
pwr        dc.b     12
           dc.b     1,0,3,0,10,39,136
           dc.b     0,7,1,0,0,0,0
           dc.b     0,7,1,0,0,0,100
           dc.b     0,7,1,255,206,0,100
           dc.b     0,7,1,0,0,0,225
           dc.b     0,7,1,0,50,0,100
           dc.b     0,7,1,0,0,0,100
           dc.b     1,63,86,0,0,0,0
           dc.b     1,0,0,0,0,0,0
           dc.b     1,7,2,255,206,0,250
           dc.b     2,32,0,0,2,167,136
           dc.b     0,7,1,0,0,0,0
*
gnd        dc.b     12
           dc.b     1,0,0,0,10,39,117
           dc.b     0,7,1,0,0,0,0
           dc.b     0,7,1,0,0,255,156
           dc.b     0,63,1,255,181,255,156
           dc.b     0,7,1,0,0,255,156
           dc.b     0,63,1,0,75,255,156
           dc.b     0,7,1,0,50,255,131
           dc.b     0,63,1,255,206,255,131
           dc.b     0,7,1,255,231,255,106
           dc.b     0,7,1,0,25,255,106
           dc.b     2,32,0,0,2,167,117
           dc.b     0,7,1,0,0,0,0
*
port       dc.b     12
           dc.b     1,0,3,0,10,39,146
           dc.b     0,7,1,0,0,0,0
           dc.b     0,7,1,0,30,255,226
           dc.b     0,7,1,2,238,255,226
           dc.b     0,7,1,2,238,0,30
           dc.b     0,7,1,0,30,0,30
           dc.b     0,7,1,0,0,0,0
           dc.b     1,63,0,0,0,0,0
           dc.b     1,0,0,0,0,0,0
           dc.b     1,7,2,0,40,255,236
           dc.b     2,32,0,0,2,167,146
           dc.b     0,7,1,0,0,0,0
*
marker     dc.b     10
           dc.b     1,0,0,0,6,19,136
           dc.b     0,27,0,0,0,0,0
           dc.b     0,63,0,0,100,0,100
           dc.b     0,27,0,0,0,1,144
           dc.b     0,27,0,0,0,0,0
           dc.b     0,27,0,1,144,0,0
           dc.b     2,0,0,0,4,147,136
           dc.b     0,5,1,1,144,0,0
           dc.b     0,5,1,0,0,0,0
           dc.b     0,5,1,0,0,1,144
*
fiducial   dc.b     23
           dc.b     1,32,12,0,14,35,40   fiducial spot made by pad
           dc.b     0,4,12,0,0,0,0
           dc.b     1,70,77,63,0,0,0
           dc.b     1,0,0,0,0,0,0
           dc.b     1,10,1,255,216,0,40
           dc.b     1,70,73,68,85,67,73
           dc.b     1,65,76,0,0,0,0
           dc.b     1,139,1,0,0,255,216
           dc.b     1,0,0,0,0,0,0
           dc.b     1,0,0,0,0,0,0
           dc.b     1,11,1,0,0,255,176
           dc.b     1,32,0,0,0,0,0
           dc.b     1,0,0,0,0,0,0
           dc.b     1,139,1,0,0,255,136
           dc.b     2,32,0,0,2,163,40    pad
           dc.b     0,10,43,0,0,0,0
           dc.b     2,0,0,0,7,163,40     mechanical
           dc.b     0,27,0,0,0,0,0
           dc.b     0,27,0,255,151,0,105
           dc.b     0,27,0,0,105,0,105
           dc.b     0,27,0,0,105,255,151
           dc.b     0,27,0,255,151,255,151
           dc.b     0,27,0,255,151,0,105  
bridge     dc.b     15
           dc.b     1,0,0,0,15,19,137 
           dc.b     0,43,0,0,0,0,0 
           dc.b     0,43,0,0,20,255,250 
           dc.b     0,43,0,0,34,255,235 
           dc.b     0,43,0,0,40,255,216 
           dc.b     0,43,0,0,34,255,196 
           dc.b     0,43,0,0,19,255,182 
           dc.b     0,63,0,0,0,255,176 
           dc.b     0,43,0,0,140,255,176 
           dc.b     0,43,0,0,120,255,182 
           dc.b     0,43,0,0,106,255,197 
           dc.b     0,43,0,0,100,255,216 
           dc.b     0,43,0,0,106,255,236 
           dc.b     0,43,0,0,121,255,250 
           dc.b     0,43,0,0,140,0,0
*
edit_del   moveq    #1,d6
           bsr      set_over             set exor print mode
           lea      par,a4               optional find screen sets a4
           move.l   72(a4),a2            a2=edit base
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.w   2(a2),d1
           sub.w    194(a4),d1
           move.b   (a2),d5
           andi.b   #type_mask,d5
           moveq    #0,d0
           cmpi.w   #2,d1
           beq.s    exit38               element is minimum length pad
           cmpi.b   #pad,d5
           beq      cont4                if pad can be made shorter
           cmpi.w   #3,d1
           beq.s    exit38               element is minimum length
           cmpi.b   #trk,d5
           beq      cont4
           cmpi.b   #blk,d5
           beq.s    isablk2
exit38     rts                           element is text or other
isablk2    cmpi.w   #5,d1
           blt.s    exit38
           btst.l   #0,d1
           beq      cont4                block is currupt so try to correct
           bsr      segment1             delete edit element
           move.l   72(a4),a2
           move.w   70(a4),d0
           move.w   2(a2),d1
           sub.w    194(a4),d1
           btst.b   #0,71(a4)
           beq.s    blk_ok2
           addi.w   #1,70(a4)            move edit to lower segment
           addi.w   #1,d0                adjusted segment picked
           move.w   d1,d2
           sub.w    d0,d2
           mulu.w   #6,d2
           add.l    d2,a2                address of segment picked up
           move.w   2(a2),d2             swap coordinates
           move.w   4(a2),d3
           move.w   8(a2),2(a2)
           move.w   10(a2),4(a2)
           move.w   d2,8(a2)
           move.w   d3,10(a2)
blk_ok2    move.l   72(a4),a2            a2 = edit address
           sub.w    d0,d1
           cmpi.w   #1,d1
           bne.s    nt_blkst
           bsr      blkmv_l1
nt_blkst   mulu.w   #6,d1
           move.l   a2,a1
           add.l    d1,a1                a1 = address of segments to delete
           move.l   a1,a0                a0 = to be address of new coordinates
           subi.w   #2,2(a2)             reduce length
           cmpi.w   #2,70(a4)            check if segment on end
           beq.s    blkend_seg
           subi.w   #2,70(a4)            edit seg reduced
           addq.l   #6,a0
           addq.l   #6,a0
           bra.s    blkmov_seg
blkend_seg subq.l   #6,a0
           subq.l   #6,a0
           move.w   2(a2),d1
           sub.w    194(a4),d1
           cmpi.w   #3,d1
           beq.s    blkmov_seg
           move.w   -12(a0),(a0)
           move.w   -6(a0),6(a0)
blkmov_seg move.w   2(a0),d4             new cursor coords
           move.w   4(a0),d5
           tst.b    135(a4)
           beq.s    noqptr05
           move.w   d4,d0
           move.w   d5,d1
           sub.w    58(a4),d0            d0 = x coord difference 
           sub.w    60(a4),d1            d1 = y coord difference
           sub.w    d0,12(a4)            shift screen offsets
           sub.w    d1,14(a4)
noqptr05   move.w   d4,58(a4)
           move.w   d5,60(a4)
           move.l   76(a4),d7
           move.l   a1,a2
           addq.l   #6,a2
           addq.l   #6,a2
           subi.l   #12,76(a4)           new end of file
           bra      shifter1
*
cont4      bsr      segment1             delete edit element
           move.l   72(a4),a2            a2 = edit address
           move.w   70(a4),d0            d0 = segment picked up
           move.w   2(a2),d1             d1 = element length
           sub.w    194(a4),d1
           sub.w    d0,d1
           cmpi.w   #1,d1
           bne.s    nt_start
           bsr      mve_lab1
nt_start   mulu.w   #6,d1
           move.l   a2,a1
           add.l    d1,a1                a1=addr of seg to delete
           move.l   a1,a0                a0 to be addr of new coords
           subi.w   #1,2(a2)             reduce length
           cmpi.w   #1,70(a4)            check if segment on end
           beq.s    end_seg
           subi.w   #1,70(a4)            edit seg reduced
           addq.l   #6,a0
           bra.s    mov_seg
*
end_seg    subq.l   #6,a0
           move.w   2(a2),d1
           sub.w    194(a4),d1
           cmpi.w   #2,d1
           beq.s    mov_seg
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq.s    mov_seg
           move.w   -6(a0),(a0)          set layer/size to previous seg
*
mov_seg    move.w   2(a0),d4             *
           move.w   4(a0),d5             *  new cursor coords
           tst.b    135(a4)
           beq.s    noqptr06
           move.w   d4,d0
           move.w   d5,d1
           sub.w    58(a4),d0            d0 = x coord difference 
           sub.w    60(a4),d1            d1 = y coord difference
           sub.w    d0,12(a4)            shift screen offsets
           sub.w    d1,14(a4)
noqptr06   move.w   d4,58(a4)
           move.w   d5,60(a4)
           move.l   76(a4),d7
           move.l   a1,a2
           addq.l   #6,a2
           subi.l   #6,76(a4)            new end of file
shifter1   move.b   (a2)+,(a1)+
           cmp.l    a2,d7
           bgt.s    shifter1
           move.l   #$ffffffff,(a1)+
           move.w   #$ffff,(a1)
           moveq    #0,d0
           tst.b    135(a4)
           beq      draw_segs            print element and move cursor
           bsr      update3              update entire screen
           bra      put_cur
*
blkmv_l1   move.w   8(a2),d4
           sub.w    20(a2),d4
           move.w   10(a2),d5
           sub.w    22(a2),d5
           bra.s    blkmv_l2
mve_lab1   move.w   8(a2),d4
           sub.w    14(a2),d4            x offset for labels
           move.w   10(a2),d5
           sub.w    16(a2),d5            y offset for labels
blkmv_l2   move.w   194(a4),d2           d2 = labels
           beq.s    exit39
           move.w   2(a2),d3             d3 = element length
           sub.w    d2,d3
           mulu.w   #6,d3
           add.l    d3,a2                a2 = base of labels
           subi.w   #3,d2
           mulu.w   #6,d2                (a2,d2.l) = base of last label
mve_lab2   move.w   14(a2,d2.l),d3
           add.w    d4,d3
           move.w   d3,14(a2,d2.l)
           move.w   16(a2,d2.l),d3
           add.w    d5,d3
           move.w   d3,16(a2,d2.l)
           subi.l   #18,d2
           bge.s    mve_lab2
           move.l   72(a4),a2
exit39     rts
*
edit_kill  moveq    #1,d6
           bsr      set_over             set exor print mode
           lea      par,a4               optional find screen sets a4
           move.l   350(a4),a2           set edit base for print
           bsr      elements             delete edit elements
           move.l   350(a4),a2           edit base
           move.l   a2,76(a4)            new end of file
           move.l   #$ffffffff,(a2)+
           move.w   #$ffff,(a2)
           moveq    #0,d0
exit40     rts
*
isblk      move.w   (a2),d5
           andi.w   #lab_mask,d5
           cmpi.w   #3,d5
           bgt.s    has_rf3
           move.w   4(a2),d5
           andi.w   #lib_mask,d5
           bne.s    has_rf3
           move.b   #1,280(a4)
           rts
has_rf3    move.b   #0,280(a4)
           rts
edit_move  move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit40
           cmpi.w   #1,d3
           bne.s    exit40
           lea      par,a4
           move.l   72(a4),a2
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           moveq    #0,d0
           move.l   #0,d1
           move.w   2(a2),d1
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #blk,d5
           bne.s    notblk
           bsr      isblk
notblk     sub.w    194(a4),d1
           cmpi.w   #2,d1                check for length
           beq.s    exit40
           move.b   3(a6,a1.l),d3
           andi.b   #1,d3
           cmpi.b   #1,d3
           beq.s    forw1
           subi.w   #1,d1                subtract from length
           cmp.w    70(a4),d1
           beq      exit40
           tst.b    135(a4)
           bne.s    isqptr01
           bsr      segment1
isqptr01   addi.w   #1,70(a4)
           bra.s    new_pos1
forw1      cmpi.w   #1,70(a4)
           beq      exit40
           tst.b    135(a4)
           bne.s    isqptr02
           bsr      segment1
isqptr02   subi.w   #1,70(a4)
new_pos1   move.l   72(a4),a2
           move.w   70(a4),d0            d0=segment picked up
           move.w   2(a2),d1             d1=element length
           sub.w    194(a4),d1
           sub.w    d0,d1
           mulu.w   #6,d1
           add.l    d1,a2                a2=addr of seg picked up
           move.w   2(a2),d4             *
           move.w   4(a2),d5             *  new cursor coords
           tst.b    135(a4)
           bne.s    isqptr03
           move.w   d4,58(a4)            cursor x coord
           move.w   d5,60(a4)            cursor y coord
           bra      draw_segs
isqptr03   move.w   d4,d0
           move.w   d5,d1
           sub.w    58(a4),d0            d0 = x coord difference 
           sub.w    60(a4),d1            d1 = y coord difference
           sub.w    d0,12(a4)            shift screen offsets
           sub.w    d1,14(a4)
           move.w   d4,58(a4)
           move.w   d5,60(a4)
           bsr      update3
           bra      put_cur
exit41     rts
*
edit_make  moveq    #1,d6
           bsr      set_over
           lea      par,a4
           moveq    #0,d0
           move.l   72(a4),a2
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmp.b    #wrd,d5
           beq.s    exit41               text element
           moveq    #0,d5
           move.w   2(a2),d5
           cmpi.w   #lib_mask,d5
           bge.s    exit41               max element length
           bsr      segment1
           bsr.s    add_track
           bra      segment1             this sets netlist flag
add_track  bsr      whole_off            corner edit mode
           move.l   72(a4),a0            a0 = edit address
           moveq    #0,d1
           move.w   70(a4),d0            d0 = segment picked up
           move.w   2(a0),d1             d1 = element length
           sub.w    194(a4),d1
           move.b   (a0),d5
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq      isapad
           cmpi.b   #trk,d5
           beq      isatrack
           cmpi.b   #blk,d5
           beq.s    isablock
blk_err    moveq    #0,d0
           rts
isablock   btst.l   #0,d1
           beq.s    blk_err              length of block element is corrupt
           move.b   #0,280(a4)
           btst.b   #0,71(a4)
           beq.s    blk_ok
           addi.w   #1,70(a4)            move edit to lower segment
           addi.w   #1,d0                adjusted segment picked
           move.w   d1,d2
           sub.w    d0,d2
           mulu.w   #6,d2
           add.l    d2,a0                address of segment picked up
           move.w   2(a0),d2             swap coordinates
           move.w   4(a0),d3
           move.w   8(a0),2(a0)
           move.w   10(a0),4(a0)
           move.w   d2,8(a0)
           move.w   d3,10(a0)           
           move.l   72(a4),a0            a0 = edit address
blk_ok     cmpi.w   #3,d1                check for only 1 block
           bne.s    not1blk
           sub.w    d0,d1
           bra.s    end_seg2
not1blk    sub.w    d0,d1
           cmpi.w   #1,d1
           bgt.s    end_seg2
           addi.w   #2,70(a4)
end_seg2   mulu.w   #6,d1
           addi.w   #2,2(a0)
           add.l    d1,a0
           move.l   76(a4),a2
           move.l   a2,a1
           addq.l   #6,a1
           addq.l   #6,a1
           addi.l   #12,76(a4)           change end of file address
           bra.s    shifter2
****
isatrack   sub.w    d0,d1
           cmpi.w   #1,d1
           bne.s    end_seg3
*
*           cmpi.w   #1,d1               ** first segment picked up
*           bne.s    end_seg3            **********
*           move.b   6(a0),d2
*           andi.b   #lay_mask,d2
*           cmpi.b   #inv_lay,d2         **********
*           beq.s    end_seg3            ** first segment invisible
*
           addi.w   #1,70(a4)
end_seg3   mulu.w   #6,d1
           addi.w   #1,2(a0)             increase element length
           add.l    d1,a0                a0 = address of segment picked up
           move.l   76(a4),a2
           move.l   a2,a1
           addq.l   #6,a1
           addi.l   #6,76(a4)            change end of file address
           bra.s    shifter2
****
isapad     cmpi.w   #2,d1                check for only 1 pad
           bne.s    not1pad
           sub.w    d0,d1
           bra.s    end_seg4             do not move edit to next segment if only 1 pad
not1pad    sub.w    d0,d1
           cmpi.w   #1,d1                ** first segment picked up
           bne.s    end_seg4             **********
           addi.w   #1,70(a4)
end_seg4   mulu.w   #6,d1
           addi.w   #1,2(a0)             increase length of element
           add.l    d1,a0                a0 = address of segment picked up
           move.l   76(a4),a2            a2 = end of edit element
           move.l   a2,a1
           addq.l   #6,a1
           addi.l   #6,76(a4)            change end of file address
****
shifter2   move.w   -(a2),-(a1)
           cmp.l    a0,a2
           bgt.s    shifter2
           move.l   76(a4),a1
           move.l   #$ffffffff,(a1)+
           move.w   #$ffff,(a1)
           moveq    #0,d0
           move.l   72(a4),a2            a2 = edit address 
*           
           move.b   (a2),d5              *
           andi.b   #type_mask,d5        *
           cmpi.b   #trk,d5              *
           bne.s    exit42               *
           move.w   2(a2),d1             * d1 = element length
           sub.w    194(a4),d1           * d1 = length without labels
           sub.w    70(a4),d1            * d1 = segment picked up
           cmpi.w   #1,d1                *
           bne.s    exit42               *
           move.b   6(a2),d1             *
           andi.b   #lay_mask,d1         *
           cmpi.b   #inv_lay,d1          *
           bne.s    exit42               *
           move.b   18(a2),6(a2)         *
exit42     rts
*
edit_copy  lea      par,a4
           move.l   350(a4),a2
           bsr      elements             blank out elements
           moveq    #7,d6
           bsr      set_ink2
           bsr      blank                blank cursor
           moveq    #2,d6
           bsr      set_over             over 2
           andi.b   #$fe,80(a4)          edit mode off
           move.l   350(a4),a2
           bsr      elements             put original element down
           moveq    #1,d6
           bsr      set_over             over 1
           ori.b    #1,80(a4)            edit mode back on
           move.l   350(a4),a2
           bsr      elements             put new elements down
           moveq    #7,d6
           bsr      set_ink2
           bsr      blank                print cursor
           bsr      whole_on             whole mode
           move.l   72(a4),d1            d1=element edit base
           move.l   350(a4),a2           a2=component edit base
           sub.l    a2,d1                d1=difference
           move.l   76(a4),a0            a0=end of file
           move.l   a0,a1
copy_el    move.b   (a2)+,(a0)+
           cmp.l    a2,a1
           bgt.s    copy_el
           move.l   a2,350(a4)           new component edit base
           add.l    d1,a2
           move.l   a2,72(a4)            new element edit base
           move.l   a0,76(a4)            new end of file
           move.l   #$ffffffff,(a0)+
           move.w   #$ffff,(a0)
           moveq    #0,d0
exit43     rts
*
edit_inv   lea      par,a4
           moveq    #0,d0
           move.l   72(a4),a2
           cmp.l    350(a4),a2           look for component
           bne.s    exit43
           move.w   4(a2),d1             look for library and finger pad
           andi.w   #lib_mask,d1         mask control bit
           bne.s    exit43
           cmp.l    350(a4),a2           look for component
           bgt      exit43
no_rf5     move.b   6(a2),d2
           andi.b   #lay_mask,d2
           cmpi.b   #inv_lay,d2          look for schematic
           beq.s    exit43
           cmpi.b   #trk,(a2)            look for track
           bne.s    exit43
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.w   2(a2),d1
           move.b   (a2),d5          ******** not needed
           andi.b   #type_mask,d5    ********  "    "
           sub.w    194(a4),d1
           cmp.w    #2,d1
           beq.s    exit43
           bsr      segment1
           move.l   72(a4),a2
           move.l   76(a4),a1            a1 = end of file
           moveq    #0,d1
           move.w   2(a2),d0             d0 = element length
           sub.w    194(a4),d0
           move.w   194(a4),d1
           mulu.w   #6,d1
           sub.l    d1,a1                adjust end of file
           move.w   70(a4),d1            segment picked up
           sub.w    d1,d0
           move.w   d0,70(a4)            inv seg picked up
           addq.l   #6,a2                a2 addr of first seg
           subq.l   #6,a1                a1 addr of last seg
*
next_seg   cmp.l    a2,a1
           ble.s    swap_fin
           moveq    #6,d0                d0 = 6 counter
seg_swap   move.b   (a2),d1              *
           move.b   (a1),d2              * swap coords
           move.b   d2,(a2)+             *
           move.b   d1,(a1)+             *
           subi.w   #1,d0
           bne.s    seg_swap
           suba.l   #12,a1
           bra.s    next_seg
*
swap_fin   move.l   72(a4),a2
           move.w   2(a2),d0             element length
           sub.w    194(a4),d0
move_lay   move.b   6(a2),d1             store via size
           andi.b   #via_mask,d1
           move.w   12(a2),6(a2)         move layer and size
           andi.b   #lay_mask,6(a2)
           or.b     d1,6(a2)             replace via size
           addq.l   #6,a2
           subi.w   #1,d0
           cmpi.w   #2,d0
           bne.s    move_lay
           move.w   (a2),6(a2)
           move.l   72(a4),a2
           bra      segment1
*
chg_seg2   cmpi.b   #wrd,d5
           beq.s    exit44
           move.b   d1,134(a4)           store size
           bsr      segment1
           move.l   72(a4),a2            a2 = edit address
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           moveq    #0,d0
           moveq    #0,d1
           move.w   70(a4),d0            d0 = segment picked up
           move.w   2(a2),d1             d1 = element length
           sub.w    194(a4),d1
           sub.w    d0,d1
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #trk,d5
           bne.s    not_trk2             is not a track element
           cmpi.w   #1,d0
           beq.s    ext_trk2             end of element
           cmpi.w   #1,d1
           beq.s    ext_trk2             start of element
not_trk2   move.l   a2,a1
           mulu.w   #6,d1
           add.l    d1,a1                a1 = address of segment
           move.b   134(a4),1(a1)        change segment size
           cmpi.b   #trk,d5
           bne      segment1             not track element
           cmpi.w   #1,d0
           bne      segment1
           move.b   134(a4),7(a1)
           bra      segment1
ext_trk2   movem.l  d0-d1/d5,-(a7)
           bsr      add_track
           movem.l  (a7)+,d0-d1/d5
           bra.s    not_trk2 
*
exit44     rts
edit_siz   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit44
           moveq    #-15,d0
           moveq    #0,d2
           cmpi.w   #2,d3
           bne.s    exit44      
           lea      par,a4 
           move.w   2(a1,a6.l),d1
           move.w   6(a1,a6.l),d2
           move.l   72(a4),a2
           moveq    #0,d0
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmp.b    #blk,d5
           beq.s    exit44               element is block
           cmpi.w   #256,d1
           bge.s    exit44
           cmpi.b   #pad,d5
           beq.s    pads_ok2
           cmpi.w   #64,d1               must be tracks or text
           bge.s    exit44
pads_ok2   cmpi.w   #1,d2
           beq      chg_seg2
           move.b   d1,136(a4)
           bsr      segment1             remove element
           move.l   72(a4),a2            a2 = base of element
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           moveq    #0,d0
           moveq    #0,d1
           move.b   136(a4),d0           d0 = new element size
           move.w   2(a2),d1             d1 = element length
           sub.w    194(a4),d1
new_siz2   addq.l   #6,a2                move to next segment
           move.b   d0,1(a2)             change size
           subi.w   #1,d1
           cmpi.w   #1,d1
           bne.s    new_siz2
           move.l   72(a4),a2
           bra      segment1
*
chg_seg1   cmpi.b   #inv_lay,d1
           bgt      exit45
           move.b   d1,134(a4)           store via layer
           move.l   72(a4),a2            a2 = edit address
           bsr      segment1             sets netlist flag
           move.l   72(a4),a2            a2 = edit address
           moveq    #0,d0
           moveq    #0,d1
           move.w   70(a4),d0            d0 = segment picked up
           move.w   2(a2),d1             d1 = element length
           sub.w    194(a4),d1
           sub.w    d0,d1
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #trk,d5
           beq.s    is_a_track           is a track element
           move.l   a2,a1
           mulu.w   #6,d1
           add.l    d1,a1                a1 = address of segment
           move.b   134(a4),d2
           andi.b   #lay_mask,d2
           move.b   d2,(a1)              change segment layer
           move.b   148(a4),d3
           lsl.b    #6,d3
           or.b     d3,(a1)              change via size
           bra      segment1
is_a_track cmpi.b   #1,d0                
           beq.s    ext_track            last segment
           cmpi.b   #1,d1
           beq.s    ext_track            first segment
track_ret  move.l   a2,a1
           mulu.w   #6,d1
           add.l    d1,a1                a1 = address of segment
           move.b   134(a4),d2
           andi.b   #lay_mask,d2         d2 = new layer
           move.b   148(a4),d3
           lsl.b    #6,d3                d3 = via size
           cmpi.w   #6,d1
           beq.s    via03                first segment
           cmpi.w   #1,d0
           beq.s    via02                last segment
           cmpi.w   #2,d0
           beq.s    via03                2nd from last
           move.b   (a1),d0
           move.b   6(a1),d1
           andi.b   #lay_mask,d0
           andi.b   #lay_mask,d1
           cmp.b    d0,d1
           bne.s    not_st
           bra.s    via03
via02      cmpi.b   #inv_lay,d2
           bne.s    via04
           move.b   -6(a1),6(a1)
           bra.s    via03
via04      move.b   d2,6(a1)
via03      andi.b   #lay_mask,6(a1)
           or.b     d3,6(a1)
not_st     move.b   d2,(a1)              set new layer
           or.b     d3,(a1)              set new via size
           bra      segment1
ext_track  movem.l  d0-d1/d5,-(a7)
           bsr      add_track
           movem.l  (a7)+,d0-d1/d5
           bra.s    track_ret
*
exit45     rts
edit_lay   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit45
           moveq    #-15,d0
           cmpi.w   #2,d3
           bne.s    exit45  
           lea      par,a4
           move.b   3(a1,a6.l),d1 
           move.w   6(a1,a6.l),d2
           moveq    #0,d0
           move.l   72(a4),a2
           cmpi.b   #wrd,(a2)
           beq.s    wh_lay
           cmpi.b   #blk,(a2)
           beq.s    is_blk1
           moveq    #0,d0
           tst.b    d1
           beq.s    exit45               its layer zero
is_blk1    cmpi.w   #1,d2
           beq      chg_seg1
wh_lay     cmpi.b   #63,d1
           bgt.s    exit45
           move.b   d1,136(a4)
           move.l   72(a4),a2
           bsr      segment1
           move.l   72(a4),a2
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           moveq    #0,d0
           moveq    #0,d1
           move.b   136(a4),d0
           move.w   2(a2),d1             element length
           sub.w    194(a4),d1
new_lay2   addq.l   #6,a2
           move.b   (a2),d2
           andi.b   #lay_mask,d2
           cmpi.b   #inv_lay,d2
           beq.s    invis_lay
           tst.b    d2
           beq.s    invis_lay
           move.b   (a2),d2
           andi.b   #via_mask,d2
           or.b     d2,d0
           move.b   d0,(a2)
invis_lay  subi.w   #1,d1
           cmpi.w   #1,d1
           bne.s    new_lay2
           move.l   72(a4),a2
           bra      segment1
*
edit_dn    move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit46
           moveq    #0,d0
           lea      par,a4
           tst.w    d3
           beq.s    edit_dn2
           move.l   76(a4),72(a4)
           move.l   76(a4),350(a4)
           rts
edit_dn2   move.b   #1,d6
           bsr      set_over
           moveq    #7,d6
           bsr      set_ink2
           bsr      blank                remove cursor
*
           move.l   350(a4),a2
           bsr      elements             remove elements
           andi.b   #$fe,80(a4)          edit mode off
           move.b   #2,d6
           bsr      set_over             place mode
           move.l   350(a4),a2
           move.l   76(a4),72(a4)        edit address at end of file
           move.l   76(a4),350(a4)
           bsr      elements             place elements
*
           move.b   #1,d6
           bsr      set_over
           moveq    #7,d6
           bsr      set_ink2
           bsr      blank                place cursor
           bsr      prt_c                print coordinates
           bra      prt_s                print scale
*
exit46     rts
type       move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit46
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit46
           moveq    #0,d0
           moveq    #0,d2
           lea      par,a4
           move.w   2(a6,a1.l),d2
           move.b   d2,102(a4)           store ascii value
           cmpi.w   #32,d2
           blt.s    exit46
           beq      space
           cmpi.w   #191,d2
           bgt      extras
           subi.b   #33,d2
           bsr      find_text            a2=address of element
           move.b   #1,d6
           bsr      set_over             set xor
           moveq    #7,d6
           bsr      set_ink2
           bsr      blank                blank cursor
           moveq    #2,d6
           bsr      set_over             set put
           move.l   76(a4),a0            end of file
           move.w   142(a4),d1           d1 = element length
           move.l   a2,a1
           move.l   a0,a2                a2 = new element addr
copy_el2   move.b   (a1)+,(a0)+
           subi.w   #1,d1
           bgt.s    copy_el2
           move.l   a0,72(a4)            new edit base
           move.l   a0,350(a4)
           move.l   a0,76(a4)            new end of file
           move.l   a2,a0
           lea      text_buff,a3
           cmpi.w   #$800,138(a4)        check for buffer overflow
           ble.s    buff_ok
           move.w   #0,138(a4)           zero buffer
buff_ok    addi.w   #8,138(a4)           increment pointer
           moveq    #0,d4
           move.w   138(a4),d4           d4 = pointer
           add.l    d4,a3
           move.l   a0,(a3)              put addr on buffer
           move.l   58(a4),4(a3)         store cursor x
           moveq    #0,d4
           moveq    #0,d5
           move.w   2(a0),d1             d1 = element length
text_seg1  addq.l   #6,a0                move to first seg
           subi.w   #1,d1
           beq.s    text_end2
           cmpi.b   #62,(a0)
           bgt.s    invis2
           move.b   123(a4),(a0)         text layer default
invis2     move.b   122(a4),1(a0)        text size default
           move.w   2(a0),d4
           move.w   118(a4),d5
           mulu.w   d5,d4 
           asr.w    #2,d4
           add.w    58(a4),d4            add cursor x pos
           move.w   d4,2(a0)
           moveq    #0,d4
           move.w   4(a0),d4
           move.w   120(a4),d5
           mulu.w   d5,d4
           asr.w    #2,d4
           add.w    60(a4),d4            add cursor y pos
           move.w   d4,4(a0)
           bra.s    text_seg1
text_end2  move.l   #$ffffffff,(a0)+
           move.w   #$ffff,(a0)
           moveq    #0,d0
           bsr      segment1             print text
           move.w   118(a4),d0           text width
           cmpi.b   #97,102(a4)
           blt.s    upper_case
           cmpi.b   #122,102(a4)
           bgt.s    upper_case
           mulu.w   #25,d0
           bra.s    lower_case
upper_case mulu.w   #30,d0
lower_case asr.w    #2,d0
           add.w    d0,58(a4)
           bra      put_cur
           moveq    #0,d0
exit47     rts
*
space      move.w   118(a4),d0           d0=text width
           mulu.w   #30,d0               steps of 5 
           asr.w    #2,d0
           add.w    d0,58(a4)
           move.b   #1,d6
           bsr      set_over
           moveq    #7,d6
           bsr      set_ink2
           move.w   58(a4),d0
           move.w   60(a4),d1
           bra      move_cur
*
delete     tst.w    138(a4)              check for empty buffer
           beq.s    exit47
           move.b   #1,d6
           bsr      set_over
           lea      par,a4
           moveq    #7,d6
           bsr      set_ink2
           bsr      blank                blank cursor
           lea      text_buff,a3
           moveq    #0,d4
           move.w   138(a4),d4           d4 = pointer
           add.l    d4,a3
           move.l   (a3),a2              take addr from buffer
           move.l   4(a3),58(a4)         retrieve cursor coords
           move.l   a2,144(a4)
           subi.w   #8,138(a4)           decrement pointer
           moveq    #3,d6
           bsr      set_over
           bsr      segment1             blank element
           move.l   144(a4),a2
           move.l   a2,72(a4)
           move.l   a2,350(a4)
           move.l   a2,76(a4)
           move.l   #$ffffffff,(a2)+
           move.w   #$ffff,(a2)
           moveq    #0,d0
           bra      put_cur              print cursor over and ink ok
*
find_text  andi.l   #$ffff,d2
           lea      txt_dat2,a2
           lsl.w    #1,d2
           move.w   (a2,d2.w),d2
           add.l    d2,a2
           move.w   2(a2),d1             d1 = element length
           mulu.w   #6,d1
           move.w   d1,142(a4)
exit48     rts
set_buff   lea      par,a4
*
*
*
           cmpi.w   #8,138(a4)
           ble.s    clrbuff1
           moveq    #0,d4
           move.w   138(a4),d4
           moveq    #0,d5
join_loop  lea      text_buff,a3
           add.l    d4,a3
           move.l   (a3),a2
           add.w    2(a2),d5
           move.b   #inv_lay,-6(a2)
           move.l   -6(a2),(a2)
           move.w   -2(a2),4(a2)
           subi.w   #8,d4
           cmpi.w   #8,d4
           bne.s    join_loop
           lea      text_buff,a3
           add.l    d4,a3
           move.l   (a3),a2
           add.w    2(a2),d5
           move.w   d5,2(a2)
*
*
*
clrbuff1   move.w   #0,138(a4)
exit49     moveq    #0,d0
           rts
extras     cmpi.w   #194,d2
           beq      delete
           move.l   #0,172(a4)           word shift x y offset
           move.w   82(a4),d0
           cmpi.w   #192,d2
           bne.s    mve_right
           sub.w    d0,172(a4)           shift left
           bra.s    shiftit
mve_right  cmpi.w   #200,d2
           bne.s    mve_up
           add.w    d0,172(a4)           shift right
           bra.s    shiftit
mve_up     cmpi.w   #208,d2
           bne.s    mve_down
           add.w    d0,174(a4)           shift up
           bra.s    shiftit
mve_down   cmpi.w   #216,d2
           bne.s    exit49
           sub.w    d0,174(a4)           shift down
shiftit    tst.w    138(a4)
           beq.s    exit49               buffer empty
           move.b   #1,d6
           bsr      set_over             set to xor
           lea      par,a4
           moveq    #7,d6
           bsr      set_ink2             set to white
           bsr      blank                remove cursor
           move.w   138(a4),144(a4)
w_10       lea      text_buff,a3
           moveq    #0,d4
           move.w   144(a4),d4
           beq.s    shifted_it
           add.l    d4,a3
           subi.w   #8,144(a4)
           move.w   172(a4),d0
           move.w   174(a4),d1
           add.w    d0,4(a3)
           add.w    d1,6(a3)
           move.l   (a3),a2              a2 element address
           move.b   #3,d6
           bsr      set_over             set to take
           lea      par,a4
           move.l   a2,176(a4)
           bsr      segment1             remove element
           move.w   172(a4),d0
           move.w   174(a4),d1
           move.l   176(a4),a2
           move.w   2(a2),d2             d2 = element length
move10     addq.l   #6,a2                move to first coord
           subi.w   #1,d2
           move.w   2(a2),d3             x
           move.w   4(a2),d4             y
           add.w    d0,d3
           add.w    d1,d4
           move.w   d3,2(a2)
           move.w   d4,4(a2)
           cmpi.w   #1,d2
           bne.s    move10
           bra      w_10
shifted_it move.w   138(a4),144(a4)
w_11       lea      text_buff,a3
           moveq    #0,d4
           move.w   144(a4),d4
           beq.s    printed_it
           add.l    d4,a3
           subi.w   #8,144(a4)
           move.l   (a3),a2
           move.b   #2,d6
           bsr      set_over             set to put
           lea      par,a4
           bsr      segment1             replace element
           bra.s    w_11
printed_it move.w   172(a4),d0
           move.w   174(a4),d1
           add.w    d0,58(a4)
           add.w    d1,60(a4)
           bra      put_cur              replace cursor
exit50     rts
*
scr_op     moveq    #0,d1
           moveq    #0,d3
           move.l   18(a4),a2            screen memory address
           move.w   300(a4),d0           window width
           move.w   302(a4),d2           window height
           move.w   186(a4),d1           screen width
           move.w   304(a4),d3           x offset
           tst.b    263(a4)
           bne.s    hi_scr4
           lsr.w    #4,d0                long words across window
           lsr.w    #2,d1                d1 bytes per line
           lsr.w    #2,d3                d3 offset bytes
           bra.s    m4_scr4              mode 4 or 8
hi_scr4    lsr.w    #1,d0                long words across window
           lsl.w    #1,d1                d1 bytes per line
           lsl.w    #1,d3                d3 x offset bytes
m4_scr4    add.l    d3,a2                add x offset
           move.w   306(a4),d3           y offset
           muls     d1,d3                d3 y offset bytes
           add.l    d3,a2                add y offset
           subi.w   #1,d2                dbra checks for -1
           rts
*
clr_scr    bsr      scr_op
nxtline1   move.w   d0,d3                d3 long word counter
           subi.w   #1,d3                dbra checks for -1
           move.l   a2,a3                a3 start of line
clrline    move.l   #0,(a3)+
           dbra     d3,clrline
           add.l    d1,a2                move to next line
           dbra     d2,nxtline1
exit51     rts
*
save_scr   lea      par,a4
           move.l   150(a4),a1
           bsr      scr_op
nxtline2   move.w   d0,d3                d3 long word counter
           subi.w   #1,d3                dbra checks for -1
           move.l   a2,a3                a3 start of line
saveline   move.l   (a3)+,(a1)+
           dbra     d3,saveline
           add.l    d1,a2                move to next line
           dbra     d2,nxtline2
           moveq    #0,d0
exit52     rts
*
load_scr   lea      par,a4
           move.l   150(a4),a1
           bsr      scr_op
nxtline3   move.w   d0,d3                d3 long word counter
           subi.w   #1,d3                dbra checks for -1
           move.l   a2,a3                a3 start of line
loadline   move.l   (a1)+,(a3)+
           dbra     d3,loadline
           add.l    d1,a2                move to next line
           dbra     d2,nxtline3
           moveq    #0,d0
exit53     rts
*
lib_base   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit53
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit53
           lea      par,a4
           move.l   (a6,a1.l),154(a4)
           moveq    #0,d0
           rts
*
findeof    move.l   26(a4),a0
feof_lp    cmpi.b   #$ff,(a0)
           beq.s    eofile
           move.w   2(a0),d5
           mulu.w   #6,d5
           adda.l   d5,a0
           bra.s    feof_lp
eofile     move.l   a0,76(a4)
exit54     rts
*
is_str     moveq    #0,d0
           move.l   154(a4),a2           a2 = base of library
           moveq    #0,d4
           move.w   (a0)+,d5
           bsr      fnd_string           a2 = address of element
           tst.b    d4                   d4 = 0 if not found
           bne      got_lib
           bsr      findeof
           move.w   516(a4),d4
           bra      int_ret2
*
lib        move.w   ca.gtstr,a0
           jsr      (a0)
           bne      exit54
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne      exit54
           lea      par,a4
*
           lea      store,a0
           moveq    #0,d4
           move.w   (a6,a1.l),d1         d1 = string length
           beq      int_ret2
           cmpi.w   #12,d1
           bgt      int_ret2
*
           move.w   d1,(a0)+
           addq.l   #2,a1
lib_lp1    move.b   (a6,a1.l),(a0)+
           addq.l   #1,a1
           subi.w   #1,d1
           bne.s    lib_lp1
           move.w   #0,516(a4)           clear string match length
           lea      store,a0
*
           moveq    #0,d2
           move.w   (a0),d1              d1 = string length
           move.w   d1,514(a4)
           moveq    #0,d0
           cmpi.w   #5,d1
           bgt.s    is_str
           move.b   2(a0),d0
           cmpi.w   #49,d0               *
           blt.s    is_str               * check first char
           cmpi.w   #57,d0               *
           bgt      is_str               *
           add.w    #1,d1
           moveq    #1,d3
*
cnv_lp1    moveq    #0,d0
           move.b   (a0,d1.w),d0
           subi.w   #48,d0
           cmpi.w   #0,d0
           blt      is_str
           cmpi.w   #9,d0
           bgt      is_str
           mulu.w   d3,d0
           add.l    d0,d2
           mulu.w   #10,d3
           subi.w   #1,d1
           cmpi.w   #1,d1
           beq.s    cnv_end
           bra.s    cnv_lp1
*
cnv_end    cmpi.l   #$7fff,d2
           bgt      is_str
           moveq    #0,d0
           move.l   154(a4),a2
           moveq    #0,d4
           bsr      fnd_num              a2 = eof
           tst.b    d4
           bne.s    got_lib
           moveq    #0,d0
           move.l   154(a4),a2           a2 = base of library
           moveq    #0,d4
           lea      store,a0
           move.w   (a0)+,d5
           bsr      fnd_string           a2 = address of element
           tst.b    d4                   d4 = 0 if not found
           bne.s    got_lib
           bsr      findeof
           move.w   516(a4),d4
           bra      int_ret2
*
got_lib    move.l   a2,a0                a0 = end of file
           move.l   362(a4),a2           a2 = address of component
           move.l   a2,a1
           move.w   142(a4),d1           d1 = element length
cpy_lib1   move.w   (a1)+,(a0)+
           subi.w   #2,d1
           bne.s    cpy_lib1
           move.l   a0,a3                a3 = end of file
           move.l   a2,a0
           move.l   a2,a1
           moveq    #0,d1
           move.w   142(a4),d1
           add.l    d1,a1
cpy_lib2   move.w   (a1)+,(a0)+
           cmp.l    a1,a3                look for end
           bne.s    cpy_lib2
           move.l   a0,a2
           sub.l    d1,a2                a2 = base of element
           move.l   #$ffffffff,(a0)+
           move.w   #$ffff,(a0)+
*
           moveq    #1,d6
           bsr      set_over             set xor
*                                        calculate end of art file
           bsr      findeof
*
           move.l   a0,350(a4)           new component edit address
           move.l   a2,a1
           move.l   a0,a2                a2 = new component addr
copy_el3   move.b   (a1),d5
           andi.b   #type_mask,d5
           cmpi.b   #end,d5
           beq.s    endcopy1
           move.l   a0,72(a4)            new element edit address
           move.w   8(a1),d2             d2 = first coordinate
           move.w   10(a1),d3            d3 = second coordinate
           move.w   2(a1),d1             d1 = length
copyseg1   move.l   (a1)+,(a0)+
           move.w   (a1)+,(a0)+
           subi.w   #1,d1
           bne.s    copyseg1
           bra.s    copy_el3
endcopy1   move.l   a0,76(a4)            new end of file
           move.l   #$ffffffff,(a0)+
           move.w   #$ffff,(a0)
           sub.w    58(a4),d2
           move.w   d2,172(a4)           last element x offset
           sub.w    60(a4),d3
           move.w   d3,174(a4)           last element y offset
*
           move.l   a2,a1
nxt_el12   move.l   a1,a0
           move.b   (a0),d5
           andi.b   #type_mask,d5
           cmpi.b   #end,d5
           beq.s    symb_end2
           move.w   (a0),194(a4)
           andi.w   #lab_mask,194(a4)
           moveq    #0,d1
           move.w   2(a0),d1             d1 = element length
           move.w   d1,d3
           mulu.w   #6,d3
           sub.w    194(a4),d1
           subi.w   #1,d1
symb_seg1  addq.l   #6,a0                move to first seg
           move.w   2(a0),d4
           sub.w    172(a4),d4           sub cursor x offset
           move.w   d4,2(a0)
           move.w   4(a0),d4
           sub.w    174(a4),d4           sub cursor y offset
           move.w   d4,4(a0)
           subi.w   #1,d1
           bne.s    symb_seg1
           move.l   a1,a2                a2 = old address
           add.l    d3,a1
           bra.s    nxt_el12
*
symb_end2  moveq    #0,d0
           bsr      edit_on              cad edit on
           move.w   2(a2),d4             d4 = element length
           sub.w    194(a4),d4
           subi.w   #1,d4
           move.w   d4,70(a4)            segment picked up
           move.l   350(a4),a2
           bsr      elements             print component
           move.w   516(a4),d4
           bra      int_ret2
           rts
*                                        a2 = base of library
fnd_num    move.l   #0,362(a4)           clear component start
           move.l   #0,366(a4)           clear component end
find_lp1   move.b   (a2),d3
           andi.b   #type_mask,d3
           cmpi.b   #pad,d3
           beq.s    el_ok1
           cmpi.b   #trk,d3
           beq.s    el_ok1
           cmpi.b   #wrd,d3
           beq.s    el_ok1
           cmpi.b   #blk,d3
           beq.s    el_ok1
           cmpi.b   #end,d3              look for end of file
           beq.s    findend1
           bra.s    cont2
el_ok1     move.w   4(a2),d3
           andi.w   #comp_mask,d3
           bne.s    iscomp1
           tst.b    d4
           bne.s    found1
           move.l   a2,362(a4)           a2 = component start
           bra.s    iscomp1
found1     cmpi.l   #0,366(a4)
           bne.s    cont2
           move.l   a2,366(a4)           a3 = component end
           bra.s    cont2
iscomp1    move.w   4(a2),d3             d3 = library number
           andi.w   #lib_mask,d3         mask control bit
           cmp.w    d2,d3
           bne.s    cont2
           moveq    #1,d4                d4 = status
           move.w   514(a4),516(a4)
cont2      move.w   2(a2),d1             d1 = element length
           mulu.w   #6,d1
           add.l    d1,a2
           bra.s    find_lp1
*
findend1   move.w   #0,142(a4)
           tst.b    d4
           beq.s    exit55
           cmpi.l   #0,366(a4)
           bne.s    iscomp2
           move.l   a2,366(a4)
iscomp2    move.l   366(a4),d1
           sub.l    362(a4),d1           d1 = component length
           move.w   d1,142(a4)           save length
exit55     rts
*
fnd_string move.l   #0,362(a4)           clear component start
           move.l   #0,366(a4)           clear component end
find_lp2   move.b   (a2),d3
           andi.b   #type_mask,d3
           cmpi.b   #pad,d3
           beq.s    el_ok2
           cmpi.b   #trk,d3
           beq.s    el_ok2
           cmpi.b   #wrd,d3
           beq.s    el_ok2
           cmpi.b   #blk,d3
           beq.s    el_ok2
           cmpi.b   #end,d3              look for end of file
           beq.s    findend1
           bra      cont3
el_ok2     move.w   4(a2),d3
           andi.w   #comp_mask,d3
           bne.s    iscomp3
           tst.b    d4
           bne.s    found2
           move.l   a2,362(a4)           a2 = component start
           bra.s    iscomp3
found2     cmpi.l   #0,366(a4)
           bne      cont3
           move.l   a2,366(a4)           a3 = component end
           bra.s    cont3
*
iscomp3    move.w   2(a2),d1             d1 = element length
           moveq    #0,d3
           move.w   (a2),d3
           andi.w   #lab_mask,d3
           mulu.w   #6,d1
           cmpi.w   #6,d3
           blt.s    cont3                no type/value
           move.l   a2,a3
           cmpi.w   #12,d3
           blt.s    no_footprt           no footprint
           add.l    #54,a3               add footprint offset
           bra.s    footprt
no_footprt add.l    #18,a3               add type/value offset
footprt    move.l   d1,d2
           cmpi.w   #12,d3
           mulu.w   #6,d3
           sub.l    d3,d2
           add.l    d2,a3                a3 = address of component string
           tst.b    (a3)
           beq.s    cont3                no component reference
           moveq    #0,d6                a0 = search    string address
len_sym2   addi.w   #1,d6                d5 = search    string length
           cmpi.b   #0,(a3,d6.w)         a3 = component string address
           bne.s    len_sym2             d6 = component string length
*                                        if found goto found_symb
*                                        else     goto nxt_sym2
*
*           cmp.w    d5,d6                compare string lengths
*           blt.s    cont3
           moveq    #0,d7
cmp_sym2   move.b   (a0,d7.w),d2
           move.b   (a3,d7.w),d3
           andi.b   #$5f,d2
           andi.b   #$5f,d3
           cmp.b    d2,d3                compare string
           bne.s    cmp_sym3
           addi.w   #1,d7
           cmp.w    d7,d5
           bgt.s    cmp_sym2
           move.w   #1,d4                string found   
cmp_sym3   cmp.w    516(a4),d7
           ble.s    cont3
           move.w   d7,516(a4)
*
cont3      move.w   2(a2),d1             d1 = element length
           mulu.w   #6,d1
           add.l    d1,a2
           bra      find_lp2
*
edit_lab   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit56
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit56
           moveq    #0,d0
           lea      par,a4
           move.l   350(a4),a2
           move.w   2(a6,a1.l),d1
           andi.w   #lib_mask,d1
nxt_el13   move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #end,d5
           beq.s    exit56
           andi.w   #comp_mask,4(a2)
           or.w     d1,4(a2)
           move.w   2(a2),d5             d5 = element length
           mulu.w   #6,d5
           add.l    d5,a2
           bra.s    nxt_el13
*
exit56     rts
edit_rot   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit56
           cmpi.w   #1,d3
           bne.s    exit56
           move.b   3(a6,a1.l),d0        d0 = rotate type
           andi.b   #3,d0                0=Y 1=X 2=clockwize 3=anticlock
           moveq    #1,d6
           bsr      set_over             set exor print mode
           lea      par,a4               optional find screen sets a4
           move.b   d0,136(a4)           save rot mode
           move.l   350(a4),a2           set edit base for print
           bsr      elements             delete edit elements
           move.l   350(a4),a2
           move.l   a2,a1                *
nxt_el14   move.w   58(a4),d0
           move.w   60(a4),d1
           move.l   a2,a3                * a3 = base of current element
           move.b   (a2),d5              *
           andi.b   #type_mask,d5        *
           cmpi.b   #end,d5              *
           beq.s    edit_ex2             *
           move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           moveq    #0,d2
           move.w   2(a2),d2             d2 = element length
           move.w   d2,d3
           mulu.w   #6,d3
           add.l    d3,a1                
           subi.w   #1,d2
           sub.w    194(a4),d2
rot2       addq.l   #6,a2                move to first coord
           move.w   2(a2),d4             x
           move.w   4(a2),d5             y
           tst.b    136(a4)
           beq      edit_y
           cmpi.b   #1,136(a4)
           beq      edit_x
           cmpi.b   #2,136(a4)
           beq      edit_c
           bra      edit_a
edit_e     move.w   d4,2(a2)             x
           move.w   d5,4(a2)             y
           subi.w   #1,d2
           bne.s    rot2
*
           move.w   194(a4),d2
           beq.s    nolabels
           move.l   a3,a2                a2 = base of element
           move.w   2(a2),d5
           sub.w    d2,d5
           mulu.w   #6,d5
           add.l    d5,a2                a2 = base of labels
           subi.w   #3,d2
           mulu.w   #6,d2                (a2,d2.l) = base of last label
           bsr.s    rot_lab
nolabels   move.l   a1,a2                *
           bra      nxt_el14             *
*
edit_ex2   move.l   350(a4),a2           set a2 to element base
           cmpi.b   #1,136(a4)
           bgt      elements             not mirroring 
           move.w   #36,d3               d3 parameters count
           move.b   #1,137(a4)           global flag
           lea      layswap,a1           a1 pointer to first layer colour
           bsr      layswap1
           move.l   350(a4),a2           restore element base
           bra      elements             print new elements
*
rot_lab    tst.b    136(a4)
           beq      lab_y1
           cmpi.b   #1,136(a4)
           beq.s    lab_x1
           cmpi.b   #2,136(a4)
           beq      lab_c1
           bra      lab_a1
lab_e1     subi.l   #18,d2
           bge.s    rot_lab
           rts                           d2 d3 d6 d7  spare
*
edit_y     sub.w    d0,d4                d0=curx d1=cury d4=cx d5=cy
           exg      d0,d4
           sub.w    d0,d4
           move.w   58(a4),d0
           bra      edit_e
edit_x     sub.w    d1,d5
           exg      d1,d5
           sub.w    d1,d5
           move.w   60(a4),d1
           bra      edit_e
edit_c     sub.w    d0,d4
           sub.w    d1,d5
           sub.w    d4,d1
           add.w    d5,d0
           move.w   d1,d5
           move.w   d0,d4
           move.w   58(a4),d0
           move.w   60(a4),d1
           bra      edit_e
edit_a     sub.w    d0,d4
           sub.w    d1,d5
           add.w    d4,d1
           sub.w    d5,d0
           move.w   d1,d5
           move.w   d0,d4
           move.w   58(a4),d0
           move.w   60(a4),d1
           bra      edit_e
*
lab_dcy1   bsr      fnd_len1             d1 = length
           move.w   16(a2,d2.l),d0
           sub.w    d1,d0
           move.w   d0,16(a2,d2.l)
           bra      lab_e1
*
lab_x1     btst.b   #0,290(a4)           do not mirror labels if schematic
           bne.s    sch_cmp1
           move.b   13(a2,d2.l),d1
           andi.w   #size_mask,d1
           mulu.w   #5,d1
           move.w   14(a2,d2.l),d0
           btst.b   #mbit,13(a2,d2.l)
           bne.s    mirror02
           add.w    d1,d0
           bra.s    mirror03
mirror02   sub.w    d1,d0
mirror03   move.w   d0,14(a2,d2.l)
           btst.b   #obit,13(a2,d2.l)
           bne.s    mirror05
           move.b   13(a2,d2.l),d0       needed to find length
           bsr      fnd_len1             horizontal text   d1 = length
           move.w   14(a2,d2.l),d0
           btst.b   #mbit,13(a2,d2.l)
           bne.s    mirror04
           add.w    d1,d0
           bra.s    mirror05
mirror04   sub.w    d1,d0
mirror05   move.w   d0,14(a2,d2.l)
           move.b   13(a2,d2.l),d0
           bchg.l   #mbit,d0
           move.b   d0,13(a2,d2.l)
sch_cmp1   move.b   13(a2,d2.l),d0
           andi.w   #size_mask,d0
           mulu.w   #5,d0
           move.w   16(a2,d2.l),d1
           add.w    d0,d1
           neg.w    d1
           move.w   d1,16(a2,d2.l)
           move.b   13(a2,d2.l),d0       d0 = ori/size
           btst.l   #obit,d0
           beq      lab_e1
lab_iny1   bsr      fnd_len1             d1 = length
           move.w   16(a2,d2.l),d0
           add.w    d1,d0
           move.w   d0,16(a2,d2.l)
           bra      lab_e1
*
lab_y1     move.b   13(a2,d2.l),d0  
           btst.b   #0,290(a4)           check for schematic
           bne.s    sch_cmp2
           move.w   14(a2,d2.l),d1       if pcb component then simply
           neg.w    d1                   negate x offset and mirror
           move.w   d1,14(a2,d2.l)       text
           bchg.l   #mbit,d0
           move.b   d0,13(a2,d2.l)
           bra      lab_e1  
sch_cmp2   btst.l   #mbit,d0
           bne.s    lab_y2
           andi.w   #size_mask,d0
           mulu.w   #5,d0
           move.w   14(a2,d2.l),d1
           add.w    d0,d1
           neg.w    d1
           move.w   d1,14(a2,d2.l)
           move.b   13(a2,d2.l),d0       d0 = ori/size
           btst.l   #obit,d0
           bne      lab_e1
lab_dcx1   bsr      fnd_len1             d1 = length
           move.w   14(a2,d2.l),d0
           sub.w    d1,d0
           move.w   d0,14(a2,d2.l)
           bra      lab_e1
*
lab_y2     andi.w   #size_mask,d0
           mulu.w   #5,d0
           move.w   14(a2,d2.l),d1
           sub.w    d0,d1
           neg.w    d1
           move.w   d1,14(a2,d2.l)
           move.b   13(a2,d2.l),d0
           btst.l   #obit,d0
           bne      lab_e1
lab_inx1   bsr      fnd_len1
           move.w   14(a2,d2.l),d0
           add.w    d1,d0
           move.w   d0,14(a2,d2.l)
           bra      lab_e1
*
lab_c1     move.b   13(a2,d2.l),d0
           btst.l   #mbit,d0
           bne.s    lab_c2
           andi.w   #size_mask,d0
           mulu.w   #5,d0
           move.w   14(a2,d2.l),d1
           add.w    d0,d1
           neg.w    d1
           move.w   16(a2,d2.l),d0
           move.w   d0,14(a2,d2.l)
           move.w   d1,16(a2,d2.l)
           move.b   13(a2,d2.l),d0
           bchg.l   #obit,d0
           beq      lab_e2
           move.b   d0,13(a2,d2.l)
           bra.s    lab_dcx1
*
lab_c2     andi.w   #size_mask,d0
           mulu.w   #5,d0
           move.w   16(a2,d2.l),d1
           add.w    d0,d1
           move.w   14(a2,d2.l),d0
           neg.w    d0
           move.w   d0,16(a2,d2.l)
           move.w   d1,14(a2,d2.l)
           move.b   13(a2,d2.l),d0
           bchg.l   #obit,d0
           bne.s    lab_e2
           move.b   d0,13(a2,d2.l)
           bra      lab_iny1
*
lab_a1     move.b   13(a2,d2.l),d0
           btst.l   #mbit,d0
           bne.s    lab_a2
           andi.w   #size_mask,d0
           mulu.w   #5,d0
           move.w   16(a2,d2.l),d1
           add.w    d0,d1
           neg.w    d1
           move.w   14(a2,d2.l),d0
           move.w   d0,16(a2,d2.l)
           move.w   d1,14(a2,d2.l)
           move.b   13(a2,d2.l),d0
           bchg.l   #obit,d0
           bne.s    lab_e2
           move.b   d0,13(a2,d2.l)
           bra      lab_iny1
*
lab_a2     andi.w   #size_mask,d0
           mulu.w   #5,d0
           move.w   14(a2,d2.l),d1
           sub.w    d0,d1
           move.w   16(a2,d2.l),d0
           neg.w    d0
           move.w   d0,14(a2,d2.l)
           move.w   d1,16(a2,d2.l)
           move.b   13(a2,d2.l),d0
           bchg.l   #obit,d0
           beq.s    lab_e2
           move.b   d0,13(a2,d2.l)
           bra      lab_inx1
*
lab_e2     move.b   d0,13(a2,d2.l)
           bra      lab_e1
*
fnd_len1   andi.w   #size_mask,d0
           moveq    #0,d1
           move.l   d2,d3
fnd_len2   cmpi.b   #0,(a2,d3.l)
           beq.s    lab_end1
           addi.l   #1,d3
           addi.w   #1,d1
           cmpi.w   #12,d1
           bne.s    fnd_len2
lab_end1   mulu.w   #30,d1
           subi.w   #30,d1
           mulu.w   d0,d1
           asr.w    #2,d1
exit57     rts
*
edit_krump moveq    #0,d0
           lea      par,a4
           move.l   350(a4),a2
nxt_el15   move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #end,d5
           beq      exit57
           move.w   #0,4(a2)             clear library data
           move.w   2(a2),d5             d5 = element length
           mulu.w   #6,d5
           add.l    d5,a2
           bra.s    nxt_el15           
*
prt_logo   lea      logo_data,a2
           lea      par,a4
           move.w   186(a4),d0           d0 = screen width
           move.w   188(a4),d1           d1 = screen height
           cmp.w    d0,d1
           bgt.s    wgth
           move.w   d1,d0                d0 = smallest
wgth       move.w   #0,d1
selscale   move.w   #3200,d3             logo is 3200x3200
           lsr.w    d1,d3
           cmp.w    d3,d0
           bgt.s    setscale
           addi.w   #1,d1
           bra.s    selscale
setscale   move.b   d1,10(a4)            set scale
           move.b   #0,11(a4)
           move.l   #0,58(a4)            x and y cursor = 0
           move.l   a2,26(a4)            set file start
           move.b   #1,196(a4)           set logo mode
           bsr      update2              do it
           move.b   #0,196(a4)           normal mode
           move.l   #0,a2
           move.l   158(a4),a0           channel id          
           cmpi.w   #8,258(a4)
           beq.s    ismde8
           lea.l    padding,a1
           move.w   ut.mtext,a2
           jsr      (a2)
ismde8     lea.l    message,a1
           move.w   ut.mtext,a2
           jsr      (a2)
           moveq    #0,d0
           rts
padding    dc.w     16
           dc.b     '                '
*
fstat      lea      par,a4
           moveq    #0,d4
           move.w   488(a4),d4
           bra      int_ret
*
accesserr  move.w   d0,488(a4)
           moveq    #io.close,d0
           trap     #2
           moveq    #0,d0
           rts
*
bmpfile    moveq    #0,d1                move pointer to start of file
           moveq    #fs.posab,d0
           move.w   #-1,d3               timeout
           trap     #3
           tst.w    d0
           bne.s    accesserr
           moveq    #32,d2               buffer length
           bsr      fill_buff
           moveq    #-19,d0
           moveq    #0,d4
           move.b   28(a1),d4            d4 = bits per pixel
           move.b   d4,481(a4)
           cmpi.b   #8,d4
           bgt.s    accesserr            24 bit image 
           moveq    #8,d5
           divu     d4,d5
           move.b   19(a1),490(a4)       msb
           move.b   18(a1),491(a4)       lsb
           move.b   23(a1),492(a4)       msb
           move.b   22(a1),493(a4)       lsb
           move.w   490(a4),d4
           subq.l   #1,d4
           divu     d5,d4
           lsr.w    #2,d4
           addq.l   #1,d4
           lsl.w    #2,d4                d4 = bytes per line
           move.w   d4,494(a4)
           moveq    #0,d1
           move.b   11(a1),d1
           lsl.w    #8,d1
           move.b   10(a1),d1            d1 = start of image
           moveq    #fs.posab,d0
           move.w   #-1,d3               timeout
           trap     #3
           tst.w    d0
           bne.s    accesserr  
           move.l   a2,a3                a3 = file start
           moveq    #1,d7                d7=element length
           move.w   #$3000,(a2)+         block element
           move.w   #0,(a2)+
           move.w   #1,(a2)+             library part
           move.w   #0,498(a4)           clear y           
bmp1       move.w   #0,496(a4)           clear x
           bclr.b   #1,500(a4)           clear old pixel
           move.w   #1,502(a4)           set b = 1
bmp2       moveq    #io.fbyte,d0
           moveq    #100,d3              timeout
           trap     #3
           tst.w    d0
           bne      accesserr 
           moveq    #7,d4                d4 = bit
bmp3       move.w   490(a4),d5           w
           cmp.w    496(a4),d5           x
           bgt.s    nopad
           move.b   #$ff,d1              normal video
           tst.b    501(a4)
           beq.s    nopad
           moveq    #0,d1                inverted video
nopad      moveq    #0,d5                d5 = n
           bset.b   #0,500(a4)           normal video
           tst.b    501(a4)
           beq.s    bmp4
           bclr.b   #0,500(a4)           inverted video
bmp4       move.w   d4,d6
           sub.w    d5,d6
           btst     d6,d1
           beq.s    nopixel
           bclr.b   #0,500(a4)           normal video
           tst.b    501(a4)
           beq.s    nopixel
           bset.b   #0,500(a4)           inverted video
nopixel    addi.w   #1,d5
           cmp.b    481(a4),d5
           bne.s    bmp4
           cmpi.b   #1,500(a4)
           bne.s    chkend
           move.w   496(a4),d6
           mulu.w   486(a4),d6
           move.w   d6,504(a4)
           move.w   498(a4),d6
           mulu.w   486(a4),d6
           move.w   d6,506(a4)
           bra.s    blkstart
chkend     cmpi.b   #2,500(a4)
           bne.s    blkstart
           bsr      plotblk
           move.l   a2,d2
           addi.l   #30,d2
           cmp.l    198(a4),d2           compare with file top
           bge      overun
blkstart   btst.b   #0,500(a4)
           beq.s    npzero
           bset.b   #1,500(a4)
           bra.s    npnzero
npzero     bclr.b   #1,500(a4)
npnzero    addi.w   #1,496(a4)           x=x+1
           moveq    #0,d6
           move.b   481(a4),d6           d6=bits
           sub.w    d6,d4
           bge      bmp3
           addi.w   #1,502(a4)           b=b+1
           move.w   502(a4),d6           d6=b
           cmp.w    494(a4),d6
           ble      bmp2
           btst.b   #1,500(a4)
           beq.s    opzero
           bsr      plotblk
opzero     addi.w   #1,498(a4)
           move.w   492(a4),d6
           cmp.w    498(a4),d6
           bne      bmp1
           move.l   #$ffffffff,(a2)+
           move.w   #$ffff,(a2)+   
*
           move.l   a3,a2
           move.l   d7,d5
optimiz    moveq    #1,d3
           moveq    #6,d1
bmp5       move.l   d1,d2
           addi.l   #12,d2
bmp6       tst.b    (a2,d1.l)
           beq.s    nodel
           tst.b    (a2,d2.l)
           beq.s    nodel
           move.w   2(a2,d1.l),d0
           cmp.w    2(a2,d2.l),d0
           bne.s    nodel
           move.w   8(a2,d1.l),d0
           cmp.w    8(a2,d2.l),d0
           bne.s    nodel
           move.w   10(a2,d1.l),d0
           cmp.w    4(a2,d2.l),d0
           bne.s    nodel
           move.w   10(a2,d2.l),d0
           move.w   d0,10(a2,d1.l)       extend block size
           move.b   #0,(a2,d2.l)         mark for deletion
           moveq    #0,d3
nodel      addi.l   #12,d2
           move.l   d7,d6
           mulu.w   #6,d6
           cmp.l    d2,d6
           bne.s    bmp6
           addi.l   #12,d1
           subi.l   #12,d6
           cmp.l    d1,d6
           bne.s    bmp5
           tst.b    d3
           beq.s    optimiz
           moveq    #6,d1
           move.l   d1,d2
bmp7       tst.b    (a2,d2.l)            check layer
           beq.s    nolaychk
           move.l   (a2,d2.l),(a2,d1.l)
           move.l   4(a2,d2.l),4(a2,d1.l)
           move.l   8(a2,d2.l),8(a2,d1.l)
           addi.l   #12,d1
           bra.s    laychked
nolaychk   subi.l   #2,d5                reduce element length
laychked   addi.l   #12,d2
           move.l   d7,d6
           mulu.w   #6,d6
           cmp.l    d2,d6
           bne.s    bmp7 
           cmpi.l   #32767,d5
           bgt.s    overun  
           move.w   d5,2(a3)             element length
           move.l   #$ffffffff,(a2,d1.l)
           move.w   #$ffff,4(a2,d1.l)
           bra      closechn               
*
plotblk    move.w   #$0200,(a2)+         layer and size
           move.l   504(a4),(a2)+
           move.w   #$0200,(a2)+         layer and size
           move.w   496(a4),d6
           mulu.w   486(a4),d6
           move.w   d6,(a2)+
           move.w   498(a4),d6
           mulu.w   486(a4),d6
           add.w    486(a4),d6
           move.w   d6,(a2)+
           addi.l   #2,d7                increase element length
           rts
*
overun     move.l   #$ffffffff,(a3)+
           move.w   #$ffff,(a3)+
           bra      closechn
*
newpads    dc.w     10,12,14,16,20,24,30,69
           dc.w     70,71,72,76,80,129,40,52,129
*
store      dc.l     0,0,0,0,0,0,0,0
           dc.l     0,0,0,0,0,0,0,0
*
fill_buff  lea      store,a1
           moveq    #io.fstrg,d0
           moveq    #100,d3
           trap     #3
           tst.w    d0
           bne      exit58
           lea      store,a1
           rts
*
cad_load   move.w   ca.gtstr,a0
           jsr      (a0)
           bne      exit58
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne      exit58
           lea      par,a4
           move.w   #0,488(a4)           clear error flag
*
           lea      store,a0
           move.w   (a6,a1.l),d1         d1 = string length
*
           move.w   d1,(a0)+
           addq.l   #2,a1
fle_lp1    move.b   (a6,a1.l),(a0)+
           addq.l   #1,a1
           subi.w   #1,d1
           bne.s    fle_lp1
           lea      store,a0
*
           moveq    #io.open,d0
           moveq    #-1,d1               job id
           moveq    #1,d3                old exclusive file
           trap     #2                   open channel
           tst.w    d0
           beq.s    chnopened
           move.w   d0,488(a4)
           moveq    #0,d0
           rts
*                                        a0 = channel id
chnopened  lea      store,a1
           moveq    #fs.headr,d0
           moveq    #64,d2               buffer length
           moveq    #100,d3
           trap     #3                   get header details
           tst.w    d0
           bne      accesserr
           lea      store,a1
           move.l   (a1),d1              d1 = new file length
           move.l   d1,162(a4)           store new file length
*
           moveq    #5,d2                buffer length           
           bsr      fill_buff
           move.l   26(a4),a2            start of file
           move.b   #0,265(a4)           clear append flag
*
           move.b   (a2),d5
           andi.b   #type_mask,d5        d5 = type
           cmpi.b   #end,d5
           beq.s    no_file              no file loaded
           cmpi.b   #inf,d5
           bne.s    no_inf1
           move.w   2(a2),d5
           mulu.w   #6,d5                d5 = header length in bytes
           move.b   (a2,d5.l),d5         d5 = type of next element
           andi.b   #type_mask,d5
           cmpi.b   #end,d5
           beq.s    no_file              was just header
*
no_inf1    move.b   #1,265(a4)           set append flag
           move.l   76(a4),a2            load address
no_file    move.l   162(a4),d1           new file length
           cmpi.w   #'BM',(a1)
           beq      bmpfile              is a bit map file
           moveq    #0,d0                check format version
           move.b   (a1),d0
           btst.l   #6,d0
           beq      new_format           is already new format
           move.b   #0,474(a4)           clear version 1 format flag
           divu     #5,d1
           mulu     #6,d1                new file length after conversion
           add.l    a2,d1                new end of file
           addi.l   #8192,d1             spare space for library
           cmp.l    198(a4),d1           check for overflow
           bgt      oom_err
           bra.s    srt_conv             buffer already loaded
*
nxt_el16   moveq    #5,d2                buffer length
           bsr      fill_buff
srt_conv   cmpi.b   #$ff,(a1)
           beq      fin_conv
*
           move.b   (a1)+,d5             type
           moveq    #0,d7
           andi.b   #$df,d5
           cmpi.b   #'T',d5
           bne.s    nt_trk
           moveq    #trk,d5
nt_trk     cmpi.b   #'W',d5
           bne.s    nt_txt
           moveq    #wrd,d5
nt_txt     cmpi.b   #'P',d5
           bne.s    nt_blk
           moveq    #pad,d5
nt_blk     cmpi.b   #'B',d5
           bne.s    type_chg
           moveq    #blk,d5
type_chg   move.b   d5,(a2)+
*
           moveq    #0,d4
           move.b   (a1)+,d4             size
           subi.b   #48,d4
*
           move.w   #0,102(a4)
           btst.l   #7,d4
           beq.s    not_eixlab
           andi.w   #$ff7f,d4           
           move.b   #1,474(a4)           version 1
           bra.s    has_lab
not_eixlab tst.b    474(a4)
           bne.s    no_lab
           btst.b   #7,2(a1)
           beq.s    no_lab 
           bclr.b   #7,2(a1)   
has_lab    move.w   #3,d7
           move.b   1(a1),102(a4)
           move.b   2(a1),103(a4)
*
no_lab     cmpi.b   #pad,d5
           bne.s    no_chg
           lsl.w    #1,d4
           lea      newpads,a3
           move.w   (a3,d4.w),d4
*
no_chg     move.w   d7,d5                d7 = 3
           andi.w   #2,d5                d5 = 2
           move.b   d7,(a2)+
*
nt_lab4    moveq    #0,d6                length
           move.b   (a1)+,d6
           add.w    d5,d6                add 2 if library label present
           move.w   d6,(a2)+
           sub.w    d7,d6                sub 3 if library to restore old length
*
           move.b   (a1)+,1(a2)          library
           move.b   (a1)+,(a2)+
           addq.l   #1,a2
           andi.w   #lib_mask,-2(a2)     make sure component flag is off
*
next_c2    subi.b   #1,d6
           beq.s    end_conv
           moveq    #5,d2                buffer length
           bsr      fill_buff
*
           move.b   (a1)+,(a2)+          layer
           move.b   d4,(a2)+             size
           move.b   (a1)+,1(a2)          x
           move.b   (a1)+,(a2)+          coordinates
           addq.l   #1,a2
           move.b   (a1)+,1(a2)          y
           move.b   (a1)+,(a2)+
           addq.l   #1,a2
*
           cmp.l    198(a4),a2           compare with file top
           blt.s    next_c2
           bra.s    overrun
*
end_conv   tst.b    d7
           beq      nxt_el16
           moveq    #5,d2                buffer length
           bsr      fill_buff
*
           tst.w    102(a4)
           beq.s    nt_lab2
           move.w   102(a4),(a2)+
nt_lab2    bsr.s    chg_term             *
           bsr.s    chg_term             *
           bsr.s    chg_term             *
           bsr.s    chg_term             * netlist
           bsr.s    chg_term             *
           move.b   #0,(a2)+             *
           tst.w    102(a4)
           bne.s    nt_lab3
           move.w   #0,(a2)+
nt_lab3    move.l   #0,(a2)+
*
           move.b   #$82,(a2)+           layer 2 mode off
           move.b   #$02,(a2)+           size 8 horizontal
           move.w   204(a4),(a2)+        x offset
           move.w   206(a4),(a2)+        y offset
           cmp.l    198(a4),a2           compare with file top
           blt      nxt_el16
overrun    moveq    #io.close,d0         close
           trap     #2                   channel
           bra      fileerr
*
fin_conv   move.l   #$ffffffff,(a2)+     trailer
           move.w   #$ffff,(a2)
           bra.s    closechn
*
chg_term   move.b   (a1)+,d5
           cmpi.b   #$20,d5
           bne.s    nt_spce
           move.b   #0,(a2)+
           rts
nt_spce    move.b   d5,(a2)+
           rts
*
oom_err    move.w   #-3,488(a4)          out of memory flag
           moveq    #io.close,d0         close
           trap     #2                   channel
exit58     rts
*
new_format add.l    a2,d1                new end of file
           addi.l   #1024,d1             spare space
           cmp.l    198(a4),d1           check for overflow
           bgt.s    oom_err
*
           moveq    #fs.posab,d0         set file pointer
           moveq    #0,d1                pointer to start
           moveq    #100,d3              timeout
           trap     #3
*
           move.l   a2,a1                a1 = load address
           moveq    #fs.load,d0          load file
           move.w   #-1,d3               timeout
           move.l   162(a4),d2           file_length
           trap     #3
           tst.w    d0
           bne.s    exit58
*
closechn   moveq    #io.close,d0
           trap     #2
*
           move.l   26(a4),a2            start of file
           tst.b    265(a4)
           beq.s    not_app              file not appended
           move.l   76(a4),a2            simple file check
not_app    move.l   a2,a0
filechk    cmpi.b   #$ff,(a0)
           beq.s    formatchk
           move.w   2(a0),d5
           beq.s    fileerr              zero length element
           mulu.w   #6,d5
           adda.l   d5,a0
           cmp.l    198(a4),a0           compare with file top
           blt.s    filechk
fileerr    move.w   #-1,488(a4)          not complete error
           move.l   #$ffffffff,(a2)+     clean up file
           move.w   #$ffff,(a2)
           rts
*
formatchk  move.b   #0,381(a4)           clear flags
           cmpi.b   #inf,(a2)            look for info block
           beq.s    is_inf1
           move.b   #7,381(a4)           no information file
           bsr      upd_lab1
           bra.s    updfile1
is_inf1    cmpi.b   #3,4(a2)
           bgt.s    new_lab1
           bsr      upd_lab1
new_lab1   cmpi.b   #2,4(a2)
           bne.s    cleanup              must be newer than version 2
           bset.b   #1,381(a4)           change invisible layer
           bset.b   #2,381(a4)           move via bits
           tst.b    30(a2)               check update flags
           bne.s    updfile1
           bset.b   #0,381(a4)           exchange layers 2,11 and 6,10
updfile1   move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d5              d5 = type
           andi.b   #type_mask,d5
           cmpi.b   #pad,d5
           beq.s    t_p_w_b5
           cmpi.b   #trk,d5
           beq.s    t_p_w_b5
           cmpi.b   #wrd,d5
           beq.s    t_p_w_b5
           cmpi.b   #blk,d5
           beq.s    t_p_w_b5
           cmpi.b   #end,d5
           beq.s    cleanup
           moveq    #0,d5
           move.w   2(a2),d5
           mulu.w   #6,d5
           adda.l   d5,a2
           bra.s    updfile1
cleanup    move.l   26(a4),a2
           move.b   (a2),d5
           andi.b   #type_mask,d5        d5 = type
           cmpi.b   #end,d5
           beq.s    fle_fin5
           move.w   2(a2),d6             d6 = element length
           mulu.w   #6,d6
           add.l    d6,a2                skip first element
           move.l   a2,a1
nxt_el26   move.w   2(a2),d6             d6 = element length
           mulu.w   #6,d6                d6 = element length in bytes
           move.b   (a2),d5
           andi.b   #type_mask,d5        d5 = type
           cmpi.b   #end,d5
           beq.s    fle_fin6
           cmpi.b   #inf,d5
           beq.s    rmv_inf
mve_el2    move.w   (a2)+,(a1)+
           subi.l   #2,d6
           bne.s    mve_el2           
           bra.s    nxt_el26
rmv_inf    add.l    d6,a2
           bra.s    nxt_el26
fle_fin6   move.l   #$ffffffff,(a1)+
           move.w   #$ffff,(a1)
fle_fin5   rts
t_p_w_b5   move.w   2(a2),d5             d5 = element length
           sub.w    194(a4),d5
nxt_coor5  addq.l   #6,a2                base to next coord
*
           move.b   (a2),d1              layer and via size
           move.b   d1,d2
           andi.b   #$1f,d1              d1=layer
           andi.b   #$60,d2              d2=via size
           btst.b   #2,381(a4)
           beq.s    via_ok
           lsl.b    #1,d2                new via size bits
via_ok     btst.b   #1,381(a4)
           beq.s    inv_ok1
           cmpi.b   #16,d1               
           bne.s    inv_ok1  
           move.b   #inv_lay,d1          new invisible layer
inv_ok1    btst.b   #0,381(a4)
           beq.s    lay_ok1
           cmpi.b   #2,d1
           bne.s    nt_lay2
           move.b   #11,d1
           bra.s    lay_ok1
nt_lay2    cmpi.b   #11,d1
           bne.s    nt_lay11
           move.b   #2,d1
           bra.s    lay_ok1   
nt_lay11   cmpi.b   #6,d1
           bne.s    nt_lay6
           move.b   #10,d1
           bra.s    lay_ok1
nt_lay6    cmpi.b   #10,d1
           bne.s    lay_ok1
           move.b   #6,d1
lay_ok1    move.b   d1,(a2)              set layer
           or.b     d2,(a2)              set via size
*
           subi.w   #1,d5
           cmpi.w   #1,d5
           bne.s    nxt_coor5
*
           addq.l   #6,a2                move to first label or next element
           move.w   194(a4),d0           number of labels
           beq      updfile1             no labels
*
nxt_lab1   move.b   12(a2),d1            label layer
           move.b   d1,d2
           andi.b   #$1f,d1              d1=layer
           andi.b   #$80,d2              d2=display switch
           btst.b   #1,381(a4)
           beq.s    inv_ok2              don't change invisible layer
           cmpi.b   #16,d1               
           bne.s    inv_ok2  
           move.b   #inv_lay,d1          new invisible layer
inv_ok2    btst.b   #0,381(a4)
           beq.s    lay_ok2
           cmpi.b   #2,d1
           bne.s    nt_ly2
           move.b   #11,d1
           bra.s    lay_ok2
nt_ly2     cmpi.b   #11,d1
           bne.s    nt_ly11
           move.b   #2,d1
           bra.s    lay_ok2   
nt_ly11    cmpi.b   #6,d1
           bne.s    nt_ly6
           move.b   #10,d1
           bra.s    lay_ok2
nt_ly6     cmpi.b   #10,d1
           bne.s    lay_ok2
           move.b   #6,d1
*
lay_ok2    move.b   d1,12(a2)            set layer
           or.b     d2,12(a2)            set display switch 
           addq.l   #6,a2                                     
           addq.l   #6,a2
           addq.l   #6,a2                move to next label or next element
           subi.w   #3,d0
           bgt.s    nxt_lab1
           bra      updfile1         
*
upd_lab1   move.l   a2,a1
nxt_el25   move.b   (a1),d3
           andi.b   #type_mask,d3
           cmpi.b   #end,d3
           beq.s    eof3
           bsr.s    upd_labels
           move.w   2(a1),d3
           mulu.w   #6,d3
           adda.l   d3,a1
           bra.s    nxt_el25
eof3       rts
upd_labels move.w   (a1),d4              label length
           andi.w   #lab_mask,d4
           beq.s    exit59               no labels
           move.l   a1,a3
           move.w   2(a3),d5             d5 = element length
           sub.w    d4,d5
           mulu.w   #6,d5
           add.l    d5,a3                a3 = base of labels
updtxt     move.b   13(a3),d5
           lsl.b    #2,d5   
           move.b   d5,13(a3)
           andi.b   #size_mask,d5
           bne.s    has_size
           bset.b   #2,13(a3)
has_size   addq.l   #6,a3
           addq.l   #6,a3
           addq.l   #6,a3
           subi.w   #3,d4
           bgt.s    updtxt  
exit59     rts              
*
page_sze   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit59
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit59
           lea      par,a4
           moveq    #0,d1
           move.b   3(a6,a1.l),d1
           beq.s    wscr
           cmpi.b   #1,d1
           bne.s    not_hscr
           move.w   188(a4),d4           d4 = screen height
           bra      int_ret2
not_hscr   subi.b   #2,d1                zero d1
           lsl.w    #1,d1
           add.l    d1,a4
           move.w   300(a4),d4
           bra      int_ret2
wscr       move.w   186(a4),d4           d4 = screen width
           bra      int_ret2
*
moden      move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit60
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit60
           moveq    #0,d1
           moveq    #0,d4
           move.b   3(a6,a1.l),d1
           lea      par,a4
           move.b   d1,263(a4)
           move.w   300(a4),d0           d0 = window width
           muls     302(a4),d0           window height
           asr.l    #2,d0
           tst.b    d1                   check for hi colour
           beq.s    not_hi_col
           asl.l    #3,d0                hi colour needs 8 times more memory
not_hi_col move.l   d0,190(a4)           store screen size
           moveq    #mt.inf,d0
           trap     #1
           btst.b   #3,$34(a0)
           bne.s    mode_8
           move.w   300(a4),296(a4)
           move.w   #4,d4
           move.w   d4,258(a4)
           bra      int_ret2
mode_8     move.w   300(a4),d0
           lsr.w    #1,d0
           move.w   d0,296(a4)
           move.w   #8,d4
           move.w   d4,258(a4)
           bra      int_ret2
exit60     rts
*
mousebt    lea      par,a4
           moveq    #0,d4
           tst.b    135(a4)
           beq      int_ret              no qptr present
           moveq    #mt.inf,d0
           trap     #1                   a0 = system variables
           move.l   $78(a0),a0           a0 = base of channel table
           move.l   (a0),a0              a0 = channel definition block
           move.l   4(a0),a0             a0 = driver linkage address
           moveq    #0,d4
           move.b   289(a4),d4           d4 = stored toggle
           move.b   $33(a0),d1           d1 = new state
           bne.s    button_on
*
           tst.b    d4                   check toggle
           beq      int_ret              both buttons and toggle off
           neg.w    d4
           move.b   #0,289(a4)           set toggle off
           bra      int_ret              button is off
button_on  tst.b    d4                   check toggle
           bne.s    still_on
           move.b   d1,289(a4)           set toggle to new state
           move.b   d1,d4                return new state
           bra      int_ret
still_on   add.b    #2,d4
           bra      int_ret
*
lib_set    move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit62
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit62
           moveq    #0,d0
           move.b   3(a6,a1.l),d0
           lea      par,a4
           move.b   d0,170(a4)
           moveq    #0,d0
exit62     rts
*
tp_size    move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit62
           moveq    #-15,d0
           cmpi.w   #3,d3
           bne.s    exit62
           moveq    #0,d0
           moveq    #0,d2
           moveq    #0,d3
           move.b   7(a6,a1.l),d2
           move.b   11(a6,a1.l),d3
           move.b   3(a6,a1.l),d4
           beq.s    tr_type
           cmpi.w   #130,d2              pad size limits
           bge.s    exit62
           cmpi.w   #130,d3
           bge.s    exit62
           bra.s    pa_type
tr_type    cmpi.w   #64,d2               track size limits
           bge.s    exit62
           cmpi.w   #64,d3
           bge.s    exit62
pa_type    lea      par,a4
           bsr      do
           move.l   26(a4),a2            a2 = start of art file
nxt_el17   move.w   (a2),194(a4)
           andi.w   #lab_mask,194(a4)
           move.b   (a2),d5
           andi.b   #type_mask,d5
           move.w   2(a2),d1             d1 = element length
           sub.w    194(a4),d1
           cmpi.b   #pad,d5
           beq.s    p_size
           cmpi.b   #trk,d5
           beq.s    t_size
           cmpi.b   #wrd,d5
           beq.s    bw_size
           cmpi.b   #blk,d5
           beq.s    bw_size
           cmpi.b   #end,d5
           beq      redraw
bw_size    moveq    #0,d5
           move.w   2(a2),d5
           mulu.w   #6,d5
           adda.l   d5,a2
           bra.s    nxt_el17
*
t_size     cmpi.b   #0,d4
           bne.s    bw_size
           bra.s    exg_size
p_size     cmpi.b   #1,d4
           bne.s    bw_size
exg_size   addq.l   #6,a2                a2 = addr of first coord
           subi.w   #1,d1
           beq.s    end_exg
           cmp.b    1(a2),d2
           bne.s    exg_size
           move.b   d3,1(a2)
           bra.s    exg_size
end_exg    move.w   194(a4),d5
           mulu.w   #6,d5
           add.l    d5,a2
           bra      nxt_el17
*
new_label  bsr      segment1
           move.l   72(a4),a2
           moveq    #0,d5
           move.w   (a2),d5
           andi.w   #lab_mask,d5
           move.w   2(a2),d4
           addi.w   #3,d4
           addi.w   #3,d5
           andi.b   #type_mask,(a2)
           move.b   #0,1(a2)
           or.w     d5,(a2)
           move.w   d4,2(a2)
           subi.w   #3,d4
           mulu.w   #6,d4
           add.l    d4,a2
           move.w   252(a4),d0           d0 = orientation
           move.l   #0,(a2)
           move.l   #0,4(a2)             clear text
           move.l   #0,8(a2)               "     "
           move.w   238(a4),12(a2)       set layer/size
           move.w   254(a4),d1           x offset
           move.w   256(a4),d2           y offset
           tst.w    d0
           beq.s    ori_h6
           addi.w   #lab_vert,d1         move x offset left
           bra.s    ori_v6
ori_h6     subi.w   #lab_vert,d2         move y offset down
ori_v6     move.w   d1,14(a2)            set x offset
           move.w   d2,16(a2)            set y offset
           or.w     d0,12(a2)            set orientation bit 4
           add.l    #18,a2
           move.l   a2,76(a4)
           move.l   #$ffffffff,(a2)+
           move.w   #$ffff,(a2)
           move.w   372(a4),374(a4)
           divu     #3,d5
           subi.w   #1,d5
           move.w   d5,372(a4)
           bra.s    swp_lab
*
swop_label move.w   372(a4),374(a4)      old label edit
           move.w   d0,372(a4)           new label edit
           bsr      segment1             remove element
swp_lab    move.l   72(a4),a2
           move.w   2(a2),d4
           moveq    #0,d5
           move.w   (a2),d5
           andi.w   #lab_mask,d5
           sub.w    d5,d4
           mulu.w   #6,d4
           add.l    d4,a2                a2 = base of labels
           move.w   372(a4),d1
           move.w   374(a4),d2
           mulu.w   #18,d1
           mulu.w   #18,d2
*
           move.l   14(a2,d1.l),254(a4)  save x y offsets for new label
*          
           moveq    #12,d0   
           tst.w    374(a4)
           bne.s    lab_lp1
           moveq    #10,d0
lab_lp1    cmpi.b   #1,(a2,d2.l)
           bne.s    is_chr1
           move.b   #0,(a2,d2.l)
is_chr1    addi.l   #1,d2
           subi.w   #1,d0
           bne.s    lab_lp1
*
           moveq    #12,d0 
           tst.w    372(a4)
           bne.s    lab_lp2
           moveq    #10,d0
lab_lp2    cmpi.b   #0,(a2,d1.l)
           bne.s    is_chr2
           move.b   #1,(a2,d1.l)
is_chr2    addi.l   #1,d1
           subi.w   #1,d0
           bne.s    lab_lp2
*
           move.l   72(a4),a2
           bra      segment1
*
set_label  lea      par,a4
           move.l   72(a4),a2
           move.l   (a6,a1.l),d0
           bge      swop_label           if negative then set label
           cmpi.l   #-2,d0
           beq      new_label
           bsr      segment1
           move.l   72(a4),a2
           move.l   a2,a1
           moveq    #0,d5
           move.w   (a2),d5
           andi.w   #lab_mask,d5
           move.w   2(a2),d4             d4 = element length
           sub.w    d5,d4
           mulu.w   #6,d4
           add.l    d4,a1                a1 = base of labels
           cmpi.w   #18,d5
           bge      has_all
           move.b   #18,1(a2)            installing all blocks
           tst.w    d5
           bne.s    has_ref1
           addi.w   #3,2(a2)             increase length
           move.l   #0,(a1)
           move.l   #0,4(a1)
           move.l   #0,8(a1)
           move.w   #0,12(a1)            clear orientation bit 4
*
has_ref1   cmpi.w   #3,d5
           bgt.s    has_typ1
           addi.w   #3,2(a2)             increase length
           move.l   #0,18(a1)
           move.l   #0,22(a1)
           move.l   #0,26(a1)
*
has_typ1   cmpi.w   #6,d5
           bgt.s    has_mod1
           addi.w   #3,2(a2)             increase length
           move.l   #0,36(a1)
           move.l   #0,40(a1)
           move.l   #0,44(a1)
*
has_mod1   cmpi.w   #9,d5
           bgt.s    has_fpr1
           addi.w   #3,2(a2)             increase length
           move.l   #0,54(a1)
           move.l   #0,58(a1)
           move.l   #0,62(a1)
*
has_fpr1   cmpi.w   #12,d5
           bgt.s    has_sup1
           addi.w   #3,2(a2)             increase length
           move.l   #0,72(a1)
           move.l   #0,76(a1)
           move.l   #0,80(a1)
*
has_sup1   addi.w   #3,2(a2)             increase length
           move.l   #0,90(a1)
           move.l   #0,94(a1)
           move.l   #0,98(a1)
*
           move.l   #$ffffffff,108(a1)
           move.w   #$ffff,112(a1)
           move.l   a1,a0
           add.l    #108,a0
           move.l   a0,76(a4)            new end of file
*
has_all    move.w   12(a1),d0
           andi.w   #$10,d0              mask out orientation
           move.w   d0,252(a4)           store orientation for new labels
*
           tst.b    (a1)
           bne.s    has_ref2
           move.w   202(a4),12(a1)       reference id layer/size
           move.l   204(a4),d1
           tst.w    d0
           beq.s    ori_h
           swap     d1                   swap offsets
ori_h      move.l   d1,14(a1)            reference id x y offsets
           or.w     d0,12(a1)
*
has_ref2   tst.b    18(a1)
           bne.s    has_typ2
           move.w   208(a4),30(a1)       type/value layer/size
           move.l   210(a4),d1
           tst.w    d0
           beq.s    ori_h1
           swap     d1                   swap offsets
ori_h1     move.l   d1,32(a1)            type/value x y offsets
           or.w     d0,30(a1)            set orientation
*
has_typ2   tst.b    36(a1)
           bne.s    has_mod2
           move.w   214(a4),48(a1)       modifier layer/size
           move.l   216(a4),d1
           tst.w    d0
           beq.s    ori_h2
           swap     d1                   swap offsets
ori_h2     move.l   d1,50(a1)            modifier x y offsets
           or.w     d0,48(a1)            set orientation
*
has_mod2   tst.b    54(a1)
           bne.s    has_fpr2
           move.w   220(a4),66(a1)       footprint layer/size
           move.l   222(a4),d1
           tst.w    d0
           beq.s    ori_h3
           swap     d1                   swap offsets
ori_h3     move.l   d1,68(a1)            footprint x y offsets
           or.w     d0,66(a1)            set orientation
*
has_fpr2   tst.b    72(a1)
           bne.s    has_sup2
           move.w   226(a4),84(a1)       supplier layer/size
           move.l   228(a4),d1
           tst.w    d0
           beq.s    ori_h4
           swap     d1                   swap offsets
ori_h4     move.l   d1,86(a1)            supplier x y offsets
           or.w     d0,84(a1)            set orientation
*
has_sup2   tst.b    90(a1)
           bne.s    has_all2
           move.w   232(a4),102(a1)      stock number layer/size
           move.l   234(a4),d1
           tst.w    d0
           beq.s    ori_h5
           swap     d1                   swap offsets
ori_h5     move.l   d1,104(a1)           stock number x y offsets
           or.w     d0,102(a1)           set orientation
*
has_all2   move.b   12(a1),244(a4)       save reference id on/off flag
           move.b   30(a1),245(a4)       save type/value   on/off flag
           move.b   48(a1),246(a4)       save modifier     on/off flag
           move.b   66(a1),247(a4)       save footprint    on/off flag
           move.b   84(a1),248(a4)       save supplier     on/off flag
           move.b   102(a1),249(a4)      save stock number on/off flag
           andi.b   #lsw_mask,244(a4)
           andi.b   #lsw_mask,245(a4)
           andi.b   #lsw_mask,246(a4)
           andi.b   #lsw_mask,247(a4)
           andi.b   #lsw_mask,248(a4)
           andi.b   #lsw_mask,249(a4)
           andi.b   #nlsw_mask,12(a1)    switch on reference id label
           andi.b   #nlsw_mask,30(a1)    switch on type/value   label
           andi.b   #nlsw_mask,48(a1)    switch on modifier     label
           andi.b   #nlsw_mask,66(a1)    switch on footprint    label
           andi.b   #nlsw_mask,84(a1)    switch on supplier     label
           andi.b   #nlsw_mask,102(a1)   switch on stock number label
           bra      segment1
*
clr_label  lea      par,a4
           move.l   72(a4),a2
           bsr      segment1
           move.l   72(a4),a2
           move.l   a2,a1
           moveq    #0,d5
           move.w   (a1),d5
           andi.w   #lab_mask,d5
           move.w   2(a2),d4             d4 = element length
           sub.w    d5,d4
           mulu.w   #6,d4
           add.l    d4,a1                a1 = base of labels
*
           moveq    #12,d0               d0 = label string length
           move.w   372(a4),d1 
           bne.s    ntrefid1
           moveq    #10,d0               d0 ref id string length
ntrefid1   mulu.w   #18,d1
lab_lp5    cmpi.b   #1,(a1,d1.l)
           bne.s    is_chr5
           move.b   #0,(a1,d1.l)
is_chr5    addi.l   #1,d1
           subi.w   #1,d0
           bne.s    lab_lp5
*
           move.w   #12,d1
           move.l   #244,d2
set_layer  andi.b   #nlsw_mask,(a1,d1.w) clear layer on/off bit
           move.b   (a4,d2.w),d0
           andi.b   #lsw_mask,d0
           or.b     d0,(a1,d1.w)         set layer on/off bit
           addi.w   #18,d1
           addi.w   #1,d2
           cmpi.w   #250,d2
           bne.s    set_layer
*
           cmpi.w   #18,d5
           ble.s    no_gen_lb
           bsr.s    clr_labs
           cmpi.w   #18,d5
           bgt.s    clr_exit
*
no_gen_lb  tst.b    90(a1)
           bne.s    clr_exit             has all blocks
           subi.w   #3,2(a2)             reduce length
           subi.w   #3,d5
*
           move.l   #72,d1
red_len    cmpi.b   #0,(a1,d1.w)
           bne.s    clr_set
           subi.w   #3,2(a2)             reduce length
           subi.w   #3,d5
           subi.w   #18,d1
           bge.s    red_len
           moveq    #0,d5
*
clr_set    andi.b   #type_mask,(a2)      clear label count
           move.b   #0,1(a2)               "     "     "
           or.w     d5,(a2)              new label count
           mulu.w   #6,d5
           add.l    d5,a1
           move.l   a1,76(a4)
           move.l   #$ffffffff,(a1)+
           move.w   #$ffff,(a1)+
clr_exit   bra      segment1
*
*
clr_labs   move.l   a1,a0                find nul label strings and remove
           move.l   a1,a3                a0 and a3 = base of labels
           add.l    #108,a0              a0 and a3 = base of general labels
           add.l    #108,a3
fnd_emp1   tst.b    (a0)
           beq.s    emp_str1
           cmpi.b   #$ff,(a0)
           beq.s    fin_str1
           add.l    #18,a0
           add.l    #18,a3
           bra.s    fnd_emp1
*
emp_str1   tst.b    (a3)
           bne.s    ful_str1
           add.l    #18,a3
           subi.w   #3,2(a2)             reduce length
           subi.w   #3,d5                reduce labels
           bra.s    emp_str1
*
ful_str1   andi.b   #type_mask,(a2)
           move.b   #0,1(a2)
           or.w     d5,(a2)
           move.l   (a3),(a0)
           move.l   4(a3),4(a0)
           move.l   8(a3),8(a0)
           move.l   12(a3),12(a0)
           move.w   16(a3),16(a0)
           cmpi.b   #$ff,(a0)
           beq.s    fin_str1
           add.l    #18,a0
           add.l    #18,a3
           bra.s    emp_str1
*
fin_str1   move.l   a0,76(a4)
exit63     rts
*
setlab     move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit63
           moveq    #-15,d0
           tst.w    d3
           beq      clr_label
           cmpi.w   #1,d3
           beq      set_label
           cmpi.w   #2,d3
           bne.s    exit63
           lea      par,a4
           move.w   2(a6,a1.l),370(a4)
           move.w   6(a6,a1.l),372(a4)   label number
           move.l   72(a4),a2
           bsr      segment1             remove element
           move.l   72(a4),a2
           move.l   a2,a1
           moveq    #0,d5
           move.w   (a2),d5
           andi.w   #lab_mask,d5
           move.w   2(a2),d4             d4 = element length
           sub.w    d5,d4
           mulu.w   #6,d4
           add.l    d4,a1                a1 = base of labels           
           move.w   372(a4),d0
           mulu.w   #18,d0
           add.l    d0,a1
           moveq    #0,d5
           move.w   370(a4),d5   
           moveq    #12,d6               d6 = length of labels
           tst.w    372(a4)
           bne.s    is_net2
           cmpi.w   #191,d5
           bgt.s    is_net2
           moveq    #10,d6               length of ref id label is 10
is_net2    bsr.s    wr_labels
           bra      segment1             draw element
*                                        a1 = base of label
wr_labels  move.l   14(a1),254(a4)
           cmpi.w   #194,d5
           beq.s    lab_cont             delete character
           cmpi.w   #208,d5
           beq.s    lab_up
           cmpi.w   #216,d5
           beq      lab_down
           cmpi.w   #192,d5
           beq      lab_left
           cmpi.w   #200,d5
           beq      lab_right
           cmpi.w   #209,d5
           beq      incsize
           cmpi.w   #217,d5
           beq      decsize
           cmpi.w   #193,d5
           beq      decatrib
           cmpi.w   #201,d5
           beq      incatrib
           cmpi.w   #255,d5
           bgt      lab_layer
           cmpi.w   #191,d5
           bgt.s    exit64
lab_cont   moveq    #0,d0                zero counter
lab_lp4    cmpi.b   #1,(a1,d0.w)
           beq.s    lab_end
           addi.w   #1,d0
           cmp.w    d0,d6
           bne.s    lab_lp4
lab_end    cmpi.b   #194,d5
           beq.s    lab_del              delete character
           cmp.w    d0,d6
           beq.s    exit64
           move.b   d5,(a1,d0.w)         new character
exit64     rts
lab_del    tst.w    d0
           beq.s    exit64
           subi.w   #1,d0
           move.b   #1,(a1,d0.w)
           rts
*
lab_up     add.l    d6,a1
           move.w   4(a1),d0
           add.w    82(a4),d0
           move.w   d0,4(a1)
           rts
lab_down   add.l    d6,a1
           move.w   4(a1),d0
           sub.w    82(a4),d0
           move.w   d0,4(a1)
           rts
lab_left   add.l    d6,a1
           move.w   2(a1),d0
           sub.w    82(a4),d0
           move.w   d0,2(a1)
           rts
lab_right  add.l    d6,a1
           move.w   2(a1),d0
           add.w    82(a4),d0
           move.w   d0,2(a1)
           rts
*
incsize    add.l    d6,a1
           move.b   1(a1),d0
           andi.w   #size_mask,d0
           cmpi.w   #size_mask,d0
           beq.s    exit64
           addi.w   #1,d0
           andi.b   #ctrl_mask,1(a1)
           or.b     d0,1(a1)
           rts
decsize    add.l    d6,a1
           move.b   1(a1),d0
           andi.w   #size_mask,d0
           cmpi.w   #4,d0
           ble      exit64
           subi.w   #1,d0
           andi.b   #ctrl_mask,1(a1)
           or.b     d0,1(a1)
           rts
*
incatrib   add.l    d6,a1
           move.b   1(a1),d0
           andi.w   #size_mask,d0
           mulu.w   #5,d0 
           move.b   1(a1),d1
           andi.b   #size_mask,1(a1)
           andi.w   #ctrl_mask,d1
           bne.s    notzero1
           ori.b    #$40,1(a1)           attribute was 0 now 1
           rts
notzero1   cmpi.w   #$40,d1
           bne.s    notone1
           ori.b    #$80,1(a1)           attribute was 1 now 2
           add.w    d0,2(a1)
           rts
notone1    cmpi.w   #$80,d1
           bne.s    nottwo1
           ori.b    #$c0,1(a1)           attribute was 2 now 3
           rts
nottwo1    sub.w    d0,2(a1)             attribute must be 3 now 0
           rts
decatrib   add.l    d6,a1
           move.b   1(a1),d0
           andi.w   #size_mask,d0
           mulu.w   #5,d0 
           move.b   1(a1),d1
           andi.b   #size_mask,1(a1)
           andi.w   #ctrl_mask,d1
           bne.s    notzero2
           ori.b    #$c0,1(a1)           attribute was 0 now 3
           add.w    d0,2(a1)
           rts
notzero2   cmpi.w   #$40,d1
           bne.s    notone2
           rts                           attribute was 1 now 0
notone2    cmpi.w   #$80,d1
           bne.s    nottwo2
           ori.b    #$40,1(a1)           attribute was 2 now 1
           sub.w    d0,2(a1)
           rts
nottwo2    ori.b    #$80,1(a1)           attribute must be 3 now 2
           rts
*
lab_layer  subi.w   #256,d5
           beq.s    swch_off
           cmpi.w   #255,d5
           bgt.s    swch_on
           add.l    d6,a1                d5 = 1 to 63
           andi.b   #lsw_mask,(a1)
           or.b     d5,(a1)              set layer
           rts
swch_off   move.w   372(a4),d0
           cmpi.w   #5,d0
           bgt.s    no_on_off
           addi.w   #244,d0
           move.b   #0,(a4,d0.w)
           rts
swch_on    move.w   372(a4),d0
           cmpi.w   #5,d0
           bgt.s    no_on_off
           addi.w   #244,d0
           move.b   #lsw_mask,(a4,d0.w)
no_on_off  rts
*
read_net   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    end_rdnet
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    end_rdnet
           moveq    #0,d0
           move.l   (a6,a1.l),a2         a2 = edit address         
           move.w   (a2),d5
           andi.w   #lab_mask,d5
           beq.s    end_rdnet            d0 will be zero
           move.w   2(a2),d4             d4 = element length
           sub.w    d5,d4
           mulu     #6,d4
           add.l    d4,a2
*
           lea      net_data,a4
           moveq    #0,d1                d1 = string length counter
mv_net_str cmpi.b   #0,(a2,d1.w)
           beq.s    end_of_str
           cmpi.w   #12,d1
           beq.s    end_of_str
           move.b   (a2,d1.w),(a4,d1.w)
           addi.w   #1,d1                increment string length
           bra.s    mv_net_str
end_of_str lea      net_len,a4
           move.w   d1,(a4)
           bra.s    str_ret
*
end_rdnet  lea      null_str,a4
           bra.s    str_ret
null_str   dc.w     0
net_len    dc.w     0
net_data   dc.l     0
           dc.l     0
           dc.l     0
*
lab_mode   move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit65
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit65
           lea      par,a4
           moveq    #0,d4
           move.w   2(a6,a1.l),d1
           cmpi.w   #5,d1
           bgt.s    no_on2
           addi.w   #244,d1
           move.b   (a4,d1.w),d4
           lsr.b    #7,d4
           bra      int_ret2
no_on2     move.l   72(a4),a2
           move.w   (a2),d2
           andi.w   #lab_mask,d2
           mulu.w   #3,d1
           cmp.w    d2,d1
           bge.s    end_lab2
           moveq    #0,d4
           bra      int_ret2
end_lab2   move.w   #-1,d4
           bra      int_ret2
*
str_ret    moveq    #3,d1
           add.w    (a4),d1
           bclr.l   #0,d1
           move.w   bv.chrix,a2
           movem.l  d1-d3,-(a7)
           jsr      (a2)                 bv chrix allocate space on stack
           movem.l  (a7)+,d1-d3
           movea.l  $58(a6),a1
           adda.l   d1,a4
move_str   subq.l   #2,a1
           move.w   -(a4),(a6,a1.l)
           subq.l   #2,d1
           bgt.s    move_str
           moveq    #1,d4                string argument
           move.l   a1,$58(a6)
           moveq    #0,d0
exit65     rts
*
schematic  move.b   (a1),d1
           andi.b   #type_mask,d1
           move.w   d6,d4
           sub.w    70(a4),d4
           move.w   d4,d5
           mulu.w   #6,d5
           moveq    #0,d0
sch_loop   cmpi.b   #pad,d1              **
           beq.s    is_pad2              ** this is just for backward compatibility
           move.b   (a1,d5.l),d2         **
           andi.b   #lay_mask,d2         **
           cmpi.b   #inv_lay,d2          **
           bne      no_pin2              **
is_pad2    subi.l   #6,d5
           bne.s    sch_loop
           move.w   d4,d5
           mulu.w   #6,d5
sch_lp2    move.b   (a1,d5.l),d2
           move.b   6(a1,d5.l),d3
           cmp.b    d2,d3
           bne      noalph_ret
           move.l   2(a1,d5.l),d2
           move.l   8(a1,d5.l),d3
           cmp.l    d2,d3
           bne      noalph_ret
           addi.w   #1,d4
           addi.l   #6,d5
           subi.w   #1,d6
           beq      no_pin2
           bra.s    sch_lp2
*
get_pin    move.l   72(a4),a1            element address
           move.w   (a1),194(a4)
           andi.w   #lab_mask,194(a4)
           moveq    #0,d6
           move.w   2(a1),d6             d4 = element length
           sub.w    194(a4),d6
           moveq    #0,d1
           moveq    #0,d4
           moveq    #0,d5
           move.b   (a1),d1              element type
           andi.b   #type_mask,d1
           cmpi.b   #trk,d1
           beq.s    is_trk               check for finger pad
           cmpi.b   #pad,d1
           beq.s    is_pad
           cmpi.b   #blk,d1
           beq      is_blk2
           bra      no_pin2              not a pad, track or block
*
is_trk     move.b   6(a1),d1             d6 = element length
           andi.b   #lay_mask,d1
           cmpi.b   #inv_lay,d1          ** look for invisible layer
           beq      schematic            ** this is just for backward compatability
           move.w   #inv_lay,d2
trk_pin1   move.w   d2,d1
           addq.l   #6,a1                move to next segment
           subi.w   #1,d6
           cmpi.w   #1,d6                dont do last segment
           beq      noalph_ret
           move.b   (a1),d2
           andi.b   #lay_mask,d2
           cmpi.b   #inv_lay,d1
           beq.s    d1_hi
           cmpi.b   #inv_lay,d2
           bne      no_pin2
           bra.s    trk_pin1
d1_hi      cmpi.b   #inv_lay,d2
           beq.s    trk_pin1
           cmp.w    70(a4),d6
           blt.s    trk_pin1
           addi.w   #1,d4                increment pin number
           bra.s    trk_pin1
*
is_pad     move.b   7(a1),d1             pad size
           cmpi.w   #1,d1
           ble      schematic
           cmpi.w   #10,d6               3 x 3 + header array
           blt      not_bga
           move.l   a1,a2                d6 = element length a2 = element address
           move.w   d6,286(a4)           store element length
           move.w   8(a2),d0
           cmp.w    14(a2),d0
           bne.s    chk4ypins
           cmp.w    20(a2),d0
           bne.s    chk4ypins
           move.b   #0,288(a4)           y pins are numerical
           bra.s    chk_bga
chk4ypins  move.w   10(a2),d0
           cmp.w    16(a2),d0
           bne.s    not_bga
           cmp.w    22(a2),d0
           bne.s    not_bga
           move.b   #1,288(a4)           x pins are numerical
chk_bga    moveq    #0,d2                clear counter
           moveq    #0,d3                clear counter        
chk_bga_lp addq.l   #6,a2
           subi.w   #1,d6                subtract from element length
           cmpi.w   #1,d6
           beq      is_bga
           tst.b    288(a4)
           bne.s    num_h                numbers horizontal alpha vertical
*
           move.w   4(a2),d0
           cmp.w    10(a2),d0
           beq.s    not_bga2             no change in y coordinates
           move.w   2(a2),d0
           cmp.w    8(a2),d0
           bne.s    chk_cnt              change in x coordinates
           addi.w   #1,d3
           bra.s    chk_bga_lp
*
num_h      move.w   2(a2),d0
           cmp.w    8(a2),d0
           beq.s    not_bga2             no change in x coordinates
           move.w   4(a2),d0
           cmp.w    10(a2),d0
           bne.s    chk_cnt              change in y coordinates
           addi.w   #1,d3
           bra.s    chk_bga_lp
*
chk_cnt    addi.w   #1,d2
           cmpi.w   #bga_len,d3
           blt.s    not_bga2
           moveq    #0,d3                clear counter
           bra.s    chk_bga_lp
*
not_bga2   move.w   286(a4),d6           restore element length
           moveq    #0,d4                clear numerical value
           moveq    #0,d5                clear alpha value
*
not_bga    subi.w   #1,d6                subtract from element length
           addq.l   #6,a1                move to first coord
           addi.w   #1,d4                increment pin number
           cmp.w    70(a4),d6
           bne.s    pin_loop
           bra      noalph_ret
pin_loop   subi.w   #1,d6
           addq.l   #6,a1                move to next pad
           move.l   2(a1),d1             coord of first pad
           cmp.l    -4(a1),d1            second pad
           beq.s    same_pad             coord the same
           addi.w   #1,d4                increment pin number 
same_pad   cmp.w    70(a4),d6
           bne.s    pin_loop
           bra.s    noalph_ret
*
is_bga     cmpi.w   #1,d2                at least 2 rows
           blt.s    not_bga2
           cmpi.w   #bga_len,d3
           blt.s    not_bga2
           move.w   286(a4),d6           restore element length
           moveq    #1,d4                d6 = element length a1 = element address
           moveq    #1,d5
           addq.l   #6,a1
           subi.w   #1,d6
           cmp.w    70(a4),d6
           beq.s    pin_ret
pin_lp2    addq.l   #6,a1                move to second coordinate
           subi.w   #1,d6
           addi.w   #1,d4
           tst.b    288(a4)
           bne.s    chk4ychg
           move.w   -4(a1),d0
           cmp.w    2(a1),d0
           beq.s    noxchg
           moveq    #1,d4
           addi.w   #1,d5
           bra.s    noxchg
chk4ychg   move.w   -2(a1),d0
           cmp.w    4(a1),d0
           beq.s    noxchg
           moveq    #1,d4
           addi.w   #1,d5
noxchg     cmp.w    70(a4),d6
           bne.s    pin_lp2
           bra.s    pin_ret              d4 = numerical value d5 = alpha value
*
is_blk2    sub.w    70(a4),d6
           addi.w   #1,d6
           asr.w    #1,d6
           move.w   d6,d4
noalph_ret moveq    #0,d5                no alpha value
pin_ret    move.w   d4,282(a4)           numerical value
           move.w   d5,284(a4)           alpha value
           rts
*
no_pin2    moveq    #0,d4
           moveq    #0,d5
           bra      pin_ret                                    
*
edt_size   lea      par,a4
           move.l   72(a4),a2
           move.w   2(a2),d2             d2 = element length
           moveq    #0,d5
           move.w   (a2),d5
           andi.w   #lab_mask,d5
           sub.w    d5,d2
           sub.w    70(a4),d2
           mulu.w   #6,d2
           adda.l   d2,a2
           moveq    #0,d4
           move.b   1(a2),d4
           bra      int_ret
*
clr_tab    move.w   #254,d1
clrtablp   move.w   #0,(a0,d1.w)
           subi.w   #2,d1
           bge.s    clrtablp
exit66     rts
*
pad_chk    move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit66
           moveq    #-15,d0
           lea      par,a4
           lea      pad_tab,a0
           moveq    #pad,d6
           tst.w    d3
           beq.s    padtab
           cmpi.w   #1,d3
           bne.s    exit66
           move.w   2(a6,a1.l),d1
           lsl.w    #1,d1
           move.w   (a0,d1.w),d4
           bra      int_ret2
*
padtab     bsr      clr_tab
           move.l   26(a4),a2
nxt_el18   moveq    #0,d4
           cmpi.b   #$ff,(a2)
           beq      int_ret
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmp.b    d6,d5
           beq.s    pad_tp
pad_rt     move.w   2(a2),d5
           mulu.w   #6,d5
           add.l    d5,a2
           bra.s    nxt_el18
*                                        pad element
pad_tp     move.w   2(a2),d5             d5 = element length (6 byte blocks)
           moveq    #0,d4
           move.w   (a2),d4
           andi.w   #lab_mask,d4         d4 = label length (6 byte blocks)
           sub.w    d4,d5
           mulu.w   #6,d5                d5 = element length in bytes
seg_lp     subi.l   #6,d5
           beq.s    pad_rt               end of segments
           moveq    #0,d0
           move.b   1(a2,d5.l),d0
           lsl.w    #1,d0
           move.w   #1,(a0,d0.w)
           bra.s    seg_lp
*
lay_chk    move.w   ca.gtlin,a0
           jsr      (a0)
           bne      exit66
           moveq    #-15,d0
           lea      par,a4
           lea      pad_tab,a0
           moveq    #trk,d6
           tst.w    d3
           beq.s    laytab
           cmpi.w   #1,d3
           bne      exit66
           move.w   2(a6,a1.l),d1
           lsl.w    #1,d1
           move.w   (a0,d1.w),d4
           bra      int_ret2
*
laytab     bsr      clr_tab
           move.l   26(a4),a2
           moveq    #0,d5
nxt_el27   move.b   (a2),d3
           andi.b   #type_mask,d3
           cmpi.b   #trk,d3
           beq.s    chk_tpbw
           cmpi.b   #pad,d3
           beq.s    chk_tpbw
           cmpi.b   #blk,d3
           beq.s    chk_tpbw
           cmpi.b   #wrd,d3
           beq.s    chk_tpbw
           cmpi.b   #$ff,(a2)
           beq.s    eof2
           move.w   2(a2),d3
           mulu.w   #6,d3
           adda.l   d3,a2
           bra.s    nxt_el27
chk_tpbw   bsr.s    chk_el
           bra.s    nxt_el27
eof2       moveq    #0,d4
           bra      int_ret
*
chk_el     move.l   a2,a3                a2 = element address
           move.w   (a2),194(a4)         save label length
           andi.w   #lab_mask,194(a4)
           move.w   194(a4),d4           d4 = label length
           move.w   2(a2),d5             d5 = element length
           sub.w    d4,d5
chkloop1   addq.l   #6,a3                base to next coord
           subi.w   #1,d5
           beq.s    chklabels
           moveq    #0,d0
           move.b   (a3),d0
           andi.b   #lay_mask,d0
           bsr.s    chklay5
           bra.s    chkloop1
*
chklabels  tst.w    d4
           beq.s    nxt_el28             no labels
chkloop2   move.b   12(a3),d0
           andi.b   #nlsw_mask,d0        d0 layer
           bsr.s    chklay5
           addq.l   #6,a3
           addq.l   #6,a3
           addq.l   #6,a3
           subi.w   #3,d4
           bgt.s    chkloop2
nxt_el28   move.w   2(a2),d5
           mulu.w   #6,d5
           add.l    d5,a2
           rts
*
chklay5    cmpi.b   #10,d0
           beq      isdeflay
           cmpi.b   #11,d0
           beq      isdeflay
           cmpi.b   #14,d0
           beq      isdeflay
           cmpi.b   #15,d0
           beq      isdeflay
           cmpi.b   #26,d0
           beq      isdeflay
           cmpi.b   #27,d0
           beq.s    isdeflay
           cmpi.b   #30,d0
           beq.s    isdeflay
           cmpi.b   #31,d0
           beq.s    isdeflay
           cmpi.b   #42,d0
           beq.s    isdeflay
           cmpi.b   #46,d0
           beq.s    isdeflay
           cmpi.b   #43,d0
           beq.s    isdeflay
           cmpi.b   #47,d0
           beq.s    isdeflay
           cmpi.b   #58,d0
           beq.s    isdeflay
           cmpi.b   #62,d0
           beq.s    isdeflay
           cmpi.b   #63,d0
           beq.s    isdeflay
           btst.l   #0,d0
           beq.s    nt3lay1
           move.w   #1,2(a0)
nt3lay1    btst.l   #1,d0
           beq.s    nt3lay2
           move.w   #1,4(a0)
nt3lay2    btst.l   #2,d0
           beq.s    nt3lay4
           move.w   #1,8(a0)
nt3lay4    btst.l   #3,d0
           beq.s    nt3lay8
           move.w   #1,16(a0)
nt3lay8    btst.l   #4,d0
           beq.s    nt3lay16
           move.w   #1,32(a0)
nt3lay16   btst.l   #5,d0
           beq.s    isdeflay
           move.w   #1,64(a0)
isdeflay   lsl.w    #1,d0
           move.w   #1,(a0,d0.w)
exit67     rts
*
pad_tab    dcb.w    256,0
*
endchk     moveq    #0,d0
exit68     rts
blklab_off lea      par,a4
           move.l   26(a4),a2
nxt_el20   cmpi.b   #$ff,(a2)
           beq.s    endchk
           move.b   (a2),d5
           andi.b   #type_mask,d5
           cmpi.b   #blk,d5
           beq.s    isblk2
nxt_el21   move.w   2(a2),d5
           mulu.w   #6,d5
           add.l    d5,a2
           bra.s    nxt_el20
isblk2     move.l   a2,a3
           move.w   (a2),d4
           andi.w   #lab_mask,d4         d4 = label length
           beq.s    nxt_el21             no labels
           move.w   2(a2),d5             d5 = element length
           sub.w    d4,d5
           mulu.w   #6,d5
           add.l    d5,a3                a3 = base of labels
blkloop    ori.b    #128,12(a3)          set bit 7
           subi.w   #3,d4
           ble.s    nxt_el21
           addq.l   #6,a3
           addq.l   #6,a3
           addq.l   #6,a3
           bra.s    blkloop
*
ed_layexg  move.w   ca.gtlin,a0
           jsr      (a0)
           bne.s    exit68
           moveq    #-15,d0
           lea      par,a4
           btst.l   #0,d3
           bne.s    exit68               must be even
           cmpi.w   #16,d3
           bgt.s    exit68
           bne.s    pars_ok1
           moveq    #0,d0                is 16 parameters
           move.l   72(a4),a2
           tst.b    170(a4)
           beq      exit68               library unlocked
           cmp.l    350(a4),a2           look for component
           bgt.s    pars_ok1
           move.w   4(a2),d2
           andi.w   #lib_mask,d2         look for library
           bne.s    pars_ok1
exit69     rts
pars_ok1   subi.w   #2,d3
           lsl.w    #1,d3                d3 parameters count
           move.l   a6,d0
           add.l    d0,a1                a1 pointer to parameters
           move.l   350(a4),a2
           move.b   #1,137(a4)           global operation
           bra.s    layswap1
*
layerexg   move.w   ca.gtlin,a0
           jsr      (a0)
           bne      exit69
           moveq    #-15,d0
           lea      par,a4
           cmpi.w   #4,d3
           blt      exit69               must be greater than 3
           cmpi.w   #22,d3
           bgt      exit69
           btst.l   #0,d3
           bne      exit69               must be even
           subi.w   #4,d3
           lsl.w    #1,d3                d3 parameters count
           move.l   a6,d0
           add.l    d0,a1                a1 pointer to parameters
           move.b   7(a1),420(a4)        d0 xchange flag
           move.l   26(a4),a2
           move.b   3(a1),137(a4)        global flag
           bne.s    global1
           bsr      do
global1    addq.l   #8,a1                a1 pointer to first layer colour
           bsr.s    layswap1
           bra      close_area
*
layswap1   addq.l   #2,a1                add 2 due to word read
           move.w   #310,d1              a4,d1 pointer to layers
nxtlay3    move.w   (a1),(a4,d1.w)
           addq.l   #4,a1
           addq.l   #2,d1
           cmpi.w   #348,d1
           ble.s    nxtlay3
*
           move.w   d3,308(a4)
           tst.b    137(a4)              check global
           bne.s    exg_comp
           bsr      sort_xy              uses d0 and d1
*
exg_comp   moveq    #0,d6
           moveq    #0,d5
nxt_el22   move.b   (a2),d3
           andi.b   #type_mask,d3
           cmpi.b   #trk,d3
           beq.s    exg_tpbw
           cmpi.b   #pad,d3
           beq.s    exg_tpbw
           cmpi.b   #blk,d3
           beq.s    exg_tpbw
           cmpi.b   #wrd,d3
           beq.s    exg_tpbw 
           cmpi.b   #end,d3
           beq.s    eof1
           move.w   2(a2),d3
           mulu.w   #6,d3
           adda.l   d3,a2
           bra.s    nxt_el22
exg_tpbw   bsr.s    exg_el
           bra.s    nxt_el22
eof1       move.b   #0,420(a4)
           moveq    #0,d0
           rts
*************************************************
exg_el     move.b   #0,509(a4)           clear flag
           move.l   a2,a3                a2 = element address
           move.w   (a2),194(a4)         save label length
           andi.w   #lab_mask,194(a4)
           tst.b    137(a4)
           bne.s    global3
           bsr      check_area           uses d0 d3 d4 d6
           exg      a2,a3                a2 = element address
           cmp.l    a3,d6
           bne      nxt_el23
           move.l   a2,a3
global3    move.w   194(a4),d4           d4 = label length
           move.w   2(a2),d5             d5 = element length
           sub.w    d4,d5
exgloop1   addq.l   #6,a3                base to next coord
           subi.w   #1,d5
           beq.s    exglabels
           move.w   2(a3),d1             x
           move.w   4(a3),d2             y
           tst.b    137(a4)
           bne.s    global4
           cmp.w    94(a4),d1
           bgt.s    exgloop1             *
           cmp.w    96(a4),d1
           blt.s    exgloop1             *
           cmp.w    98(a4),d2
           bgt.s    exgloop1             *
           cmp.w    100(a4),d2
           blt.s    exgloop1             *           
global4    move.b   #1,509(a4)
           moveq    #0,d0
           move.b   (a3),d0
           andi.b   #lay_mask,d0
           moveq    #0,d6
           move.w   308(a4),d6           d6 counter
nxtlay1    lea      par,a4
           add.l    d6,a4
           move.w   310(a4),d1
           move.w   312(a4),d2
           bsr.s    chklay1
           subi.w   #4,d6
           bge.s    nxtlay1
           lea      par,a4
           bra.s    exgloop1
*
chklay1    cmp.b    d0,d1                ********
           bne.s    chklay2              *
           andi.b   #via_mask,(a3)       *
           or.b     d2,(a3)              *
           rts                           *
chklay2    tst.b    420(a4)              *
           bne.s    nomatch1             *
           cmp.b    d0,d2                *
           bne.s    nomatch1             *
           andi.b   #via_mask,(a3)       *    
           or.b     d1,(a3)              *
nomatch1   rts                           ********
*
exglabels  tst.w    d4
           beq.s    nxt_el23
           tst.b    509(a4)
           beq.s    nxt_el23
exgloop2   move.b   12(a3),d0
           andi.b   #nlsw_mask,d0        d0 layer
           moveq    #0,d6
           move.w   308(a4),d6           d6 counter
nxtlay2    lea      par,a4
           add.l    d6,a4
           move.w   310(a4),d1
           move.w   312(a4),d2
           bsr.s    chklay3
           subi.w   #4,d6
           bge.s    nxtlay2
           lea      par,a4
           addq.l   #6,a3
           addq.l   #6,a3
           addq.l   #6,a3
           subi.w   #3,d4
           bgt.s    exgloop2
nxt_el23   move.w   2(a2),d5
           mulu.w   #6,d5
           add.l    d5,a2
           rts
*
chklay3    cmp.b    d0,d1                ********
           bne.s    chklay4              *
           andi.b   #lsw_mask,12(a3)     *
           or.b     d2,12(a3)            *
           rts                           *
chklay4    tst.b    420(a4)              *
           bne.s    nomatch2             *
           cmp.b    d0,d2                *
           bne.s    nomatch2             *
           andi.b   #lsw_mask,12(a3)     *
           or.b     d1,12(a3)            *
nomatch2   rts                           ********
*************************************************
therm_bs   lea      par,a4
           move.l   26(a4),a2
nxt_el24   move.b   (a2),d3
           andi.b   #type_mask,d3
           cmpi.b   #pad,d3
           bne.s    notapad
*
           move.l   a2,a3
           move.w   (a2),d4
           andi.w   #lab_mask,d4         d4 = number of label blocks
           move.w   2(a2),d5             d5 = element length including label blocks
           sub.w    d4,d5                d5 = element length
thbs_loop  addq.l   #6,a3
           subi.w   #1,d5
           beq.s    padchked
           cmpi.b   #128,1(a3)
           bne.s    not_thm
           move.b   #144,1(a3)
           bra.s    thbs_loop
not_thm    cmpi.b   #129,1(a3)
           bne.s    thbs_loop
           move.b   #192,1(a3)
           bra.s    thbs_loop
*
notapad    cmpi.b   #$ff,(a2)
           beq      endchk
padchked   move.w   2(a2),d3
           mulu.w   #6,d3
           adda.l   d3,a2
           bra.s    nxt_el24
*
pin_inv    movea.w  ca.gtlin,a0
           jsr      (a0)
           bne.s    exit71
           moveq    #-15,d0
           lea      par,a4
           cmpi.w   #1,d3
           bgt.s    exit71
           move.b   3(a6,a1.l),d1
           move.b   d1,501(a4)
           moveq    #0,d0
exit71     rts
dpi        movea.w  ca.gtlin,a0
           jsr      (a0)
           bne.s    exit71
           moveq    #-15,d0
           lea      par,a4 
           cmpi.w   #1,d3
           bne.s    exit71
           move.l   #1000,d2
           move.w   2(a6,a1.l),d1        dots per inch
           divu     d1,d2
           move.w   d2,486(a4)
           moveq    #0,d0
exit72     rts
*
lab_dens   movea.w  ca.gtlin,a0
           jsr      (a0)
           bne.s    exit72
           moveq    #-15,d0
           cmpi.w   #1,d3
           bne.s    exit72
           moveq    #0,d0
           move.b   3(a6,a1.l),d1
           cmpi.w   #64,d1               label size limits
           bge.s    exit72
           lea      par,a4
           move.b   d1,262(a4)
           rts
*
par        dc.l     0                    0   cursor size
           dc.w     $80c0                4   ink 7 rgb bits set to 1
           dc.l     0                    6   x y cursor coords in pixels
           dc.b     4                    10  scale -64 -32 -16 -8 -4 -2 1 2 4 8
           dc.b     0                    11  scale up / down flag
           dc.l     0                    12  x y screen offset in mils
           dc.b     0                    16  fast draw modes for ql
           dc.b     0                    17  text and labels on/off
           dc.l     0                    18  screen memory
           dc.l     0                    22  file length
           dc.l     0                    26  file start
           dc.l     0                    30  element length
           dc.b     0                    34  pad size
           dc.b     0                    35  track size
           dc.l     0                    36  x y source coordinates
           dc.l     0                    40  x y destination coordinates
           dc.l     0                    44  track x y source
           dc.l     0                    48  track x y destination
           dc.w     $0700                52  ink mask
           dc.l     0                    54  temp storage
           dc.l     0                    58  x y cursor coords in mils
           dc.l     0                    62  x y area coords 1
           dc.l     0                    66  x y area coords ( scaled )
           dc.w     0                    70  segment detected in search
           dc.l     0                    72  return search value
           dc.l     0                    76  end of file location
           dc.b     0                    80  edit mode bit 0, whole mode bit 1
           dc.b     0                    81  snap grid flag
           dc.w     25                   82  grid step
           dc.w     0                    84  track ink colour
           dc.l     0                    86  window left
           dc.l     0                    90  window right
           dc.w     0                    94  largest x area coord
           dc.w     0                    96  smallest x area coord
           dc.w     0                    98  largest y area coord
           dc.w     0                    100 smallest y area coord
           dc.w     0                    102 temp
           dc.l     0                    104 x y area coords 2
           dc.l     0                    108 base for file backup
           dc.l     0                    112 old file length saved
           dc.w     0                    116 area update on off flag
           dc.w     $0020                118 default text height
           dc.w     $0020                120 default text width
           dc.w     $000b                122 default text size and layer
           dc.w     $0201                124 default track size and layer
           dc.w     $0c01                126 default pad size and layer
           dc.w     0                    128 default block layer (no longer used)
           dc.l     0                    130 x y offset for move element
           dc.b     0                    134 via layer
           dc.b     0                    135 qptr present flag
           dc.w     0                    136 storage of edit shift dir
           dc.l     0                    138 pointer to text buffer
           dc.w     0                    142 text element length
           dc.l     0                    144 delete text element addr
           dc.w     $0100                148 via size 0=50 1=40 2=30 3=20
           dc.l     0                    150 save base for screen
           dc.l     0                    154 library base addr
           dc.l     0                    158 window 3 channel id
           dc.l     0                    162 new file length
           dc.l     0                    166 lower via addr (edit off)
           dc.b     1                    170 library move all
           dc.b     0                    171 grid point
           dc.l     0                    172 text move x y offset
           dc.l     0                    176 text edit address
           dc.l     0                    180 library cursor coordinates
           dc.w     1                    184 print over mode
           dc.w     0                    186 x screen width
           dc.w     0                    188 y screen height
           dc.l     $8000                190 window memory size
           dc.w     0                    194 number of netlist blocks
           dc.b     0                    196 logo mode
           dc.b     0                    197 schematic component flag
           dc.l     0                    198 upper via addr (edit on)
*
           dc.b     $0b                  202 default reference id label layer
           dc.b     $04                  203 default reference id label text orientation/size
           dc.w     0                    204 default reference id label x offset
           dc.w     0                    206 default reference id label y offset
           dc.b     $0b                  208 default type/value   label layer
           dc.b     $04                  209 default type/value   label text orientation/size
           dc.w     0                    210 default type/value   label x offset
           dc.w     0-lab_vert           212 default type/value   label y offset
           dc.b     $0b                  214 default modifier     label layer
           dc.b     $04                  215 default modifier     label text orientation/size
           dc.w     0                    216 default modifier     label x offset
           dc.w     0-lab_vert*2         218 default modifier     label y offset
           dc.b     $8b                  220 default footprint    label layer
           dc.b     $04                  221 default footprint    label text orientation/size
           dc.w     0                    222 default footprint    label x offset
           dc.w     0-lab_vert*3         224 default footprint    label y offset
           dc.b     $8b                  226 default supplier     label layer
           dc.b     $04                  227 default supplier     label text orientation/size
           dc.w     0                    228 default supplier     label x offset
           dc.w     0-lab_vert*4         230 default supplier     label y offset
           dc.b     $8b                  232 default stock number label layer
           dc.b     $04                  233 default stock number label text orientation/size
           dc.w     0                    234 default stock number label x offset
           dc.w     0-lab_vert*5         236 default stock number label y offset
           dc.b     $0b                  238 default new          label layer
           dc.b     $04                  239 default new          label text orientation/size
           dc.w     0                    240 default new          label x offset * not used *
           dc.w     0                    242 default new          label y offset * not used *
*
           dc.b     0                    244 store reference id on/off flag
           dc.b     0                    245 store type/value   on/off flag
           dc.b     0                    246 store modifier     on/off flag
           dc.b     0                    247 store footprint    on/off flag
           dc.b     0                    248 store supplier     on/off flag
           dc.b     0                    249 store stock number on/off flag
*
           dc.w     0                    250 label counter
*
           dc.w     0                    252 store label orientation
           dc.l     0                    254 store old label x y offsets
           dc.w     8                    258 screen mode
           dc.b     0                    260 windows initialized flag
           dc.b     0                    261 first element in component flag
           dc.b     1                    262 label density
           dc.b     0                    263 hi colour mode = 1
           dc.b     0                    264 high density mode
           dc.b     0                    265 file loading append flag
           dc.w     0                    266 temp
           dc.w     $0032                268 default block x size
           dc.w     $0032                270 default block y size
           dc.w     $0100                272 default block layer
           dc.w     0                    274 block element flag
           dc.l     0                    276 temp search
           dc.w     0                    280 block edit mode
           dc.w     0                    282 numerical pin picked up
           dc.w     0                    284 alpha pin picked up
           dc.w     0                    286 element length
           dc.b     0                    288 bga orientation flag
           dc.b     0                    289 mouse button toggle store
           dc.b     0                    290 schematic mode flag
           dc.b     0                    291 component flag
           dc.w     0                    292 spare
           dc.b     0                    294 cursor moved on find flag
           dc.b     0                    295 spare
           dc.w     0                    296 x window width in pixels
           dc.w     0                    298 x window offset in pixels
           dc.w     0                    300 x window width
           dc.w     0                    302 y window height
           dc.w     0                    304 x window offset
           dc.w     0                    306 y window offset
           dc.w     0                    308 layer pairs
           dc.l     0                    310 layer 0,1
           dc.l     0                    314 layer 2,3
           dc.l     0                    318 layer 4,5
           dc.l     0                    322 layer 6,7
           dc.l     0                    326 layer 8,9
           dc.l     0                    330 layer 10,11
           dc.l     0                    334 layer 12,13
           dc.l     0                    338 layer 14,15   
           dc.l     0                    342 layer 16,17
           dc.l     0                    346 layer 18,19
           dc.l     0                    350 component picked up start address
           dc.l     0                    354 component picked up end address
           dc.l     0                    358 component picked up length
           dc.l     0                    362 component start
           dc.l     0                    366 component end
           dc.w     0                    370 label char
           dc.w     0                    372 label edit number
           dc.w     0                    374 old edit number
           dc.l     0                    376 label address
           dc.b     0                    380 text mode for plotter
           dc.b     0                    381 flags for loading
           dc.w     0                    382 colour table offset
           dc.w     0                    384 reference offset
           dc.w     4                    386 grid colour
           dc.w     9                    388 layer zero colour
           dc.w     0                    390 hole colour
           dc.b     0                    392 view layer zero
           dc.b     0                    393 view holes 
           dc.b     0                    394 draw pad hole flag
           dc.b     0                    395 spare
           dc.w     0                    396 spare
           dc.l     0                    398 spare
           dc.l     0                    402 spare
           dc.w     0                    406 spare
           dc.w     100                  408 circle x radius
           dc.w     100                  410 circle y radius
           dc.w     24                   412 circle points per 360 degrees
           dc.b     0                    414 circle set offset flag
           dc.b     0                    415 component flag for area copy
           dc.l     0                    416 circle x y offsets
           dc.b     0                    420 layer xchange change flag
           dc.b     0                    421 spare
           dc.w     0                    422 spare
           dc.l     0                    424 spare
           dc.l     0                    428 spare
           dc.l     0                    432 spare
           dc.l     0                    436 spare
           dc.l     0                    440 spare
           dc.l     0                    444 spare
           dc.l     0                    448 spare
           dc.l     0                    452 spare
           dc.l     0                    456 spare
           dc.l     0                    460 spare
           dc.l     0                    464 spare
           dc.l     0                    468 spare
           dc.w     0                    472 spare
           dc.b     0                    474 format version EIX = 0
           dc.b     0                    475 spare
           dc.l     0                    476 spare
           dc.b     0                    480 spare
           dc.b     0                    481 bits per pixel
           dc.w     0                    482 temp
           dc.w     0                    484 spare
           dc.w     2                    486 pixel size in mils for bmp import
           dc.w     0                    488 file error flag
           dc.w     0                    490 bmp width
           dc.w     0                    492 bmp height
           dc.w     0                    494 bmp bytes per line
           dc.w     0                    496 bmp x count
           dc.w     0                    498 bmp y count
           dc.b     0                    500 bmp pixel bit 1 old 2 new
           dc.b     0                    501 bmp inverted video
           dc.w     0                    502 bmp byte count
           dc.w     0                    504 bmp x1
           dc.w     0                    506 bmp y1
           dc.b     0                    508 component check area flag
           dc.b     0                    509 layer exchange flag  
           dc.w     0                    510 temp
           dc.w     0                    512 temp    
           dc.w     0                    514 search string length
           dc.w     0                    516 library search string match length 
           dc.l     $ffffffff            518 layer on off mask
*
text_buff  dcb.l    514,0                2k buffer space 256 characters
*
           dc.w     1024                 1024 entries for 360 degrees
sinetab    dc.w     $0000                0
           dc.w     $00C9                1
           dc.w     $0192                2
           dc.w     $025B                3
           dc.w     $0324                4
           dc.w     $03ED                5
           dc.w     $04B6                6
           dc.w     $057F                7
           dc.w     $0648                8
           dc.w     $0711                9
           dc.w     $07D9                10
           dc.w     $08A2                11
           dc.w     $096A                12
           dc.w     $0A33                13
           dc.w     $0AFB                14
           dc.w     $0BC4                15
           dc.w     $0C8C                16
           dc.w     $0D54                17
           dc.w     $0E1C                18
           dc.w     $0EE3                19
           dc.w     $0FAB                20
           dc.w     $1072                21
           dc.w     $113A                22
           dc.w     $1201                23
           dc.w     $12C8                24
           dc.w     $138F                25
           dc.w     $1455                26
           dc.w     $151C                27
           dc.w     $15E2                28
           dc.w     $16A8                29
           dc.w     $176E                30
           dc.w     $1833                31
           dc.w     $18F9                32
           dc.w     $19BE                33
           dc.w     $1A82                34
           dc.w     $1B47                35
           dc.w     $1C0B                36
           dc.w     $1CCF                37
           dc.w     $1D93                38
           dc.w     $1E57                39
           dc.w     $1F1A                40
           dc.w     $1FDD                41
           dc.w     $209F                42
           dc.w     $2161                43
           dc.w     $2223                44
           dc.w     $22E5                45
           dc.w     $23A6                46
           dc.w     $2467                47
           dc.w     $2528                48
           dc.w     $25E8                49
           dc.w     $26A8                50
           dc.w     $2767                51
           dc.w     $2826                52
           dc.w     $28E5                53
           dc.w     $29A3                54
           dc.w     $2A61                55
           dc.w     $2B1F                56
           dc.w     $2BDC                57
           dc.w     $2C99                58
           dc.w     $2D55                59
           dc.w     $2E11                60
           dc.w     $2ECC                61
           dc.w     $2F87                62
           dc.w     $3041                63
           dc.w     $30FB                64
           dc.w     $31B5                65
           dc.w     $326E                66
           dc.w     $3326                67
           dc.w     $33DF                68
           dc.w     $3496                69
           dc.w     $354D                70
           dc.w     $3604                71
           dc.w     $36BA                72
           dc.w     $376F                73
           dc.w     $3824                74
           dc.w     $38D9                75
           dc.w     $398C                76
           dc.w     $3A40                77
           dc.w     $3AF2                78
           dc.w     $3BA5                79
           dc.w     $3C56                80
           dc.w     $3D07                81
           dc.w     $3DB8                82
           dc.w     $3E68                83
           dc.w     $3F17                84
           dc.w     $3FC5                85
           dc.w     $4073                86
           dc.w     $4121                87
           dc.w     $41CE                88
           dc.w     $427A                89
           dc.w     $4325                90
           dc.w     $43D0                91
           dc.w     $447A                92
           dc.w     $4524                93
           dc.w     $45CD                94
           dc.w     $4675                95
           dc.w     $471C                96
           dc.w     $47C3                97
           dc.w     $4869                98
           dc.w     $490F                99
           dc.w     $49B4                100
           dc.w     $4A58                101
           dc.w     $4AFB                102
           dc.w     $4B9D                103
           dc.w     $4C3F                104
           dc.w     $4CE0                105
           dc.w     $4D81                106
           dc.w     $4E20                107
           dc.w     $4EBF                108
           dc.w     $4F5D                109
           dc.w     $4FFB                110
           dc.w     $5097                111
           dc.w     $5133                112
           dc.w     $51CE                113
           dc.w     $5268                114
           dc.w     $5302                115
           dc.w     $539B                116
           dc.w     $5432                117
           dc.w     $54C9                118
           dc.w     $5560                119
           dc.w     $55F5                120
           dc.w     $568A                121
           dc.w     $571D                122
           dc.w     $57B0                123
           dc.w     $5842                124
           dc.w     $58D3                125
           dc.w     $5964                126
           dc.w     $59F3                127
           dc.w     $5A82                128
           dc.w     $5B0F                129
           dc.w     $5B9C                130
           dc.w     $5C28                131
           dc.w     $5CB3                132
           dc.w     $5D3E                133
           dc.w     $5DC7                134
           dc.w     $5E4F                135
           dc.w     $5ED7                136
           dc.w     $5F5D                137
           dc.w     $5FE3                138
           dc.w     $6068                139
           dc.w     $60EB                140
           dc.w     $616E                141
           dc.w     $61F0                142
           dc.w     $6271                143
           dc.w     $62F1                144
           dc.w     $6370                145
           dc.w     $63EE                146
           dc.w     $646C                147
           dc.w     $64E8                148
           dc.w     $6563                149
           dc.w     $65DD                150
           dc.w     $6656                151
           dc.w     $66CF                152
           dc.w     $6746                153
           dc.w     $67BC                154
           dc.w     $6832                155
           dc.w     $68A6                156
           dc.w     $6919                157
           dc.w     $698B                158
           dc.w     $69FD                159
           dc.w     $6A6D                160
           dc.w     $6ADC                161
           dc.w     $6B4A                162
           dc.w     $6BB7                163
           dc.w     $6C23                164
           dc.w     $6C8E                165
           dc.w     $6CF8                166
           dc.w     $6D61                167
           dc.w     $6DC9                168
           dc.w     $6E30                169
           dc.w     $6E96                170
           dc.w     $6EFB                171
           dc.w     $6F5E                172
           dc.w     $6FC1                173
           dc.w     $7022                174
           dc.w     $7083                175
           dc.w     $70E2                176
           dc.w     $7140                177
           dc.w     $719D                178
           dc.w     $71F9                179
           dc.w     $7254                180
           dc.w     $72AE                181
           dc.w     $7307                182
           dc.w     $735E                183
           dc.w     $73B5                184
           dc.w     $740A                185
           dc.w     $745F                186
           dc.w     $74B2                187
           dc.w     $7504                188
           dc.w     $7555                189
           dc.w     $75A5                190
           dc.w     $75F3                191
           dc.w     $7641                192
           dc.w     $768D                193
           dc.w     $76D8                194
           dc.w     $7722                195
           dc.w     $776B                196
           dc.w     $77B3                197
           dc.w     $77FA                198
           dc.w     $783F                199
           dc.w     $7884                200
           dc.w     $78C7                201
           dc.w     $7909                202
           dc.w     $794A                203
           dc.w     $7989                204
           dc.w     $79C8                205
           dc.w     $7A05                206
           dc.w     $7A41                207
           dc.w     $7A7C                208
           dc.w     $7AB6                209
           dc.w     $7AEE                210
           dc.w     $7B26                211
           dc.w     $7B5C                212
           dc.w     $7B91                213
           dc.w     $7BC5                214
           dc.w     $7BF8                215
           dc.w     $7C29                216
           dc.w     $7C59                217
           dc.w     $7C88                218
           dc.w     $7CB6                219
           dc.w     $7CE3                220
           dc.w     $7D0E                221
           dc.w     $7D39                222
           dc.w     $7D62                223
           dc.w     $7D89                224
           dc.w     $7DB0                225
           dc.w     $7DD5                226
           dc.w     $7DFA                227
           dc.w     $7E1D                228
           dc.w     $7E3E                229
           dc.w     $7E5F                230
           dc.w     $7E7E                231
           dc.w     $7E9C                232
           dc.w     $7EB9                233
           dc.w     $7ED5                234
           dc.w     $7EEF                235
           dc.w     $7F09                236
           dc.w     $7F21                237
           dc.w     $7F37                238
           dc.w     $7F4D                239
           dc.w     $7F61                240
           dc.w     $7F74                241
           dc.w     $7F86                242
           dc.w     $7F97                243
           dc.w     $7FA6                244
           dc.w     $7FB4                245
           dc.w     $7FC1                246
           dc.w     $7FCD                247
           dc.w     $7FD8                248
           dc.w     $7FE1                249
           dc.w     $7FE9                250
           dc.w     $7FF0                251
           dc.w     $7FF5                252
           dc.w     $7FF9                253
           dc.w     $7FFD                254
           dc.w     $7FFE                255
           dc.w     $7FFF                256
*
logo_data  dc.b     48,0,0,3,0,0
           dc.b     4,0,251,136,5,127
           dc.b     4,0,250,40,253,63
           dc.b     48,0,0,3,0,0
           dc.b     4,0,253,64,5,127
           dc.b     4,0,251,136,4,31
           dc.b     48,0,0,3,0,0
           dc.b     4,0,253,64,0,175
           dc.b     4,0,251,136,2,15
           dc.b     48,0,0,3,0,0
           dc.b     4,0,253,64,3,199
           dc.b     4,0,253,152,5,127
           dc.b     48,0,0,3,0,0
           dc.b     4,0,253,64,2,103
           dc.b     4,0,253,152,0,175
           dc.b     48,0,0,3,0,0
           dc.b     4,0,253,152,0,175
           dc.b     4,0,254,160,5,127
           dc.b     48,0,0,3,0,0
           dc.b     1,0,255,80,5,39
           dc.b     1,0,254,248,3,199
           dc.b     48,0,0,3,0,0
           dc.b     4,0,254,248,5,39
           dc.b     4,0,254,160,1,7
           dc.b     48,0,0,3,0,0
           dc.b     1,0,253,240,5,39
           dc.b     1,0,253,152,253,151
           dc.b     48,0,0,3,0,0
           dc.b     1,0,254,248,253,63
           dc.b     1,0,253,240,5,127
           dc.b     48,0,0,3,0,0
           dc.b     1,0,255,80,5,127
           dc.b     1,0,254,248,3,199
           dc.b     48,0,0,3,0,0
           dc.b     1,0,255,80,253,63
           dc.b     1,0,254,248,254,247
           dc.b     48,0,0,3,0,0
           dc.b     1,0,0,176,5,127
           dc.b     1,0,255,80,4,31
           dc.b     48,0,0,3,0,0
           dc.b     1,0,0,176,253,63
           dc.b     1,0,255,80,254,159
           dc.b     48,0,0,3,0,0
           dc.b     1,0,2,16,5,127
           dc.b     1,0,0,176,3,199
           dc.b     48,0,0,3,0,0
           dc.b     1,0,2,16,253,63
           dc.b     1,0,0,176,254,247
           dc.b     48,0,0,3,0,0
           dc.b     1,0,2,104,3,199
           dc.b     1,0,2,16,5,39
           dc.b     48,0,0,3,0,0
           dc.b     1,0,2,104,254,247
           dc.b     1,0,2,16,253,151
           dc.b     48,0,0,3,0,0
           dc.b     11,0,2,104,5,127
           dc.b     11,0,1,8,253,63
           dc.b     48,0,0,3,0,0
           dc.b     11,0,2,104,5,127
           dc.b     11,0,4,32,4,31
           dc.b     48,0,0,3,0,0
           dc.b     11,0,2,104,0,175
           dc.b     11,0,4,32,2,15
           dc.b     48,0,0,3,0,0
           dc.b     11,0,2,104,254,159
           dc.b     11,0,4,32,253,63
           dc.b     48,0,0,3,0,0
           dc.b     11,0,4,120,3,199
           dc.b     11,0,4,32,5,127
           dc.b     48,0,0,3,0,0
           dc.b     11,0,4,120,2,103
           dc.b     11,0,4,32,0,87
           dc.b     48,0,0,3,0,0
           dc.b     11,0,4,120,253,63
           dc.b     11,0,4,32,254,247
           dc.b     48,0,0,3,0,0
           dc.b     11,0,4,120,5,127
           dc.b     11,0,5,128,253,63
           dc.b     48,0,0,3,0,0
           dc.b     11,0,5,128,1,193
           dc.b     11,0,5,216,5,39
           dc.b     48,0,0,3,0,0
           dc.b     11,0,5,128,0,253
           dc.b     11,0,5,216,253,151
           dc.b     0,0,0,10,0,0
           dc.b     7,0,2,104,4,31
           dc.b     7,0,4,32,4,31
           dc.b     7,0,4,32,3,199
           dc.b     7,0,4,120,3,199
           dc.b     7,0,4,120,2,103
           dc.b     7,0,4,32,2,103
           dc.b     7,0,4,32,2,15
           dc.b     7,0,2,104,2,15
           dc.b     7,0,2,104,4,31
           dc.b     0,0,0,10,0,0
           dc.b     7,0,2,104,0,175
           dc.b     7,0,4,32,0,175
           dc.b     7,0,4,32,0,87
           dc.b     7,0,4,120,0,87
           dc.b     7,0,4,120,254,247
           dc.b     7,0,4,32,254,247
           dc.b     7,0,4,32,254,159
           dc.b     7,0,2,104,254,159
           dc.b     7,0,2,104,0,175
           dc.b     0,0,0,14,0,0
           dc.b     7,0,1,8,5,127
           dc.b     7,0,5,128,5,127
           dc.b     7,0,5,128,5,39
           dc.b     7,0,5,216,5,39
           dc.b     7,0,5,216,1,193
           dc.b     7,0,5,128,1,193
           dc.b     7,0,5,128,0,253
           dc.b     7,0,5,216,0,253
           dc.b     7,0,5,216,253,151
           dc.b     7,0,5,128,253,151
           dc.b     7,0,5,128,253,63
           dc.b     7,0,1,8,253,63
           dc.b     7,0,1,8,5,127
           dc.b     48,0,0,3,0,0
           dc.b     7,0,250,72,252,187
           dc.b     7,0,250,40,253,63
           dc.b     48,0,0,3,0,0
           dc.b     7,0,250,72,250,171
           dc.b     7,0,250,40,250,39
           dc.b     48,0,0,3,0,0
           dc.b     7,0,250,72,250,39
           dc.b     7,0,250,247,253,63
           dc.b     48,0,0,3,0,0
           dc.b     7,0,251,166,253,63
           dc.b     7,0,250,247,252,187
           dc.b     48,0,0,3,0,0
           dc.b     7,0,251,166,250,39
           dc.b     7,0,250,247,250,171
           dc.b     48,0,0,3,0,0
           dc.b     7,0,251,166,253,63
           dc.b     7,0,252,85,250,39
           dc.b     48,0,0,3,0,0
           dc.b     7,0,252,117,252,187
           dc.b     7,0,253,36,250,39
           dc.b     48,0,0,3,0,0
           dc.b     7,0,253,211,252,55
           dc.b     7,0,253,36,252,187
           dc.b     48,0,0,3,0,0
           dc.b     7,0,253,211,251,179
           dc.b     7,0,253,36,251,47
           dc.b     48,0,0,3,0,0
           dc.b     7,0,254,130,250,171
           dc.b     7,0,253,36,250,39
           dc.b     48,0,0,3,0,0
           dc.b     7,0,253,211,252,187
           dc.b     7,0,254,130,251,47
           dc.b     48,0,0,3,0,0
           dc.b     7,0,255,81,251,47
           dc.b     7,0,254,162,252,187
           dc.b     48,0,0,3,0,0
           dc.b     7,0,254,162,250,171
           dc.b     7,0,0,0,250,39
           dc.b     48,0,0,3,0,0
           dc.b     7,0,255,81,252,55
           dc.b     7,0,0,175,252,187
           dc.b     48,0,0,3,0,0
           dc.b     7,0,255,81,251,179
           dc.b     7,0,0,0,251,47
           dc.b     48,0,0,3,0,0
           dc.b     7,0,0,0,251,179
           dc.b     7,0,0,175,250,39
           dc.b     48,0,0,3,0,0
           dc.b     7,0,1,126,253,63
           dc.b     7,0,0,207,250,39
           dc.b     48,0,0,3,0,0
           dc.b     7,0,2,77,250,39
           dc.b     7,0,1,158,252,187
           dc.b     48,0,0,3,0,0
           dc.b     7,0,2,77,252,55
           dc.b     7,0,3,171,252,187
           dc.b     48,0,0,3,0,0
           dc.b     7,0,2,77,250,39
           dc.b     7,0,2,252,250,171
           dc.b     48,0,0,3,0,0
           dc.b     7,0,3,171,251,47
           dc.b     7,0,2,252,250,39
           dc.b     48,0,0,3,0,0
           dc.b     7,0,3,203,252,187
           dc.b     7,0,4,122,250,39
           dc.b     48,0,0,3,0,0
           dc.b     7,0,5,41,252,187
           dc.b     7,0,4,122,252,55
           dc.b     48,0,0,3,0,0
           dc.b     7,0,5,41,252,187
           dc.b     7,0,5,216,250,39
           dc.b     255,255,255,255,255,255
*
char_data  dcb.l    512,0
*
txt_dat1
tx1        dc.w     t33-tx1
           dc.w     t34-tx1
           dc.w     t35-tx1
           dc.w     t36-tx1
           dc.w     t37-tx1
           dc.w     t38-tx1
           dc.w     t39-tx1
           dc.w     t40-tx1
           dc.w     t41-tx1
           dc.w     t42-tx1
           dc.w     t43-tx1
           dc.w     t44-tx1
           dc.w     t45-tx1
           dc.w     t46-tx1
           dc.w     t47-tx1
           dc.w     t48-tx1
           dc.w     t49-tx1
           dc.w     t50-tx1
           dc.w     t51-tx1
           dc.w     t52-tx1
           dc.w     t53-tx1
           dc.w     t54-tx1
           dc.w     t55-tx1
           dc.w     t56-tx1
           dc.w     t57-tx1
           dc.w     t58-tx1
           dc.w     t59-tx1
           dc.w     t60-tx1
           dc.w     t61-tx1
           dc.w     t62-tx1
           dc.w     t63-tx1
           dc.w     t64-tx1
           dc.w     t65-tx1
           dc.w     t66-tx1
           dc.w     t67-tx1
           dc.w     t68-tx1
           dc.w     t69-tx1
           dc.w     t70-tx1
           dc.w     t71-tx1
           dc.w     t72-tx1
           dc.w     t73-tx1
           dc.w     t74-tx1
           dc.w     t75-tx1
           dc.w     t76-tx1
           dc.w     t77-tx1
           dc.w     t78-tx1
           dc.w     t79-tx1
           dc.w     t80-tx1
           dc.w     t81-tx1
           dc.w     t82-tx1
           dc.w     t83-tx1
           dc.w     t84-tx1
           dc.w     t85-tx1
           dc.w     t86-tx1
           dc.w     t87-tx1
           dc.w     t88-tx1
           dc.w     t89-tx1
           dc.w     t90-tx1
           dc.w     t91-tx1
           dc.w     t92-tx1
           dc.w     t93-tx1
           dc.w     t94-tx1
           dc.w     t95-tx1
           dc.w     t96-tx1
           dc.w     t97-tx1
           dc.w     t98-tx1
           dc.w     t99-tx1
           dc.w     t100-tx1
           dc.w     t101-tx1
           dc.w     t102-tx1
           dc.w     t103-tx1
           dc.w     t104-tx1
           dc.w     t105-tx1
           dc.w     t106-tx1
           dc.w     t107-tx1
           dc.w     t108-tx1
           dc.w     t109-tx1
           dc.w     t110-tx1
           dc.w     t111-tx1
           dc.w     t112-tx1
           dc.w     t113-tx1
           dc.w     t114-tx1
           dc.w     t115-tx1
           dc.w     t116-tx1
           dc.w     t117-tx1
           dc.w     t118-tx1
           dc.w     t119-tx1
           dc.w     t120-tx1
           dc.w     t121-tx1
           dc.w     t122-tx1
           dc.w     t123-tx1
           dc.w     t124-tx1
           dc.w     t125-tx1
           dc.w     t126-tx1
           dc.w     t127-tx1
           dc.w     t128-tx1
           dc.w     t129-tx1
           dc.w     t130-tx1
           dc.w     t131-tx1
           dc.w     t132-tx1
           dc.w     t133-tx1
           dc.w     t134-tx1
           dc.w     t135-tx1
           dc.w     t136-tx1
           dc.w     t137-tx1
           dc.w     t138-tx1
           dc.w     t139-tx1
           dc.w     t140-tx1
           dc.w     t141a-tx1
           dc.w     t142-tx1
           dc.w     t143-tx1
           dc.w     t144a-tx1
           dc.w     t145a-tx1
           dc.w     t146a-tx1
           dc.w     t147a-tx1
           dc.w     t148a-tx1
           dc.w     t149a-tx1
           dc.w     t150a-tx1
           dc.w     t151a-tx1
           dc.w     t152a-tx1
           dc.w     t153a-tx1
           dc.w     t154-tx1
           dc.w     t155-tx1
           dc.w     t156-tx1
           dc.w     t157a-tx1
           dc.w     t158-tx1
           dc.w     t159-tx1
           dc.w     t160-tx1
           dc.w     t161-tx1
           dc.w     t162-tx1
           dc.w     t163-tx1
           dc.w     t164-tx1
           dc.w     t165-tx1
           dc.w     t166-tx1
           dc.w     t167-tx1
           dc.w     t168-tx1
           dc.w     t169-tx1
           dc.w     t170-tx1
           dc.w     t171-tx1
           dc.w     t172-tx1
           dc.w     t173-tx1
           dc.w     t174-tx1
           dc.w     t175-tx1
           dc.w     t176-tx1
           dc.w     t177-tx1
           dc.w     t178-tx1
           dc.w     t179-tx1
           dc.w     t180-tx1
           dc.w     t181-tx1
           dc.w     t182-tx1
           dc.w     t183-tx1
           dc.w     t184-tx1
           dc.w     t185-tx1
           dc.w     t186-tx1
           dc.w     t187-tx1
           dc.w     t188-tx1
           dc.w     t189-tx1
           dc.w     t190-tx1
           dc.w     t191-tx1
           dc.w     t192-tx1
*
txt_dat2
tx2        dc.w     t33-tx2
           dc.w     t34-tx2
           dc.w     t35-tx2
           dc.w     t36-tx2
           dc.w     t37-tx2
           dc.w     t38-tx2
           dc.w     t39-tx2
           dc.w     t40-tx2
           dc.w     t41-tx2
           dc.w     t42-tx2
           dc.w     t43-tx2
           dc.w     t44-tx2
           dc.w     t45-tx2
           dc.w     t46-tx2
           dc.w     t47-tx2
           dc.w     t48-tx2
           dc.w     t49-tx2
           dc.w     t50-tx2
           dc.w     t51-tx2
           dc.w     t52-tx2
           dc.w     t53-tx2
           dc.w     t54-tx2
           dc.w     t55-tx2
           dc.w     t56-tx2
           dc.w     t57-tx2
           dc.w     t58-tx2
           dc.w     t59-tx2
           dc.w     t60-tx2
           dc.w     t61-tx2
           dc.w     t62-tx2
           dc.w     t63-tx2
           dc.w     t64-tx2
           dc.w     t65-tx2
           dc.w     t66-tx2
           dc.w     t67-tx2
           dc.w     t68-tx2
           dc.w     t69-tx2
           dc.w     t70-tx2
           dc.w     t71-tx2
           dc.w     t72-tx2
           dc.w     t73-tx2
           dc.w     t74-tx2
           dc.w     t75-tx2
           dc.w     t76-tx2
           dc.w     t77-tx2
           dc.w     t78-tx2
           dc.w     t79-tx2
           dc.w     t80-tx2
           dc.w     t81-tx2
           dc.w     t82-tx2
           dc.w     t83-tx2
           dc.w     t84-tx2
           dc.w     t85-tx2
           dc.w     t86-tx2
           dc.w     t87-tx2
           dc.w     t88-tx2
           dc.w     t89-tx2
           dc.w     t90-tx2
           dc.w     t91-tx2
           dc.w     t92-tx2
           dc.w     t93-tx2
           dc.w     t94-tx2
           dc.w     t95-tx2
           dc.w     t96-tx2
           dc.w     t97-tx2
           dc.w     t98-tx2
           dc.w     t99-tx2
           dc.w     t100-tx2
           dc.w     t101-tx2
           dc.w     t102-tx2
           dc.w     t103-tx2
           dc.w     t104-tx2
           dc.w     t105-tx2
           dc.w     t106-tx2
           dc.w     t107-tx2
           dc.w     t108-tx2
           dc.w     t109-tx2
           dc.w     t110-tx2
           dc.w     t111-tx2
           dc.w     t112-tx2
           dc.w     t113-tx2
           dc.w     t114-tx2
           dc.w     t115-tx2
           dc.w     t116-tx2
           dc.w     t117-tx2
           dc.w     t118-tx2
           dc.w     t119-tx2
           dc.w     t120-tx2
           dc.w     t121-tx2
           dc.w     t122-tx2
           dc.w     t123-tx2
           dc.w     t124-tx2
           dc.w     t125-tx2
           dc.w     t126-tx2
           dc.w     t127-tx2
           dc.w     t128-tx2
           dc.w     t129-tx2
           dc.w     t130-tx2
           dc.w     t131-tx2
           dc.w     t132-tx2
           dc.w     t133-tx2
           dc.w     t134-tx2
           dc.w     t135-tx2
           dc.w     t136-tx2
           dc.w     t137-tx2
           dc.w     t138-tx2
           dc.w     t139-tx2
           dc.w     t140-tx2
           dc.w     t141b-tx2
           dc.w     t142-tx2
           dc.w     t143-tx2
           dc.w     t144b-tx2
           dc.w     t145b-tx2
           dc.w     t146b-tx2
           dc.w     t147b-tx2
           dc.w     t148b-tx2
           dc.w     t149b-tx2
           dc.w     t150b-tx2
           dc.w     t151b-tx2
           dc.w     t152b-tx2
           dc.w     t153b-tx2
           dc.w     t154-tx2
           dc.w     t155-tx2
           dc.w     t156-tx2
           dc.w     t157b-tx2
           dc.w     t158-tx2
           dc.w     t159-tx2
           dc.w     t160-tx2
           dc.w     t161-tx2
           dc.w     t162-tx2
           dc.w     t163-tx2
           dc.w     t164-tx2
           dc.w     t165-tx2
           dc.w     t166-tx2
           dc.w     t167-tx2
           dc.w     t168-tx2
           dc.w     t169-tx2
           dc.w     t170-tx2
           dc.w     t171-tx2
           dc.w     t172-tx2
           dc.w     t173-tx2
           dc.w     t174-tx2
           dc.w     t175-tx2
           dc.w     t176-tx2
           dc.w     t177-tx2
           dc.w     t178-tx2
           dc.w     t179-tx2
           dc.w     t180-tx2
           dc.w     t181-tx2
           dc.w     t182-tx2
           dc.w     t183-tx2
           dc.w     t184-tx2
           dc.w     t185-tx2
           dc.w     t186-tx2
           dc.w     t187-tx2
           dc.w     t188-tx2
           dc.w     t189-tx2
           dc.w     t190-tx2
           dc.w     t191-tx2
           dc.w     t192-tx2
*
           dc.w     0
text_data
t33        dc.b     wrd,0,0,8,0,0        33   !
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,5,0,4
           dc.b     1,3,0,9,0,4
           dc.b     1,3,0,9,0,0
           dc.b     63,3,0,5,0,0
           dc.b     1,3,0,7,0,9
           dc.b     1,3,0,7,0,20
t34        dc.b     wrd,0,0,5,0,0        34   "
           dc.b     1,3,0,4,0,15
           dc.b     63,3,0,4,0,20
           dc.b     1,3,0,9,0,20
           dc.b     1,3,0,9,0,15
t35        dc.b     wrd,0,0,9,0,0        35   #
           dc.b     1,3,0,5,0,0
           dc.b     63,3,0,5,0,20
           dc.b     1,3,0,0,0,15
           dc.b     63,3,0,20,0,15
           dc.b     1,3,0,15,0,20
           dc.b     63,3,0,15,0,0
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,0,0,5
t36        dc.b     wrd,0,0,15,0,0       36   $
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,3,0,10
           dc.b     1,3,0,0,0,13
           dc.b     1,3,0,0,0,17
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,17,0,20
           dc.b     63,3,0,20,0,17
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,10,0,0
t37        dc.b     wrd,0,0,13,0,0       37   %
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,15,0,5
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,20,0,0
           dc.b     63,3,0,15,0,0
           dc.b     1,3,0,0,0,0
           dc.b     63,3,0,20,0,20
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,15
           dc.b     1,3,0,5,0,20
t38        dc.b     wrd,0,0,12,0,0       38   &
           dc.b     1,3,0,20,0,0
           dc.b     1,3,0,5,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,10,0,15
           dc.b     1,3,0,2,0,7
           dc.b     1,3,0,2,0,3
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,10,0,0
           dc.b     1,3,0,15,0,5
           dc.b     1,3,0,20,0,10
t39        dc.b     wrd,0,0,3,0,0        39   '
           dc.b     1,3,0,7,0,15
           dc.b     1,3,0,7,0,20
t40        dc.b     wrd,0,0,5,0,0        40   (
           dc.b     1,3,0,10,0,0
           dc.b     1,3,0,5,0,5
           dc.b     1,3,0,5,0,15
           dc.b     1,3,0,10,0,20
t41        dc.b     wrd,0,0,5,0,0        41   )
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,10,0,5
           dc.b     1,3,0,10,0,15
           dc.b     1,3,0,5,0,20
t42        dc.b     wrd,0,0,7,0,0        42   *
           dc.b     1,3,0,10,0,0
           dc.b     63,3,0,10,0,20
           dc.b     1,3,0,0,0,15
           dc.b     63,3,0,20,0,5
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,0,0,5
t43        dc.b     wrd,0,0,5,0,0        43   +
           dc.b     1,3,0,10,0,0
           dc.b     63,3,0,10,0,20
           dc.b     1,3,0,0,0,10
           dc.b     1,3,0,20,0,10
t44        dc.b     wrd,0,0,3,0,0        44   ,
           dc.b     1,3,0,4,0,0
           dc.b     1,3,0,9,0,5
t45        dc.b     wrd,0,0,3,0,0        45   -
           dc.b     1,3,0,0,0,10
           dc.b     1,3,0,20,0,10
t46        dc.b     wrd,0,0,6,0,0        46   .
           dc.b     1,3,0,9,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,5,0,4
           dc.b     1,3,0,9,0,4
           dc.b     1,3,0,9,0,0
t47        dc.b     wrd,0,0,3,0,0        47   /
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,20,0,20
t48        dc.b     wrd,0,0,11,0,0       48   0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
t49        dc.b     wrd,0,0,4,0,0        49   1
           dc.b     1,3,0,0,0,10
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,10,0,0
t50        dc.b     wrd,0,0,11,0,0       50   2
           dc.b     1,3,0,0,0,17
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,17,0,20
           dc.b     1,3,0,20,0,17
           dc.b     1,3,0,20,0,13
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,3,0,10
           dc.b     1,3,0,0,0,7
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,20,0,0
t51        dc.b     wrd,0,0,10,0,0       51   3
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,20,0,20
           dc.b     1,3,0,10,0,10
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
t52        dc.b     wrd,0,0,5,0,0        52   4
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,20,0,5
t53        dc.b     wrd,0,0,10,0,0       53   5
           dc.b     1,3,0,20,0,20
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,0,0,10
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
t54        dc.b     wrd,0,0,13,0,0       54   6
           dc.b     1,3,0,20,0,17
           dc.b     1,3,0,17,0,20
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,0,0,17
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,3,0,10
           dc.b     1,3,0,0,0,7
t55        dc.b     wrd,0,0,4,0,0        55   7
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,20,0,20
           dc.b     1,3,0,0,0,0
t56        dc.b     wrd,0,0,17,0,0       56   8
           dc.b     1,3,0,3,0,10
           dc.b     1,3,0,0,0,7
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,3,0,10
           dc.b     1,3,0,0,0,13
           dc.b     1,3,0,0,0,17
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,17,0,20
           dc.b     1,3,0,20,0,17
           dc.b     1,3,0,20,0,13
           dc.b     1,3,0,17,0,10
t57        dc.b     wrd,0,0,13,0,0       57   9
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,20,0,17
           dc.b     1,3,0,17,0,20
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,0,0,17
           dc.b     1,3,0,0,0,13
           dc.b     1,3,0,3,0,10
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,20,0,13
t58        dc.b     wrd,0,0,11,0,0       58   :
           dc.b     1,3,0,9,0,10
           dc.b     1,3,0,5,0,10
           dc.b     1,3,0,5,0,14
           dc.b     1,3,0,9,0,14
           dc.b     63,3,0,9,0,10
           dc.b     1,3,0,9,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,5,0,4
           dc.b     1,3,0,9,0,4
           dc.b     1,3,0,9,0,0
t59        dc.b     wrd,0,0,12,0,0       59   ;
           dc.b     1,3,0,9,0,10
           dc.b     1,3,0,5,0,10
           dc.b     1,3,0,5,0,14
           dc.b     1,3,0,9,0,14
           dc.b     63,3,0,9,0,10
           dc.b     1,3,0,9,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,5,0,4
           dc.b     1,3,0,9,0,4
           dc.b     1,3,0,9,0,0
           dc.b     1,3,0,5,255,252
t60        dc.b     wrd,0,0,4,0,0        60   <
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,5,0,10
           dc.b     1,3,0,15,0,20
t61        dc.b     wrd,0,0,5,0,0        61   =
           dc.b     1,3,0,0,0,5
           dc.b     63,3,0,20,0,5
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,0,0,15
t62        dc.b     wrd,0,0,4,0,0        62   >
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,15,0,10
           dc.b     1,3,0,5,0,20
t63        dc.b     wrd,0,0,10,0,0       63   ?
           dc.b     1,3,0,0,0,17
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,17,0,20
           dc.b     1,3,0,20,0,17
           dc.b     1,3,0,20,0,13
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,13,0,10
           dc.b     1,3,0,10,0,7
           dc.b     1,3,0,10,0,0
t64        dc.b     wrd,0,0,16,0,0       64   @
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,20,0,10
           dc.b     1,3,0,15,0,5
           dc.b     1,3,0,15,0,15
           dc.b     1,3,0,10,0,15
           dc.b     1,3,0,5,0,10
           dc.b     1,3,0,10,0,5
           dc.b     1,3,0,15,0,10
t65        dc.b     wrd,0,0,6,0,0        65   A
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,10,0,20
           dc.b     63,3,0,20,0,0
           dc.b     1,3,0,17,0,6
           dc.b     1,3,0,3,0,6
t66        dc.b     wrd,0,0,13,0,0       66   B
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,17,0,20
           dc.b     1,3,0,20,0,17
           dc.b     1,3,0,20,0,13
           dc.b     1,3,0,17,0,10
           dc.b     63,3,0,0,0,10
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,0,0,0
t67        dc.b     wrd,0,0,9,0,0        67   C
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
t68        dc.b     wrd,0,0,8,0,0        68   D
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,0,0,0
t69        dc.b     wrd,0,0,8,0,0        69   E
           dc.b     1,3,0,20,0,0
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,0,0,10
           dc.b     63,3,0,10,0,10
           dc.b     1,3,0,0,0,10
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,20,0,20
t70        dc.b     wrd,0,0,7,0,0        70   F
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,0,0,10
           dc.b     63,3,0,10,0,10
           dc.b     1,3,0,0,0,10
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,20,0,20
t71        dc.b     wrd,0,0,11,0,0       71   G
           dc.b     1,3,0,15,0,7
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
t72        dc.b     wrd,0,0,7,0,0        72   H
           dc.b     1,3,0,0,0,0
           dc.b     63,3,0,0,0,20
           dc.b     1,3,0,0,0,10
           dc.b     63,3,0,20,0,10
           dc.b     1,3,0,20,0,20
           dc.b     1,3,0,20,0,0
t73        dc.b     wrd,0,0,7,0,0        73   I
           dc.b     1,3,0,5,0,0
           dc.b     63,3,0,15,0,0
           dc.b     1,3,0,10,0,0
           dc.b     63,3,0,10,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,5,0,20
t74        dc.b     wrd,0,0,7,0,0        74   J
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,20,0,20
           dc.b     1,3,0,10,0,20
t75        dc.b     wrd,0,0,7,0,0        75   K
           dc.b     1,3,0,0,0,0
           dc.b     63,3,0,0,0,20
           dc.b     1,3,0,20,0,20
           dc.b     63,3,0,0,0,6
           dc.b     1,3,0,6,0,10
           dc.b     1,3,0,20,0,0
t76        dc.b     wrd,0,0,4,0,0        76   L
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,20,0,0
t77        dc.b     wrd,0,0,6,0,0        77   M
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,10,0,10
           dc.b     1,3,0,20,0,20
           dc.b     1,3,0,20,0,0
t78        dc.b     wrd,0,0,5,0,0        78   N
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,20,0,0
           dc.b     1,3,0,20,0,20
t79        dc.b     wrd,0,0,10,0,0       79   O
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,5,0,0
t80        dc.b     wrd,0,0,8,0,0        80   P
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,16,0,20
           dc.b     1,3,0,20,0,16
           dc.b     1,3,0,20,0,10
           dc.b     1,3,0,16,0,6
           dc.b     1,3,0,0,0,6
t81        dc.b     wrd,0,0,13,0,0       81   Q
           dc.b     1,3,0,20,0,0
           dc.b     1,3,0,15,0,5
           dc.b     63,3,0,10,0,5
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,5,0,0
t82        dc.b     wrd,0,0,10,0,0       82   R
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,16,0,20
           dc.b     1,3,0,20,0,16
           dc.b     1,3,0,20,0,10
           dc.b     1,3,0,16,0,6
           dc.b     63,3,0,0,0,6
           dc.b     1,3,0,14,0,6
           dc.b     1,3,0,20,0,0
t83        dc.b     wrd,0,0,13,0,0       83   S
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,3,0,10
           dc.b     1,3,0,0,0,13
           dc.b     1,3,0,0,0,17
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,17,0,20
           dc.b     1,3,0,20,0,17
t84        dc.b     wrd,0,0,5,0,0        84   T
           dc.b     1,3,0,10,0,0
           dc.b     63,3,0,10,0,20
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,20,0,20
t85        dc.b     wrd,0,0,7,0,0        85   U
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,20,0,20
t86        dc.b     wrd,0,0,4,0,0        86   V
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,10,0,0
           dc.b     1,3,0,20,0,20
t87        dc.b     wrd,0,0,6,0,0        87   W
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,10,0,10
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,20,0,20
t88        dc.b     wrd,0,0,5,0,0        88   X
           dc.b     1,3,0,0,0,0
           dc.b     63,3,0,20,0,20
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,20,0,0
t89        dc.b     wrd,0,0,6,0,0        89   Y
           dc.b     1,3,0,10,0,0
           dc.b     1,3,0,10,0,10
           dc.b     63,3,0,0,0,20
           dc.b     1,3,0,10,0,10
           dc.b     1,3,0,20,0,20
t90        dc.b     wrd,0,0,5,0,0        90   Z
           dc.b     1,3,0,20,0,0
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,20,0,20
           dc.b     1,3,0,0,0,20
t91        dc.b     wrd,0,0,5,0,0        91   [
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,10,0,0
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,15,0,20
t92        dc.b     wrd,0,0,3,0,0        92
           dc.b     1,3,0,20,0,0
           dc.b     1,3,0,0,0,20
t93        dc.b     wrd,0,0,5,0,0        93   ]
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,10,0,0
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,5,0,20
t94        dc.b     wrd,0,0,4,0,0        94   ^
           dc.b     1,3,0,5,0,15
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,15,0,15
t95        dc.b     wrd,0,0,3,0,0        95   _
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,20,0,0
t96        dc.b     wrd,0,0,13,0,0       96   `
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,5,0,15
           dc.b     1,3,0,5,0,10
           dc.b     63,3,0,15,0,10
           dc.b     1,3,0,0,0,10
           dc.b     1,3,0,5,0,10
           dc.b     1,3,0,5,0,5
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,20,0,5
t97        dc.b     wrd,0,0,11,0,0       97   a
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     63,3,0,14,0,11
           dc.b     1,3,0,14,0,14
           dc.b     1,3,0,14,0,0
t98        dc.b     wrd,0,0,11,0,0       98   b
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,0,0,3
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,0,0,20
t99        dc.b     wrd,0,0,9,0,0        99   c
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
t100       dc.b     wrd,0,0,11,0,0       100  d
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,11,0,0
           dc.b     63,3,0,14,0,3
           dc.b     1,3,0,14,0,0
           dc.b     1,3,0,14,0,20
t101       dc.b     wrd,0,0,10,0,0       101  e
           dc.b     1,3,0,0,0,7
           dc.b     1,3,0,14,0,7
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,14,0,0
t102       dc.b     wrd,0,0,8,0,0        102  f
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,3,0,11
           dc.b     63,3,0,10,0,11
           dc.b     1,3,0,3,0,11
           dc.b     1,3,0,3,0,17
           dc.b     1,3,0,6,0,20
           dc.b     1,3,0,10,0,20
t103       dc.b     wrd,0,0,12,0,0       103  g
           dc.b     1,3,0,0,255,249
           dc.b     1,3,0,11,255,249
           dc.b     1,3,0,14,255,252
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,14,0,3
t104       dc.b     wrd,0,0,8,0,0        104  h
           dc.b     1,3,0,0,0,20
           dc.b     63,3,0,0,0,0
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,0
t105       dc.b     wrd,0,0,8,0,0        105  i
           dc.b     1,3,0,7,0,0
           dc.b     63,3,0,7,0,11
           dc.b     1,3,0,5,0,15
           dc.b     1,3,0,5,0,19
           dc.b     1,3,0,9,0,19
           dc.b     1,3,0,9,0,15
           dc.b     1,3,0,5,0,15
t106       dc.b     wrd,0,0,5,0,0        106  j
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,7,0,0
           dc.b     1,3,0,10,0,3
           dc.b     1,3,0,10,0,20
t107       dc.b     wrd,0,0,6,0,0        107  k
           dc.b     1,3,0,0,0,0
           dc.b     63,3,0,0,0,20
           dc.b     1,3,0,14,0,14
           dc.b     1,3,0,0,0,7
           dc.b     1,3,0,14,0,0
t108       dc.b     wrd,0,0,6,0,0        108  l
           dc.b     1,3,0,2,0,20
           dc.b     1,3,0,2,0,3
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,9,0,0
           dc.b     1,3,0,12,0,3
t109       dc.b     wrd,0,0,10,0,0       109  m
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,7,0,10
           dc.b     63,3,0,7,0,0
           dc.b     1,3,0,7,0,10
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,0
t110       dc.b     wrd,0,0,8,0,0        110  n
           dc.b     1,3,0,0,0,14
           dc.b     63,3,0,0,0,0
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,0
t111       dc.b     wrd,0,0,10,0,0       111  o
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
t112       dc.b     wrd,0,0,11,0,0       112  p
           dc.b     1,3,0,0,255,249
           dc.b     63,3,0,0,0,14
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
t113       dc.b     wrd,0,0,11,0,0       113  q
           dc.b     1,3,0,14,255,249
           dc.b     63,3,0,14,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,14,0,3
t114       dc.b     wrd,0,0,7,0,0        114  r
           dc.b     1,3,0,0,0,0
           dc.b     63,3,0,0,0,14
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
t115       dc.b     wrd,0,0,9,0,0        115  s
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,10,0,7
           dc.b     1,3,0,4,0,7
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,14,0,14
t116       dc.b     wrd,0,0,8,0,0        116  t
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,3,0,14
           dc.b     63,3,0,10,0,14
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,3,0,3
           dc.b     1,3,0,6,0,0
           dc.b     1,3,0,10,0,0
t117       dc.b     wrd,0,0,8,0,0        117  u
           dc.b     1,3,0,0,0,14
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,11,0,0
           dc.b     63,3,0,14,0,3
           dc.b     1,3,0,14,0,0
           dc.b     1,3,0,14,0,14
t118       dc.b     wrd,0,0,4,0,0        118  v
           dc.b     1,3,0,0,0,14
           dc.b     1,3,0,7,0,0
           dc.b     1,3,0,14,0,14
t119       dc.b     wrd,0,0,10,0,0       119  w
           dc.b     1,3,0,0,0,14
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,7,0,4
           dc.b     63,3,0,7,0,14
           dc.b     1,3,0,7,0,4
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,14,0,14
t120       dc.b     wrd,0,0,5,0,0        120  x
           dc.b     1,3,0,0,0,0
           dc.b     63,3,0,14,0,14
           dc.b     1,3,0,0,0,14
           dc.b     1,3,0,14,0,0
t121       dc.b     wrd,0,0,10,0,0       121  y
           dc.b     1,3,0,0,0,14
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,11,0,0
           dc.b     63,3,0,14,0,3
           dc.b     1,3,0,14,0,14
           dc.b     1,3,0,14,255,252
           dc.b     1,3,0,11,255,249
           dc.b     1,3,0,0,255,249
t122       dc.b     wrd,0,0,5,0,0        122  z
           dc.b     1,3,0,0,0,14
           dc.b     1,3,0,14,0,14
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,14,0,0
t123       dc.b     wrd,0,0,8,0,0        123  {
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,10,0,15
           dc.b     1,3,0,10,0,10
           dc.b     63,3,0,5,0,10
           dc.b     1,3,0,10,0,10
           dc.b     1,3,0,10,0,5
           dc.b     1,3,0,15,0,0
t124       dc.b     wrd,0,0,3,0,0        124
           dc.b     1,3,0,10,0,0
           dc.b     1,3,0,10,0,20
t125       dc.b     wrd,0,0,8,0,0        125  }
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,10,0,15
           dc.b     1,3,0,10,0,10
           dc.b     63,3,0,15,0,10
           dc.b     1,3,0,10,0,10
           dc.b     1,3,0,10,0,5
           dc.b     1,3,0,5,0,0
t126       dc.b     wrd,0,0,5,0,0        126  ~
           dc.b     1,3,0,0,0,21
           dc.b     1,3,0,4,0,25
           dc.b     1,3,0,10,0,19
           dc.b     1,3,0,14,0,23
t127       dc.b     wrd,0,0,16,0,0       127  
           dc.b     1,3,0,13,0,5
           dc.b     1,3,0,8,0,5
           dc.b     1,3,0,5,0,8
           dc.b     1,3,0,5,0,12
           dc.b     1,3,0,8,0,15
           dc.b     63,3,0,13,0,15
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
t128       dc.b     wrd,0,0,15,0,0       128
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     63,3,0,14,0,11
           dc.b     1,3,0,14,0,14
           dc.b     63,3,0,14,0,0
           dc.b     1,3,0,0,0,20
           dc.b     63,3,0,0,0,20
           dc.b     1,3,0,14,0,20
           dc.b     1,3,0,14,0,20
t129       dc.b     wrd,0,0,15,0,0       129
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     63,3,0,14,0,11
           dc.b     1,3,0,14,0,14
           dc.b     63,3,0,14,0,0
           dc.b     1,3,0,0,0,21
           dc.b     1,3,0,4,0,25
           dc.b     1,3,0,10,0,19
           dc.b     1,3,0,14,0,23
t130       dc.b     wrd,0,0,16,0,0       130
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     63,3,0,14,0,11
           dc.b     1,3,0,14,0,14
           dc.b     63,3,0,14,0,0
           dc.b     1,3,0,4,0,19
           dc.b     1,3,0,4,0,25
           dc.b     1,3,0,10,0,25
           dc.b     1,3,0,10,0,19
           dc.b     1,3,0,4,0,19
t131       dc.b     wrd,0,0,12,0,0       131
           dc.b     1,3,0,0,0,7
           dc.b     1,3,0,14,0,7
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,14,0,0
           dc.b     1,3,0,4,0,19
           dc.b     1,3,0,10,0,25
t132       dc.b     wrd,0,0,14,0,0       132
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,0,0,3
           dc.b     1,3,0,0,0,20
           dc.b     63,3,0,0,0,20
           dc.b     1,3,0,14,0,20
           dc.b     1,3,0,14,0,20
t133       dc.b     wrd,0,0,14,0,0       133
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,0,0,3
           dc.b     1,3,0,0,0,21
           dc.b     1,3,0,4,0,25
           dc.b     1,3,0,10,0,19
           dc.b     1,3,0,14,0,23
t134       dc.b     wrd,0,0,12,0,0       134
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,0,0,3
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,14,0,14
t135       dc.b     wrd,0,0,12,0,0       135
           dc.b     1,3,0,0,0,14
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,11,0,0
           dc.b     63,3,0,14,0,3
           dc.b     1,3,0,14,0,0
           dc.b     63,3,0,14,0,14
           dc.b     1,3,0,0,0,20
           dc.b     63,3,0,0,0,20
           dc.b     1,3,0,14,0,20
           dc.b     1,3,0,14,0,20
t136       dc.b     wrd,0,0,12,0,0       136
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     63,3,0,14,0,11
           dc.b     1,3,0,7,0,0
           dc.b     1,3,0,7,255,249
           dc.b     1,3,0,3,255,249
t137       dc.b     wrd,0,0,12,0,0       137
           dc.b     1,3,0,0,0,14
           dc.b     63,3,0,0,0,0
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     63,3,0,14,0,0
           dc.b     1,3,0,0,0,21
           dc.b     1,3,0,4,0,25
           dc.b     1,3,0,10,0,19
           dc.b     1,3,0,14,0,23
t138       dc.b     wrd,0,0,17,0,0       138
           dc.b     1,3,0,0,0,14
           dc.b     1,3,0,7,0,14
           dc.b     1,3,0,10,0,11
           dc.b     1,3,0,10,0,3
           dc.b     1,3,0,7,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,4,0,7
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,20,0,11
           dc.b     1,3,0,17,0,14
           dc.b     1,3,0,13,0,14
           dc.b     63,3,0,10,0,11
           dc.b     1,3,0,10,0,3
           dc.b     1,3,0,13,0,0
           dc.b     1,3,0,20,0,0
t139       dc.b     wrd,0,0,18,0,0       139
           dc.b     1,3,0,10,0,11
           dc.b     1,3,0,7,0,14
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,7,0,0
           dc.b     63,3,0,10,0,3
           dc.b     1,3,0,10,0,7
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,20,0,11
           dc.b     1,3,0,17,0,14
           dc.b     1,3,0,13,0,14
           dc.b     1,3,0,10,0,11
           dc.b     1,3,0,10,0,3
           dc.b     1,3,0,13,0,0
           dc.b     1,3,0,20,0,0
t140       dc.b     wrd,0,0,13,0,0       140
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     63,3,0,14,0,11
           dc.b     1,3,0,14,0,14
           dc.b     63,3,0,14,0,0
           dc.b     1,3,0,4,0,19
           dc.b     1,3,0,10,0,25
*
t141a      dc.b     wrd,0,0,7,0,0        141
           dc.b     1,0,0,0,0,0
           dc.b     1,0,0,15,0,0
           dc.b     63,0,0,15,0,20
           dc.b     1,0,0,20,0,20
           dc.b     1,0,0,5,0,20
           dc.b     1,0,0,5,0,0
*
t141b      dc.b     wrd,0,0,13,0,0       141
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     63,3,0,14,0,11
           dc.b     1,3,0,14,0,14
           dc.b     63,3,0,14,0,0
           dc.b     1,3,0,10,0,19
           dc.b     1,3,0,4,0,25
*
t142       dc.b     wrd,0,0,14,0,0       142
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     63,3,0,14,0,11
           dc.b     1,3,0,14,0,14
           dc.b     63,3,0,14,0,0
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,7,0,24
           dc.b     1,3,0,11,0,20
t143       dc.b     wrd,0,0,14,0,0       143
           dc.b     1,3,0,0,0,7
           dc.b     1,3,0,14,0,7
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,14,0,0
           dc.b     1,3,0,0,0,20
           dc.b     63,3,0,0,0,20
           dc.b     1,3,0,14,0,20
           dc.b     1,3,0,14,0,20
t144a      dc.b     wrd,0,0,4,0,0        144
           dc.b     1,0,0,0,0,20
           dc.b     1,0,0,20,0,20
           dc.b     1,0,0,20,0,0
t145a      dc.b     wrd,0,0,5,0,0        145
           dc.b     1,0,0,0,0,0
           dc.b     1,0,0,0,0,20
           dc.b     1,0,0,20,0,10
           dc.b     1,0,0,0,0,0
t146a      dc.b     wrd,0,0,5,0,0        146
           dc.b     1,0,0,20,0,0
           dc.b     1,0,0,20,0,20
           dc.b     1,0,0,0,0,10
           dc.b     1,0,0,20,0,0
t147a      dc.b     wrd,0,0,10,0,0       147
           dc.b     1,0,0,0,0,0
           dc.b     1,0,0,10,0,0
           dc.b     1,0,0,0,0,10
           dc.b     1,0,0,10,0,20
           dc.b     1,0,0,20,0,10
           dc.b     63,0,0,0,0,10
           dc.b     1,0,0,20,0,10
           dc.b     1,0,0,10,0,0
           dc.b     1,0,0,20,0,0
t148a      dc.b     wrd,0,0,10,0,0       148
           dc.b     1,0,0,0,0,20
           dc.b     1,0,0,10,0,20
           dc.b     1,0,0,0,0,10
           dc.b     1,0,0,10,0,0
           dc.b     1,0,0,20,0,10
           dc.b     63,0,0,0,0,10
           dc.b     1,0,0,20,0,10
           dc.b     1,0,0,10,0,20
           dc.b     1,0,0,20,0,20
t149a      dc.b     wrd,0,0,6,0,0        149
           dc.b     1,0,0,10,0,0
           dc.b     1,0,0,0,0,10
           dc.b     1,0,0,10,0,20
           dc.b     1,0,0,20,0,10
           dc.b     1,0,0,10,0,0
t150a      dc.b     wrd,0,0,8,0,0        150
           dc.b     1,0,0,0,0,20
           dc.b     1,0,0,10,0,20
           dc.b     1,0,0,0,0,10
           dc.b     1,0,0,10,0,0
           dc.b     1,0,0,20,0,10
           dc.b     1,0,0,10,0,20
           dc.b     1,0,0,20,0,20
t151a      dc.b     wrd,0,0,8,0,0        151
           dc.b     1,0,0,0,0,0
           dc.b     1,0,0,10,0,0
           dc.b     1,0,0,0,0,10
           dc.b     1,0,0,10,0,20
           dc.b     1,0,0,20,0,10
           dc.b     1,0,0,10,0,0
           dc.b     1,0,0,20,0,0
t152a      dc.b     wrd,0,0,7,0,0        152
           dc.b     1,0,0,0,0,0
           dc.b     1,0,0,0,0,15
           dc.b     1,0,0,5,0,20
           dc.b     1,0,0,15,0,20
           dc.b     1,0,0,20,0,15
           dc.b     1,0,0,20,0,0
t153a      dc.b     wrd,0,0,5,0,0        153
           dc.b     1,0,0,0,0,20
           dc.b     1,0,0,10,0,0
           dc.b     1,0,0,20,0,20
           dc.b     1,0,0,0,0,20
*
t144b      dc.b     wrd,0,0,12,0,0       144
           dc.b     1,3,0,0,0,7
           dc.b     1,3,0,14,0,7
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,14,0,0
           dc.b     1,3,0,4,0,25
           dc.b     1,3,0,10,0,19
t145b      dc.b     wrd,0,0,13,0,0       145
           dc.b     1,3,0,0,0,7
           dc.b     1,3,0,14,0,7
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,14,0,0
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,7,0,24
           dc.b     1,3,0,11,0,20
t146b      dc.b     wrd,0,0,7,0,0        146
           dc.b     1,3,0,7,0,0
           dc.b     63,3,0,7,0,14
           dc.b     1,3,0,0,0,20
           dc.b     63,3,0,0,0,20
           dc.b     1,3,0,14,0,20
           dc.b     1,3,0,14,0,20
t147b      dc.b     wrd,0,0,5,0,0        147
           dc.b     1,3,0,7,0,0
           dc.b     63,3,0,7,0,14
           dc.b     1,3,0,4,0,19
           dc.b     1,3,0,10,0,25
t148b      dc.b     wrd,0,0,5,0,0        148
           dc.b     1,3,0,7,0,0
           dc.b     63,3,0,7,0,14
           dc.b     1,3,0,4,0,25
           dc.b     1,3,0,10,0,19
t149b      dc.b     wrd,0,0,6,0,0        149
           dc.b     1,3,0,7,0,0
           dc.b     63,3,0,7,0,14
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,7,0,24
           dc.b     1,3,0,11,0,20
t150b      dc.b     wrd,0,0,12,0,0       150
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,0,0,3
           dc.b     1,3,0,4,0,19
           dc.b     1,3,0,10,0,25
t151b      dc.b     wrd,0,0,12,0,0       151
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,0,0,3
           dc.b     1,3,0,4,0,25
           dc.b     1,3,0,10,0,19
t152b      dc.b     wrd,0,0,13,0,0       152
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,0,0,3
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,7,0,24
           dc.b     1,3,0,11,0,20
t153b      dc.b     wrd,0,0,10,0,0       153
           dc.b     1,3,0,0,0,14
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,11,0,0
           dc.b     63,3,0,14,0,3
           dc.b     1,3,0,14,0,0
           dc.b     63,3,0,14,0,14
           dc.b     1,3,0,4,0,19
           dc.b     1,3,0,10,0,25
*
t154       dc.b     wrd,0,0,10,0,0       154
           dc.b     1,3,0,0,0,14
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,11,0,0
           dc.b     63,3,0,14,0,3
           dc.b     1,3,0,14,0,0
           dc.b     63,3,0,14,0,14
           dc.b     1,3,0,4,0,25
           dc.b     1,3,0,10,0,19
t155       dc.b     wrd,0,0,11,0,0       155
           dc.b     1,3,0,0,0,14
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,11,0,0
           dc.b     63,3,0,14,0,3
           dc.b     1,3,0,14,0,0
           dc.b     63,3,0,14,0,14
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,7,0,24
           dc.b     1,3,0,11,0,20
t156       dc.b     wrd,0,0,15,0,0       156
           dc.b     1,3,0,0,255,249
           dc.b     1,3,0,0,0,17
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,14,0,20
           dc.b     1,3,0,17,0,17
           dc.b     1,3,0,17,0,13
           dc.b     1,3,0,14,0,10
           dc.b     63,3,0,0,0,10
           dc.b     1,3,0,14,0,10
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,5,0,0
*
t157a      dc.b     wrd,0,0,7,0,0        157
           dc.b     1,0,0,0,0,0
           dc.b     1,0,0,5,0,0
           dc.b     1,0,0,5,0,20
           dc.b     1,0,0,15,0,20
           dc.b     1,0,0,15,0,0
           dc.b     1,0,0,20,0,0
t157b      dc.b     wrd,0,0,11,0,0       157
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     63,3,0,14,0,11
           dc.b     1,3,0,11,0,20
           dc.b     1,3,0,11,255,250
*
t158       dc.b     wrd,0,0,12,0,0       158
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,10,0,13
           dc.b     63,3,0,17,0,20
           dc.b     1,3,0,10,0,13
           dc.b     63,3,0,10,0,8
           dc.b     1,3,0,5,0,8
           dc.b     63,3,0,15,0,8
           dc.b     1,3,0,10,0,8
           dc.b     63,3,0,10,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,15,0,0
t159       dc.b     wrd,0,0,11,0,0       159
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,20,0,0
t160       dc.b     wrd,0,0,10,0,0       160
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,10,0,20
           dc.b     63,3,0,20,0,0
           dc.b     1,3,0,15,0,10
           dc.b     63,3,0,5,0,10
           dc.b     1,3,0,3,0,26
           dc.b     63,3,0,3,0,26
           dc.b     1,3,0,17,0,26
           dc.b     1,3,0,17,0,26
t161       dc.b     wrd,0,0,10,0,0       161
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,10,0,20
           dc.b     63,3,0,20,0,0
           dc.b     1,3,0,15,0,10
           dc.b     63,3,0,5,0,10
           dc.b     1,3,0,3,0,27
           dc.b     1,3,0,7,0,31
           dc.b     1,3,0,13,0,25
           dc.b     1,3,0,17,0,29
t162       dc.b     wrd,0,0,11,0,0       162
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,10,0,20
           dc.b     63,3,0,20,0,0
           dc.b     1,3,0,15,0,10
           dc.b     63,3,0,5,0,10
           dc.b     1,3,0,7,0,25
           dc.b     1,3,0,7,0,31
           dc.b     1,3,0,13,0,31
           dc.b     1,3,0,13,0,25
           dc.b     1,3,0,7,0,25
t163       dc.b     wrd,0,0,10,0,0       163
           dc.b     1,3,0,20,0,0
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,0,0,10
           dc.b     63,3,0,10,0,10
           dc.b     1,3,0,0,0,10
           dc.b     1,3,0,0,0,20
           dc.b     63,3,0,20,0,20
           dc.b     1,3,0,7,0,25
           dc.b     1,3,0,13,0,31
t164       dc.b     wrd,0,0,14,0,0       164
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     63,3,0,5,0,0
           dc.b     1,3,0,3,0,26
           dc.b     63,3,0,3,0,26
           dc.b     1,3,0,17,0,26
           dc.b     1,3,0,17,0,26
t165       dc.b     wrd,0,0,14,0,0       165
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     63,3,0,5,0,0
           dc.b     1,3,0,3,0,27
           dc.b     1,3,0,7,0,31
           dc.b     1,3,0,13,0,25
           dc.b     1,3,0,17,0,29
t166       dc.b     wrd,0,0,12,0,0       166
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     63,3,0,5,0,0
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,20,0,20
t167       dc.b     wrd,0,0,11,0,0       167
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,20,0,5
           dc.b     63,3,0,20,0,20
           dc.b     1,3,0,3,0,26
           dc.b     63,3,0,3,0,26
           dc.b     1,3,0,17,0,26
           dc.b     1,3,0,17,0,26
t168       dc.b     wrd,0,0,12,0,0       168
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     63,3,0,20,0,15
           dc.b     1,3,0,10,0,0
           dc.b     1,3,0,10,255,249
           dc.b     1,3,0,6,255,249
t169       dc.b     wrd,0,0,9,0,0        169
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,0,0,20
           dc.b     1,3,0,20,0,0
           dc.b     63,3,0,20,0,20
           dc.b     1,3,0,3,0,27
           dc.b     1,3,0,7,0,31
           dc.b     1,3,0,13,0,25
           dc.b     1,3,0,17,0,29
t170       dc.b     wrd,0,0,9,0,0        170
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,5,0,20
           dc.b     63,3,0,20,0,20
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,10,0,0
           dc.b     63,3,0,20,0,0
           dc.b     1,3,0,20,0,10
           dc.b     1,3,0,3,0,10
t171       dc.b     wrd,0,0,11,0,0       171
           dc.b     1,3,0,20,0,0
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     63,3,0,20,0,20
           dc.b     1,3,0,10,0,20
           dc.b     63,3,0,10,0,0
           dc.b     1,3,0,20,0,10
           dc.b     1,3,0,10,0,10
t172       dc.b     wrd,0,0,15,0,0       172
           dc.b     1,3,0,20,0,14
           dc.b     1,3,0,17,0,14
           dc.b     1,3,0,12,0,9
           dc.b     1,3,0,12,0,5
           dc.b     1,3,0,7,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,7,0,14
           dc.b     63,3,0,12,0,9
           dc.b     1,3,0,12,0,5
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,20,0,0
t173       dc.b     wrd,0,0,15,0,0       173
           dc.b     1,3,0,20,0,17
           dc.b     1,3,0,17,0,20
           dc.b     1,3,0,3,0,20
           dc.b     1,3,0,0,0,17
           dc.b     1,3,0,0,0,13
           dc.b     1,3,0,3,0,10
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,20,0,7
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,7
           dc.b     1,3,0,3,0,10
t174       dc.b     wrd,0,0,12,0,0       174
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,15
           dc.b     1,3,0,5,0,20
           dc.b     1,3,0,15,0,20
           dc.b     1,3,0,20,0,15
           dc.b     1,3,0,20,0,5
           dc.b     1,3,0,15,0,0
           dc.b     63,3,0,5,0,0
           dc.b     1,3,0,0,0,10
           dc.b     1,3,0,20,0,10
t175       dc.b     wrd,0,0,5,0,0        175
           dc.b     1,3,0,5,0,20
           dc.b     63,3,0,15,0,0
           dc.b     1,3,0,12,0,6
           dc.b     1,3,0,6,0,0
t176       dc.b     wrd,0,0,7,0,0        176
           dc.b     1,3,0,0,255,249
           dc.b     63,3,0,0,0,14
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,14,0,14
t177       dc.b     wrd,0,0,9,0,0        177
           dc.b     1,3,0,5,0,0
           dc.b     1,3,0,5,0,14
           dc.b     63,3,0,0,0,11
           dc.b     1,3,0,5,0,14
           dc.b     1,3,0,15,0,14
           dc.b     63,3,0,15,0,0
           dc.b     1,3,0,15,0,14
           dc.b     1,3,0,20,0,14
t178       dc.b     wrd,0,0,12,0,0       178
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,0,0,3
           dc.b     1,3,0,7,0,20
           dc.b     1,3,0,7,255,250
t179       dc.b     wrd,0,0,5,0,0        179
           dc.b     1,3,0,7,0,0
           dc.b     63,3,0,7,0,14
           dc.b     1,3,0,7,0,20
           dc.b     1,3,0,7,0,20
t180       dc.b     wrd,0,0,10,0,0       180
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,7
           dc.b     1,3,0,3,0,10
           dc.b     1,3,0,7,0,10
           dc.b     1,3,0,10,0,13
           dc.b     1,3,0,10,0,20
t181       dc.b     wrd,0,0,15,0,0       181
           dc.b     1,3,0,20,0,3
           dc.b     1,3,0,17,0,0
           dc.b     1,3,0,3,0,0
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,7
           dc.b     1,3,0,3,0,10
           dc.b     1,3,0,17,0,10
           dc.b     1,3,0,20,0,13
           dc.b     1,3,0,20,0,17
           dc.b     1,3,0,17,0,20
           dc.b     1,3,0,3,0,20
           dc.b     63,3,0,0,0,17
           dc.b     1,3,0,10,255,250
           dc.b     1,3,0,10,255,250
t182       dc.b     wrd,0,0,25,0,0       182
           dc.b     1,3,0,18,0,18
           dc.b     1,3,0,16,0,20
           dc.b     1,3,0,12,0,20
           dc.b     1,3,0,10,0,18
           dc.b     1,3,0,10,0,14
           dc.b     1,3,0,12,0,12
           dc.b     1,3,0,16,0,12
           dc.b     1,3,0,18,0,10
           dc.b     1,3,0,18,0,6
           dc.b     1,3,0,16,0,4
           dc.b     1,3,0,12,0,4
           dc.b     1,3,0,10,0,6
           dc.b     1,3,0,10,0,2
           dc.b     1,3,0,8,0,0
           dc.b     1,3,0,5,0,0
           dc.b     63,3,0,3,0,2
           dc.b     1,3,0,10,0,6
           dc.b     1,3,0,8,0,8
           dc.b     1,3,0,5,0,8
           dc.b     1,3,0,3,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,5,0,16
           dc.b     1,3,0,8,0,16
           dc.b     1,3,0,11,0,13
t183       dc.b     wrd,0,0,18,0,0       183
           dc.b     1,3,0,0,0,3
           dc.b     1,3,0,0,0,11
           dc.b     1,3,0,3,0,14
           dc.b     1,3,0,11,0,14
           dc.b     1,3,0,14,0,11
           dc.b     1,3,0,14,0,3
           dc.b     1,3,0,11,0,0
           dc.b     1,3,0,3,0,0
           dc.b     63,3,0,0,0,3
           dc.b     1,3,0,0,0,20
           dc.b     63,3,0,0,0,20
           dc.b     1,3,0,14,0,20
           dc.b     63,3,0,14,0,20
           dc.b     1,3,0,14,255,250
           dc.b     63,3,0,14,255,250
           dc.b     1,3,0,0,255,250
           dc.b     1,3,0,0,255,250
t184       dc.b     wrd,0,0,7,0,0        184
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,0,0,10
           dc.b     63,3,0,10,0,0
           dc.b     1,3,0,20,0,0
           dc.b     1,3,0,10,0,10
           dc.b     1,3,0,20,0,20
t185       dc.b     wrd,0,0,7,0,0        185
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,20,0,10
           dc.b     63,3,0,10,0,0
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,10,0,10
           dc.b     1,3,0,0,0,20
t186       dc.b     wrd,0,0,6,0,0        186
           dc.b     1,3,0,7,0,14
           dc.b     1,3,0,7,0,20
           dc.b     1,3,0,13,0,20
           dc.b     1,3,0,13,0,14
           dc.b     1,3,0,7,0,14
t187       dc.b     wrd,0,0,7,0,0        187
           dc.b     1,3,0,0,0,10
           dc.b     63,3,0,20,0,10
           dc.b     1,3,0,10,0,20
           dc.b     63,3,0,10,0,20
           dc.b     1,3,0,10,0,0
           dc.b     1,3,0,10,0,0
t188       dc.b     wrd,0,0,6,0,0        188
           dc.b     1,3,0,0,0,10
           dc.b     1,3,0,5,0,5
           dc.b     1,3,0,5,0,15
           dc.b     1,3,0,0,0,10
           dc.b     1,3,0,20,0,10
t189       dc.b     wrd,0,0,6,0,0        189
           dc.b     1,3,0,20,0,10
           dc.b     1,3,0,15,0,15
           dc.b     1,3,0,15,0,5
           dc.b     1,3,0,20,0,10
           dc.b     1,3,0,0,0,10
t190       dc.b     wrd,0,0,6,0,0        190
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,5,0,15
           dc.b     1,3,0,15,0,15
           dc.b     1,3,0,10,0,20
           dc.b     1,3,0,10,0,0
t191       dc.b     wrd,0,0,6,0,0        191
           dc.b     1,3,0,10,0,0
           dc.b     1,3,0,15,0,5
           dc.b     1,3,0,5,0,5
           dc.b     1,3,0,10,0,0
           dc.b     1,3,0,10,0,20
t192       dc.b     wrd,0,0,5,0,0        192 special case
           dc.b     1,3,0,0,0,5
           dc.b     1,3,0,0,0,0
           dc.b     1,3,0,20,0,0
           dc.b     1,3,0,20,0,5
           dc.b     255,255,255,255,255,255
           end

