home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / apps / dtp / pgsmodst / atariimp / wordperf.s < prev   
Text File  |  1991-05-23  |  10KB  |  663 lines

  1.  Include "equ.h"
  2.  Include "impequ.h"
  3.  
  4. TAB    equ    9
  5. CR    equ    $d
  6. LF    equ    $a
  7. FF    equ    $c
  8. ESC    equ    $1b
  9.  
  10.  SECTION wp,CODE,PUBLIC
  11.  
  12. ***************************************************
  13. ***                        ***
  14. ***************************************************
  15. dumbentry:
  16.     clr.l    d0
  17.     rts
  18.  
  19.     dc.l    "IMPT"
  20.     dc.w    200
  21.     dc.l    0
  22.  
  23. table:    dc.l    0
  24.     dc.l    name,special,check,wp        ;Word Perfect
  25.  
  26. *
  27. * Word Perfect
  28. *
  29. check:    move.l    table,a0
  30.     move.l    buff1(a0),a1
  31.     move.l    (a1),a1
  32.     cmp.b    #$80,(a1)+
  33.     bne    never
  34.     cmp.b    #$80,(a1)+
  35.     bne    never
  36.  
  37.     moveq    #2,d0
  38. irts:    rts
  39.  
  40.  
  41. ***
  42. *** Text File Import
  43. ***
  44.  
  45. *
  46. * Word Perfect
  47. *
  48. wp:    move.l    table,a0
  49.     move.l    f_openr(a0),a0
  50.     jsr    (a0)
  51.     beq    ascii9
  52.  
  53.     move.l    table,a0
  54.     move.l    t_open(a0),a0
  55.     jsr    (a0)
  56.     beq    ascii9
  57.  
  58.     clr.w    attrb
  59.     clr.w    lin
  60.     clr.w    rin
  61.     clr.w    bmod
  62.  
  63. ascii1:    bsr    tget
  64.     beq    ascii9
  65.  
  66.     lea    commands,a0
  67. ascii2:    move.b    (a0),d1
  68.     beq    ascii3
  69.     cmp.b    d0,d1
  70.     beq    docmd
  71.     addq.l    #6,a0
  72.     bra    ascii2
  73.  
  74. ascii3:    cmp.b    #$c0,d0
  75.     bcc    skipto
  76.     cmp.b    #$20,d0
  77.     bcs    ascii1
  78.     cmp.b    #$80,d0
  79.     bcc    ascii1
  80.  
  81.     bsr    tput
  82.     beq    ascii9
  83.     bra    ascii1
  84.  
  85. skipto:    move.b    d0,temp
  86. skpto1:    bsr    tget
  87.     beq    ascii9
  88.     cmp.b    temp,d0
  89.     bne    skpto1
  90.     bra    ascii1
  91.  
  92. docmd:    move.l    2(a0),a0
  93.     jmp    (a0)
  94.  
  95. *
  96. * end of input file.  close and flush buffer
  97. *
  98. ascii9:    move.l    table,a0
  99.     move.l    f_closer(a0),a0
  100.     jsr    (a0)
  101.  
  102.     move.l    table,a0
  103.     move.l    t_close(a0),a0
  104.     jmp    (a0)
  105.  
  106. *
  107. *
  108. dospace:
  109.     move.b    #$20,d0
  110.     bsr    tput
  111.     beq    ascii9
  112.     bra    ascii1
  113.  
  114.  
  115. docr:    move.w    #CMD_CR,d0
  116.     bsr    tputw
  117.     beq    ascii9
  118.     bra    ascii1
  119.  
  120.  
  121. dotab:    move.w    #CMD_TAB,d0
  122.     bsr    tputw
  123.     beq    ascii9
  124.     bra    ascii1
  125.  
  126. dodash:    move.b    #"-",d0
  127.     bsr    tput
  128.     beq    ascii9
  129.     bra    ascii1
  130.  
  131. extended:
  132.     bsr    tget
  133.     beq    ascii9
  134.     and.w    #$ff,d0
  135.     lea    ktoi,a0
  136.     move.b    0(a0,d0.w),d0
  137.     beq    extend1
  138.     bsr    tput
  139. extend1:
  140.     bsr    tget
  141.     beq    ascii9
  142.     bra    ascii1
  143.  
  144. domhyp:
  145.     move.w    #CMD_IMH,d0
  146.     bsr    tputw
  147.     beq    ascii9
  148.     bra    ascii1
  149.  
  150. superscript:
  151.     add.w    #400,bmod
  152. script:    move.w    #CMD_BMOD,d0
  153.     bsr    tputw
  154.     beq    ascii9
  155.     move.w    bmod,d0
  156.     bsr    tputw
  157.     beq    ascii9
  158.     bra    ascii1
  159.  
  160.  
  161. subscript:
  162.     sub.w    #400,bmod
  163.     bra    script
  164.  
  165.  
  166. leftj:    move.w    #CMD_JST,d0
  167.     bsr    tputw
  168.     beq    ascii9
  169.     moveq    #0,d0
  170.     move.b    d0,justify
  171.     bsr    tput
  172.     beq    ascii9
  173.     bra    ascii1
  174.  
  175.  
  176. centerj:
  177.     move.w    #CMD_JST,d0
  178.     bsr    tputw
  179.     beq    ascii9
  180.     moveq    #1,d0
  181.     bsr    tput
  182.     beq    ascii9
  183.  
  184. ctrj0:    bsr    tget
  185.     beq    ascii9
  186.     cmp.b    #$c3,d0
  187.     bne    ctrj0
  188.     bra    ascii1
  189.  
  190. rightj:    move.w    #CMD_JST,d0
  191.     bsr    tputw
  192.     beq    ascii9
  193.     moveq    #2,d0
  194.     bsr    tput
  195.     beq    ascii9
  196.  
  197. rhtj0:    bsr    tget
  198.     beq    ascii9
  199.     cmp.b    #$c4,d0
  200.     bne    rhtj0
  201.  
  202.  
  203. prevj:    move.w    #CMD_JST,d0
  204.     bsr    tputw
  205.     beq    ascii9
  206.     move.b    justify,d0
  207.     bsr    tput
  208.     beq    ascii9
  209.     bra    ascii1
  210.  
  211.  
  212. charj:    move.w    #CMD_JST,d0
  213.     bsr    tputw
  214.     beq    ascii9
  215.     moveq    #3,d0
  216.     move.b    d0,justify
  217.     bsr    tput
  218.     beq    ascii9
  219.     bra    ascii1
  220.  
  221. margin:    bsr    tget
  222.     beq    ascii9
  223.     bsr    tget
  224.     beq    ascii9
  225.  
  226.     bsr    tget
  227.     beq    ascii9
  228.     and.w    #$ff,d0
  229.     mulu    #720,d0
  230.     move.w    d0,lin
  231.     bsr    tget
  232.     beq    ascii9
  233.     and.w    #$ff,d0
  234.     mulu    #720,d0
  235.     move.w    d0,rin
  236.     bsr    tget
  237.     beq    ascii9
  238. ;    cmp.b    #$c0,d0
  239. ;    bne    ascii9
  240. ;    move.w    #CMD_IN,d0
  241. ;    bsr    tputw
  242. ;    beq    ascii9
  243. ;    move.w    lin,d0
  244. ;    bsr    tputw
  245. ;    beq    ascii9
  246. ;    move.w    rin,d0
  247. ;    bsr    tputw
  248. ;    beq    ascii9
  249.     bra    ascii1
  250.  
  251. lindent:
  252.     bsr    tget
  253.     beq    ascii9
  254.     and.w    #$ff,d0
  255.     mulu    #720,d0
  256.     move.w    lin,d1
  257.     sub.w    d0,d1
  258.     bcc    lin1
  259.     moveq    #0,d1
  260. lin1:    move.w    d1,lin
  261.  
  262.     bsr    tget
  263.     beq    ascii9
  264.     cmp.b    #$c2,d0
  265.     bne    ascii9
  266.     move.w    #CMD_IN,d0
  267.     bsr    tputw
  268.     beq    ascii9
  269.     move.w    lin,d0
  270.     bsr    tputw
  271.     beq    ascii9
  272.     move.w    rin,d0
  273.     bsr    tputw
  274.     beq    ascii9
  275.     bra    ascii1
  276.  
  277.  
  278. linespacing:
  279.     bsr    tget
  280.     beq    ascii9
  281.     and.w    #$ff,d0
  282.     mulu    #600,d0
  283.     move.w    d1,lspac
  284.  
  285.     bsr    tget
  286.     beq    ascii9
  287.     cmp.b    #$c1,d0
  288.     bne    ascii9
  289.     move.w    #CMD_LSP,d0
  290.     bsr    tputw
  291.     beq    ascii9
  292.     move.w    lspac,d0
  293.     sub.w    #1200,d0
  294.     bsr    tputw
  295.     beq    ascii9
  296.     bra    ascii1
  297.  
  298.  
  299. tlindent:
  300.     bsr    tget
  301.     beq    ascii9
  302.     and.w    #$ff,d0
  303.     mulu    #600,d0
  304.     move.w    d0,temp
  305.     bsr    tget
  306.     beq    ascii9
  307.     and.w    #$ff,d0
  308.     mulu    #600,d0
  309.     sub.w    temp,d0
  310.     move.w    d0,lin
  311.  
  312.     bsr    tget
  313.     beq    ascii9
  314.     cmp.b    #$cc,d0
  315.     bne    ascii9
  316.     move.w    #CMD_IN,d0
  317.     bsr    tputw
  318.     beq    ascii9
  319.     move.w    lin,d0
  320.     bsr    tputw
  321.     beq    ascii9
  322.     move.w    rin,d0
  323.     bsr    tputw
  324.     beq    ascii9
  325.     bra    ascii1
  326.  
  327. tmargin:
  328.     bsr    tget
  329.     beq    ascii9
  330.     bsr    tget
  331.     beq    ascii9
  332.     and.w    #$ff,d0
  333.     mulu    #600,d0
  334.     move.w    d0,lin
  335.     move.w    d0,rin
  336.  
  337.     bsr    tget
  338.     beq    ascii9
  339.     cmp.b    #$e0,d0
  340.     bne    ascii9
  341.     move.w    #CMD_IN,d0
  342.     bsr    tputw
  343.     beq    ascii9
  344.     move.w    lin,d0
  345.     bsr    tputw
  346.     beq    ascii9
  347.     move.w    rin,d0
  348.     bsr    tputw
  349.     beq    ascii9
  350.     bra    ascii1
  351.  
  352.  
  353. trestore:
  354.     bsr    tget
  355.     beq    ascii9
  356.     bsr    tget
  357.     beq    ascii9
  358.     bsr    tget
  359.     beq    ascii9
  360.     cmp.b    #$de,d0
  361.     bne    ascii9
  362.     clr.w    lin
  363.     clr.w    rin
  364.  
  365.     move.w    #CMD_IN,d0
  366.     bsr    tputw
  367.     beq    ascii9
  368.     move.w    lin,d0
  369.     bsr    tputw
  370.     beq    ascii9
  371.     move.w    rin,d0
  372.     bsr    tputw
  373.     beq    ascii9
  374.     bra    ascii1
  375.  
  376.  
  377. doubleon:
  378.     move.w    #DOUBLEU,d0
  379.     bra    a_on
  380.  
  381. doubleoff:
  382.     move.w    #DOUBLEU,d0
  383.     bra    a_off
  384.  
  385. strikeon:
  386.     move.w    #STRIKE,d0
  387.     bra    a_on
  388.  
  389. strikeoff:
  390.     move.w    #STRIKE,d0
  391.     bra    a_off
  392.  
  393. underon:
  394.     move.w    #UNDER,d0
  395.     bra    a_on
  396.  
  397. underoff:
  398.     move.w    #UNDER,d0
  399.     bra    a_off
  400.  
  401. boldon:
  402.     move.w    #BOLD,d0
  403.     bra    a_on
  404.  
  405. boldoff:
  406.     move.w    #BOLD,d0
  407.     bra    a_off
  408.  
  409. italicon:
  410.     move.w    #ITALICS,d0
  411.     bra    a_on
  412.  
  413. italicoff:
  414.     move.w    #ITALICS,d0
  415.     bra    a_off
  416.  
  417. a_on:    move.w    attrb,d1
  418.     bset    d0,d1
  419.     bne    irts
  420.     move.w    d1,attrb
  421.     move.w    #CMD_AT,d0
  422.     bsr    tputw
  423.     beq    ascii9
  424.     moveq    #0,d0
  425.     move.w    attrb,d0
  426.     bsr    tputl
  427.     beq    ascii9
  428.     bra    ascii1
  429.  
  430.  
  431. a_off:    move.w    attrb,d1
  432.     bclr    d0,d1
  433.     beq    irts
  434.     move.w    d1,attrb
  435.     move.w    #CMD_AT,d0
  436.     bsr    tputw
  437.     beq    ascii9
  438.     moveq    #0,d0
  439.     move.w    attrb,d0
  440.     bsr    tputl
  441.     beq    ascii9
  442.     bra    ascii1
  443.  
  444.  
  445. tget:    move.l    table,a0
  446.     move.l    f_get(a0),a0
  447.     jmp    (a0)
  448.  
  449. tput:    move.l    table,a0
  450.     move.l    t_put(a0),a0
  451.     jmp    (a0)
  452.  
  453. tputw:    move.l    table,a0
  454.     move.l    t_putw(a0),a0
  455.     jmp    (a0)
  456.  
  457. tputl:    move.l    table,a0
  458.     move.l    t_putl(a0),a0
  459.     jmp    (a0)
  460.  
  461. *******************************************************************
  462. ***    called when the import routine choosen finds something    ***
  463. ***    wrong with the file loaded.                ***
  464. *******************************************************************
  465. notright:
  466.     rts
  467.  
  468. never:    moveq    #0,d0
  469.     rts
  470.  
  471. maybe:    moveq    #1,d0
  472.     rts
  473.  
  474. right:    moveq    #2,d0
  475.     rts
  476.  
  477. ***********************************************************
  478. ***                            ***
  479. ***********************************************************
  480.  SECTION wp,DATA,PUBLIC
  481.  
  482. commands:
  483.     dc.b    LF,0
  484.     dc.l    docr
  485.     dc.b    $8c,0
  486.     dc.l    docr
  487.  
  488.     dc.b    TAB,0
  489.     dc.l    dotab
  490.     dc.b    CR,0
  491.     dc.l    dospace
  492.     dc.b    $0b,0
  493.     dc.l    dospace
  494.     dc.b    $0c,0
  495.     dc.l    dospace
  496.  
  497.     dc.b    $a0,0
  498.     dc.l    dospace
  499.     dc.b    $a9,0
  500.     dc.l    dodash
  501.     dc.b    $aa,0
  502.     dc.l    dodash
  503.     dc.b    $ab,0
  504.     dc.l    dodash
  505.  
  506.     dc.b    $ac,0
  507.     dc.l    domhyp
  508.     dc.b    $ad,0
  509.     dc.l    domhyp
  510.     dc.b    $ae,0
  511.     dc.l    domhyp
  512.  
  513.     dc.b    $bc,0
  514.     dc.l    superscript
  515.     dc.b    $bd,0
  516.     dc.l    subscript
  517.  
  518.     dc.b    $81,0
  519.     dc.l    charj
  520.     dc.b    $82,0
  521.     dc.l    leftj
  522.     dc.b    $83,0
  523.     dc.l    prevj
  524.     dc.b    $84,0
  525.     dc.l    prevj
  526.     dc.b    $c3,0
  527.     dc.l    centerj
  528.     dc.b    $c4,0
  529.     dc.l    rightj
  530.  
  531.     dc.b    $90,0
  532.     dc.l    doubleon
  533.     dc.b    $91,0
  534.     dc.l    doubleoff
  535.     dc.b    $92,0
  536.     dc.l    strikeon
  537.     dc.b    $93,0
  538.     dc.l    strikeoff
  539.     dc.b    $94,0
  540.     dc.l    underon
  541.     dc.b    $95,0
  542.     dc.l    underoff
  543.     dc.b    $9d,0
  544.     dc.l    boldon
  545.     dc.b    $9c,0
  546.     dc.l    boldoff
  547.  
  548.     dc.b    $b2,0
  549.     dc.l    italicon
  550.     dc.b    $b3,0
  551.     dc.l    italicoff
  552.  
  553.     dc.b    $c0,0
  554.     dc.l    margin
  555.  
  556.     dc.b    $cc,0
  557.     dc.l    tlindent
  558.     dc.b    $e0,0
  559.     dc.l    tmargin
  560.     dc.b    $de,0
  561.     dc.l    trestore
  562.  
  563.     dc.b    $e1,0
  564.     dc.l    extended
  565.  
  566.     dc.b    0,0
  567.  
  568. *
  569. *
  570. *
  571.  
  572.  IF AMIGA
  573. * Amiga ktoi
  574. ktoi:    dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$00-$07
  575.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$08-$0f
  576.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$10-$17
  577.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$18-$1f
  578.     dc.b    $20,$21,$22,$23,$24,$25,$26,$27
  579.     dc.b    $28,$29,$2a,$2b,$2c,$2d,$2e,$2f
  580.     dc.b    $30,$31,$32,$33,$34,$35,$36,$37
  581.     dc.b    $38,$39,$3a,$3b,$3c,$3d,$3e,$3f
  582.     dc.b    $40,$41,$42,$43,$44,$45,$46,$47
  583.     dc.b    $48,$49,$4a,$4b,$4c,$4d,$4e,$4f
  584.     dc.b    $50,$51,$52,$53,$54,$55,$56,$57
  585.     dc.b    $58,$59,$5a,$5b,$5c,$5d,$5e,$5f
  586.     dc.b    $60,$61,$62,$63,$64,$65,$66,$67
  587.     dc.b    $68,$69,$6a,$6b,$6c,$6d,$6e,$6f
  588.     dc.b    $70,$71,$72,$73,$74,$75,$76,$77
  589.     dc.b    $78,$79,$7a,$7b,$7c,$7d,$7e,$00
  590.  
  591.     dc.b    000,000,000,000,000,000,000,000        ;$80
  592.     dc.b    000,000,000,000,000,000,000,000        ;$88
  593.     dc.b    000,000,000,000,000,000,000,000        ;$90
  594.     dc.b    000,000,000,000,000,000,000,000        ;$98
  595.     dc.b    000,186,162,163,160,161,142,165        ;$a0
  596.     dc.b    000,183,188,136,141,173,184,129        ;$a8
  597.     dc.b    155,140,148,149,166,153,181,172        ;$b0
  598.     dc.b    000,147,156,137,144,145,146,185        ;$b8
  599.     dc.b    192,193,194,195,196,197,198,199        ;$c0
  600.     dc.b    200,201,202,203,204,205,206,207        ;$c8
  601.     dc.b    157,209,210,211,212,213,214,138        ;$d0
  602.     dc.b    159,217,218,219,220,221,158,187        ;$d8
  603.     dc.b    224,225,226,227,228,229,230,231        ;$e0
  604.     dc.b    232,233,234,235,236,237,238,239        ;$e8
  605.     dc.b    189,241,242,243,244,245,246,139        ;$f0
  606.     dc.b    191,249,250,251,252,253,190,254        ;$f8
  607.  
  608.  ENDIF
  609.  
  610.  IF ATARIST
  611. * AtariST ktoi
  612. ktoi:    dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$00-$07
  613.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$08-$0f
  614.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$10-$17
  615.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$18-$1f
  616.     dc.b    $20,$21,$22,$23,$24,$25,$26,$27
  617.     dc.b    $28,$29,$2a,$2b,$2c,$2d,$2e,$2f
  618.     dc.b    $30,$31,$32,$33,$34,$35,$36,$37
  619.     dc.b    $38,$39,$3a,$3b,$3c,$3d,$3e,$3f
  620.     dc.b    $40,$41,$42,$43,$44,$45,$46,$47
  621.     dc.b    $48,$49,$4a,$4b,$4c,$4d,$4e,$4f
  622.     dc.b    $50,$51,$52,$53,$54,$55,$56,$57
  623.     dc.b    $58,$59,$5a,$5b,$5c,$5d,$5e,$5f
  624.     dc.b    $60,$61,$62,$63,$64,$65,$66,$67
  625.     dc.b    $68,$69,$6a,$6b,$6c,$6d,$6e,$6f
  626.     dc.b    $70,$71,$72,$73,$74,$75,$76,$77
  627.     dc.b    $78,$79,$7a,$7b,$7c,$7d,$7e,$00
  628.     dc.b    199,252,233,226,228,224,229,231
  629.     dc.b    234,235,232,239,238,236,196,197
  630.     dc.b    201,230,198,244,246,242,251,249
  631.     dc.b    254,214,220,162,163,161,187,164
  632.     dc.b    225,237,243,250,241,209,189,156
  633.     dc.b    185,000,141,145,144,186,136,137
  634.     dc.b    227,245,159,191,247,215,192,195
  635.     dc.b    213,000,000,180,181,183,184,182
  636.     dc.b    000,000,138,000,000,000,000,000
  637.     dc.b    000,000,000,000,000,000,000,000
  638.     dc.b    000,000,000,000,000,000,000,000
  639.     dc.b    000,000,000,000,000,165,000,151
  640.     dc.b    000,000,000,150,000,000,153,000
  641.     dc.b    000,000,000,000,000,160,000,000
  642.     dc.b    131,140,135,134,000,000,139,130
  643.     dc.b    155,172,171,128,147,148,149,173
  644.  ENDIF
  645.  
  646. *
  647. special:
  648.     dc.w    1
  649.     dc.l    spcl1
  650. *
  651. name:    dc.b    "Word Perfect v2.0.3",0
  652. spcl1:    dc.b    "Formated Text",0
  653.  
  654.  SECTION wp,BSS,PUBLIC
  655. temp:        ds.l    1
  656. lin:        ds.w    1
  657. rin:        ds.w    1
  658. lspac:        ds.w    1
  659. bmod:        ds.w    1
  660. justify:    ds.b    1
  661.         ds.b    1
  662. attrb:        ds.w    1
  663.