Fixed 86Box stack issues

This commit is contained in:
Frater 2026-02-12 23:10:12 +01:00
commit 4b581d497d
10 changed files with 1274 additions and 1243 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
doc/assets/86box-video.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
doc/assets/Capture-QEMU.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

12
doc/assets/screenshot.md Normal file
View file

@ -0,0 +1,12 @@
![Screenshot of the boot + text test](/doc/assets/Capture-2026-01-29-210122.png)
Screenshot of early boot version + Text functions
![Screenshot WIP - Buttons & Sliders](/doc/assets/Capture-2026-02-03-213148.png)
Screenshot of early buttons & sliders
![Screenshot WIP - Rounded Buttons & Checkboxes ](/doc/assets/Capture-2026-02-06-232336.png)
Screenshot of rounded buttons & checkboxes

65
doc/build.md Normal file
View file

@ -0,0 +1,65 @@
### Build & Run
#### Compilation
From the project root:
```bash
cd src
nasm -f bin boot.asm -o ..\build\bios.bin
```
This produces a raw BIOS ROM image (bios.bin) suitable for direct execution by QEMU.
#### QEMU Execution
The QEMU VGA BIOS must be copied into a local rom/ directory.
Default locations of `vgabios.bin`:
Windows
`C:\Program Files\qemu\share\vgabios.bin`
Linux
`/usr/share/qemu/vgabios.bin`
You can use an video bios from the 86box's project:
https://github.com/86Box/roms
Copy it to: `roms/vgabios.bin`
Then run QEMU with:
```bash
qemu-system-i386 \
-bios build/bios.bin \
-device loader,file=roms/vgabios.bin,addr=0xC0000,force-raw=on \
-device isa-debugcon,chardev=myconsole \
-chardev stdio,id=myconsole \
-k be \
-display sdl
```
This command:
- Loads the custom BIOS as the system ROM
- Injects the VGA BIOS at 0xC0000
- Redirects debug output to the console
- Displays graphics using SDL
#### 86Box Execution
This is a bit tricky since 86box doesn't allow to pick custom BIOS file. You'll have to choose an existing computer and replace the original BIOS file with the compliled one.
create a new configuration:
![86Box Config - Machine](/doc/assets/86box-machine.png)
![86Box Config - video](/doc/assets/86box-video.png)
- save the configuration
- go to the 86Box's `roms\machines\vli486sv2g\` folder
- rename the `0402.001` file (it's the original machine's BIOS);
- copy the `build\bios.bin` into the 86Bos's `roms\machines\vli486sv2g\` folder and rename as `0402.001`

View file

@ -12,17 +12,9 @@ Rather than booting an operating system from disk, the PC starts **directly from
The project is intentionally educational, experimental, and minimalist.
![Screenshot of the boot + text test](/doc/assets/Capture-2026-01-29-210122.png)
![Screenshot 86Box](/doc/assets/Capture-86box.png)
Screenshot of early boot version + Text functions
![Screenshot WIP - Buttons & Sliders](/doc/assets/Capture-2026-02-03-213148.png)
Screenshot of early buttons & sliders
![Screenshot WIP - Rounded Buttons & Checkboxes ](/doc/assets/Capture-2026-02-06-232336.png)
Screenshot of rounded buttons & checkboxes
You may want to get a look at the [Older screenshots](/doc/assets/screenshot.md)
---
@ -82,53 +74,7 @@ Get a look at the [API](/doc/API.md) for more information.
### Build and Run
#### Compilation
From the project root:
```bash
cd src
nasm -f bin boot.asm -o ..\build\bios.bin
```
This produces a raw BIOS ROM image (bios.bin) suitable for direct execution by QEMU.
#### Execution
The QEMU VGA BIOS must be copied into a local rom/ directory.
Default locations of `vgabios.bin`:
Windows
`C:\Program Files\qemu\share\vgabios.bin`
Linux
`/usr/share/qemu/vgabios.bin`
You can use an video bios from the 86box's project:
https://github.com/86Box/roms
Copy it to: `roms/vgabios.bin`
Then run QEMU with:
```bash
qemu-system-i386 \
-bios build/bios.bin \
-device loader,file=roms/vgabios.bin,addr=0xC0000,force-raw=on \
-device isa-debugcon,chardev=myconsole \
-chardev stdio,id=myconsole \
-k be \
-display sdl
```
This command:
- Loads the custom BIOS as the system ROM
- Injects the VGA BIOS at 0xC0000
- Redirects debug output to the console
- Displays graphics using SDL
[read detailed step to compile an run](/doc/build.md)
### Non-Goals
@ -149,20 +95,6 @@ Ce projet consiste à concevoir et développer un **BIOS/ROM PC compatible enti
Au lieu de charger un système dexploitation depuis un disque, le PC **démarre directement depuis la ROM** vers une **interface graphique minimaliste**, utilisant le mode **CGA Haute Résolution Monochrome (640×200)**.
Le projet est volontairement **éducatif, expérimental et minimaliste**.
![Screenshot of the boot + text test](/doc/assets/Capture-2026-01-29-210122.png)
Screenshot of early boot version + Text functions
![Screenshot WIP - Buttons & Sliders](/doc/assets/Capture-2026-02-03-213148.png)
Screenshot of early buttons & sliders
![Screenshot WIP - Rounded Buttons & Checkboxes ](/doc/assets/Capture-2026-02-06-232336.png)
Screenshot of rounded buttons & checkboxes
---
### Objectifs

View file

@ -152,14 +152,14 @@ main_loop:
pop ds
DEBUG 1
ISADBG ISA_RED, 1
ISADBG ISA_LEFT, 1
; Init du système GUI
call gui_init_system
DEBUG 2
ISADBG ISA_RED, 2
ISADBG ISA_LEFT, 2
; --- CRÉATION DYNAMIQUE DES BOUTONS ---
@ -180,7 +180,7 @@ main_loop:
GUI OBJ_SET_TEXT, ax, cs, str_option3
DEBUG 3
ISADBG ISA_RED, 3
ISADBG ISA_LEFT, 3
; Créer Slider (Drag)
GUI OBJ_CREATE, OBJ_TYPE_SLIDER, 10, 100, 150, 12
@ -197,7 +197,7 @@ main_loop:
mov .value, 0xFADE
DEBUG 4
ISADBG ISA_RED, 4
ISADBG ISA_LEFT, 4
.loop:
call gui_process_all

View file

@ -20,45 +20,59 @@
;
; =============================================================================
%macro DEBUG 1
GFX GOTOXY, 0, 0
mov ax, %1
call print_word_hex
%endmacro
%define DISABLE_DEBUGER
;
; Debugger for 86Box
;
%define ISA_DBG_PORT 0x007a
;
%define ISA_RED 0
%define ISA_GREEN 1
%define ISA_RIGHT 2
%define ISA_LEFT 3
%define ISA_RESET 0xff
%ifndef DISABLE_DEBUGER
%macro ISADBG 2
push dx
push ax
mov dx, ISA_DBG_PORT
mov al, byte %1
out dx, al
inc dx
mov al, byte %2
out dx, al
pop ax
pop dx
%endmacro
%macro DEBUG 1
GFX GOTOXY, 0, 0
mov ax, %1
call print_word_hex
%endmacro
%macro ISADBG_RESET 0
push dx
push ax
mov dx, ISA_DBG_PORT
mov al, ISA_RESET
out dx, al
pop ax
pop dx
%endmacro
;
; Debugger for 86Box
;
%define ISA_DBG_PORT 0x007a
;
%define ISA_RED 0
%define ISA_GREEN 1
%define ISA_RIGHT 2
%define ISA_LEFT 3
%define ISA_RESET 0xff
%macro ISADBG 2
push dx
push ax
mov dx, ISA_DBG_PORT
mov al, byte %1
out dx, al
inc dx
mov al, byte %2
out dx, al
pop ax
pop dx
%endmacro
%macro ISADBG_RESET 0
push dx
push ax
mov dx, ISA_DBG_PORT
mov al, ISA_RESET
out dx, al
pop ax
pop dx
%endmacro
%else
%macro DEBUG 1
%endmacro
%macro ISADBG 2
%endmacro
%macro ISADBG_RESET 0
%endmacro
%endif
; -----------------------------------------------------------------------------------
; PC components I/O ports

File diff suppressed because it is too large Load diff