Is it possible to display pixels to the screen or play a beep in the speakers to screen in ASM language, without using any BIOS/DOR/... interrupts ?
Asked
Active
Viewed 105 times
-4
-
2It is only possible if there is a screen (or speaker) on the device in question. Anything that can be done in any languages can be done in asm as that is ulitimately what all other languages that actually run reduce to. – Chris Dodd Jun 03 '21 at 19:43
-
So, how to display pixel onto the screen in asm without any interrupts ? I dod not found any tutorial – mpo Jun 03 '21 at 19:45
-
1On x86 with standard graphics look for VGA tutorials. See for example [this one](https://files.osdev.org/mirrors/geezer/osd/graphics/modes.c). – Jester Jun 03 '21 at 19:56
-
@mpo What kind of computer with what sort of graphics card are you programming for? – fuz Jun 03 '21 at 22:30
-
you have to do it the same way that you would with an operating system. you have code that knows the specific board/chip and simply writes control registers and pixel data and it shows up on the screen. you wont find any recent tutorials for an x86 system, but other systems it is easy to find. in the vga days it was documented and fairly simple. – old_timer Jun 04 '21 at 01:25
-
there is no real demand for such tutorials, so you wont find any. current video cards are not necessarily openly documented, although you can look at an open source driver and figure it out. – old_timer Jun 04 '21 at 01:28
-
@old_timer: Modern PCs still have enough hardware support to pretend to be VGA, even for hardware drivers (not using firmware calls). That's how OSes can portably do 640x480 graphics, for example. And there are tutorials for that (https://wiki.osdev.org/VGA_Hardware), doing mode-setting without `int` calls but instead writing to the VGA registers. (Which may actually trigger a System Management Interrupt, but [the actual VGA framebuffer is "real", even text mode](https://stackoverflow.com/questions/61521819/does-modern-pc-video-hardware-support-vga-text-mode-in-hw-or-does-the-bios-emul)) – Peter Cordes Jun 04 '21 at 11:04
-
@PeterCordes yes, agreed. various ways to do this, and these modes have been documented for decades, the OP just didnt look...beyond those modes though, it is much worse today because you have gpus as well as other factors that you need to know from the vendor. put some text or some pixels in an ega/vga mode, somewhat trivial...yes – old_timer Jun 04 '21 at 11:31
-
as far as the title question the answer is obvious, of course, that is how it works now. software interrupts just call code. drivers are code, applications are code. the processor only supports machine code, and you can generate that from assembly language...so it is possible yes. – old_timer Jun 04 '21 at 11:58
1 Answers
0
It is possible but useless, as each PC is equipped with firmware (BIOS or UEFI) which does the most tedious work.
Many years ago I disassembled PC/XT BIOS code of Int 10/AH=00h just to learn how to switch Hercules card into graphic mode using bare metal, i.e. instructions IN and OUT applied to CRT ports.
Most information about hardware I found in TechHelp, for instance the chapter PC Sounds / Speaker Support shows how to play a tone on motherboard speaker by sending a square wave with OUT 61h,AL
and toggling bit 1 of AL
. Quoting TechHelp:
The speaker is connected to PPI port B, port 61H.
Set bit 1 to pulse the speaker out and
clear bit 1 to bring the speaker back to normal.
in al,61H ;get current value
again: or al,02H ;set bit 2 to pulse it out
out 61H, al
mov cx,1000H
delay1:loop delay1 ;wait a little while
and al,0fdH ;clear bit 2 to pulse it back in
out 61H, al
mov cx,1000H
delay2:loop delay2 ;wait a little while
jmp again

vitsoft
- 5,515
- 1
- 18
- 31
-
1Please don't post link-only answers like this. Stack Overflow answers must be useful on their own, even if all links go down. – fuz Jun 03 '21 at 22:31