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

  1.  
  2.  Include "equ.h"
  3.  Include "impequ.h"
  4.  
  5.  SECTION ascii,CODE,PUBLIC
  6.  
  7. ***************************************************
  8. ***                        ***
  9. ***************************************************
  10. dumbentry:
  11.     clr.l    d0
  12.     rts
  13.  
  14.     dc.l    "IMPT"            ; magik number for import module
  15.     dc.w    200
  16.     dc.l    0
  17.  
  18. table:    dc.l    0
  19.     dc.l    name,special,check,ascii    ;Plain Ascii
  20.  
  21. check:    moveq    #1,d0
  22.     rts
  23.  
  24. ***
  25. *** Text File Import
  26. ***
  27.  
  28. *
  29. * Plain Ascii
  30. *
  31. ascii:    move.l    table,a0
  32.     move.l    spclnum(a0),a1
  33.     move.w    (a1),crstrip
  34.     clr.w    crcount
  35.  
  36.     move.l    f_openr(a0),a0
  37.     jsr    (a0)
  38.     beq    ascii9
  39.  
  40.     move.l    table,a0
  41.     move.l    t_open(a0),a0
  42.     jsr    (a0)
  43.     beq    ascii9
  44.  
  45. ascii1:    move.l    table,a0
  46.     move.l    f_get(a0),a0
  47.     jsr    (a0)
  48.     beq    ascii9
  49.     and.w    #$ff,d0
  50.     lea    ktoi,a0
  51.     tst.b    0(a0,d0.w)
  52.     bne    tput
  53.     cmp.b    #$a,d0
  54.     beq    docr
  55.     cmp.b    #$9,d0
  56.     beq    dotab
  57.     bra    ascii1
  58. *
  59. docr:    tst.w    crstrip
  60.     beq    docr1
  61.     bset    #0,crcount
  62.     beq    ascii1
  63.     move.w    #CMD_CR,d0
  64.     move.l    table,a0
  65.     move.l    t_putw(a0),a0
  66.     jsr    (a0)
  67.     beq    ascii9
  68. docr1:    move.w    #CMD_CR,d0
  69.     bra    tputw
  70. *
  71. dotab:    move.w    #CMD_TAB,d0
  72.     bra    tputw
  73. *
  74. * put as is
  75. *
  76. tput:    bclr    #0,crcount
  77.     beq    tput1
  78.     move.w    d0,-(sp)
  79.     move.b    #" ",d0
  80.     move.l    table,a0
  81.     move.l    t_put(a0),a0
  82.     jsr    (a0)
  83.     beq    ascii9a
  84.     lea    ktoi,a0
  85.     move.w    (sp)+,d0
  86. tput1:    move.b    0(a0,d0.w),d0
  87.     move.l    table,a0
  88.     move.l    t_put(a0),a0
  89.     jsr    (a0)
  90.     beq    ascii9
  91.     bra    ascii1
  92. *
  93. * end of input file.  close and flush buffer
  94. *
  95. ascii9a:
  96.     addq.l    #2,sp
  97. ascii9:    move.l    table,a0
  98.     move.l    f_closer(a0),a0
  99.     jsr    (a0)
  100.  
  101.     move.l    table,a0
  102.     move.l    t_close(a0),a0
  103.     jmp    (a0)
  104.  
  105. tputw:    move.l    table,a0
  106.     move.l    t_putw(a0),a0
  107.     jsr    (a0)
  108.     beq    ascii9
  109.     bra    ascii1
  110.  
  111. *******************************************************************
  112. ***    called when the import routine choosen finds something    ***
  113. ***    wrong with the file loaded.                ***
  114. *******************************************************************
  115. notright:
  116.     rts
  117.  
  118. never:    moveq    #0,d0
  119.     rts
  120.  
  121. maybe:    moveq    #1,d0
  122.     rts
  123.  
  124. right:    moveq    #2,d0
  125.     rts
  126.  
  127. ***********************************************************
  128. ***                            ***
  129. ***********************************************************
  130.  SECTION ascii,DATA,PUBLIC
  131.  
  132.  IF AMIGA
  133. * Amiga ktoi
  134. ktoi:    dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$00-$07
  135.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$08-$0f
  136.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$10-$17
  137.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$18-$1f
  138.     dc.b    $20,$21,$22,$23,$24,$25,$26,$27
  139.     dc.b    $28,$29,$2a,$2b,$2c,$2d,$2e,$2f
  140.     dc.b    $30,$31,$32,$33,$34,$35,$36,$37
  141.     dc.b    $38,$39,$3a,$3b,$3c,$3d,$3e,$3f
  142.     dc.b    $40,$41,$42,$43,$44,$45,$46,$47
  143.     dc.b    $48,$49,$4a,$4b,$4c,$4d,$4e,$4f
  144.     dc.b    $50,$51,$52,$53,$54,$55,$56,$57
  145.     dc.b    $58,$59,$5a,$5b,$5c,$5d,$5e,$5f
  146.     dc.b    $60,$61,$62,$63,$64,$65,$66,$67
  147.     dc.b    $68,$69,$6a,$6b,$6c,$6d,$6e,$6f
  148.     dc.b    $70,$71,$72,$73,$74,$75,$76,$77
  149.     dc.b    $78,$79,$7a,$7b,$7c,$7d,$7e,$00
  150.  
  151.     dc.b    000,000,000,000,000,000,000,000        ;$80
  152.     dc.b    000,000,000,000,000,000,000,000        ;$88
  153.     dc.b    000,000,000,000,000,000,000,000        ;$90
  154.     dc.b    000,000,000,000,000,000,000,000        ;$98
  155.     dc.b    000,186,162,163,160,161,142,165        ;$a0
  156.     dc.b    000,183,188,136,141,173,184,129        ;$a8
  157.     dc.b    155,140,148,149,166,153,181,172        ;$b0
  158.     dc.b    000,147,156,137,144,145,146,185        ;$b8
  159.     dc.b    192,193,194,195,196,197,198,199        ;$c0
  160.     dc.b    200,201,202,203,204,205,206,207        ;$c8
  161.     dc.b    157,209,210,211,212,213,214,138        ;$d0
  162.     dc.b    159,217,218,219,220,221,158,187        ;$d8
  163.     dc.b    224,225,226,227,228,229,230,231        ;$e0
  164.     dc.b    232,233,234,235,236,237,238,239        ;$e8
  165.     dc.b    189,241,242,243,244,245,246,139        ;$f0
  166.     dc.b    191,249,250,251,252,253,190,254        ;$f8
  167.  
  168.  ENDIF
  169.  
  170.  IF ATARIST
  171. * AtariST ktoi
  172. ktoi:    dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$00-$07
  173.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$08-$0f
  174.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$10-$17
  175.     dc.b    $00,$00,$00,$00,$00,$00,$00,$00        ;$18-$1f
  176.     dc.b    $20,$21,$22,$23,$24,$25,$26,$27
  177.     dc.b    $28,$29,$2a,$2b,$2c,$2d,$2e,$2f
  178.     dc.b    $30,$31,$32,$33,$34,$35,$36,$37
  179.     dc.b    $38,$39,$3a,$3b,$3c,$3d,$3e,$3f
  180.     dc.b    $40,$41,$42,$43,$44,$45,$46,$47
  181.     dc.b    $48,$49,$4a,$4b,$4c,$4d,$4e,$4f
  182.     dc.b    $50,$51,$52,$53,$54,$55,$56,$57
  183.     dc.b    $58,$59,$5a,$5b,$5c,$5d,$5e,$5f
  184.     dc.b    $60,$61,$62,$63,$64,$65,$66,$67
  185.     dc.b    $68,$69,$6a,$6b,$6c,$6d,$6e,$6f
  186.     dc.b    $70,$71,$72,$73,$74,$75,$76,$77
  187.     dc.b    $78,$79,$7a,$7b,$7c,$7d,$7e,$00
  188.     dc.b    199,252,233,226,228,224,229,231
  189.     dc.b    234,235,232,239,238,236,196,197
  190.     dc.b    201,230,198,244,246,242,251,249
  191.     dc.b    254,214,220,162,163,161,187,164
  192.     dc.b    225,237,243,250,241,209,189,156
  193.     dc.b    185,000,141,145,144,186,136,137
  194.     dc.b    227,245,159,191,247,215,192,195
  195.     dc.b    213,000,000,180,181,183,184,182
  196.     dc.b    000,000,138,000,000,000,000,000
  197.     dc.b    000,000,000,000,000,000,000,000
  198.     dc.b    000,000,000,000,000,000,000,000
  199.     dc.b    000,000,000,000,000,165,000,151
  200.     dc.b    000,000,000,150,000,000,153,000
  201.     dc.b    000,000,000,000,000,160,000,000
  202.     dc.b    131,140,135,134,000,000,139,130
  203.     dc.b    155,172,171,128,147,148,149,173
  204.  ENDIF
  205.  
  206. *
  207. special:
  208.     dc.w    2
  209.     dc.l    spcl1,spcl2
  210. *
  211. name:    dc.b    "Ascii Text v2.0.0",0
  212. spcl1:    dc.b    "Paragraph has LF",0
  213. spcl2:    dc.b    "Line has LF",0
  214. *
  215.  
  216.  SECTION ascii,BSS,PUBLIC
  217. crcount:    ds.w    1
  218. crstrip:    ds.w    1
  219.