186 lines
5.0 KiB
Erlang
186 lines
5.0 KiB
Erlang
THE SOUTH POLE..........[312] 677-7140
|
||
*=-----------------------------------=*
|
||
* PROGRAM COMPRESSION *
|
||
*=-----------------------------------=*
|
||
|
||
WITH IN MANY CRACKED PROGRAMS LURK MANY WAISTFUL REPETITIONS OF DATA (I.E.
|
||
23 04 59 55 55 55 55 55 55 55 55) THEY ARE NECCESSARY FOR THE PROGRAM TO WORK
|
||
BUT THEY TAKE UP A LOT OF SPACE. TO SOLVE THIS "PROBLEM" I HAVE WRITTEN A
|
||
PROGRAM TO CRAM TOGETHER OTHER PROGRAMS AND A PROGRAM TO UNCRAM AND RUN THE
|
||
ORIGINAL PROGRAM. OF COURSE THERE ARE MANY VERY COMPLICATED WAYS TO "GET THE
|
||
MOST OUT OF EVERY BYTE" BUT THE WAY I CHOSE IS VERY SIMPLE:
|
||
|
||
IF THERE IS A REPETITION IT IS STORED LIKE THIS:
|
||
|
||
1) NUMBER OF REPEATS (UP TO $FF), REPEAT VALUE
|
||
|
||
OTHERWISE STORE THINGS LIKE THIS:
|
||
|
||
2) $00, NUMBER OF UNIQUES (UP TO $FFFF), LIST OF UNIQES USING THIS METHOD
|
||
THE ABOVE EXAMPLE WOULD LOOK LIKE THIS: 00 00 03 23 04 59 07 55
|
||
|
||
IN THIS SMALL EXAMPLE NOT MUCH WAS SAVED BUT IN REAL LIFE HOWEVER I HAVE
|
||
BEEN ABLE TO REDUCE THE SIZE BY 4K TO 12K DEPENDING ON THE PROGRAM USING THIS
|
||
SIMPLE METHOD!
|
||
|
||
THE FOLLOWING TWO PROGRAMS ARE RELOCATABLE SO THEY CAN BE RUN ANYWHERE YOU
|
||
WISH. THE FIRST OF THE TWO IS THE CRAMMER AND THE SECOND PROGRAM IS THE
|
||
UNCRAMMER.
|
||
|
||
TO USE THE CRAMMER JUST:
|
||
|
||
1) LOAD THE PROGRAM TO BE CRAMMED ALONG WITH THE CRAMMER (AT LEAST ONE PAGE
|
||
ABOVE THE PROGRAM)
|
||
|
||
2) ENTER THE FOLLOWING INTO PAGE 0:
|
||
|
||
00- PROGRAM START (LSB)
|
||
01- PROGRAM START (MSB)
|
||
02- PROGRAM END (LSB)
|
||
03- PROGRAM END (MSB)
|
||
|
||
3) RUN CRAMMER
|
||
|
||
4) GET THE FOLLOWING FROM PAGE 0:
|
||
|
||
00- CRAMMED START (LSB)
|
||
01- CRAMMED START (MSB)
|
||
02- CRAMMED END (LSB)
|
||
03- CRAMMED END (MSB)
|
||
|
||
BEFORE==> PPPPPPPPPPPPP CRAM
|
||
! ! ! !
|
||
DURING==> CCCCCCC ! CRAM
|
||
! ! ! ! ! !
|
||
AFTER===> ! ! ! CCCCCCC CRAM
|
||
! ! ! ! !! ! !
|
||
$0400 ! ! ! !! ! !
|
||
(PROGRAM START) ! ! !! ! !
|
||
$???? ! !! ! !
|
||
(CRAM START) !! ! !
|
||
(PROGRAM END)! ! !
|
||
(CRAM END) (CRAMMER)
|
||
|
||
|
||
TO USE THE UNCRAMMER JUST:
|
||
|
||
1) LOAD CRAMMED PROGRAM AND UNCRAMMER RIGHT ABOVE IT
|
||
|
||
2) CHANGE THE NOP'S IN UNCRAM TO THE FOLLOWING:
|
||
|
||
NOP- CRAMMED START (LSB)
|
||
NOP- CRAMMED START (MSB)
|
||
NOP- CRAMMED END (LSB)
|
||
NOP- CRAMMED END (MSB)
|
||
NOP- ORIGINAL PROGRAM START (LSB)
|
||
NOP- ORIGINAL PROGRAM START (MSB)
|
||
|
||
3) CHANGE THE JMP $FF69 IN UNCRAM TO THE STARTING ADDRESS OF THE ORIGINAL
|
||
PROGRAM.
|
||
|
||
4) PUT A JMP $(UNCRAM ADDRESS) BEFORE CRAMMED START AND YOUR DONE
|
||
|
||
BEFORE===> CCCCCCCC:UNCRAM
|
||
! !
|
||
AFTER====> PPPPPPPPPPPPP!
|
||
! ! !!
|
||
(PROGRAM START) ! !!
|
||
(CRAM START) !!
|
||
(PROGRAM END)!
|
||
(CRAM END)
|
||
|
||
|
||
AN EXAMPLE:
|
||
|
||
CANNONBAL BLITZ-
|
||
|
||
MY BLITZ LOADED AT $0800 TO $8FFF AND THE STARTING ADDRESS WAS $2900 I THEN
|
||
LOADED CRAMMER AT $B000 AND TYPED:
|
||
|
||
00:00 08 FF 8F
|
||
|
||
B000G
|
||
|
||
0 <RETURN> <RETURN>
|
||
|
||
0000- 77 15 FF 90 (A SAVING OF 3K)
|
||
|
||
THE CRAMMED PROGRAM NOW RESIDES AT $1577 TO $90FF. I THEN LOADED UNCRAM AT
|
||
$9100 AND TYPED:
|
||
|
||
911D:77 15 FF 90 00 08
|
||
913B:4C 00 29
|
||
1574:4C 00 91
|
||
|
||
THE NEW BLITZ STARTS AT $1574 AND ENDS AT $919C.
|
||
|
||
|
||
|
||
THE CRAMMER:
|
||
|
||
1000:A0 00 A9 00 85 04 A9 04
|
||
1008:85 05 B1 02 C8 AA E8 8A
|
||
1010:91 02 88 A5 00 85 06 A5
|
||
1018:01 85 07 B1 00 A2 00 85
|
||
1020:0C A5 06 C5 02 D0 18 A5
|
||
1028:07 C5 03 D0 12 8A F0 43
|
||
1030:91 04 E6 04 D0 02 E6 05
|
||
1038:A5 0C 91 04 18 90 7B A5
|
||
1040:0C E6 06 D0 02 E6 07 D1
|
||
1048:06 D0 04 E8 D0 D1 CA 85
|
||
1050:0C 8A C9 06 90 1D 91 04
|
||
1058:E6 04 D0 02 E6 05 A5 0C
|
||
1060:91 04 E6 04 D0 02 E6 05
|
||
1068:A5 06 85 00 A5 07 85 01
|
||
1070:18 90 A0 A9 00 85 0A 85
|
||
1078:0B 91 04 E6 04 D0 02 E6
|
||
1080:05 A5 04 85 08 A5 05 85
|
||
1088:09 E6 04 D0 02 E6 05 E6
|
||
1090:04 D0 02 E6 05 B1 00 91
|
||
1098:04 E6 0A D0 02 E6 0B A5
|
||
10A0:00 C5 02 D0 19 A5 01 C5
|
||
10A8:03 D0 13 A5 0B 91 08 E6
|
||
10B0:08 D0 02 E6 09 A5 0A 91
|
||
10B8:08 18 90 40 90 B3 E6 00
|
||
10C0:D0 02 E6 01 E6 04 D0 02
|
||
10C8:E6 05 A5 00 85 06 A5 01
|
||
10D0:85 07 B1 00 A2 00 E6 06
|
||
10D8:D0 02 E6 07 D1 06 D0 04
|
||
10E0:E8 D0 F3 CA 85 0C 8A C9
|
||
10E8:06 90 AA A5 0B 91 08 E6
|
||
10F0:08 D0 02 E6 09 A5 0A 91
|
||
10F8:08 18 90 C0 E6 03 A5 02
|
||
1100:85 06 A5 03 85 07 B1 04
|
||
1108:91 06 C6 06 A5 06 C9 FF
|
||
1110:D0 02 C6 07 C6 04 A5 04
|
||
1118:C9 FF D0 02 C6 05 A5 04
|
||
1120:C9 FF D0 E2 A5 05 C9 03
|
||
1128:D0 DC E6 06 D0 02 E6 07
|
||
1130:A5 06 85 00 A5 07 85 01
|
||
1138:60
|
||
|
||
|
||
THE UNCRAMMER:
|
||
|
||
|
||
2000:20 58 FF BA BD 00 01 85
|
||
2008:07 CA BD 00 01 85 06 A2
|
||
2010:05 A0 20 B1 06 95 00 88
|
||
2018:CA D0 F8 F0 06>EA EA EA
|
||
2020:EA EA EA<B1 06 95 00 A0
|
||
2028:00 E6 02 D0 02 E6 03 A5
|
||
2030:00 C5 02 D0 09 A5 01 C5
|
||
2038:03 D0 03>4C 69 FF<B1 00
|
||
2040:E6 00 D0 02 E6 01 09 00
|
||
2048:D0 3B B1 00 85 07 E6 00
|
||
2050:D0 02 E6 01 B1 00 85 06
|
||
2058:E6 00 D0 02 E6 01 B1 00
|
||
2060:91 04 E6 00 D0 02 E6 01
|
||
2068:E6 04 D0 02 E6 05 C6 06
|
||
2070:A5 06 C9 FF D0 02 C6 07
|
||
2078:A9 00 C5 07 D0 E0 C5 06
|
||
2080:D0 DC 18 90 AA AA B1 00
|
||
2088:E6 00 D0 02 E6 01 E8 91
|
||
2090:04 E6 04 D0 02 E6 05 CA
|
||
2098:D0 F5 18 90 92
|
||
|