Exploring ROM BASIC on an IBM XT

Torbjørn Kristoffersen
4 min readApr 20, 2016

Let’s do a retro article.

The IBM XT 8088 computer comes with a piece of software called IBM Cassette BASIC. As few of these computers were sold without disk drives, I had grown up with this computer but never actually seen this version of ROM BASIC, which lives inside a few ROM chips on the motherboard.

This is not disk basic or any advanced form of BASIC such as QBASIC or GWBASIC which you can run from DOS.

I read up on the specific interrupt you need to trigger ROM BASIC — INT 18h.

Naïvely, I ran DEBUG, wrote a few assembly instructions so I could trigger INT 18h. It responded, and sure enough I saw ROM BASIC.. that easy!?

Unfortunately, the keyboard input was not working.

There’s actually a logical reason for this: when MS-DOS starts up, it replaces the IBM’s original Interrupt Vector Table (IVT) with its own modified version. Interrupts are little routines used for things like keyboard input and talking to devices.

This meant I had to simply restore the IVT to its original state before invoking BASIC mode.

I temporarily removed the hard drive, and started the computer so that ROM BASIC came up automatically (this is another way of entering ROM BASIC, but it’s cumbersome to open up the PC and remove cables).

I then wrote a little BASIC program to dump the entire IVT contents as hexadecimal codes to screen. 100 at a time. Just enough so that I could take a photograph of each screen.

(At the time, I didn’t have any means of connecting the XT to one of my other modern machines…)

Streams of interrupt vectors…

Typing it all in on my laptop, I started to make sense of it, and finally printed it all out, including my prototype 8088 program on old fashioned paper.

I’m by no means an assembly expert so I learned quite a bit about the innards of the IBM PC while doing this.

Running the above program worked.. and I was now able to invoke ROM BASIC mode with a fully functioning keyboard. Success!

If you have access to an old IBM PC you can also do this directly from the command line by starting DEBUG and typing:

n tobasic.com
a 100
jmp 183
db 23, ff, 00, f0, 23, ff, 00, f0
db 5f, f8, 00, f0, 23, ff, 00, f0
db 23, ff, 00, f0, 54, ff, 00, f0
db 23, ff, 00, f0, 23, ff, 00, f0
db a5, fe, 00, f0, 87, e9, 00, f0
db 23, ff, 00, f0, 23, ff, 00, f0
db 23, ff, 00, f0, 23, ff, 00, f0
db 57, ef, 00, f0, 23, ff, 00, f0
db 65, f0, 00, f0, 4d, f8, 00, f0
db 41, f8, 00, f0, 59, ec, 00, f0
db 39, e7, 00, f0, 59, f8, 00, f0
db 2e, e8, 00, f0, d2, ef, 00, f0
db 00, 00, 00, f6, f2, e6, 00, f0
db 6e, fe, 00, f0, 34, 4d, 00, f6
db 44, 57, 00, f6, a4, f0, 00, f0
db c7, ef, 00, f0, 00, 00, 00, f0
CLD ; Direction flag up
CLI ; Interrupts off
MOV AL, 63
OUT 20, AL ; Invoke generic EOI
MOV AL, 80
MOV A0, AL
MOV AX, 0 ; IVT resides at at 0000:0000..03ffh
MOV ES, AX
MOV AX, 0
MOV DI, AX
MOV SI, 0103 ; New IVT table above
MOV CX, 44 ; IVT is 1kB exactly, we copy a bit less
REP
MOVSB
STI ; Interrupts back on
MOV AH, 0
INT 18
rcx
A4
w

Quit DEBUG and now you can run TOBASIC.COM on the command line.

--

--