home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crawly Crypt Collection 2
/
crawlyvol2.bin
/
apps
/
dtp
/
pgsmodst
/
atariimp
/
iffftxt.s
< prev
next >
Wrap
Text File
|
1991-05-23
|
5KB
|
261 lines
Include "equ.h"
Include "impequ.h"
SECTION ftxt,CODE,PUBLIC
***************************************************
*** ***
***************************************************
dumbentry:
clr.l d0
rts
dc.l "IMPT"
dc.w 200
dc.l 0
table: dc.l 0
dc.l name,special,check,ftxt
*
* ftxt Check routine
*
check: move.l table,a0
move.l buff1(a0),a1
move.l (a1),a1
cmp.l #"FORM",(a1)
bne never
cmp.l #"FTXT",8(a1)
bne never
moveq #2,d0
rrts: rts
***
*** Text File Import
***
*
* ftxt
*
ftxt: move.l sp,savesp
move.l table,a0
move.l f_openr(a0),a0
jsr (a0)
beq rrts
move.l table,a0
move.l t_open(a0),a0
jsr (a0)
beq ftxt9
bsr pgetl ;"FORM"
bsr pgetl
move.l d0,length
bsr pgetl ;"FTXT"
sub.l #4,length
getchunk:
bsr pgetl
move.l d0,temp
bsr pgetl
move.l d0,clength
sub.l #8,length
move.l temp,d0
lea chunks-4,a0
move.w #2,d1
gc1: lea 4(a0),a0
cmp.l (a0)+,d0
dbeq d1,gc1
move.l (a0),a0
jsr (a0)
tst.l length
bne getchunk
ftxt9: move.l table,a0
move.l f_closer(a0),a0
jsr (a0)
move.l table,a0
move.l t_close(a0),a0
jmp (a0)
chunks: dc.l "FONS",fons
dc.l "CHRS",chrs
dc.l 0,skip
***********************************
*** ***
***********************************
chrs: move.l clength,temp
chrs1: bsr pget
cmp.b #$a,d0
beq chrcr
lea ktoi,a0
and.w #$ff,d0
move.b 0(a0,d0.w),d0
beq chrs2
bsr tput
bra chrs2
chrcr: move.w #CMD_CR,d0
bsr tputw
chrs2: subq.l #1,temp
bne chrs1
bra adjlen
fons: bra skip
***********************************
*** ***
***********************************
adjlen: move.l clength,d0
btst #0,d0
beq al1
bsr pget
move.l clength,d0
add.l #1,d0
al1: sub.l d0,length
rts
***********************************
*** ***
***********************************
skip: move.l clength,d0
add.l #1,d0
bclr #0,d0
sub.l d0,length
sk1: move.l d0,-(sp)
bsr pgetw
move.l (sp)+,d0
sub.l #2,d0
bgt sk1
rts
***********************************
*** ***
***********************************
errrts: move.l savesp,sp
move.l table,a0
move.l f_closer(a0),a0
jsr (a0)
move.l table,a0
move.l t_close(a0),a0
jmp (a0)
***********************************
*** ***
***********************************
pgetl: move.l table,a0
move.l f_getl(a0),a0
jsr (a0)
beq errrts
rts
pgetw: move.l table,a0
move.l f_getw(a0),a0
jsr (a0)
beq errrts
rts
pget: move.l table,a0
move.l f_get(a0),a0
jsr (a0)
beq errrts
rts
tputw: move.l table,a0
move.l t_putw(a0),a0
jsr (a0)
beq errrts
rts
tput: move.l table,a0
move.l t_put(a0),a0
jsr (a0)
beq errrts
rts
*******************************************************************
*** called when the import routine choosen finds something ***
*** wrong with the file loaded. ***
*******************************************************************
notright:
rts
never: moveq #0,d0
rts
maybe: moveq #1,d0
rts
right: moveq #2,d0
rts
***********************************************************
*** ***
***********************************************************
SECTION ftxt,DATA,PUBLIC
*
special:
dc.w 1
dc.l spcl1
*
name: dc.b "IFF FTXT v2.0.0",0
*
spcl1: dc.b "Formatted Text",0
*
* AMIGA ktoi
ktoi: dc.b $00,$00,$00,$00,$00,$00,$00,$00 ;$00-$07
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ;$08-$0f
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ;$10-$17
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ;$18-$1f
dc.b $20,$21,$22,$23,$24,$25,$26,$27
dc.b $28,$29,$2a,$2b,$2c,$2d,$2e,$2f
dc.b $30,$31,$32,$33,$34,$35,$36,$37
dc.b $38,$39,$3a,$3b,$3c,$3d,$3e,$3f
dc.b $40,$41,$42,$43,$44,$45,$46,$47
dc.b $48,$49,$4a,$4b,$4c,$4d,$4e,$4f
dc.b $50,$51,$52,$53,$54,$55,$56,$57
dc.b $58,$59,$5a,$5b,$5c,$5d,$5e,$5f
dc.b $60,$61,$62,$63,$64,$65,$66,$67
dc.b $68,$69,$6a,$6b,$6c,$6d,$6e,$6f
dc.b $70,$71,$72,$73,$74,$75,$76,$77
dc.b $78,$79,$7a,$7b,$7c,$7d,$7e,$00
dc.b 000,000,000,000,000,000,000,000 ;$80
dc.b 000,000,000,000,000,000,000,000 ;$88
dc.b 000,000,000,000,000,000,000,000 ;$90
dc.b 000,000,000,000,000,000,000,000 ;$98
dc.b 000,186,162,163,160,161,142,165 ;$a0
dc.b 000,183,188,136,141,173,184,129 ;$a8
dc.b 155,140,148,149,166,153,181,172 ;$b0
dc.b 000,147,156,137,144,145,146,185 ;$b8
dc.b 192,193,194,195,196,197,198,199 ;$c0
dc.b 200,201,202,203,204,205,206,207 ;$c8
dc.b 157,209,210,211,212,213,214,138 ;$d0
dc.b 159,217,218,219,220,221,158,187 ;$d8
dc.b 224,225,226,227,228,229,230,231 ;$e0
dc.b 232,233,234,235,236,237,238,239 ;$e8
dc.b 189,241,242,243,244,245,246,139 ;$f0
dc.b 191,249,250,251,252,253,190,254 ;$f8
SECTION ftxt,BSS,PUBLIC
savesp: ds.l 1
clength: ds.l 1
length: ds.l 1
temp: ds.l 1