Re: Windows Assembly



Richard Cooper wrote:
>> Always read errors from top to bottom and fix them in that order.
>
> Yeah, I figured that out. It was kind of hard at first when it
> printed out so many errors that the ones I needed to see were
> scrolled so far up the console that I couldn't scroll back far enough
> to see them. Then I just made my compile script run the output
> through "head -n 20" so that's kinda fixed now.

That'll work if you're not using an IDE :)

> But what really bothers me about it is that I'm used to, like with
> NASM, being able to run my compile script once, and if there's 20
> errors, I can fix all 20 before running it again. With GCC, I have
> to fix just one error, then run the compile script again to see how
> many of the rest of the errors weren't actually errors at all.

Yeah, some errors (especially the "duh" ones) has this effect. But what if
you start doing complicated macros in nasm? At least in MASM you can get
some pretty horrid error lines as well :)

> Only because it seems totally unnecessary. If the information the
> compiler needs is in the file, it seems silly that it can't find it. The
> compiler should be working for the user, not the other way
> around. It makes me feel like assembly is more advanced, simply
> because the assembler is smarter than the C compiler.

Must admit I can't really come up with a good reason for protos in the same
module off top of my head. Might still be some reason, though.

> Another thing that's bothering me is that everything is exported to
> the object file. So I can't have two source files each with a
> function of the same name (only called from within that file of
> course), because those functions are made globals in the assembly
> output, and once it gets to the linker, the linker complains about
> duplicate symbols.

Either use namespaces (C++) or the "static" keyword. Namespaces are pretty
nice.

> Maybe what I need is to learn C++.

It helps a lot with a lot of things. You will shoot yourself in the foot
many times while learning it, though. You can do some really clean &
well-performing things in C++, but if you mess up you get extreme bloat and
slop easily.

> Even my assembly code is somewhat object oriented, it's just the way my
> mind thinks about things.

You can (and should, IMO) do object-oriented programming in most languages.
If nothing more, at least follow the rules of modules, black boxes /
encapsulation, etc. Makes life easier.

> I even get so anal about it that I
> call a function in another file that does nothing but return a single
> variable, rather than make that variable global.

Probably overkill in most situations, but probably not too bad unless you
have global data that's very small. Your approach does buy you some
flexibility for later extension.

> C++ might be what I need, I imagine if a function is private to a class
> that
> it's not marked as global in the assembly output.

well, the "static" keyword can fix this even without the use of C++.

> I think I've got a C++ book somewhere, I'll have to see if I can find
> it.

If it's anything like "teach yourself C++ in <amount> <timeunits>", don't
even open it - some of those books do a lot of damage that is hard to repair
later on.

> I was so in the habit of checking for less than zero and then checking
> errno from all of the other system calls that it didn't occur to me
> that this one system call had it's own constant. The others all just
> say "returns -1 on error" and don't have a constant to check for.

Can't blame you, unix code is littered with "< 0" checks.

> Even so, I just don't trust the error handling in C. It all feels so
> hacked together.

Well, if you look at libc isolated, it's relatively consistent. Memory
functions tend to return 0/NULL on error, file-routines have some EOF
marker, etc. Once you start bringing in third-party libraries, POSIX calls,
and operating system APIs, that's when things become fun.

C++ brings in exception handling which is really nice when done right, but
it still doesn't help you when interfacing with legacy code.

> Well, even if it did, I'd have to surround everything with it.

Well, if you only have to handle "panic" cases and restore things + bomb out
to the shell, wrapping your main() function in a try/catch should be enough.
I can't remember if the C++ standard guarantees that "catch(...)" will
handle things like memory violation errors, but at least it does under
win32/msvc, and I would expect it to under linux/gcc as well.

> I just tried Ubuntu yesterday. It was the final nail in the coffin
> for my idea to make this game in Linux. It starts up linux in 80x25
> mode, but uses it's own VGA code to switch to 80x30.

I think it uses some pretty standard stuff to do this, "vanilla" debian
flavours has it too (and iirc Ubuntu is based on debian). Never really liked
the console fonts stuff though, always preferred lilo.conf/"vga=ext" on
machines that don't have framebuffer capable cards.

> The problem is that it doesn't use the standard timings for 80x30 text
> mode,
> so the screen scrolls off the right side of the monitor a little, and you
> have to re-adjust your monitor.

Joy, oh joy. I suppose this is mainly an issue with older monitors though?
Most digital monitors I've used for the last couple of years have memory for
settings for a whole bunch of modes. Still annoying though.

> Gentoo sucks. When you install software, it contacts a server
> somewhere to figure out the dependancies and install the dependancies
> for you. This sounds like a good idea, but the problem is that the
> information on that server is constantly being updated, and constant
> updates means constant bugs. So you go to install the thing, but the
> installation fails (after five hours no less). You post about it on
> a message board and someone says "oh yeah, there was a bug in some
> file on the server, but it's fixed now" so you try to install it
> again, and sure enough that bug is fixed, but now there's a new one.

*grin*. Sounds pretty fantastic that you have gotten such a polite reply, in
my experience the usual response would have been "go RTFM kpzlthx n00b". And
then you're off manually fixing the proftpd sources because the author
didn't quite get the OpenSSL initialization right.

> Then I installed Slackware 10.0 and my printer hasn't worked since. As
> best I can tell, the printer driver thinks that the printer is
> always busy, and so it never sends it anything.


I've, quite fantastic enough, gotten a USB based laserprinter working on
slack 9.0, *and* I'm able to share it with my windows boxes via samba +
cups. Of course there's like 20 second stalls sometimes when a application
wants to print, but of course this is my problem for not setting up the cups
and samba configuration files properly. And yes, I did read through all the
documentation I could find. I'm seriously considering switching the server
to win2003, at least that would plain and simple work.


.



Relevant Pages

  • Re: Windows Assembly
    ... But what really bothers me about it is that I'm used to, like with NASM, being able to run my compile script once, and if there's 20 errors, I can fix all 20 before running it again. ... It makes me feel like assembly is more advanced, simply because the assembler is smarter than the C compiler. ... The signal handler is there to catch obscure bugs that I never expected to occur and restore the machine to it's original state. ... When you install software, it contacts a server somewhere to figure out the dependancies and install the dependancies for you. ...
    (alt.lang.asm)
  • Re: The Greatest Lesson Ive Learned
    ... Yeah, silly kids right out of school, miseducated prima donas with no ... Seems Install was using OLD APIs and the long wrapped to a negative ... Did I say it was written in assembler? ...
    (comp.lang.basic.visual.misc)
  • Re: The Greatest Lesson Ive Learned
    ... Yeah, silly kids right out of school, miseducated prima donas with no ... My most bizarre teksport call was when the spanking new 2G HDs came ... Seems Install was using OLD APIs and the long wrapped to a negative ... Did I say it was written in assembler? ...
    (comp.lang.basic.visual.misc)
  • Re: me&xp home conflict?
    ... Yeah yeah, ... Why should you bother being coherent; it's my job to decipher your ... Grammar check. ... HOW TO Install Windows XP ...
    (microsoft.public.windowsxp.basics)
  • Re: Bit Twister: Is this the dhclient-exit-hooks you were talking about?
    ... you have to use your editor commands. ... Yeah I got that part figured out now. ... I alwasy install in seprate partitions and share common stuff I ... save it all to peruse at a later date, thanks bit twister. ...
    (alt.os.linux)

Loading