initial commit master
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 17 Sep 2022 14:53:36 +0000 (17:53 +0300)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 17 Sep 2022 14:53:36 +0000 (17:53 +0300)
.gitignore [new file with mode: 0644]
Makefile [new file with mode: 0644]
src/main.c [new file with mode: 0644]
src/video.c [new file with mode: 0644]
src/video.h [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..f784744
--- /dev/null
@@ -0,0 +1,7 @@
+*.obj
+*.swp
+*.exe
+*.lnk
+*.occ
+*.err
+*.map
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..58ff52f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,42 @@
+!ifdef __UNIX__
+obj = src/main.obj src/video.obj
+!else
+obj = src\main.obj src\video.obj
+!endif
+bin = dosplash.exe
+
+warn = -w=3
+dbg = -d3
+
+CC = wcc
+LD = wlink
+CFLAGS = $(warn) $(dbg) $(opt) $(def) -zq -bt=dos -ml
+
+$(bin): $(obj)
+       %write obj.lnk $(obj)
+       $(LD) debug all option map name $@ system dos file { @obj }
+
+.c: src
+.asm: src
+
+cflags.occ: Makefile
+       %write $@ $(CFLAGS)
+
+.c.obj: .autodepend
+       $(CC) -fo=$@ @cflags.occ $[*
+
+.asm.obj:
+       nasm -f obj -o $@ $[*.asm
+
+!ifdef __UNIX__
+clean: .symbolic
+       rm -f $(obj)
+       rm -f $(bin)
+       rm -f cflags.occ obj.lnk
+!else
+clean: .symbolic
+       del *.obj
+       del obj.lnk
+       del cflags.occ
+       del $(bin)
+!endif
diff --git a/src/main.c b/src/main.c
new file mode 100644 (file)
index 0000000..9c5cd90
--- /dev/null
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <conio.h>
+#include <dos.h>
+#include "video.h"
+
+int main(int argc, char **argv)
+{
+       set_video_mode(0x13);
+
+       memset(MK_FP(0xa000, 0), 4, 64000);
+
+       for(;;) {
+               if(kbhit()) {
+                       if(getch() == 27) break;
+               }
+       }
+
+       set_video_mode(3);
+       return 0;
+}
diff --git a/src/video.c b/src/video.c
new file mode 100644 (file)
index 0000000..e17f1f7
--- /dev/null
@@ -0,0 +1,10 @@
+#include <dos.h>
+#include "video.h"
+
+void set_video_mode(int mode)
+{
+       union REGS regs = {0};
+
+       regs.x.ax = mode;
+       int86(0x10, &regs, &regs);
+}
diff --git a/src/video.h b/src/video.h
new file mode 100644 (file)
index 0000000..28725bd
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef VIDEO_H_
+#define VIDEO_H_
+
+void set_video_mode(int mode);
+
+#endif /* VIDEO_H_ */