initial commit

This commit is contained in:
John Bintz 2024-03-19 08:18:55 -04:00
commit 9ec9389bdf
6 changed files with 103 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.o
*.err
*.exe

34
main.c Normal file
View File

@ -0,0 +1,34 @@
#include <i86.h>
#include <conio.h>
extern void __cdecl enableUnchainedVGAMode();
extern void __cdecl enableTextMode();
char far *VGA = (char*)0xA0000;
int main(void) {
// activate unchained vga mode
// set up 8 very clear colors
// place some data into video memory to be latch copied
// show off the following
// * latch copies
// * masking
// * barrel shifting
int i,j;
enableUnchainedVGAMode();
outp(0x3c4, 0x02);
for (i = 0; i < 200; ++i) {
for (j = 0; j < 4; ++j) {
outp(0x3c5, 1 << j);
VGA[i] = j + 1;
}
}
delay(5000);
enableTextMode();
}

10
makefile Normal file
View File

@ -0,0 +1,10 @@
obj = vga.o main.o
.c.o:
wcc386 -q -bt=dos $<
.asm.o:
wasm $<
main.exe: $(obj)
wcl386 -fe=main -bt=dos -l=dos4g $(obj)

3
run Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
wmake -h && dosbox-x -nolog main.exe

5
setup.sh Normal file
View File

@ -0,0 +1,5 @@
export WATCOM=~/Applications/open-watcom-v2/rel
export INCLUDE=$WATCOM/h
export LIB=$WATCOM/lib286/dos:$WATCOM/lib286
export PATH=$WATCOM/binl64:$WATCOM/binl:$PATH

48
vga.asm Normal file
View File

@ -0,0 +1,48 @@
PUBLIC _enableUnchainedVGAMode
PUBLIC _enableTextMode
DISPLAY_MODE_VGA equ 13h
DISPLAY_MODE_TEXT equ 03h
VGA_SEQUENCE_CONTROLLER_INDEX equ 0x3c4
VGA_SEQUENCE_CONTROLLER_DATA equ 0x3c5h
VGA_SEQUENCE_CONTROLLER_MEMORY_MODE equ 0x04
VGA_CRT_CONTROLLER_INDEX equ 0x03d4
VGA_CRT_CONTROLLER_DATA equ 0x03d5
VGA_CRT_CONTROLLER_UNDERLINE_LOC equ 0x14
VGA_CRT_CONTROLLER_MODE_CONTROL equ 0x17
.386
.model flat,c
.CODE
_enableUnchainedVGAMode:
mov ax,0x0013;
int 0x10
mov dx, VGA_SEQUENCE_CONTROLLER_INDEX
mov al, VGA_SEQUENCE_CONTROLLER_MEMORY_MODE
mov ah, 0x06
out dx, ax
mov dx, VGA_CRT_CONTROLLER_INDEX
mov al, VGA_CRT_CONTROLLER_MODE_CONTROL
mov ah, 0xe3
out dx, ax
mov dx, VGA_CRT_CONTROLLER_INDEX
mov al, VGA_CRT_CONTROLLER_UNDERLINE_LOC
mov ah, 0x00
out dx, ax
ret
_enableTextMode:
mov ah,0h
mov al,DISPLAY_MODE_TEXT
int 10h
ret
end