Difference between revisions of "Z80 Routines:Other:IonCompress"
From WikiTI
(untested ioncompress routine) |
m (trying to add the category...crude special thanks...) |
||
Line 1: | Line 1: | ||
+ | [[Category:Z80 Routines:Other|IonCompress]] | ||
+ | [[Category:Z80 Routines|IonCompress]] | ||
<nowiki>;Ion Compression Routines | <nowiki>;Ion Compression Routines | ||
;These routines are <supposed to> compress data in the format used by | ;These routines are <supposed to> compress data in the format used by | ||
Line 148: | Line 150: | ||
pop hl | pop hl | ||
ret</nowiki> | ret</nowiki> | ||
+ | ==Special Thanks== | ||
+ | <!-- Sorry, it's 12AM, and I didn't get enough sleep last night... this is the last thing I'm doing b4 going to bed, so please don't kill me for not remembering the correct facts...-->'''Joe Wingbermuhele''' for creating Ion for the 83/83+ | ||
+ | |||
+ | '''XDG Kat-Productions''''s '''Justin Haygood''' and '''Benny Baumann''' for encouraging my coding abilities in both z80 Asm and TI-BASIC. |
Revision as of 20:08, 6 April 2006
;Ion Compression Routines ;These routines are <supposed to> compress data in the format used by ;the IonDecompress routine. I, Saibot84, have only reverse-engineered ;the compression algorithm based on the IonDecompress routine. ; ;Just a note: The way I consider this, there is a routine that does ;the work, and then there may be a routine that modifies slightly the ;inputs and outputs of the first routine. This modifying routine, I ;call the MetaLibrary routine as an analogy to how physics is under ;metaphysics. ;-) ; ;I know it's not good to post untested bits of code, but I just ;stumbled upon this on my computer and remembered I wanted to ;release it. ; ;IonCompress ;Inputs: ; hl->where to read the data from ; de->where to store the compressed output ; b = number of bytes to copmpress ; c = compression factor (see IonDecompress) ;Outputs: ; hl->end of where to read ; de->end of where to store ; carry flag: set->error res->all is well ; ;MetaLib_IonCompress ;Inputs: ; hl->where to read the data from ; de->where to store the compressed output ; bc = number of bytes to copmpress ; a = compression factor (see IonDecompress) ;Outputs: ; hl->end of where to read ; de->end of where to store ; bc = new length ; carry flag: set->error res->all is well IonCompress: ;016-7-2005 ;=>hl->read ;=>de->sto ;=>b=len ;=>c=comp factor ;<=hl->read+len ;<=de->sto+len(new) ;<=cf=error ld a,c cp 2 jr nc, IC_Next1 srl b IC_Next1: cp 4 jr nc,IC_Next2 srl b IC_Next2: srl b push ix IC_Loop: push bc ld ixh,0 ld ixl,8 ld a,c ld b,8 cp 1 jr z,IC_cmp1 ld b,4 cp 3 jr z,IC_cmp1 ld b,2 IC_cmp1: push bc ld a,c ld b,1 cp 1 jr z,IC_cmp2 inc b cp 3 jr z,IC_cmp2 ld b,4 IC_cmp2: ld a,ixl sub b ld b,a ld ixl,a ld a,c cp (hl) jr c,IC_Error ld a,(hl) IC_cmp3: sla a djnz IC_cmp3 or ixh inc hl pop bc djnz IC_cmp1 inc de pop bc djnz IC_Loop IC_Exit: pop ix ret IC_Error: pop bc pop bc jr IC_Exit MetaLib_IonCompress: ;016-7-2005 ;=>hl->read ;=>de->sto ;=>bc=len ;=>a=comp factor ;<=hl->read+len ;<=de->sto+len(new) ;<=bc=new length ;<=cf=error push de push af push bc ld b,a ld a,c or a ld a,b pop bc jr z,ML_IC_Loop inc b ML_IC_Loop: push bc push af ld b,c ld c,a call IonCompress ret c pop af pop bc ld c,0 djnz ML_IC_Loop pop af ex (sp),hl ex de,hl push hl or a sbc hl,de pop de push hl pop bc pop hl ret
Special Thanks
Joe Wingbermuhele for creating Ion for the 83/83+
XDG Kat-Productions's Justin Haygood and Benny Baumann for encouraging my coding abilities in both z80 Asm and TI-BASIC.