linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jack Dennon <jdennon@seasurf.net>
To: ram <ram@curvesoft.com>
Cc: linux-assembly@vger.kernel.org
Subject: Re: 2 questions on bootsect.S
Date: Mon, 13 Jan 2003 13:25:11 -0800	[thread overview]
Message-ID: <3E232EB7.4841F0F5@seasurf.net> (raw)
In-Reply-To: 3E21EB31.3080709@curvesoft.com

[-- 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;
	}
}


      parent reply	other threads:[~2003-01-13 21:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E232EB7.4841F0F5@seasurf.net \
    --to=jdennon@seasurf.net \
    --cc=linux-assembly@vger.kernel.org \
    --cc=ram@curvesoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).