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

  1.  Include "equ.h"
  2.  Include "impequ.h"
  3.  
  4.  SECTION ftxt,CODE,PUBLIC
  5. ***************************************************
  6. ***                        ***
  7. ***************************************************
  8. dumbentry:
  9.     clr.l    d0
  10.     rts
  11.  
  12.     dc.l    "IMPT"
  13.     dc.w    200
  14.     dc.l    0
  15.  
  16. table:    dc.l    0
  17.     dc.l    name,special,check,ftxt
  18.  
  19. *
  20. * Excellence Check routine
  21. *
  22. check:    move.l    table,a0
  23.     move.l    buff1(a0),a1
  24.     move.l    (a1),a1
  25.     cmp.l    #"FORM",(a1)
  26.     bne    never
  27.     cmp.l    #"FTXT",8(a1)
  28.     bne    never
  29.     moveq    #2,d0
  30. rrts:    rts
  31.  
  32.  
  33. ***
  34. *** Text File Import
  35. ***
  36.  
  37. *
  38. * Excellence
  39. *
  40. ftxt:    move.l    sp,savesp
  41.  
  42.     move.l    table,a0
  43.     move.l    f_openr(a0),a0
  44.     jsr    (a0)
  45.     beq    rrts
  46.  
  47.     move.l    table,a0
  48.     move.l    t_open(a0),a0
  49.     jsr    (a0)
  50.     beq    ftxt9
  51.  
  52.     jsr    pgetl        ;"FORM"
  53.     jsr    pgetl
  54.     move.l    d0,length
  55.     jsr    pgetl        ;"FTXT"
  56.     sub.l    #4,length
  57.  
  58.     clr.b    prevstyle
  59.     clr.b    curstyle
  60.     move.l    #1200,curpoint
  61.  
  62. getchunk:
  63.     jsr    pgetl
  64.     move.l    d0,temp
  65.     jsr    pgetl
  66.     move.l    d0,clength
  67.     sub.l    #8,length
  68.  
  69.     move.l    temp,d0
  70.     lea    chunks,a0
  71. gc1:    tst.l    (a0)
  72.     beq    gc2
  73.     cmp.l    (a0),d0
  74.     beq    gc2
  75.     lea    8(a0),a0
  76.     bra    gc1
  77.  
  78. gc2:    move.l    4(a0),a0
  79.     jsr    (a0)
  80.     tst.l    length
  81.     bne    getchunk
  82.  
  83. ftxt9:    move.l    table,a0
  84.     move.l    f_closer(a0),a0
  85.     jsr    (a0)
  86.     move.l    table,a0
  87.     move.l    t_close(a0),a0
  88.     jmp    (a0)
  89.  
  90.  
  91. ***********************************
  92. ***                ***
  93. ***********************************
  94. chrs:    move.l    clength,temp
  95. chrs1:    jsr    pget
  96.     cmp.b    #$a,d0
  97.     beq    chrcr
  98.     lea    ktoi,a0
  99.     and.w    #$ff,d0
  100.     move.b    0(a0,d0.w),d0
  101.     beq    chrs2
  102.     jsr    tput
  103.     bra    chrs2
  104. chrcr:    move.w    #CMD_CR,d0
  105.     jsr    tputw
  106. chrs2:    subq.l    #1,temp
  107.     bne    chrs1
  108.     bra    adjlen
  109.  
  110. ***********************************
  111. ***                ***
  112. ***********************************
  113. fons:    jsr    pget
  114.     jsr    pget
  115.     and.w    #$ff,d0
  116.     mulu    #100,d0
  117.     move.l    d0,curpoint
  118.     move.w    #CMD_PT,d0
  119.     jsr    tputw
  120.     move.l    curpoint,d0
  121.     btst    #3,curstyle
  122.     beq    fons0
  123.     lsl.l    #1,d0
  124. fons0:    jsr    tputl
  125.     move.l    curpoint,d0
  126.     jsr    tputl
  127.  
  128.     move.l    clength,d0
  129.     add.l    #1,d0
  130.     bclr    #0,d0
  131.     sub.l    d0,length
  132.     subq.l    #2,d0
  133. fons1:    move.l    d0,-(sp)
  134.     jsr    pgetw
  135.     move.l    (sp)+,d0
  136.     sub.l    #2,d0
  137.     bgt    fons1
  138.     rts
  139.  
  140.  
  141. ***********************************
  142. ***                ***
  143. ***********************************
  144. rule:    bsr    pgetw
  145.     lea    justtbl,a0
  146.     move.b    0(a0,d0.w),d0
  147.     move.w    d0,-(sp)
  148.     move.w    #CMD_JST,d0
  149.     bsr    tputw
  150.     move.w    (sp)+,d0
  151.     bsr    tput
  152.  
  153.     move.w    #CMD_LSP,d0
  154.     bsr    tputw
  155.     bsr    pgetw
  156.     mulu    #100,d0
  157.     or.w    #$0000,d0
  158.     bsr    tputw
  159.  
  160.  
  161.     move.l    clength,d0
  162.     add.l    #1,d0
  163.     bclr    #0,d0
  164.     sub.l    d0,length
  165.     subq.l    #4,d0
  166. rule1:    move.l    d0,-(sp)
  167.     jsr    pgetw
  168.     move.l    (sp)+,d0
  169.     sub.l    #2,d0
  170.     bgt    rule1
  171.     rts
  172.  
  173.  
  174. ***********************************
  175. ***                ***
  176. ***********************************
  177. styl:    jsr    pget
  178.     move.b    curstyle,d1
  179.     move.b    d1,prevstyle
  180.     move.b    d0,curstyle
  181.     eor.b    d0,d1
  182.     and.b    #%11000111,d1
  183.     beq    nonewa
  184.  
  185.     moveq    #0,d1
  186.     btst    #0,d0
  187.     beq    newa1
  188.     bset    #BOLD,d1
  189. newa1:    btst    #1,d0
  190.     beq    newa2
  191.     bset    #ITALICS,d1
  192. newa2:    btst    #2,d0
  193.     beq    newa3
  194.     bset    #UNDER,d1
  195. newa3:    btst    #6,d0
  196.     beq    newa4
  197.     bset    #OUTLINE,d1
  198. newa4:    btst    #7,d0
  199.     beq    newa5
  200.     bset    #SHADOW,d1
  201. newa5:    move.l    d1,-(sp)
  202.     move.w    #CMD_AT,d0
  203.     jsr    tputw
  204.     move.l    (sp)+,d0
  205.     jsr    tputl
  206.  
  207. nonewa:    move.b    prevstyle,d1
  208.     move.b    curstyle,d0
  209.     eor.b    d0,d1
  210.     and.b    #%00110000,d1
  211.     beq    nonewb
  212.  
  213.     moveq    #0,d1
  214.     btst    #4,d0
  215.     beq    newb1
  216.     move.l    curpoint,d1
  217.     lsr.l    #1,d1
  218. newb1:    btst    #5,d0
  219.     beq    newb2
  220.     move.l    curpoint,d1
  221.     lsr.l    #1,d1
  222.     neg.l    d1
  223. newb2:    move.l    d1,-(sp)
  224.     move.w    #CMD_BMOD,d0
  225.     jsr    tputw
  226.     move.l    (sp)+,d0
  227.     jsr    tputw
  228.  
  229. nonewb:    move.b    prevstyle,d1
  230.     move.b    curstyle,d0
  231.     eor.b    d0,d1
  232.     and.b    #%00001000,d1
  233.     beq    nonewe
  234.  
  235.     move.l    curpoint,d1
  236.     btst    #3,d0
  237.     beq    newe1
  238.     lsl.l    #1,d1
  239. newe1:    move.l    d1,-(sp)
  240.     move.w    #CMD_PT,d0
  241.     jsr    tputw
  242.     move.l    (sp)+,d0
  243.     jsr    tputl
  244.     move.l    curpoint,d0
  245.     jsr    tputl
  246.  
  247. nonewe:    bra    adjlen
  248.  
  249. ***********************************
  250. ***                ***
  251. ***********************************
  252. color:    move.w    #CMD_CFC,d0
  253.     jsr    tputw
  254.     jsr    pget
  255.     cmp.b    #0,d0
  256.     beq    color1
  257.     moveq    #1,d0
  258. color1:    jsr    tput
  259.     bra    adjlen
  260.  
  261. ***********************************
  262. ***                ***
  263. ***********************************
  264. othr:    move.l    clength,d0
  265. othr1:    move.l    d0,-(sp)
  266.     jsr    pget
  267.     cmp.b    #9,d0
  268.     bne    notab
  269.     move.w    #CMD_TAB,d0
  270.     jsr    tputw
  271. notab:    move.l    (sp)+,d0
  272.     subq.l    #1,d0
  273.     bhi    othr1
  274.     bra    adjlen
  275.  
  276. ***********************************
  277. ***                ***
  278. ***********************************
  279. adjlen:    move.l    clength,d0
  280.     btst    #0,d0
  281.     beq    al1
  282.     jsr    pget
  283.     move.l    clength,d0
  284.     add.l    #1,d0
  285.  
  286. al1:    sub.l    d0,length
  287.     rts
  288.  
  289.  
  290. ***********************************
  291. ***                ***
  292. ***********************************
  293. skip:    move.l    clength,d0
  294.     add.l    #1,d0
  295.     bclr    #0,d0
  296.     sub.l    d0,length
  297.  
  298. sk1:    move.l    d0,-(sp)
  299.     jsr    pgetw
  300.     move.l    (sp)+,d0
  301.     sub.l    #2,d0
  302.     bhi    sk1
  303.     rts
  304.  
  305.  
  306. ***********************************
  307. ***                ***
  308. ***********************************
  309. errrts:    move.l    savesp,sp
  310.  
  311.     move.l    table,a0
  312.     move.l    f_closer(a0),a0
  313.     jsr    (a0)
  314.  
  315.     move.l    table,a0
  316.     move.l    t_close(a0),a0
  317.     jmp    (a0)
  318.  
  319.  
  320. ***********************************
  321. ***                ***
  322. ***********************************
  323. pgetl:    move.l    table,a0
  324.     move.l    f_getl(a0),a0
  325.     jsr    (a0)
  326.     beq    errrts
  327.     rts
  328.  
  329. pgetw:    move.l    table,a0
  330.     move.l    f_getw(a0),a0
  331.     jsr    (a0)
  332.     beq    errrts
  333.     rts
  334.  
  335. pget:    move.l    table,a0
  336.     move.l    f_get(a0),a0
  337.     jsr    (a0)
  338.     beq    errrts
  339.     rts
  340.  
  341. tputw:    move.l    table,a0
  342.     move.l    t_putw(a0),a0
  343.     jsr    (a0)
  344.     beq    errrts
  345.     rts
  346.  
  347. tputl:    move.l    table,a0
  348.     move.l    t_putl(a0),a0
  349.     jsr    (a0)
  350.     beq    errrts
  351.     rts
  352.  
  353. tput:    move.l    table,a0
  354.     move.l    t_put(a0),a0
  355.     jsr    (a0)
  356.     beq    errrts
  357.     rts
  358.  
  359. *******************************************************************
  360. ***    called when the import routine choosen finds something    ***
  361. ***    wrong with the file loaded.                ***
  362. *******************************************************************
  363. notright:
  364.     rts
  365.  
  366. never:    moveq    #0,d0
  367.     rts
  368.  
  369. maybe:    moveq    #1,d0
  370.     rts
  371.  
  372. right:    moveq    #2,d0
  373.     rts
  374.  
  375. ***********************************************************
  376. ***                            ***
  377. ***********************************************************
  378.  SECTION ftxt,DATA,PUBLIC
  379.  
  380. chunks:    dc.l    "CHRS",chrs
  381.     dc.l    "FONS",fons
  382.     dc.l    "RULE",rule
  383.     dc.l    "STYL",styl
  384.     dc.l    "CLR ",color
  385.     dc.l    "OTHR",othr
  386.     dc.l    0,skip
  387.  
  388. justtbl:    dc.b    0,3,1,2
  389.  
  390. special:
  391.     dc.w    1
  392.     dc.l    spcl1
  393. *
  394. name:    dc.b    "Excellence! v2.0.2",0
  395. *
  396. spcl1:    dc.b    "Formatted Text",0
  397. *
  398.  
  399. * AMIGA ktoi
  400. ktoi:    dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$00-$07
  401.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$08-$0f
  402.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$10-$17
  403.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$18-$1f
  404.     dc.b    $20,$21,$22,$23,$24,$25,$26,$27
  405.     dc.b    $28,$29,$2a,$2b,$2c,$2d,$2e,$2f
  406.     dc.b    $30,$31,$32,$33,$34,$35,$36,$37
  407.     dc.b    $38,$39,$3a,$3b,$3c,$3d,$3e,$3f
  408.     dc.b    $40,$41,$42,$43,$44,$45,$46,$47
  409.     dc.b    $48,$49,$4a,$4b,$4c,$4d,$4e,$4f
  410.     dc.b    $50,$51,$52,$53,$54,$55,$56,$57
  411.     dc.b    $58,$59,$5a,$5b,$5c,$5d,$5e,$5f
  412.     dc.b    $60,$61,$62,$63,$64,$65,$66,$67
  413.     dc.b    $68,$69,$6a,$6b,$6c,$6d,$6e,$6f
  414.     dc.b    $70,$71,$72,$73,$74,$75,$76,$77
  415.     dc.b    $78,$79,$7a,$7b,$7c,$7d,$7e,$00
  416.  
  417.     dc.b    000,000,000,000,000,000,000,000        ;$80
  418.     dc.b    000,000,000,000,000,000,000,000        ;$88
  419.     dc.b    000,000,000,000,000,000,000,000        ;$90
  420.     dc.b    000,000,000,000,000,000,000,000        ;$98
  421.     dc.b    000,186,162,163,160,161,142,165        ;$a0
  422.     dc.b    000,183,188,136,141,173,184,129        ;$a8
  423.     dc.b    155,140,148,149,166,153,181,172        ;$b0
  424.     dc.b    000,147,156,137,144,145,146,185        ;$b8
  425.     dc.b    192,193,194,195,196,197,198,199        ;$c0
  426.     dc.b    200,201,202,203,204,205,206,207        ;$c8
  427.     dc.b    157,209,210,211,212,213,214,138        ;$d0
  428.     dc.b    159,217,218,219,220,221,158,187        ;$d8
  429.     dc.b    224,225,226,227,228,229,230,231        ;$e0
  430.     dc.b    232,233,234,235,236,237,238,239        ;$e8
  431.     dc.b    189,241,242,243,244,245,246,139        ;$f0
  432.     dc.b    191,249,250,251,252,253,190,254        ;$f8
  433.  
  434. *
  435.  
  436.  SECTION ftxt,BSS,PUBLIC
  437. savesp:        ds.l    1
  438. clength:    ds.l    1
  439. length:        ds.l    1
  440. temp:        ds.l    1
  441.  
  442. curpoint:    ds.l    1
  443. curstyle:    ds.b    1
  444. prevstyle:    ds.b    1
  445.  
  446.