Rev 18 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 18 | Rev 125 | ||
---|---|---|---|
Line 48... | Line 48... | ||
48 | 48 | ||
49 | .code16 |
49 | .code16 |
50 | _start_0x7c00: |
50 | _start_0x7c00: |
51 | xorw %ax,%ax # reset, %al will be used below |
51 | xorw %ax,%ax # reset, %al will be used below |
52 | movw %ax,%dx # fd0, %dh and %dl will be used below |
52 | movw %ax,%dx # fd0, %dh and %dl will be used below |
53 | movw %dx,%ds |
53 | movw %dx,%ds |
54 | 54 | ||
55 | movw %dx,%ss # initialize stack |
55 | movw %dx,%ss # initialize stack |
56 | movw $stack,%sp |
56 | movw $stack,%sp |
57 | 57 | ||
58 | int $0x13 # reset floppy |
58 | int $0x13 # reset floppy |
59 | jc stop_trying |
59 | jc stop_trying |
60 | 60 | ||
61 | movw %dx,%ds |
61 | movw %dx,%ds |
62 | movw %dx,%ss |
62 | movw %dx,%ss |
63 | movw $0x7c00,%sp |
63 | movw $0x7c00,%sp |
64 | movw $0xffe0,%si # after next increment, %si will become 0x0000 |
64 | movw $0xffe0,%si # after next increment, %si will become 0x0000 |
65 | movw %si,%es |
65 | movw %si,%es |
66 | movw $0x8000,%bx # at %es:%bx |
66 | movw $0x8000,%bx # at %es:%bx |
Line 90... | Line 90... | ||
90 | addw $0x20,%si |
90 | addw $0x20,%si |
91 | movw %si,%es |
91 | movw %si,%es |
92 | 92 | ||
93 | movw logical_sector,%ax |
93 | movw logical_sector,%ax |
94 | divb sectors |
94 | divb sectors |
95 | 95 | ||
96 | movb %ah,%cl |
96 | movb %ah,%cl |
97 | incb %cl # sector |
97 | incb %cl # sector |
98 | 98 | ||
99 | movb %al,%ch |
99 | movb %al,%ch |
100 | shrb $1,%ch # track |
100 | shrb $1,%ch # track |
101 | 101 | ||
102 | movb %al,%dh |
102 | movb %al,%dh |
103 | andb $1,%dh # head |
103 | andb $1,%dh # head |
104 | 104 | ||
105 | movw $0x0201,%ax |
105 | movw $0x0201,%ax |
106 | int $0x13 |
106 | int $0x13 |
Line 124... | Line 124... | ||
124 | CH=4 |
124 | CH=4 |
125 | echo_mark: |
125 | echo_mark: |
126 | push %bp |
126 | push %bp |
127 | movw %sp,%bp |
127 | movw %sp,%bp |
128 | pusha |
128 | pusha |
129 | 129 | ||
130 | movb $0xe,%ah |
130 | movb $0xe,%ah |
131 | movb $7,%bl |
131 | movb $7,%bl |
132 | int $0x10 |
132 | int $0x10 |
133 | 133 | ||
134 | popa |
134 | popa |
135 | pop %bp |
135 | pop %bp |
136 | ret |
136 | ret |
137 | 137 | ||
138 | # current logical sector from the beginning of the disk |
138 | # current logical sector from the beginning of the disk |