1 Replies - 2046 Views - Last Post: 17 August 2009 - 01:09 AM Rate Topic: -----

#1 CaptKid  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 40
  • Joined: 16-August 09

Decompressing Data, How to Decompress data in the emu80866

Posted 16 August 2009 - 10:22 PM

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

This post has been edited by CaptKid: 16 August 2009 - 10:23 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Decompressing Data, How to Decompress data in the emu80866

#2 wildgoose  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 67
  • View blog
  • Posts: 468
  • Joined: 29-June 09

Re: Decompressing Data, How to Decompress data in the emu80866

Posted 17 August 2009 - 01:09 AM

DUPLICATE POSTS!

See the other post!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1