aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhpa <hpa>2004-12-17 07:52:54 +0000
committerhpa <hpa>2004-12-17 07:52:54 +0000
commit49378a236262c352087afc5df91007aa769a9fda (patch)
tree6bc5067795850bc4ffa8c4e7fc62e71d03b22465
parent77d1a2bf58ba666cc053fe3fa7fc06d440a11938 (diff)
downloadsyslinux.git-49378a236262c352087afc5df91007aa769a9fda.tar.gz
syslinux.git-49378a236262c352087afc5df91007aa769a9fda.tar.xz
syslinux.git-49378a236262c352087afc5df91007aa769a9fda.zip
Fix the RLL-packing code; include it by default (not called yet, though)
-rw-r--r--parseconfig.inc4
-rw-r--r--rllpack.inc27
2 files changed, 20 insertions, 11 deletions
diff --git a/parseconfig.inc b/parseconfig.inc
index 3b6d111b..f738dafc 100644
--- a/parseconfig.inc
+++ b/parseconfig.inc
@@ -1,7 +1,7 @@
;; $Id$
;; -----------------------------------------------------------------------
;;
-;; Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
+;; Copyright 1994-2004 H. Peter Anvin - All Rights Reserved
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -325,3 +325,5 @@ commit_vk:
cvk_ret: ret
cvk_overflow: mov word [VKernelCtr],max_vk ; No more than max_vk, please
ret
+
+%include "rllpack.inc"
diff --git a/rllpack.inc b/rllpack.inc
index 30928811..9d2aab30 100644
--- a/rllpack.inc
+++ b/rllpack.inc
@@ -24,23 +24,26 @@
; 0 = end of data
;
+ section .text
+
;
; rllpack:
; Pack CX bytes from DS:SI into ES:DI
-; Returns updated SI, DI and DX = number of bytes output
+; Returns updated SI, DI and CX = number of bytes output
;
rllpack:
push ax
push bx
+ push cx
push bp
- mov dx,di
+ push di
.startseq:
- xor ax,ax
+ xor ax,ax ; Zero byte
+ xor bx,bx ; Run length zero
mov bp,di ; Pointer to header byte
stosb ; Store header byte (might be zero)
- xor bx,bx ; No bytes emitted yet
+ jcxz .done_null
.stdbyte:
- jcxz .done
lodsb
stosb
dec cx
@@ -52,13 +55,17 @@ rllpack:
.plainbyte:
inc bx
inc byte [es:bp]
- js .startseq
- jmp .stdbyte
+ jcxz .done
+ jns .stdbyte
+ jmp .startseq
.same:
cmp bl,2
jb .plainbyte
; 3 bytes or more in a row, time to convert sequence
sub byte [es:bp],bl
+ jnz .normal
+ dec di ; We killed a whole stretch, remove start byte
+.normal:
inc bx
sub di,bx
mov bp,di
@@ -82,14 +89,14 @@ rllpack:
dec si
jmp .startseq
.done:
- and bx,bx
- jz .nullok
xor al,al
stosb
-.nullok:
+.done_null:
+ pop dx
sub dx,di
neg dx
pop bp
+ pop cx
pop bx
pop ax
ret