wok annotate syslinux/stuff/iso2exe/lzcom.S @ rev 17400
gnutls-dev: update deps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Nov 27 21:50:32 2014 +0100 (2014-11-27) |
parents | 7d300004a3b8 |
children |
rev | line source |
---|---|
pascal@13691 | 1 .text |
pascal@13691 | 2 .code16 |
pascal@13691 | 3 |
pascal@13691 | 4 ORGCOM = 0x100 |
pascal@13691 | 5 STKSZ = 0x4000 // unlzma needs 16Kb |
pascal@13691 | 6 |
pascal@13756 | 7 #undef USE_CX_LOADER // CX should be set by loader |
pascal@13756 | 8 #undef SETUP_SS // extends max code size from 47k to 63k |
pascal@13756 | 9 |
pascal@13756 | 10 #ifdef SETUP_SS |
pascal@13756 | 11 STKROOM = 256 |
pascal@13756 | 12 #else |
pascal@13756 | 13 STKROOM = STKSZ |
pascal@13756 | 14 #endif |
pascal@13756 | 15 |
pascal@13756 | 16 CODESZ = (0x10000-STKROOM)/2 // max < 16 sectors = 32Kb |
pascal@13691 | 17 .org 0 |
pascal@13691 | 18 |
pascal@13691 | 19 .globl _start |
pascal@13691 | 20 _start: |
pascal@13756 | 21 movw $ORGCOM, %ax |
pascal@13756 | 22 pushw %ax |
pascal@13756 | 23 movw $packedcode+ORGCOM-1, %si |
pascal@13756 | 24 #ifdef USE_CX_LOADER |
pascal@13756 | 25 pushw %cx |
pascal@13756 | 26 #endif |
pascal@13756 | 27 movw $-STKROOM-1, %di |
pascal@13756 | 28 movw $packedcode-unpack-1, %cx |
pascal@13756 | 29 std |
pascal@13756 | 30 // * max ~47k | 17k |
pascal@13756 | 31 // oouuuuppppppppppppppppppppp-------------------S---16k---- |
pascal@13691 | 32 rep |
pascal@13691 | 33 movsb // decompressor |
pascal@13756 | 34 // oo----ppppppppppppppppppppp---------------uuuuS---16k---- |
pascal@13756 | 35 #ifdef USE_CX_LOADER |
pascal@13756 | 36 popw %cx |
pascal@13691 | 37 pushw %di |
pascal@13756 | 38 movsb |
pascal@13756 | 39 movw $packedcode+ORGCOM-1, %si |
pascal@13756 | 40 addw %cx, %si |
pascal@13756 | 41 #else |
pascal@13756 | 42 pushw %di |
pascal@13756 | 43 movsb |
pascal@13756 | 44 #if (CODESZ % 256) == 0 |
pascal@13756 | 45 movb $CODESZ/256, %ch |
pascal@13756 | 46 #else |
pascal@13756 | 47 movw $CODESZ, %cx // the loader should update CX ... |
pascal@13756 | 48 #endif |
pascal@13756 | 49 movw $packedcode+ORGCOM+CODESZ-1, %si |
pascal@13756 | 50 // unsigned char *code; // But we can patch later: |
pascal@13756 | 51 // size -= * (unsigned short *) (code + 19); |
pascal@13756 | 52 // * (unsigned short *) (code + 19) += size; |
pascal@13756 | 53 // * (unsigned short *) (code + 22) += size; |
pascal@13756 | 54 #endif |
pascal@13756 | 55 rep |
pascal@13756 | 56 movsb // packed code |
pascal@13756 | 57 // oo--------------------ppppppppppppppppppppuuuuS---16k---- |
pascal@13756 | 58 // * |
pascal@13756 | 59 cld |
pascal@13756 | 60 incw %di |
pascal@13756 | 61 xchgw %ax, %di |
pascal@13756 | 62 xchgw %ax, %si |
pascal@13691 | 63 ret |
pascal@13756 | 64 // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx------uuuuS---16k---- |
pascal@13756 | 65 // * max ~47k | 17k |
pascal@13691 | 66 |
pascal@13691 | 67 unpack: |
pascal@13756 | 68 #ifdef SETUP_SS |
pascal@13756 | 69 movw %ss, %bx |
pascal@13756 | 70 leaw STKSZ/16(%bx), %ax |
pascal@13756 | 71 movw %ax, %ss |
pascal@13756 | 72 pushw %bx |
pascal@13756 | 73 call dounpack |
pascal@13756 | 74 popw %ss |
pascal@13756 | 75 ret |
pascal@13756 | 76 dounpack: |
pascal@13756 | 77 #endif |
pascal@13691 | 78 #define FLAT16 |
pascal@13691 | 79 #include "unlzma.S" |
pascal@13691 | 80 |
pascal@13691 | 81 packedcode: |