home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
TOXIC
/
TOXIC12.MSA
/
PROGRAMS
/
SUPERNOV
/
COMPRESS.S
next >
Wrap
Text File
|
2005-12-18
|
2KB
|
107 lines
****************************************************
; Compression de texte par comparaison de sequences
; Supernova pour TOXIC MAG
****************************************************
TEXT
OPT O+
****************************************************
PEA 0.W
MOVE #$20,-(SP)
TRAP #1
ADDQ.L #6,SP
****************************************************
; on compte la taille originale de texte puis on la
; stocke
****************************************************
LEA FILE,A0
COUNT CMP.B #0,(A0)+
BEQ.S GO
ADDQ.L #1,FILE_SIZE
BRA.S COUNT
****************************************************
GO LEA BUFFER,A2
LEA FILE,A0
BSR.S ZIP
********* Au rapport! ******************************
BSR DUMP
****************************************************
BSR.S KEY
LEA UPK_BUFFER,A2
LEA BUFFER,A0
BSR.S UNZIP
****************************************************
PEA 0.W
TRAP #1
****************************************************
KEY MOVE #7,-(SP)
TRAP #1
ADDQ.L #2,SP
RTS
****************************************************
include pack.s
include unpack.s
********** Affichage de donnees en hexa ************
DUMP
LEA ORIGINAL,A3
MOVE.L FILE_SIZE,FIGURE
BSR.S DISPLAY
LEA BUFFER,A0
LOOP CMP.B #"≡",(A0)+
BEQ.S PRINT_
ADDQ.L #1,PACKED_SIZE
BRA.S LOOP
PRINT_
LEA FINAL,A3
MOVE.L PACKED_SIZE,FIGURE
BSR.S DISPLAY
rts
DISPLAY
MOVE.L A0,-(SP)
MOVE.L A3,-(SP)
move #9,-(sp)
trap #1
addq.l #6,sp
moveQ.l #28,d1
af move.l FIGURE,d0
lsr.l d1,d0
and.l #$f,d0
cmp.b #$9,d0
bgt.s lettre
add.b #$30,d0
bra.S fin_conv
lettre add.b #$37,d0
fin_conv
move d0,-(sp)
move #2,-(sp)
trap #1
addq.l #4,sp
subq #4,d1
bge.s af
MOVE.L (SP)+,A0
RTS
****************************************************
DATA
SEQUENCES
incbin sequence.bin
EVEN
FILE dc.b "Ceci est un essai de compression"
dc.b " de texte",13,10
DC.B 0
EVEN
ORIGINAL
DC.B 27,"E",7,"ORIGINAL LENGTH:"
dc.b 0
EVEN
FINAL DC.B 13,10,"PACKED LENGTH:",0
****************************************************
BSS
FLAG DS.B 1
EVEN
FILE_SIZE DS.L 1
PACKED_SIZE DS.L 1
FIGURE DS.L 1
BUFFER DS.B 1000
UPK_BUFFER DS.B 1000
end