x86 asm graphics settings for resolutions higher than 640x480?

為{幸葍}努か 提交于 2019-12-04 12:43:16

For questions #1 and #3, look into the VESA BIOS Extensions. This was something of a standard for dealing with "Super VGA" modes, popular in the 90s.

As for #2, in general the answer is no, you can't MOV memory to memory. But it's not strictly true: there is MOVS (move string), which moves a byte, word, or dword from DS:SI to ES:DI. Usually this instruction is used in conjunction with a REP prefix to move blocks of memory. Also, assuming you have a stack set up, you can move memory-to-memory without clobbering a register by pushing and popping:

PUSH [mem1]
POP  [mem2]

Regarding your first question, interrupt 10 is very old, and likely not used beyond resolutions of 640x480. A different part of the software stack is now used; i.e., you would have to interrogate Windows to get the current screen resolution.

This rather verbose post contains a lot of details of how to use assembler to drive DirectX in Windows. DirectX is the key API family for graphics these days, you won't come far using DOS-era interrupts and programming the VGA framebuffer directly.

Interrupt 10h is basically an operating system function call (actually it runs BIOS code). Internally, it reads/writes video memory as well as various registers on the graphics card. To get an idea of what sort of stuff happens "within" interrupt 10h, check this out.

When you run a DOS program under Windows, it is run in a virtual DOS machine. Windows doesn't actually let it touch the graphics card but lets it play with a virtual one. Usually this only extends as far as VGA screen modes (and sometimes only text mode), i.e. what you have is a virtual VGA card (not a modern graphics card). For this reason, in 16-bit assembly language under Windows, you just can't use the full capabilities of modern graphics cards.

Yes, sure, assembly language can let you do anything the graphics card can do. But only if either:

  • your program has unrestricted access to the graphics hardware (e.g. you're writing a Windows or Linux device driver, or are executing in pure DOS, or your own kernel), or
  • your program goes through the appropriate operating system interface.

If you're still interested in assembly language, I would suggest you try to write a toy kernel. Doing this, you'll learn a mountain of things.

Leave a comment if you want further information.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!