• Please review our updated Terms and Rules here

INT 10H Teletype Output IBM PC 10/27/82 BIOS

mmruzek

Experienced Member
Joined
Sep 28, 2011
Messages
227
Location
Michigan, USA
Hi, I am working on a program for loading into an 8K ROM for the U29 socket on the IBM 5150 PC and PC-Retro. The ultimate goal is loading Palo Alto Tiny Basic from ROM and having it run using BIOS interrupts only (No DOS). I have been having problems using INT 10 Service 0E, which is video Teletype Output Mode (Print a character to the screen and advance the cursor). I finally decided it was best to write a short program to test the BIOS Interrupt directly. This program is supposed to write characters X, Y and Z on the screen. Then wait for a character from the keyboard and echo to the screen. What happens is the XYZ is not displayed, but the code does wait and echo the keyboard input OK. Does anyone see the problem? This is really aggravating!

MOV BH,00 ;VIDEO PAGE ZERO
MOV AH,00 ;SET VIDEO MODE
MOV AL,07 ;MDA TEXT 80x25
INT 10
MOV AH,0E ;TELETYPE OUTPUT
MOV AL,58 ;CHARACTER X
INT 10
MOV AL,59 ;CHARACTER Y
INT 10
MOV AL,5A ;CHARACTER Z
INT 10 ;
MOV AH,0 ;WAIT FOR KEY & PRINT (B4 00 CD 16 B4 OE CD 10)
INT 16 ;THESE LINES WAIT FOR KEYBOARD INPUT
MOV AH,0E ;& PRINT USING TELETYPE OUTPUT
INT 10 ;BEFORE SYSTEM RETURN
INT 3 ;BREAKPOINT
 
Your program works as-is on my system, but you should probably add a "MOV BX,7" before each INT 10 to make sure that you're still on page 0 and white-on-black attributes are being used. While most implementations of INT 10/0E preserve register contents, it's not a good idea to depend on it, so setting up AX and BX before each call is prudent.

One other thing, with some BIOSes, INT 10/0E will clobber BP if a scroll is involved. It's good to keep that in the back of your mind as you're coding.
 
Thanks Chuck. I added the code to setup AX and BX. So here is what I've found. This code works fine on a True Blue IBM 5150 with 10/27/82 BIOS and a TSENG Labs VGA video card OK. That's running either with a COM file, or straight from a ROM burned with the code. As soon as I swap the video card for an IBM MDA card the problems start. It's still doing the same thing... Program does not display the XYZ at start, but does wait for and echoes the keyboard input just fine. Puzzling...
 
I assume that you're setting the motherboard switches when you change the adapter.

Just for yucks, what happens if you enter your routine "after" the mode set? (i.e. at the first MOV AH,0E). I've got a MDA-equipped PC here if that doesn't show anything--just need to dig it out.
 
One other thing, with some BIOSes, INT 10/0E will clobber BP if a scroll is involved. It's good to keep that in the back of your mind as you're coding.

Beat me to it. My debugger (please forgive the lack of progress- real life got in the way the past week), also uses the Teletype service, and I make sure to PUSH/POP BP.

Also Michael, didn't you say you had issues with my debugger on an MDA card and that the screen wouldn't display a banner? Likely I've been doing something similar wrong as well.
 
Yes, I'm flipping the switches when swapping video cards OK. And Yes, you recall correctly, the debugger banner was problematic with MDA display but OK with VGA.

Per Chuck's suggestion I put the keyboard wait and echo routine before the XYZ print to screen. Here are the results: Works fine with VGA card. With an MDA card the program waits OK for keyboard strike and displays, but for printing the XYZ all I see is a brief flash of 5 vertical dots on the right hand side of the screen. (?)

Just to make things more confusing I pulled the IBM 10/27/82 BIOS and tried the Generic/Anonymous BIOS. Result: That works fine with MDA and VGA.
 
Maybe you should add a "set cursor position" (INT 10, AH=02) before your output. I'll have to get my XT out with an MDA and see what happens. When you're printing the "XYZ", does the cursor move?
 
I have been having problems using INT 10 Service 0E, which is video Teletype Output Mode (Print a character to the screen and advance the cursor).

What happens is the XYZ is not displayed, but the code does wait and echo the keyboard input OK. Does anyone see the problem? This is really aggravating!

I have experienced this on PCem-emulated IBM PC machine and MDA graphics, with my optromloader, and found this thread while researching the issue.

With some effort, I managed to get it working as it follows (flat assembler / intel syntax):
Code:
printchar: ;AL character to print
    push bx ;preserve BX
    push ax ;preserve AX
    mov ah,0fh ;get current video state
    int 10h ;bh is set to current page
    mov bl,$7 ;light grey
    pop ax ;restore AX
    push ax ;preserve AX again
    mov ah,0eh ;print character (teletype)
    int 10h ;character finally printed
    pop ax ;restore AX
    pop bx ;restore BX
    ret

Specifically, what fixes the output on emulated IBM PC with MDA is obtaining the page via function 0fh and passing it to function 0eh via BH.

The set color doesn't seem to be needed on any machine I emulated for testing, but as it's specified, it's not a bad idea to set it to light grey; if some machine honors it, 0 means black, so having BL=0 is seldom a good idea.

The code above is under MIT license (see my optromloader repo's LICENSE file) thus you can probably legally use it verbatim with little effort on your end.
 
Last edited:
I confess to being puzzled a bit. Not demeaning your efforts, but:

Under MIT license? I'll wager that I wrote code like that at least 35 years ago, as did many other people. I can't see what's licensable about it. :?
 
I confess to being puzzled a bit. Not demeaning your efforts, but:

Under MIT license? I'll wager that I wrote code like that at least 35 years ago, as did many other people. I can't see what's licensable about it. :?

Copyright law is a shit, everything is sadly licensed by default, and it's never clear what constitutes a "substantial portion". So I am saying to go ahead and reuse it, I made it really easy for you by using MIT, a well-known and super permissive license, so that you don't have to think twice about it.

I hope this about clears it up.
 
Last edited:
Well, I've posted great hunks of code without copyright; by definition it's PD. No "license" at all. If it's code that anyone sufficiently versed in the matter has already written or can easily write, it's generally not copyright-able, being common knowledge in the art. Thus, the MIT annotation is irrelevant--and since the notice isn't included in the body of the code itself (as a comment) is unenforceable.

My reason for the original commentary is that I've seen too much of this "sorta-copyrighted" stuff, be it MIT or gnu and especially "Must contain this page of verbiage" notices. If it's simple, leave it as public domain. I hope you can understand what I'm trying to say.

When software patents were first allowed, there were all sorts of ridiculous filings, such as one I remember for the idea of an arithmetic checksum. Maybe DMCA is the copyright equivalent of that trend.

I'm getting too old for this stuff and I apologize if I rubbed you the wrong way. It was not intentional.
 
Well, I've posted great hunks of code without copyright; by definition it's PD.

Anything (code or else) without a license is copyrighted, by default. That's how copyright works. As for how to "remove" this copyright, the only way that carries any legal weight is to use a license. Of course, IANAL, but that's my understanding of copyright law.

Thus, I use a license that's very popular, particularly simple (BSD has several incompatible variants with different amounts of clauses) and extremely permissive.

To be honest, my favourite part of most licenses is the part that gets rid of responsibility. I sure want that codified in a legal document! Imagine somebody getting harmed by a program that uses parts of your code, and you getting sued for some snippet of code you wanted to offer for free under PD in the first place.

I'm getting too old for this stuff and I apologize if I rubbed you the wrong way. It was not intentional.

No worries. I never realized my post could be taken that way either (implying the few lines of code are actually worth anything); learning so is amusing on its own way.
 
Last edited:
In any case your claim of copyright is unenforceable. Even if you deposited it and registered it with the USPTO, the claim would probably fail under AFC, given the overwhelming number of prior instances of code using BIOS interrupt 10h to display characters. And finally, there's no way for any mortal human to identify your authorship from the snippet of code alone.

Copyright, even under DMCA, isn't all that it's cracked up to be. I know from experience.
 
In any case your claim of copyright is unenforceable. Even if you deposited it and registered it with the USPTO, the claim would probably fail under AFC, given the overwhelming number of prior instances of code using BIOS interrupt 10h to display characters. And finally, there's no way for any mortal human to identify your authorship from the snippet of code alone.

Fair use is a US concept, not the same elsewhere (particularly in EU we don't have it).

Personally, I do not care; I am not about to harass anyone for using a snippet of my MIT licensed code, of all things. Imagine the shame.

The license is there to make using my code easier (not harder!), and to protect me from liability.

Copyright, even under DMCA, isn't all that it's cracked up to be. I know from experience

Copyright in the present world is garbage. Particularly it being statutory and the terms (and the fact they keep making them longer).

There's been proposals in EU (I believe by the green group) to make length 5yr, after that it'd be renewable (via registering and paying a fee) for 5 years more, then 5 years again (max 15).

It would make the world much better (no doubt many non-EU countries would follow suit) but the copyright lobbies are mighty powerful and people are way too unaware of the workings of current copyright system, so we have to just live with it.
 
Last edited:
It's largely struck me as stupid that copyright (non extension act) is life+70 years. Assuming (heaven forbid) that I die tomorrow, what code that I could possibly write would have any relevance 70 years from now? I've long been of the opinion that software copyright should not exceed the life of a patent. In particular, this is relevant when it comes to software patents.
 
Back
Top