Sean 'Captain Napalm' Conner skrev:
It was thus said that the Great Iggy Drougge once
stated:
>
> Cameron Kaiser skrev:
>
> >Besides, why not steal such stuff from BASIC ROM? On the C64, print a
> >string from memory by setting A/Y to the localtion and jsr $ab1e, and use
> >the routine at $bdcd that LIST uses to print line numbers for 16-bit
> >unsigned int.
>
> By all means, but then you're just programming BASIC in an awkward way.
> BASIC has a print statement, assembly has not. OTOH, neither does C. =)
It really depends upon what you mean by ``print
statement.'' Yes, the
language specification for BASIC (whatever specification exists) does
include a language element called ``PRINT'' (just as Pascal has WRITE and
WRITELN) and technically, the C language doesn't have such an element. But
... and this is the crucial part here ... if you are programming under ANSI
C (and most C compilers, if not all, in active use today) you have the
Standard C Library (if it doesn't come with an implementation of the
Standard C Library, it can't be considered an ANSI C compiler), of which you
then have the library function printf().
Agreed, you'll just have to tell the newbie to start each program with
#include <stdio.h> and that's it, you have a print statement.
A macro assembler with a lot of useful routines included may not be that bad
either, but I think it would benefit the newbie to operate the first few times
in a protected environment, such as BASIC, just as children go to kindergarten
before going to school.
Now, getting back to your assertion that Assembly has
no print
statement---that's a straw man if I ever saw one. It really depends upon
the platform you are programming for if there is a system facility for
printing. On the Amiga, you have RawDoFmt() (or rather, _LVORawDoFmt(a6)
where a6 contains the Exec library base address) for printing purposes, and
it's flexible enough to print to files, the screen, memory, serial port,
parallel port, or where ever you want the data to go:
I remember reading once that real programmers don't use the code of others. I
suppose that might have influenced by attitudes about assembly a lot.
[approximately fourteen lines of m68k asm snipped]
That's still a lot more than a on-line PRINT. You haven't managed to persuade
me.
[much shorter Intel UNIX routine snipped]
Not exactly rocket science here. And you might say
that you're just
programming AmigaOS or Unix in an awkward way, but no matter what, if you're
not used to Assembly, it's going to look awkward. And you don't learn
assembly in a vaccum---you learn for a particular chip on a particular
system and you will generally have documentation for doing I/O. You might
not have formatted I/O, but you can generally do I/O and part and parcel of
learning assembly is learning how to do things like divide/multiply by 10
(for decimal output), or give up on that and learn how to read octal or hex
*real* quick 8-)
From your messages, I get the feeling you don't
like Assembly all that
much ...
I have the utmost respect for assembly programmers, and have had too much
respect for assembly itself. It's only after nearly ten years of using
computers that I've managed to see that it might not be as strange as I
thought at first.
I still think that if your computer boots into Microsoft BASIC 2, you're going
to have a lot of fun with PRINT and INPUT for a while, but after that, you'll
have to investigate assembly. That's a nice learning curve. Assembly for the
actual beginner would be like throwing them in at the deep end to see who
survives.
--
En ligne avec Thor 2.6a.
Netiquette: it's not just a good idea, there's actually an RFC about it!
For the full details, check out <http://www.faqs.org/rfcs/rfc1855.html>.