Tag Archives: old-computers

Starfield in a bootloader (No OS)

Here is the starfield running from a bootblock loader (No MSDOS)

I threw my back out last week, so I could not move the old 8086 to a better place. I wanted to prepare this machine to boot from floppy disk.

The starfield above boots into VGA mode 13h (320×200 256 colors)

This one also has a Sound Blaster, so I can test music in a boot sector also!

My 8088 (v40) board has VGA also now.
I’m waiting for my ISA-PCMCIA card as replacement for a harddisk/floppy

Creating a new bootloader for old code

UPDATE 20230721 Bootdemo

I found some parts of our (Edk and Me) bootloader demo.

It was compiled using masm or tasm.
Encountering a problem converting the code into a raw bin, to put on a floppy I diverted to another setup to try to get things working.

Using old code (below) and a example from YT, I made the following setup.

Visual studio code, with the x64 assembly plugin.
xxd as hexviewer.
fasm as assembler (This makes things easier, because it is a native Linux x86 compiler. So no need for dosbox anymore.)

I’ve created a Makefile to automate things.

clean:
        rm -f *obj
        rm -f *.bin

exec:
        fasm demo.asm
        fasm boot.asm
        cat boot.bin loadpart.bin > demo.bin 
        qemu-system-x86_64 -boot a -fda demo.bin 

Some of our old demo code:

;-------- snip
Start:
    JMP     SHORT BootHere
    NOP
    DB      "FASH-EDK"
    DW      512
    DB      2
    DW      1
    DB      2
    DW      0070h
    DW      02d0h       ;max. aantal sectoren van volume A
    DB      0Fdh        ;media descriptor
    DW      0002h       ;aantal sectoren per FAT
    DW      0009h       ;aantal sectoren per spoor
    DW      2
    DW      0
BootHere:
    mov     bp,5
tryboot:
    push bp
    mov     bx,4000h
    mov     es,bx
    mov     bx,0
    mov     cx,2        ;vanaf sector 2
    mov     dx,0        ;drive A, kant 0
    mov     ah,02h
    MOV     AL,8
    int     13h         ;sector(en) lezen
    pop     bp
    jnc     bootok
    dec     bp
    jnz     tryboot
bootok:
    mov     bp,5
;---------- snap

New setup using fasm (bootloader) boot.asm

    org 0x7c00                  ;  still not sure about this, have not found this in our demo

    mov bx, 0x1000              ; load sector address 
    mov es, bx                  
    mov bx, 0x0                 

; Sector read function
    mov dh, 0x0                 ; head 0
    mov dl, 0x0                 ; drive 0
    mov ch, 0x0                 ; cylinder 0
    mov cl, 0x02                ; start sector 

readdisk:
    mov ah, 0x02                ; read sec
    mov al, 0x02                ; demo is > 512 so 2 sectors
    int 0x13                    ; call bios

    mov ax, 0x1000
    mov ds, ax                  
    mov es, ax                     
jmpcode:
    jmp 0x1000:0x0              ; far jmp demo

; Expand bin to 512 byte sector
    times 510-($-$$) db 0       
    dw 0xaa55                   ; Sector header (ROM as this at the start)

Graphics demo i wrote a long time ago, converted into fasm loadpart.asm

	mov ah,0
        mov ax, 4f02h   ; Set VESA video mode
        mov bx, 10dh    ; Your video mode number
	int 10h
	mov al,0
drawall:
	mov dx,0
	mov cx,0

drawloop:
	mov ah,0ch
	mov bh,0
	push ax
	int 10h
	pop ax
	inc al
	inc cx
	cmp cx,319
	jc drawloop
	mov cx,0
	inc dx
	cmp dx,199
	jmp drawloop
jmp drawall

; complete sector with zeros
    times 512-($-$$) db 0   

Booting the demo in milli seconds using qemu.
Next to do: Write this to floppy and test on real hardware.

A reset starts the virtual machine and boots from a virtual floppy.
The drawing of the pixels is slow, because I used a int 10h function for every pixel, instead of writing to screen memory directly.

ndisasm – disassemble binary

ndisasm loadpart.bin 
00000000  B400              mov ah,0x0
00000002  B8024F            mov ax,0x4f02
00000005  BB0D01            mov bx,0x10d
00000008  CD10              int 0x10
0000000A  B000              mov al,0x0
0000000C  BA0000            mov dx,0x0
0000000F  B90000            mov cx,0x0
00000012  B40C              mov ah,0xc
00000014  B700              mov bh,0x0
00000016  50                push ax
00000017  CD10              int 0x10
00000019  58                pop ax
0000001A  FEC0              inc al
0000001C  41                inc cx
0000001D  81F93F01          cmp cx,0x13f
00000021  72EF              jc 0x12
00000023  B90000            mov cx,0x0
00000026  42                inc dx
00000027  81FAC700          cmp dx,0xc7
0000002B  EBE5              jmp short 0x12
0000002D  EBDD              jmp short 0xc
0000002F  0000              add [bx+si],al
00000031  0000              add [bx+si],al
00000033  0000              add [bx+si],al
00000035  0000              add [bx+si],al

UPDATE 20230721 Bootdemo update

Got a part working again in PCem.
This is from our bootdemo.
A scroller and sector loader in a bootsector.
Needed some include files
masm, link, exe2com creates a 12- sector sized floppy.
And we’ve got a (little distorted but working) Scroller in boot sector with custom font!

font:   db 64 dup (0)       ;space
        db 0,0,2,2,0,0,0,0  ;!
        db 0,2,2,2,2,0,0,0
        db 0,2,2,2,2,0,0,0
        db 0,2,2,2,2,0,0,0
        db 0,0,2,2,0,0,0,0
        db 0,0,2,2,0,0,0,0
        db 0,0,0,0,0,0,0,0
        db 0,0,2,2,0,0,0,0

Bios Extension boot and bootsector programs.

Followup on

Today two boot projects.
One using a bios extension, so it chip based.
Second is a floppy disk boot program. (Creating a test situation to get our old Boot floppy demo working. ( That one without using an operatingsystem like ms-dos.

Creating a Secondary Bios ROM

NAME mycode
.model small
ORG 0h

.code
	dw 0AA55h ;  Magic header your bios is looking for
	db 16     ; lenght of this rom in 512 bytes == 8k
	jmp short clear ; jmp to program

ORG 20h                 ; start of program
	
clear:  mov cx,10       ; clear, set keyboard led and print 10 # chars
	mov ah,0ah
	mov al,31h
	int 10h
	mov bh,0
	mov cx,1
start:	mov al, 11000000b
        out 80h, al
print:  mov cx,10
	mov ah,0ah
	mov al,"#"
	int 10h
loop1:  nop           ; loop until doomsday
	jmp loop1
	db -68        ; This makes the checksum 0
                      ; steps to take: edit source, make this byte entry 0
                      ; compile using make.bat in dosbox
                      ; check checksum using my python script
                      ; output was 68 hex 0x44
                      ; edit asm file place -68 to make the checksum 0x00 again
                      ; compile and burn to ROM
ORG 2000h             ; create end of rom 0000h-1fffh = 8K
END

make.bat in dosbox

@ECHO OFF
MASM /DARCH_TYPE="T" /DCPU_TYPE="V" 1;
LINK 1;
EXE2COM 1.EXE

Python script here: https://www.henriaanstoot.nl/2023/06/20/bios-hacking/

Write EEprom

minipro -w 1.COM -p AT28C64

Part 2 – Bootsector program !

Allmost the same as above, but booting from a Floppy disk.

Video mode info : https://stanislavs.org/helppc/int_10-0.html

Assembly code

use16              ; 16 bits 
org 0x7c00         ; start address ( change? )

mov ah,0x0         ; ah 0h - video mode 
mov al,0x0         ; al 0h - mode 0 - 40x25 chars
int 10h            ; scree routines 
mov cx,11h         ; 11 chars
mov ah,0ah         ; ah 0ah - print char mode
mov al,'#'         ; choose char as #
int 10h            ; execute 


times 510 - ($-$$) db 0 ; fill rest 512 bytes sector

dw 0xaa55 ; magic bytes 

Micro cassettes with computer programs.

I’ve got some micro cassettes with programs for P2000 and the Microtrainer (SDK-85).

Lets try to get this into executable code again.

(I sold my Philips P2000 last year before I found these tapes)

I bought a Cassette player (voice memo recorder) from Marktplaats (dutch ebay), and a mini jack cable (2.5mm to 3.5mm)

There are two things i’m going to try.

Converting the recorded audio into executable code using python or Puredata.
And making a print to connect the tape player to the SDK-85.

Connecting the player to a soundcard gave me:
Signed 16bit 44.1 kHz

(there are simular projects like this for C64 tapes and alike)
So there will be FFT tricks involved.

While browsing though this book:

I found this schematic: (page A1-39)

So that’s next to build

Machine code Monitor in ROM on real BBC Acorn Hardware

My BBC Acorn model B is working again. The original monitor is still dead.

Time to play with some machine code and ROMs.

My machine has a NFS rom installed. (NetFS)

Econet was Acorn Computers’s low-cost local area network system, intended for use by schools and small businesses. It was widely used in those areas, and was supported by a large number of different computer and server systems produced both by Acorn and by other companies.

I found a ROM online called Gremlin. It is a 16K rom file. But at the moment I only got some 28C64 (8k) or 28C256 (32k) eeproms.

32k it is. But de beeb having address line A14 floating high, I need to flash the upper 16k of the 32k ROM.

So I made the 16K rom into a 32K using cat

cp Gremlin\ v1.21\ \(1983\)\(Computer\ Concepts\).rom 16k.rom
cat Gremlin\ v1.21\ \(1983\)\(Computer\ Concepts\).rom >> 16k.rom

minipro -w 16k.rom -p AT28C256

I got the rom from this page:
https://acorn.huininga.nl/pub/unsorted/roms/Gremlin%20v1.21%20(1983)(Computer%20Concepts).rom

Below booting straight into the monitor program.

Manual:

6502 and Wozmon

Ben posted a youtube about Wozmon running on his 6502.

In 1976, Steve Wozniac wrote what’s commonly known simply as Wozmon.

Wozmon is a machine-code monitor program written by Wozniak for the Apple 1. In Only 256 bytes ! Being pure 6502 code easily adaptable.
A monitor program allows you to view/edit and run machine code using simple commands.

I’ve got a different setup as Ben’s computer.
But changing the necessary, and it will run on my 6502.

I’m not using rs232 voltage levels (-7 till -25 and +7 till +25 volts).
I’m using a usb serial uart standard 5v leveling stick …

For address decoder see other post

Simplified schematic of my UART/ACIA

Compiling the Wosmon gave me an error, DEC is not a valid opcode for a bare 6502 .. but we have a 65c02.
Solution: Add -c02 extra opcodes

error 1 in line 187 of "wozmon.s": illegal operand types
>                DEC                    ; Decrement A.

# fix .. add -c02
vasm6502_oldstyle -c02 -Fbin -dotdir wozmon.s

Below Apple I Manual with the sourcecode for Wozmon

Old mystery motherboard and Bios hacking – followup

The board seems to be a X Golden Board, except for the missing logo on the motherboard.

Downloaded pcxtbios and compiled the eproms native in linux. So i don´t have to use dosbox any more.
https://github.com/virtualxt/pcxtbios

cd pcxtbios
edit make_linux.sh if needed
./make_linux.sh

and you should end up with
eproms/27512/basicfc.rom
eproms/27512/basicf8.rom
eproms/27512/basicf6.rom
eproms/27512/pcxtbios.rom
eproms/27512/basicfa.rom
eproms/27128/basicfc.rom
eproms/27128/basicf8.rom
eproms/27128/basicf6.rom
eproms/27128/pcxtbios.rom
eproms/27128/basicfa.rom
eproms/27256/basicfc.rom
eproms/27256/basicf8.rom
eproms/27256/basicf6.rom
eproms/27256/pcxtbios.rom
eproms/27256/basicfa.rom
eproms/ibmxt/u18.rom
eproms/ibmxt/u19.rom
eproms/2764/basicfc.rom
eproms/2764/basicf8.rom
eproms/2764/basicf6.rom
eproms/2764/pcxtbios.rom
eproms/2764/basicfa.rom

I didn’t have enough 28C64, but the 28C256 has the same pinout. It just lacks A14 and A13

So I flashed the compiled ROMs for basic to different Eeproms

minipro -w ./2764/basicfc.rom -p AT28C64
minipro -w ./2764/basicf6.rom -p AT28C64
minipro -w ./27256/basicfa.rom -p AT28C256
minipro -w ./27256/basicf8.rom -p AT28C256

These roms need to be placed in sockets ROM6,5,4,3

ROM7 (BIOS)fe00:0-ffff:ffff
ROM6 Basicfc00:0000-fdff:ffff
ROM5 Basicfa00:0000-fbff:ffff
ROM4 Basicf800:0000-f9ff:ffff
ROM3 Basicf600:0000-f7ff:ffff

Machine Code monitor/editor

I tried to find a machine code monitor for 8088 rom, but did not have any luck there.

I tried mumon88, but that didn´t work.

PCem and bootdisks.

PCem (short for PC Emulator) is an IBM PC emulator for Windows and Linux that specializes in running old operating systems and software that are designed for IBM PC compatibles. Originally developed as an IBM PC XT emulator, it later added support for other IBM PC compatible computers as well.

The big difference with PCem and Dosbox is the fact that you can configure many systems from 8088 to pentium, soundcards and graphic cards (like hercules, CGA, EGA VGA and alike)
You won’t start in MS-DOS, you can boot from a virtual floppy, just what i needed!

Update : Typing boot disk.img in dosbox works

I’ve installed PCem using:

cd pcem/
sudo apt-get install libsdl2-dev
sudo apt-get install libopenal-dev
tar xzvf ../PCemV17Linux.tar.gz 
./configure 
make clean
make
# first start (complains about roms, but creates ~/.pcem/...
./pcem 
cd ~/.pcem/roms
# git clone roms
git clone https://github.com/BaRRaKudaRain/PCem-ROMs.git
mv PCem-ROMs/* ./
rm -rf PCem-ROMs

Below a simple example, booting a floppy with a custom made bootsector.
I’m still searching for our bootblock demo, which uses VGA graphics and a music loader using Soundblaster.
We made this around the 90’s, and i have never seen a demo then booting a demo without dos.
Scrollers, music, starfields etc.

NOTE: Dos calls can’t be used, that’s not loaded. So NO int 21h software functions!

Running a bootblock program, there is NO ms-dos being loaded.

The disk image I created using my real original 5.25″ floppy, and converted this with my Fluxengine.

One of the other bootblock thingy’s I made, An amiga guru meditation error. (below a old capture)
When a corrupted disk or faulty software was booted using a amiga you often could see an error like this, now you could have it on you PC!

Original screen capture of a Guru Meditation.
You can see, mine is a little different, because of the font spacing and color.

PCem info

Systems / motherboards emulated :
8088

    AMI XT clone
    Atari PC3
    Compaq Portable Plus
    DTK Clone XT
    (c)Anonymous Generic Turbo XT BIOS
    IBM PC
    IBM PCjr
    IBM XT
    Juko XT clone
    NCR PC4i
    Phoenix XT clone
    Schneider Euro PC
    Tandy 1000
    Tandy 1000HX
    Thomson TO16 PC
    Toshiba T1000
    VTech Laser Turbo XT
    Zenith Data SupersPort
    Xi8088

8086

    Amstrad PC1512
    Amstrad PC1640
    Amstrad PC2086
    Amstrad PC3086
    Amstrad PC5086
    Amstrad PPC512/640
    Compaq Deskpro
    Olivetti M24
    Sinclair PC200/Amstrad PC20
    Tandy 1000SL/2
    Toshiba T1200
    VTech Laser XT3

286

    AMI 286 clone
    Award 286 clone
    Bull Micral 45
    Commodore PC30-III
    Compaq Portable II
    Dell System 200
    Epson PC AX
    Epson PC AX2e
    GW-286CT GEAR
    IBM AT
    IBM PS/1 Model 2011
    IBM PS/2 Model 30-286
    IBM PS/2 Model 50
    IBM XT Model 286
    Samsung SPC-4200P
    Samsung SPC-4216P
    Toshiba T3100e
    Tulip AT Compact

386SX

    Acermate 386SX/25N
    AMI 386SX clone
    Amstrad MegaPC
    DTK 386SX clone
    Epson PC AX3
    IBM PS/1 Model 2121
    IBM PS/2 Model 55SX
    KMX-C-02
    Packard Bell Legend 300SX
    Samsung SPC-6033P

386DX

    AMI 386DX clone
    Compaq Deskpro 386
    IBM PS/2 Model 70 (type 3)
    IBM PS/2 Model 80
    MR 386DX clone
    Samsung SPC-6000A

486

    AMI 486 clone
    AMI WinBIOS 486 clone
    Award SiS 496/497
    Elonex PC-425X
    IBM PS/2 Model 70 (type 4)
    Packard Bell PB410A

Socket 4/5/7 (Pentium)

    ASUS P/I-P55TVP4
    ASUS P/I-P55T2P4
    Award 430VX PCI
    Epox P55-VA
    Intel Advanced/EV (Endeavor)
    Intel Advanced/ZP (Zappa)
    Intel Premiere/PCI (Batman's Revenge)
    Packard Bell PB520R (Robin LC)
    Packard Bell PB570 (Hillary)

Super Socket 7 (K6-2/III)

    FIC VA-503+

Socket 8 (Pentium Pro)

    Intel VS440FX

Slot 1 (Pentium II)

    Gigabyte GA-686BX

Graphics cards emulated :

    3DFX Voodoo Graphics
    3DFX Voodoo 2
    ATI Graphics Pro Turbo (Mach64 GX)
    ATI Video Xpression (Mach64 VT2)
    ATI VGA Edge-16 (ATI-18800)
    ATI VGA Charger (ATI-28800)
    CGA
    Cirrus Logic CL-GD5429
    Cirrus Logic CL-GD5430
    Cirrus Logic CL-GD5434
    Compaq CGA
    Diamond Stealth 32 (Tseng ET4000/w32p)
    Diamond Stealth 3D 2000 (S3 ViRGE/325)
    Hercules
    Hercules InColor
    IBM EGA
    IBM VGA
    MDA
    MDSI Genius
    Number Nine 9FX (S3 Trio64)
    OAK OTI-037
    OAK OTI-067
    Olivetti GO481 (Paradise PVGA1A)
    Paradise Bahamas 64 (S3 Vision864)
    Phoenix S3 Trio32
    Phoenix S3 Trio64
    Plantronics ColorPlus
    S3 ViRGE/DX
    Sigma Color 400
    Trident TVGA8900D
    Trident TGUI9400CXi
    Trident TGUI9440
    Trigem Korean VGA (Tseng ET4000AX)
    Tseng ET4000AX
    Wsye 700

Sound cards emulated :

    AdLib
    AdLib Gold
    Ensoniq AudioPCI
    GameBlaster
    Gravis UltraSound
    Sound Blaster v1.0
    Sound Blaster v1.5
    Sound Blaster MCV
    Sound Blaster v2.0
    Sound Blaster Pro v1
    Sound Blaster Pro v2
    Sound Blaster Pro MCV
    Sound Blaster 16
    Sound Blaster AWE32
    Sound Blaster PCI128
    Windows Sound System

Old mystery motherboard and Bios hacking

When selling a large part of my computer collection I kept a few odd pieces.

Amongst those was a 8088 DIY machine.

It is a 50PTX3 motherboard with a 8088 compatible CPU

  • Power light (Not LED) and connected to power adaptor, not motherboard
  • Reset button??? not connected
  • Power switch
  • Mid center, 5v gnd and 12v
  • 5.25″ drive not connected
Bottom

Tested the power adapter first, a nice 5V and 12V.
Then I plugged the power in the Motherboard add plugged a test ISA card in the slot.
After turning the machine on I saw the Address leds flashing

A NEC D70108C from 1984, which is 8088 pin compatible with Intel 8088 but faster, and has some extra functionality.
The empty socket is for the 8087 Co-processor.

Nec V20 versus 8088

Everything pretty dirty

Rom 2764 (8Kb) and a disconnected speaker wire.

Adding an 8bit Isa hercules/CGA card.

It starts! .. But there is no Floppy controller (yet)

I’ve dumped the Bios to a file and used a hexeditor to play around.
So that’s why there is a bad checksum.

Installing a ZIF socket (Zero Insertion Force) to make things easier to modify.

Burned GlaBios on the Eprom and now I can continue to play around.

So why? Why this all ..

I want to play around with old 8088 assembly code again, but not as I did before using a Dos machine, but hardcoded into Eproms.
I’ve got 8 banks for ROMs and the source code for GlaBios is available.

In the past Edk and me wrote a boot demo, so it was not utilizing Ms-Dos functions. Maybe i can get some graphical and sound stuff working straight from the Bios.

Some commands:

# Dump the bios to file
minipro -w original.rom -p AT2764A@DIP28

xxd and hexdump to view the dump

I've used ghex to alter the ROM

# Write a new bios to a 28C64 (same Eeprom i've used for the C64 Cartridges)
minipro -w /home/henri/Downloads/MYROM -p AT28C64
 

GlaBios source code:
https://github.com/640-KB/GLaBIOS/blob/main/src/GLABIOS.ASM

I was planning to disassemble the Phoenix Bios, but it’s quite hard to differentiate between code and data, there are no named pointers and you have to interpret every line of code.

So GlaBios it is ..

First code to look at:

This is after the whole post reset.
There is a reset pointer at ffff:fffe
Which points to the bootstrap routine, which ends in below machine code.
I'm going to plug my own code over here.

(See the funny remark about Monster as being displayed in one of above pictures)

;----------------------------------------------------------------------------;
; INT 18 - Unbootable IPL
;----------------------------------------------------------------------------;
; Display a disk boot failure message and wait for a key to cold reboot.
;
; This may be re-vectored to ROM BASIC, if present.
;
; Size: 18 bytes
;----------------------------------------------------------------------------;
INT_18 PROC
		ASSUME DS:_BDA_ABS
	PRINT_SZ  BOOT_FAIL			; print boot failure string
	XOR	AX, AX				; AH = 0 (wait for key)
	MOV	DS, AX				; DS = 0000
	MOV	WARM_FLAG_ABS, AX			; do a cold boot
	INT	16H					; wait for key press
	JMP	BOOT					; reboot
INT_18 ENDP

BOOT ENDP

;----------------------------------------------------------------------------;
;
; END OF BIOS POST/BOOTSTRAP
;
;----------------------------------------------------------------------------;

		ASSUME DS:_BDA
STRINGS PROC
;----------------------------------------------------------------------------;
; Banner Strings
;
BANNER_STRINGS PROC

					IF POST_GLADOS EQ 1
BOOT_BEGIN		DB	CR, LF
			DB	'Starting GLaDOS...'
NL2_Z			DB	LF				; two NL's, null term'd
					ENDIF
NL_Z			DB	CR, LF, 0			; one NL, null term'd
BOOT_FAIL		DB	'Disk Boot Fail.'
			DB	' You monster.'
NL2_ANY_KEY		DB	LF
NL_ANY_KEY		DB	CR, LF
ANY_KEY		DB	'Press the Any Key'
			DB	'...'

Assembly stuff

I’ve got Dosbox installed on my machine.

git clone https://github.com/640-KB/GLaBIOS.git
I copied MASM.EXE and LINK.EXE in the GLaBios src directory.

edit make.bat

change
MASM GLABIOS;
into
MASM /DVER_DATE=”05/24/23″ /DARCH_TYPE=”T” /DCPU_TYPE=”V” GLABIOS;

start dosbox

mount c: /home/henri/projects/

c:

cd glabios/src

make.bat