* 2 questions on bootsect.S
@ 2003-01-12 22:24 ram
2003-01-13 21:19 ` Jack Dennon
2003-01-13 21:25 ` Jack Dennon
0 siblings, 2 replies; 3+ messages in thread
From: ram @ 2003-01-12 22:24 UTC (permalink / raw)
To: linux-assembly
Hi,
I was looking through the linux (2.5.56) arch/i386/boot/bootsect.S and was
puzzled about a couple of things:
1. Near line 221 we have:
sread: .word 0 # sectors read of current track
head: .word 0 # current head
track: .word 0 # current track
However, since a diskette can have at most 2 heads, 80 tracks and 36
sectors
per track, why are these not bytes instead of words especially since
space is
at such a tight premium in this code ?
2. Near line 272 we have "movw $7, %bx" but the documentation I've
been able to find about the "int 0x13" BIOS call says that for service
code 0xe (write character and advance cursor), it does not take an
attribute byte input parameter but rather uses the existing
attribute. Is
this movw instruction superfluous ?
Thanks.
Ram
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 2 questions on bootsect.S
2003-01-12 22:24 2 questions on bootsect.S ram
@ 2003-01-13 21:19 ` Jack Dennon
2003-01-13 21:25 ` Jack Dennon
1 sibling, 0 replies; 3+ messages in thread
From: Jack Dennon @ 2003-01-13 21:19 UTC (permalink / raw)
To: ram; +Cc: linux-assembly
[-- Attachment #1: Type: text/plain, Size: 147 bytes --]
You may need some tools if you
decide to "bend it around." Attached
is a shell script and a little C program
that I use to mess with bootsect.S:
[-- Attachment #2: text.tmp --]
[-- Type: application/x-unknown-content-type-TMP_auto_file, Size: 904 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 2 questions on bootsect.S
2003-01-12 22:24 2 questions on bootsect.S ram
2003-01-13 21:19 ` Jack Dennon
@ 2003-01-13 21:25 ` Jack Dennon
1 sibling, 0 replies; 3+ messages in thread
From: Jack Dennon @ 2003-01-13 21:25 UTC (permalink / raw)
To: ram; +Cc: linux-assembly
[-- Attachment #1: Type: text/plain, Size: 84 bytes --]
Sorry, that was supposed to
attach in the clear as plain text.
Try one more time:
[-- Attachment #2: boot.txt --]
[-- Type: text/plain, Size: 904 bytes --]
#! /bin/bash
# asmboot.sh: assemble bootsect.S
cpp -traditional bootsect.S -o bootsect.ss
removebl < bootsect.ss > bootsect.s
as -aln=bootsect.lst -o bootsect.o bootsect.s
--------------------------------------------------------------
/* removebl.c: filter to remove blank lines
...well, most of them, leaves single blank lines in place
*/
#include <stdio.h>
#include <string.h>
#define MAXLINE 256
char line[MAXLINE];
/* getline: get line into s, return length */
int getline(char s[], int lim)
{
int c, i;
i = 0;
while (--lim > 0 && (c = getchar()) != EOF
&& c != '\n')
s[i++] = c;
if (c == '\n')
s[i++] = c;
s[i] = '\0';
return i;
}
main()
{
int c, i, length;
int plength = 0; /* previous line length */
while ( (length = getline(line,MAXLINE)) > 0) {
if (length > 1 || plength > 1) {
for (i = 0; i < length; i++)
putchar(line[i]);
}
plength = length;
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-13 21:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-12 22:24 2 questions on bootsect.S ram
2003-01-13 21:19 ` Jack Dennon
2003-01-13 21:25 ` Jack Dennon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).