wok-tiny view 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 source
1 .text
2 .code16
3 .arch i8086
4 .org 0
5 .globl _start
6 _start:
7 call start2
9 BPB = 0x3E
10 #define TINY_MENU Tiny SliTaz floppy boot menu
11 #ifdef TINY_MENU
12 .org BPB-12
13 xchgw %ax, %di # 79 58 41 E8
14 popw %ax
15 incw %cx
16 call called
17 called:
18 addw $0x20, %cs:bootseg+0x201 # code at 07C0:0200
19 .org BPB, 0x90
20 #endif
22 .org BPB
23 start2:
24 popw %ax
25 com_offset = 0x100
26 cmpw $com_offset+3, %ax
27 je dotcom
28 cwd
29 int21hook:
30 movb $int21-_start, %al
31 movw %dx, %ds
32 movw %ax, 0x21*4
33 movw %cs, 0x21*4+2
34 bootseg:
35 movw $0x7C0-com_offset/16, %ax
36 .byte 0x3d # cmp $0xc88c, %ax
37 dotcom:
38 movw %cs, %ax
39 paragraphs = 9
40 addw $paragraphs, %ax
41 movw %ax, %ds
42 movw %ax, %es
43 movw %ax, %ss
44 movw $0xFFFE, %sp
45 pushw %ax
46 movw $com_offset, %ax
47 pushw %ax
48 cbw # %ax = 0
49 retf
51 int21:
52 subb $7, %ah
53 jne not_input
54 int $0x16 # %ah = 0
55 do_iret:
56 iret
57 not_input:
58 cmpb $9-7, %ah
59 jne abort
60 movw %dx, %si
61 puts:
62 lodsb
63 cmpb $'$', %al
64 je do_iret
65 movb $0xe, %ah
66 movw $0xf, %bx
67 int $0x10
68 jmp puts
69 abort:
70 ljmp $0xffff,$0
72 .org paragraphs*16
73 code:
74 .org 510
76 .word 0xaa55