How to program DOS in graphics mode

Поделиться
HTML-код
  • Опубликовано: 18 ноя 2024

Комментарии • 30

  • @AdamSommer70
    @AdamSommer70 3 года назад +3

    Great video, looking forward to the next video! Thanks for posting

  • @erichkohl9317
    @erichkohl9317 3 года назад +5

    Dude. I did not know these compilers existed. I'm definitely going to install them on my old Micron Pentium PC and mess around with them.

    • @freedosproject
      @freedosproject  3 года назад +3

      Cool! We include several C compilers with FreeDOS. My favorites are OpenWatcom and the IA-16 GCC.

    • @erichkohl9317
      @erichkohl9317 3 года назад

      @@freedosproject I have FreeDOS on another machine as well. Love me some retro DOS action.

  • @myfreenotes1499
    @myfreenotes1499 3 года назад +2

    Invaluable programming tutorial in C language! Thank you!

    • @freedosproject
      @freedosproject  3 года назад +1

      You are welcome! I'm glad it helps! I also posted a series of "learn C programming" at www.freedos.org/books/cprogramming/
      I also try to include the sample programs there, too.

  • @FrancoBugnano
    @FrancoBugnano 3 года назад +6

    Cool video!
    I didn't know those graphic functions existed. I wrote graphics in DOS by changing the video mode using int 0x10, and then by directly modifying the video memory at segment 0xA000 (or 0xB800 for CGA mode 4).
    Anyway, I don't know if the Open Watcom compiler automatically inlines simple functions, but if you're making the optimization that isodd means num&1 instead of num%2, while we're optimizing, I would have used a macro instead of a function.

    • @freedosproject
      @freedosproject  3 года назад +2

      Yup, anytime I'm using isodd(n) I could simply use (num&1) as a macro. These videos are meant as a "C programming 101" to help new programmers get started. So I haven't wanted to throw macros in there. But it's a great idea - the next time I need to use isodd, I'll see if I can introduce it as a macro.

  • @cs127
    @cs127 Год назад +1

    great tutorial!

  • @AlexJacksonSmith
    @AlexJacksonSmith Год назад +1

    Super...

  • @sofia.eris.bauhaus
    @sofia.eris.bauhaus Год назад +1

    setting a color and drawing a basic shape in it, just like with an HTML canvas. fascinating how some things stay the same after decades and decades!
    i wonder, though: is the functionality of drawing rectangles something VGA compatible cards can do by themselves, or do they just act as a framebuffer?

    • @freedosproject
      @freedosproject  Год назад

      DOS graphics mode is very simple. Once you're in VGA mode, for example, you just draw to the screen using the functions provided in your compiler's implementation.

  • @mrshodz
    @mrshodz Год назад +1

    Hi. in the 640 X 480, what is the size of the colour palette?

    • @freedosproject
      @freedosproject  Год назад +1

      Using _VRES16COLOR, that's 16 colors at 640×480. Or if you use _VRES256COLOR, youi can get 256 colors at 640×480. You can find the values in teh OpenWatcom C library reference guide (pg 989, for _setvideomode).

    • @mrshodz
      @mrshodz Год назад

      @@freedosproject hi. I have been reading about VGA adapters. Is it possible to control the VGA adapter using C or assembly. Would it be programmed in real mode?

    • @freedosproject
      @freedosproject  Год назад +1

      @@mrshodz Yes, you can always write your own graphics program in C or Assembly. I'm using OpenWatcom here, so I'm using the graphics functions they provide. But you can always access the hardware outside of that.

    • @mrshodz
      @mrshodz Год назад

      @@freedosproject Thanks.

  • @mrpix3011
    @mrpix3011 3 года назад +3

    DOSCEMBER !!!!!!!

    • @freedosproject
      @freedosproject  3 года назад +2

      Every week is DOScember on the FreeDOS Channel! :-)

  • @axle.student
    @axle.student 10 месяцев назад

    Hi, thank you for the simple and concise example of using . Much appreciated as it takes some of the guesswork out of comparing different libraries.
    >
    I am currently attempting to compare some of the different Graphics and GUI libraries that have some level of API similarity across DOS and Current Windows/Linux -x86-64. Basically close to cross platform libraries, which is difficult when I add DOS into the mix.
    >
    -The BGI API is available across all, with the original BGI and GRX library available on DOS and SDL_BGI available on Windows/Linux x64.
    -Allegro is available across all 3 platforms and also has GUI APIs available, so may be a worthwhile option (I'm not yet familiar with Allegro).
    >
    Also need to be available in C, FreeBASIC and Python3(Without DOS) which the above are.
    >
    Any thoughts with the above, like do you think I am on the right track looking at BGI and/or Allegro?
    or do you see other simple libraries that may fit in?
    >
    Just want to keep it simple for my own bit of side graphics programming fun and create a few introductory "How tos" like you have here and keep some similar feel in the API use in the examples across all platforms :)
    >
    P.S. I will likely have good peruse through the FreeDOS books examples soon as well :)

    • @freedosproject
      @freedosproject  10 месяцев назад

      I think the BGI libraries are fine for what you describe; just making a few "how-to" videos across different systems. That's what I'm doing here, so it's only _rectangle() and _ellipse() to create simple shapes in OpenWatcom C. But for what I'm doing, that's perfectly fine; you can do a lot with just rectangles and ellipses like a board game, or even a "Toy CPU" that simulates the "switches and lights" method of programming an old-style computer.
      I don't have an interest in game programming - but if I did, I'd use Allegro.

    • @axle.student
      @axle.student 10 месяцев назад

      @@freedosproject Thank you, I appreciate the response.
      I was originally looking at raylib/raygui for for the Windows/Linux examples, and did do a supplemental guide on using SDL-BGI as well.
      (It's just a third part in the series to illustrate how to set up libraries and invoke them programmatically. So no tutor on the actual library other than the basic "Hello world!" examples.)
      I was just getting my self up to speed on setting up some of the Dev environments on FreeDOS plus (Win9x) and thought I may as well do another supplemental pair of books "Aligned" with the others. Just means selecting a similar set of APIs for each example library across all of the books/guides.
      So I may drop raylib from the main book in favour of SDL_BGI (GRX), or even Allegro and just do raylib as an add-on supplemental.
      >
      I may just have to jump in and take Allegro for a spin to see how the high level APIs compare with the BGI API before I choose :P
      I think most primitives (As you said above) should be similar.
      >
      The last 3 books/guides (now maybe more with DOS) I will focus on each language individually using the programming fundamentals from the first book, and the libraries from the 3rd book to design and build some small applications combining the principles. All code examples still have to retain the same line by line flow for C, FB and PY though. But they are still a "Down the road" project.
      >
      Yeah, I like making work for myself, but it has been an enjoyable learning experience as well lol

  • @ahmad-murery
    @ahmad-murery 3 года назад

    Nice,
    these were the royal colors of the golden age of computers,
    by the way, your twitter account mentioned here is not correct, I think there is an extra underscore,
    Thanks Jim,

    • @freedosproject
      @freedosproject  3 года назад +1

      Thanks! I still use these 16 colors in my modern Linux terminal setup. The colors make me happy.
      *I changed the social media URLs a few weeks ago. Here's the announcement on Twitter: twitter.com/freedosproject/status/1457410918678159360

  • @aterisalonu
    @aterisalonu 3 года назад

    Would you upload colors.c source file?

    • @freedosproject
      @freedosproject  3 года назад

      Thanks for the reminder! I've added the source for COLORS.C and SENET.C (the follow-up video to this one) on the "bonus" page in the online ebook: www.freedos.org/books/cprogramming/bonus/

  • @tiagoout
    @tiagoout 2 года назад

    Hi, exist someone way of to use freedos with pendrive in a PC without gpu?

    • @freedosproject
      @freedosproject  2 года назад

      By "pendrive" I assume you mean a USB fob drive? Yes, we have a USB fob drive image for FreeDOS. You can download it from our website. www.freedos.org/