wok-next diff syslinux/stuff/iso2exe/bootiso.S @ rev 13699
syslinux/iso2exe: only DOS 3, 4 and 6 supported :-/
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Dec 15 13:43:51 2012 +0100 (2012-12-15) |
parents | d47403fdd900 |
children | 9d2380009b81 |
line diff
1.1 --- a/syslinux/stuff/iso2exe/bootiso.S Fri Dec 14 15:43:12 2012 +0100 1.2 +++ b/syslinux/stuff/iso2exe/bootiso.S Sat Dec 15 13:43:51 2012 +0100 1.3 @@ -44,19 +44,25 @@ 1.4 pushf 1.5 pushw %ds 1.6 pushw %es 1.7 - pushw $0 1.8 - popw %ds 1.9 call setreg 1.10 rep 1.11 movsw 1.12 ljmp $0, $0x0600+start2 1.13 1.14 +readsector2: 1.15 + incw %cx 1.16 +readsector1: 1.17 + movw %cx, (%bx) 1.18 + incw %cx 1.19 + movw $0x201, %ax 1.20 + int $0x13 1.21 setreg: 1.22 cld 1.23 - pushw %ds 1.24 - popw %es 1.25 - movw $0x7C00, %si 1.26 - movw %si, %bx 1.27 + xorw %bx, %bx // Clear C 1.28 + movw %bx, %ds 1.29 + movw %bx, %es 1.30 + movb $0x7C, %bh 1.31 + movw %bx, %si 1.32 movw $0x0600, %di 1.33 movw $0x0100, %cx 1.34 return: 1.35 @@ -64,29 +70,26 @@ 1.36 start2: 1.37 movw $0x80, %dx 1.38 dxloop: 1.39 - movw $1, %cx 1.40 - movw $0x201, %ax 1.41 - int $0x13 1.42 - jc next 1.43 - call setreg 1.44 + call readsector1 1.45 repe 1.46 cmpsw 1.47 je dxfound 1.48 next: 1.49 - addb $0x7D, %dl // try every hard disk 1.50 - andb $0x83, %dl // and floppy disk 1.51 - cmpb $0x80, %dl 1.52 + xorw %cx, %cx 1.53 + xchgw %ax, %dx 1.54 + addb $0x7D, %al // try every hard disk 1.55 + andb $0x83, %al // and floppy disk 1.56 + cmpb $0x80, %al 1.57 + xchgw %ax, %dx 1.58 jnz dxloop 1.59 fail: 1.60 int $0x19 1.61 dxfound: 1.62 movw %dx, 10(%bp) 1.63 - movb $2, %cl // %ch = 0 1.64 - movw $0x201, %ax 1.65 - int $0x13 1.66 - jc fail 1.67 - cmpw $0xAA55, 0x7DFE 1.68 - jne fail 1.69 + call readsector2 1.70 + lodsw 1.71 + decw %ax 1.72 + jz fail // read fail or not isohydrid 1.73 popw %es 1.74 popw %ds 1.75 popf 1.76 @@ -104,17 +107,18 @@ 1.77 rmPaging: 1.78 .ascii "Broken paging$" 1.79 ERRvcpi: 1.80 - .ascii "No VCPI 4.0+$" 1.81 + .ascii "No EMM386/VCPI 4.0+$" 1.82 chkerr: 1.83 - .ascii "Broken ISO$" 1.84 + .ascii "Broken ISO file$" 1.85 realmodemsg: 1.86 .ascii "Real mode$" 1.87 vm86modemsg: 1.88 .ascii "VM86 mode$" 1.89 help: 1.90 - .ascii "SliTaz GNU/Linux bootloader$" 1.91 + .ascii "SliTaz GNU/Linux boot loader$" 1.92 1.93 fixseg: 1.94 + cld 1.95 movb $EXESTR(help), %dl 1.96 movw $0x100, %si 1.97 cmpw $0x3F2F, -126(%si) # /? 1.98 @@ -133,21 +137,21 @@ 1.99 skip: 1.100 pushf 1.101 popw %ax 1.102 - movw $0xF0F0, %cx 1.103 - orb %ah, %ch 1.104 + movw $0xF0F0, %dx 1.105 + orb %ah, %dh 1.106 andb $0xF, %ah 1.107 pushw %ax 1.108 popf 1.109 pushf 1.110 popw %ax 1.111 - andb %cl, %ah 1.112 - cmp %cl, %ah 1.113 + andb %dl, %ah 1.114 + cmp %dl, %ah 1.115 je NotSupported // 8086 family 1.116 - pushw %cx 1.117 + pushw %dx 1.118 popf 1.119 pushf 1.120 popw %ax 1.121 - andb %cl, %ah 1.122 + andb %dl, %ah 1.123 jnz is386 // 80286 family 1.124 NotSupported: 1.125 movb $EXESTR(no386), %dl 1.126 @@ -162,24 +166,19 @@ 1.127 ret 1.128 1.129 is386: 1.130 - movb $0x30, %ah 1.131 - int $0x21 1.132 - cmpb $3, %al 1.133 - movb $EXESTR(noDOS3), %dl 1.134 - jb abort 1.135 movl %cr0, %eax 1.136 andb $1, %al 1.137 jne tstvcpi 1.138 movb $EXESTR(rmPaging), %dl 1.139 shll $1, %eax 1.140 +cabort: 1.141 jc abort 1.142 movb $EXESTR(realmodemsg), %dl 1.143 jmp realmode 1.144 1.145 tstvcpi: 1.146 pushw %ds 1.147 - pushw $0 1.148 - popw %ds 1.149 + movw %cx, %ds // %cx = 0 1.150 movw 0x67*4+2, %ds 1.151 std 1.152 movw $14, %si 1.153 @@ -190,7 +189,6 @@ 1.154 popw %ds 1.155 NoVCPI: 1.156 movb $EXESTR(ERRvcpi), %dl 1.157 -goabort: 1.158 jne abort 1.159 shll $8, %eax 1.160 cmpl $0x4D4D4500, %eax // [XQ]MME 1.161 @@ -215,8 +213,12 @@ 1.162 movb $EXESTR(vm86modemsg), %dl 1.163 realmode: 1.164 call puts 1.165 + movb $0x30, %ah 1.166 + int $0x21 1.167 + cmpb $3, %al 1.168 + movb $EXESTR(noDOS3), %dl 1.169 + jb cabort 1.170 movw EXEADRS(comstart), %ax // .com address 1.171 - cld 1.172 movw $moveend-move, %cx 1.173 movw $EXEADRS(move), %si 1.174 movw $0xC000, %di