#include "keyb.h"
#include "timer.h"
#include "contty.h"
-#include "int86.h"
+#include "video.h"
-static void set_mode13h(void)
-{
- struct int86regs regs;
-
- memset(®s, 0, sizeof regs);
- regs.eax = 0x13;
- int86(0x10, ®s);
-}
void logohack(void);
halt_cpu();
while((c = kb_getkey()) >= 0) {
if(c >= KB_F1 && c <= KB_F12) {
- set_mode13h();
+ set_vga_mode(0x13);
logohack();
+ set_vga_mode(3);
}
if(isprint(c)) {
printf("key: %d '%c' \n", c, (char)c);
.extern _bss_start
.extern _bss_end
.extern pcboot_main
+ .extern wait_vsync
+ .extern kb_getkey
# move the stack to the top of the conventional memory
movl $0x80000, %esp
.global logohack
logohack:
+ pusha
+
# copy palette
mov $logo_pal, %esi
xor %cl, %cl
incl frameno
- # wait vsync
- mov $0x3da, %dx
-0: in %dx, %al
- and $8, %al
- jnz 0b
-0: in %dx, %al
- and $8, %al
- jz 0b
+ call wait_vsync
+
+ # check for escape keypress
+ call kb_getkey
+ cmp $27, %eax
+ jz 0f
+
jmp frameloop
+0: popa
+ ret
+
xval: .long 0
yval: .long 0
frameno: .long 0
--- /dev/null
+/*
+pcboot - bootable PC demo/game kernel
+Copyright (C) 2018 John Tsiombikas <nuclear@member.fsf.org>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY, without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <https://www.gnu.org/licenses/>.
+*/
+#include "video.h"
+#include <string.h>
+#include "int86.h"
+
+
+void set_vga_mode(int mode)
+{
+ struct int86regs regs;
+
+ memset(®s, 0, sizeof regs);
+ regs.eax = mode;
+ int86(0x10, ®s);
+}
--- /dev/null
+#ifndef VIDEO_H_
+#define VIDEO_H_
+
+void set_vga_mode(int mode);
+
+/* defined in video_asm.s */
+void wait_vsync(void);
+
+#endif /* VIDEO_H_ */
--- /dev/null
+# pcboot - bootable PC demo/game kernel
+# Copyright (C) 2018 John Tsiombikas <nuclear@member.fsf.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+ .text
+
+ .global wait_vsync
+wait_vsync:
+ mov $0x3da, %dx
+0: in %dx, %al
+ and $8, %al
+ jnz 0b
+0: in %dx, %al
+ and $8, %al
+ jz 0b
+ ret