wok-tiny diff tfttest/stuff/bootloader.S @ rev 173
Fix ctorrent-dnh & tfttest
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Jul 14 09:04:04 2021 +0000 (2021-07-14) |
parents | 8da769e5f6c3 |
children |
line diff
1.1 --- a/tfttest/stuff/bootloader.S Sat May 08 17:23:19 2021 +0000 1.2 +++ b/tfttest/stuff/bootloader.S Wed Jul 14 09:04:04 2021 +0000 1.3 @@ -5,40 +5,57 @@ 1.4 .globl _start 1.5 _start: 1.6 call start2 1.7 + 1.8 +BPB = 0x3E 1.9 +#define TINY_MENU Tiny SliTaz floppy boot menu 1.10 +#ifdef TINY_MENU 1.11 + .org BPB-12 1.12 + xchgw %ax, %di # 79 58 41 E8 1.13 + popw %ax 1.14 + incw %cx 1.15 + call called 1.16 +called: 1.17 + addw $0x20, %cs:bootseg+0x201 # code at 07C0:0200 1.18 + .org BPB, 0x90 1.19 +#endif 1.20 + 1.21 + .org BPB 1.22 start2: 1.23 - popw %bx 1.24 - cmpb $0x1, %bh 1.25 + popw %ax 1.26 +com_offset = 0x100 1.27 + cmpw $com_offset+3, %ax 1.28 je dotcom 1.29 - xorw %ax, %ax # %ax = 0 1.30 - movw %ax, %ds 1.31 - leaw int21-start2(%bx), %ax 1.32 - movw %ax,0x21*4 1.33 - movw %cs,0x21*4+2 1.34 - movw $0x7C0-0x10, %ax 1.35 - movw %ax, %ds 1.36 + cwd 1.37 +int21hook: 1.38 + movb $int21-_start, %al 1.39 + movw %dx, %ds 1.40 + movw %ax, 0x21*4 1.41 + movw %cs, 0x21*4+2 1.42 +bootseg: 1.43 + movw $0x7C0-com_offset/16, %ax 1.44 + .byte 0x3d # cmp $0xc88c, %ax 1.45 dotcom: 1.46 - movw %ds, %ax 1.47 - addw $6, %ax # addw $code/16, %ax 1.48 + movw %cs, %ax 1.49 +paragraphs = 9 1.50 + addw $paragraphs, %ax 1.51 movw %ax, %ds 1.52 movw %ax, %es 1.53 movw %ax, %ss 1.54 movw $0xFFFE, %sp 1.55 - pushw %ds 1.56 - movw $0x100, %ax 1.57 pushw %ax 1.58 - cbw 1.59 - xorw %bx, %bx 1.60 + movw $com_offset, %ax 1.61 + pushw %ax 1.62 + cbw # %ax = 0 1.63 retf 1.64 1.65 int21: 1.66 - cmpb $7, %ah 1.67 + subb $7, %ah 1.68 jne not_input 1.69 - movb $0, %ah 1.70 - int $0x16 1.71 + int $0x16 # %ah = 0 1.72 do_iret: 1.73 iret 1.74 not_input: 1.75 - cmpb $9, %ah 1.76 + cmpb $9-7, %ah 1.77 jne abort 1.78 movw %dx, %si 1.79 puts: 1.80 @@ -51,8 +68,8 @@ 1.81 jmp puts 1.82 abort: 1.83 ljmp $0xffff,$0 1.84 - 1.85 - .org 0x60 1.86 + 1.87 + .org paragraphs*16 1.88 code: 1.89 .org 510 1.90