Let's Code MS DOS 0x21: 3D Fixed Point Maths

Ғылым және технология

The 3D Wireframe cube is part of every demoscene coder’s learning curve. Today I want to talk you through the principles of 3D programming in general and especially the idea of fixed point maths, where you use integers instead of floating point numbers to represent fractions. Older CPUs before the 80486 had no built in floating point support, and even the FPUs were quite often rather slow and hard to program for, if available at all. So people had to opt to use integer arithmetics in stead. But 3D graphics requires fractional numbers, so how do we get both things together and manage to display a rotating wireframe cube on our MS DOS machine?
Support me on Patreon: / root42
Support me on Ko-Fi: ko-fi.com/root42
Support me on PayPal: paypal.me/ArneSchmitz
Support me on KZread: / @root42
Music: A Little Wonder by Spino2006
Source Code: github.com/root42/doscube

Пікірлер: 33

  • @riccardoiovenitti8688
    @riccardoiovenitti86889 ай бұрын

    To get some extra performance use sintable of 256 and use and unsigned char as angle. That would automatically wrap around and you have no need for modulo.

  • @root42

    @root42

    9 ай бұрын

    Yeah, if 256 is enough resolution that's okay. The code is absolutely not optimized, more tuned for readability. There are loads of performance tricks to be pulled still.

  • @SomePotato
    @SomePotato9 ай бұрын

    I basically hogged the first edition from our local library until my parents got me the edition in this video. Fantastic book. It's still on my shelf.

  • @bad.sector
    @bad.sector9 ай бұрын

    Nice work! I have the book since '94 or '95 in an earlier revision, and it was a good starting point at least, and of course interesting stuff, including the demos! It's good that the 3D stuff worked out so well for you. The SB documentation was incorrect for the SB 16 in my revision, unfortunately. The MOD-Player was a nice thing to tinker with, but due to the way it was programmed more or less fixed to 8 channels max and only Amiga MOD formats, and lousy FX support. Got later PC Intern 5, and that one had the SB documentation right, which also led to my own (much better) MOD player code in the end.

  • @root42

    @root42

    9 ай бұрын

    I have another book about Sound Blaster programming, which is much better. And I think nowadays you can use MikMod more easily. Or code your own MOD engine. :) Or perhaps use the one by FreddyV -- which is probably one of the fastest out there, especially for slower machines.

  • @bad.sector

    @bad.sector

    9 ай бұрын

    @@root42 A ssaid, I simply coded my own engine, it's included in SoundLib2, which is probably the most versatile audio library for Borland Pascal available. Can you point me where to find FreddyVs engine? Just curious... couldn't find it via Google...

  • @root42

    @root42

    9 ай бұрын

    I think he mentioned you can use it as a library, too, but I can only find the standalone player right now: www.vogons.org/viewtopic.php?t=87181 But you can ask him, he is usually very responsive.

  • @bgsjust
    @bgsjustАй бұрын

    for ultimate performance use inline assemby!

  • @-taz-
    @-taz-9 ай бұрын

    I remember going to C++ from Pascal in 1993, right after high school, and I could not tell the difference between "viod" and "void." Turbo C++ helped me conquer dyslexia!

  • @root42

    @root42

    9 ай бұрын

    Good for you! :-D Pascal wasn't bad, but by the mid-90s it mostly had run its course, I think.

  • @gnurou
    @gnurou9 ай бұрын

    I had (still have actually!) the French version of this book! It was fantastic. Thanks for the nostalgia trip.

  • @root42

    @root42

    9 ай бұрын

    Oh I didn't know there was a French version!

  • @gnurou

    @gnurou

    9 ай бұрын

    @@root42 It was called "PC interdit", and uses the same cover as the German edition.

  • @yeoldestuff
    @yeoldestuff9 ай бұрын

    Thank you for the video! I have had the English edition of the book for years but haven't actually read it (yet). My goto book for DOS stuff has been Randall Hyde's "The Art of Assembly Language", although it does not focus specifically on "multimedia" topics. One advantage of Hyde's book is that the DOS edition was made freely available by the author himself, while the PC Underground book is still very much commercial.

  • @root42

    @root42

    9 ай бұрын

    Oh, the Hyde book has been unknown to me so far. There were mostly German authors available in the 90s... lots of Data Becker, Franzis', Markt&Technik, but also Addison Wesley (mostly German authors there as well)

  • @JimLeonard
    @JimLeonard9 ай бұрын

    Have the English version of this book, bought in the USA. Still have the CDROM for it (book itself destroyed in a flood, have electronic copy now). These guys also put out a great .exe wrapper (bundle files and programs into a single large .exe) back in the demoscene days.

  • @5P3C73R

    @5P3C73R

    9 ай бұрын

    Hello,is it possible to send me a copy of those?

  • @root42

    @root42

    9 ай бұрын

    The CD can be found on archive.org: archive.org/details/PCUNDERGROUND

  • @5P3C73R

    @5P3C73R

    9 ай бұрын

    @@root42Thank you so much!!!!

  • @5P3C73R

    @5P3C73R

    9 ай бұрын

    @@root42What about the book?

  • @root42

    @root42

    9 ай бұрын

    You can borrow it with a free login at archive.org, AFAIK: archive.org/details/pcundergroundunc0000unse/mode/2up

  • @Kawa-oneechan
    @Kawa-oneechan7 ай бұрын

    I have this book in Dutch. Imagine my surprise.

  • @BellaLugoshi
    @BellaLugoshi9 ай бұрын

    danke aus russland

  • @root42

    @root42

    9 ай бұрын

    Gern geschehen

  • @connoredits288
    @connoredits2888 ай бұрын

    can you make a tutorial on how to make raycasting using turbo c++

  • @root42

    @root42

    8 ай бұрын

    As usual, everything is possible. However my time is limited, and that is a rather complex topic. Maybe I will eventually get around to that as well, who knows. Being a hobby at the moment it's purely driven by my own curiosity. :)

  • @Stjaernljus
    @Stjaernljus9 ай бұрын

    sadly the english version looks to be simplified and not as good. i have to look for the german version because it seems interesting.

  • @root42

    @root42

    9 ай бұрын

    I got mine used after giving away my first copy about 20 years ago. Never should have done that. :)

  • @brucetungsten5714
    @brucetungsten57149 ай бұрын

    Kann mich noch erinnern als ich mir das Buch in den 90igern gekauft habe. Generell interessant aber der Titel war reines Marketing.

  • @root42

    @root42

    9 ай бұрын

    Haha! Ja, Data Becker hat gerne reißerische Titel gehabt.

  • @curcumin417
    @curcumin417Ай бұрын

    11:48 start of coding

  • @joel230182

    @joel230182

    Ай бұрын

    it's divided by chapters

Келесі