-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
115 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// GB-Compress decompressor | ||
// Compatible with GBTD | ||
|
||
#ifndef __RLE_DECOMPRESS_H_INCLUDE | ||
#define __RLE_DECOMPRESS_H_INCLUDE | ||
|
||
void gb_decompress(const unsigned char * sour, unsigned char * dest); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
; GB-Compress decompressor | ||
; Compatible with GBTD | ||
|
||
.area _CODE | ||
_gb_decompress:: | ||
lda hl,5(SP) | ||
ld a,(hl-) | ||
ld d,a | ||
ld a,(hl-) | ||
ld e,a | ||
ld a,(hl-) | ||
ld l,(hl) | ||
ld h,a | ||
|
||
; hl = source; de = dest | ||
gb_decompress:: | ||
push bc | ||
1$: | ||
ld a,(hl+) ; load command | ||
or a | ||
jr z,9$ ; exit, if last byte | ||
bit 7,a | ||
jr nz,5$ ; string functions | ||
bit 6,a | ||
jr nz,3$ | ||
; RLE byte | ||
and #63 ; calc counter | ||
inc a | ||
ld b,a | ||
ld a,(hl+) | ||
2$: | ||
ld (de),a | ||
inc de | ||
dec b | ||
jr nz,2$ | ||
jr 1$ ; next command | ||
3$: ; RLE word | ||
and #63 | ||
inc a | ||
ld b,(hl) ; load word into bc | ||
inc hl | ||
ld c,(hl) | ||
inc hl | ||
4$: | ||
push af | ||
ld a,b ; store word | ||
ld (de),a | ||
inc de | ||
ld a,c | ||
ld (de),a | ||
inc de | ||
pop af | ||
dec a | ||
jr nz,4$ | ||
jr 1$ ; next command | ||
5$: | ||
bit 6,a | ||
jr nz,7$ | ||
; string repeat | ||
and a,#63 | ||
inc a | ||
push hl | ||
ld c,(hl) | ||
inc hl | ||
ld b,(hl) | ||
ld h,d | ||
ld l,e | ||
add hl,bc | ||
ld b,a | ||
6$: | ||
ld a,(hl+) | ||
ld (de),a | ||
inc de | ||
dec b | ||
jr nz,6$ | ||
pop hl | ||
inc hl | ||
inc hl | ||
jr 1$ ; next command | ||
7$: ; string copy | ||
and #63 | ||
inc a | ||
ld b,a | ||
8$: | ||
ld a,(hl+) | ||
ld (de),a | ||
inc de | ||
dec b | ||
jr nz,8$ | ||
jr 1$ ; next command | ||
9$: | ||
pop bc | ||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// GB-Compress decompressor | ||
// Compatible with GBTD | ||
|
||
#ifndef __RLE_DECOMPRESS_H_INCLUDE | ||
#define __RLE_DECOMPRESS_H_INCLUDE | ||
|
||
void gb_decompress(const unsigned char * sour, unsigned char * dest); | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.