Decompressing Data

How to Decompress data in the emu80866

Page 1 of 1

2 Replies - 1242 Views - Last Post: 14 December 2008 - 09:43 AM Rate Topic: -----

#1 espenodge  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 28
  • Joined: 21-November 08

Decompressing Data

Posted 07 December 2008 - 10:35 AM

The rle compressed data is 1, 4, 3, 9, 5, 3, 2, 7, 0. The program currently just prints all these values except the terminating zero. When properly decompressed, the output should be:
4 9 9 9 3 3 3 3 3 7 7
How do I modify this program so that it only prints out the decompressed data?

; rle_soln.asm
; sample program to demonstrate decompressing RLE

include 'emu8086.inc'

org  100h; set location counter to 100h

jmp CodeStart

DataStart:
   ; this is the run length encoded data
   ; notice that it is a list of words (bytes)
   ; with a zero on the end
	rleData dw 1, 4, 3, 9, 5, 3, 2, 7, 0
	
	space db ' ', 0

CodeStart:

   ; put the address of the first rle value in bx
	mov bx, offset rleData
	
   ; start a loop that will visit each value in rle data
	LoopStart:
	
   ; compare value in list with zer0
	cmp [bx], 0
	
   ; if value was zero, must be end of list so quit
	je EndLabel
	
   ; move value in list to ax
	mov ax, [bx]
	
   ; print it
	call print_num
	
   ; print a space
	mov si, offset space
	call print_string
	
   ; add 2 bytes to the address in bx to move to the
   ; next value in the list
	add bx, 2
	
   ; continue the loop until a zero is found
	jmp LoopStart
	
	EndLabel:
	ret
	
DEFINE_PRINT_STRING	
DEFINE_SCAN_NUM
DEFINE_PRINT_NUM
DEFINE_PRINT_NUM_UNS




Is This A Good Question/Topic? 0
  • +

Replies To: Decompressing Data

#2 espenodge  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 28
  • Joined: 21-November 08

Re: Decompressing Data

Posted 09 December 2008 - 12:34 PM

Ok this one is getting to me a little....
I cant figure out how to get the code to decompress properly, all i can do is move numbers or subtract them...
Was This Post Helpful? 0
  • +
  • -

#3 no2pencil  Icon User is online

  • Professor Snuggly Pants
  • member icon

Reputation: 6582
  • View blog
  • Posts: 30,736
  • Joined: 10-May 07

Re: Decompressing Data

Posted 14 December 2008 - 09:43 AM

** Closed : Duplicate Topic **
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1