Initial commit

This commit is contained in:
kuntz 2021-02-05 17:19:43 -06:00
parent 7d7c88259c
commit efd18f1184
21 changed files with 1525 additions and 0 deletions

40
bochsrc.bxrc Executable file
View File

@ -0,0 +1,40 @@
# configuration file generated by Bochs
plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, gameport=1
config_interface: win32config
display_library: win32
memory: host=32, guest=32
romimage: file="C:\Program Files\Bochs-2.6\BIOS-bochs-latest"
vgaromimage: file="C:\Program Files\Bochs-2.6\VGABIOS-lgpl-latest"
boot: floppy
floppy_bootsig_check: disabled=0
floppya: type=1_44, 1_44="C:\masm32\projects\gameros\gameros.img", status=inserted, write_protected=0
# no floppyb
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata2: enabled=0
ata3: enabled=0
pci: enabled=1, chipset=i440fx
vga: extension=vbe, update_freq=10
cpu: count=1, ips=10000000, model=corei5_arrandale_m520, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
print_timestamps: enabled=0
port_e9_hack: enabled=0
private_colormap: enabled=0
clock: sync=realtime, time0=local, rtc_sync=0
# no cmosimage
# no loader
log: -
logprefix: %t%e%d
panic: action=ask
error: action=ask
info: action=report
debug: action=ignore
magic_break: enabled=1
keyboard: type=mf, serial_delay=250, paste_delay=100000, keymap=
user_shortcut: keys=none
mouse: enabled=0, type=ps2, toggle=ctrl+mbutton
parport1: enabled=1, file=""
parport2: enabled=0
com1: enabled=1, mode=null, dev=""
com2: enabled=0
com3: enabled=0
com4: enabled=0

2
burndrv.bat Executable file
View File

@ -0,0 +1,2 @@
dd if=C:\masm32\projects\gameros\gameros.img of=\\.\PhysicalDrive1 --localwrt
pause

21
data.asm Executable file
View File

@ -0,0 +1,21 @@
graphic_man db 99h, 99h, 06h, 06h, 06h, 99h, 99h
db 99h, 99h, 2Ch, 2Ch, 2Ch, 99h, 99h
db 99h, 99h, 2Ch, 2Ch, 2Ch, 99h, 99h
db 99h, 99h, 99h, 2Ch, 99h, 99h, 99h
db 99h, 99h, 2Fh, 2Fh, 2Fh, 99h, 99h
db 2Fh, 2Fh, 2Fh, 2Fh, 2Fh, 2Fh, 2Fh
db 2Fh, 99h, 2Fh, 2Fh, 2Fh, 99h, 2Fh
db 2Fh, 99h, 2Fh, 2Fh, 2Fh, 99h, 2Fh
db 99h, 99h, 20h, 20h, 20h, 99h, 99h
db 99h, 99h, 20h, 99h, 20h, 99h, 99h
db 99h, 99h, 20h, 99h, 20h, 99h, 99h
db 99h, 99h, 20h, 99h, 20h, 99h, 99h
db 99h, 99h, 70h, 99h, 70h, 99h, 99h
graphic_ball db 99h, 99h, 2Ah, 2Ah, 2Ah, 99h, 99h
db 99h, 2Ah, 2Ah, 2Ah, 2Ah, 2Ah, 99h
db 2Ah, 2Ah, 2Ah, 2Ah, 2Ah, 2Ah, 2Ah
db 2Ah, 2Ah, 2Ah, 2Ah, 2Ah, 2Ah, 2Ah
db 2Ah, 2Ah, 2Ah, 2Ah, 2Ah, 2Ah, 2Ah
db 99h, 2Ah, 2Ah, 2Ah, 2Ah, 2Ah, 99h
db 99h, 99h, 2Ah, 2Ah, 2Ah, 99h, 99h

1
dbg.txt Executable file
View File

@ -0,0 +1 @@
c

1
debug.bat Executable file
View File

@ -0,0 +1 @@
"C:\Program Files\Bochs-2.6\bochsdbg.exe" -rc C:\masm32\projects\gameros\dbg.txt -q -f C:\masm32\projects\gameros\bochsrc.bxrc

150
font.asm Executable file
View File

@ -0,0 +1,150 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
include font.inc
; ##########################################################################
ftoa proc uses di es number:dword, string:word, segreg:word
local mulamt:word
mov di, string
mov ax, segreg
mov es, ax
mov mulamt, 1000
fild mulamt
fmul number
fistp number
.if number & 80000000h
mov al, '-'
stosb
neg number
.endif
mov dword ptr es:[di], '00.0'
.if number < 10
add di, 4
.elseif number < 100
add di, 3
.elseif number < 1000
add di, 2
.endif
invoke ltoa, number, di, es
.if number >= 1000
.while byte ptr es:[di] != 0
inc di
.endw
mov eax, es:[di-3]
mov es:[di-2], eax
mov byte ptr es:[di-3], '.'
.endif
ret
ftoa endp
; ##########################################################################
ltoa proc uses bx si di es number:dword, string:word, segreg:word
local pbcd:tbyte
fild number
fbstp pbcd
lea si, pbcd
mov di, string
mov bx, 8
mov ax, segreg
mov es, ax
mov cl, 0
mov al, byte ptr ss:[si+9]
.if al & 80h
mov al, '-'
stosb
.endif
.while bx != -1
movzx ax, byte ptr ss:[si+bx]
shl ax, 4
shr al, 4
.if ah != 0 || cl != 0
add ah, 30h
mov es:[di], ah
inc di
or cl, -1
.endif
.if al != 0 || cl != 0
add al, 30h
stosb
or cl, -1
.endif
dec bx
.endw
.if cl == 0
mov al, '0'
stosb
.endif
mov byte ptr es:[di], 0
ret
ltoa endp
; ##########################################################################
print proc uses bx si di es X:word, Y:word, string:word, segreg:word
mov si, string
mov di, offset FONT_ARRAY
mov ax, segreg
mov es, ax
movzx bx, byte ptr es:[si]
.while bx != 0
.if bl > 20h
shl bx, 1
invoke drawgraphic, X, Y, 5, 5, word ptr [di+bx]
.endif
inc si
add X, 7
movzx bx, byte ptr es:[si]
.endw
ret
print endp
; ##########################################################################

434
font.inc Executable file
View File

@ -0,0 +1,434 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
print proto :word, :word, :word, :word
ltoa proto :dword, :word, :word
ftoa proto :dword, :word, :word
FONT_ARRAY dw 33 dup(0)
dw offset FONT_HX21, offset FONT_HX22, offset FONT_HX23, offset FONT_HX24, offset FONT_HX25
dw offset FONT_HX26, offset FONT_HX27, offset FONT_HX28, offset FONT_HX29, offset FONT_HX2A
dw offset FONT_HX2B, offset FONT_HX2C, offset FONT_HX2D, offset FONT_HX2E, offset FONT_HX2F
dw offset FONT_NUM0, offset FONT_NUM1, offset FONT_NUM2, offset FONT_NUM3, offset FONT_NUM4
dw offset FONT_NUM5, offset FONT_NUM6, offset FONT_NUM7, offset FONT_NUM8, offset FONT_NUM9
dw offset FONT_HX3A, offset FONT_HX3B, offset FONT_HX3C, offset FONT_HX3D, offset FONT_HX3E
dw offset FONT_HX3F, offset FONT_HX40, offset FONT_HXAA, offset FONT_HXBB, offset FONT_HXCC
dw offset FONT_HXDD, offset FONT_HXEE, offset FONT_HXFF, offset FONT_HXGG, offset FONT_HXHH
dw offset FONT_HXII, offset FONT_HXJJ, offset FONT_HXKK, offset FONT_HXLL, offset FONT_HXMM
dw offset FONT_HXNN, offset FONT_HXOO, offset FONT_HXPP, offset FONT_HXQQ, offset FONT_HXRR
dw offset FONT_HXSS, offset FONT_HXTT, offset FONT_HXUU, offset FONT_HXVV, offset FONT_HXWW
dw offset FONT_HXXX, offset FONT_HXYY, offset FONT_HXZZ, offset FONT_HX5B, offset FONT_HX5C
dw offset FONT_HX5D, offset FONT_HX5E, offset FONT_HX5F, offset FONT_HX60, offset FONT_HXAA
dw offset FONT_HXBB, offset FONT_HXCC, offset FONT_HXDD, offset FONT_HXEE, offset FONT_HXFF
dw offset FONT_HXGG, offset FONT_HXHH, offset FONT_HXII, offset FONT_HXJJ, offset FONT_HXKK
dw offset FONT_HXLL, offset FONT_HXMM, offset FONT_HXNN, offset FONT_HXOO, offset FONT_HXPP
dw offset FONT_HXQQ, offset FONT_HXRR, offset FONT_HXSS, offset FONT_HXTT, offset FONT_HXUU
dw offset FONT_HXVV, offset FONT_HXWW, offset FONT_HXXX, offset FONT_HXYY, offset FONT_HXZZ
dw offset FONT_HX7B, offset FONT_HX7C, offset FONT_HX7D, offset FONT_HX7E
FONT_HX21 db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
FONT_HX22 db 99h, 255, 99h, 255, 99h
db 99h, 255, 99h, 255, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
FONT_HX23 db 99h, 255, 99h, 255, 99h
db 255, 255, 255, 255, 255
db 99h, 255, 99h, 255, 99h
db 255, 255, 255, 255, 255
db 99h, 255, 99h, 255, 99h
FONT_HX24 db 99h, 255, 255, 255, 255
db 255, 99h, 255, 99h, 99h
db 99h, 255, 255, 255, 99h
db 99h, 99h, 255, 99h, 255
db 255, 255, 255, 255, 99h
FONT_HX25 db 255, 255, 99h, 99h, 255
db 255, 255, 99h, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 99h, 255, 255
db 255, 99h, 99h, 255, 255
FONT_HX26 db 99h, 255, 255, 255, 99h
db 255, 99h, 255, 99h, 99h
db 99h, 255, 255, 255, 99h
db 255, 99h, 255, 99h, 99h
db 99h, 255, 255, 255, 99h
FONT_HX27 db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
FONT_HX28 db 99h, 99h, 255, 99h, 99h
db 99h, 255, 99h, 99h, 99h
db 99h, 255, 99h, 99h, 99h
db 99h, 255, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
FONT_HX29 db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 255, 99h, 99h
FONT_HX2A db 99h, 255, 255, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 99h, 255, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
FONT_HX2B db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 255, 255, 255, 255, 255
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
FONT_HX2C db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
FONT_HX2D db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 255
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
FONT_HX2E db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
FONT_HX2F db 99h, 99h, 99h, 99h, 255
db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 99h, 99h, 99h
db 255, 99h, 99h, 99h, 99h
FONT_NUM0 db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
FONT_NUM1 db 99h, 255, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 255, 255, 99h
FONT_NUM2 db 255, 255, 255, 255, 255
db 99h, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 255
FONT_NUM3 db 255, 255, 255, 255, 255
db 99h, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
db 99h, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
FONT_NUM4 db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
db 99h, 99h, 99h, 99h, 255
db 99h, 99h, 99h, 99h, 255
FONT_NUM5 db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 255
db 99h, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
FONT_NUM6 db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
FONT_NUM7 db 255, 255, 255, 255, 255
db 99h, 99h, 99h, 99h, 255
db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
FONT_NUM8 db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
FONT_NUM9 db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
db 99h, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
FONT_HX3A db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
FONT_HX3B db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 99h, 99h, 99h
FONT_HX3C db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 99h, 255, 99h
FONT_HX3D db 99h, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 255
db 99h, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 255
db 99h, 99h, 99h, 99h, 99h
FONT_HX3E db 99h, 255, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 99h, 99h, 99h
FONT_HX3F db 99h, 99h, 255, 255, 99h
db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 255, 255, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
FONT_HX40 db 255, 255, 255, 255, 255
db 255, 99h, 255, 99h, 255
db 255, 99h, 255, 255, 255
db 255, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 255
FONT_HXAA db 99h, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
FONT_HXBB db 255, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 99h
FONT_HXCC db 99h, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 99h
db 255, 99h, 99h, 99h, 255
db 99h, 255, 255, 255, 99h
FONT_HXDD db 255, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 99h
FONT_HXEE db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 255
FONT_HXFF db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 99h
db 255, 99h, 99h, 99h, 99h
FONT_HXGG db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 99h
db 255, 99h, 99h, 255, 255
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
FONT_HXHH db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
FONT_HXII db 255, 255, 255, 255, 255
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 255, 255, 255, 255, 255
FONT_HXJJ db 255, 255, 255, 255, 255
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 255, 255, 255, 99h, 99h
FONT_HXKK db 255, 99h, 99h, 255, 99h
db 255, 99h, 255, 99h, 99h
db 255, 255, 99h, 99h, 99h
db 255, 99h, 255, 99h, 99h
db 255, 99h, 99h, 255, 99h
FONT_HXLL db 255, 99h, 99h, 99h, 99h
db 255, 99h, 99h, 99h, 99h
db 255, 99h, 99h, 99h, 99h
db 255, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 255
FONT_HXMM db 255, 99h, 99h, 99h, 255
db 255, 255, 99h, 255, 255
db 255, 99h, 255, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
FONT_HXNN db 255, 99h, 99h, 99h, 255
db 255, 255, 99h, 99h, 255
db 255, 99h, 255, 99h, 255
db 255, 99h, 99h, 255, 255
db 255, 99h, 99h, 99h, 255
FONT_HXOO db 99h, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 99h, 255, 255, 255, 99h
FONT_HXPP db 255, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 99h
db 255, 99h, 99h, 99h, 99h
FONT_HXQQ db 99h, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 255, 99h
db 99h, 255, 255, 99h, 255
FONT_HXRR db 255, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 99h
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
FONT_HXSS db 99h, 255, 255, 255, 255
db 255, 99h, 99h, 99h, 99h
db 99h, 255, 255, 255, 99h
db 99h, 99h, 99h, 99h, 255
db 255, 255, 255, 255, 99h
FONT_HXTT db 255, 255, 255, 255, 255
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
FONT_HXUU db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 99h, 255, 255, 255, 99h
FONT_HXVV db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 99h, 255, 99h, 255, 99h
db 99h, 99h, 255, 99h, 99h
FONT_HXWW db 255, 99h, 99h, 99h, 255
db 255, 99h, 99h, 99h, 255
db 255, 99h, 255, 99h, 255
db 255, 99h, 255, 99h, 255
db 99h, 255, 99h, 255, 99h
FONT_HXXX db 255, 99h, 99h, 99h, 255
db 99h, 255, 99h, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 99h, 255, 99h
db 255, 99h, 99h, 99h, 255
FONT_HXYY db 255, 99h, 99h, 99h, 255
db 99h, 255, 99h, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
FONT_HXZZ db 255, 255, 255, 255, 255
db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 99h, 99h, 99h
db 255, 255, 255, 255, 255
FONT_HX5B db 99h, 99h, 255, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 255, 99h
FONT_HX5C db 255, 99h, 99h, 99h, 99h
db 99h, 255, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 99h, 99h, 255
FONT_HX5D db 99h, 255, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 255, 99h, 99h
FONT_HX5E db 99h, 99h, 255, 99h, 99h
db 99h, 255, 99h, 255, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
FONT_HX5F db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 255, 255, 255, 255, 255
FONT_HX60 db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
FONT_HX7B db 99h, 99h, 255, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 99h, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 255, 99h
FONT_HX7C db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
FONT_HX7D db 99h, 255, 255, 99h, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 99h, 99h, 255, 99h
db 99h, 99h, 255, 99h, 99h
db 99h, 255, 255, 99h, 99h
FONT_HX7E db 99h, 255, 255, 99h, 255
db 255, 99h, 99h, 255, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h
db 99h, 99h, 99h, 99h, 99h

64
gameros.asm Executable file
View File

@ -0,0 +1,64 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
include gameros.inc
boot:far_jmp 07C0h, @F
; ##########################################################################
@@: intro
clrscr
call loadkernel
dbgout "Kernel Load Failure"
halt
; ##########################################################################
loadkernel proc
local currdrv:byte
mov currdrv, 0
.repeat
mov ah, 0
mov dl, currdrv
int 13h
mov bx, KERNEL_ADDR
mov dword ptr [bx], 0
mov ah, 2
mov al, SECTOR_COUNT
mov cx, 2
mov dh, 0
mov dl, currdrv
int 13h
.if !carry?
mov eax, ds:[KERNEL_ADDR]
mov ecx, ds:[BINARY_SIZE - 4]
.if eax == IMAGE_TAG && ecx == FOOTER_TAG
call main
reboot
.endif
.endif
inc currdrv
.until currdrv == 0
ret
loadkernel endp
; ##########################################################################
BOOT_FOOTER
include main.asm
end boot

118
gameros.inc Executable file
View File

@ -0,0 +1,118 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
KERNEL_ADDR equ 0200h
STACK_SEG equ 9000h
BINARY_SIZE equ 2000h
SECTOR_COUNT equ (BINARY_SIZE - 1) / 512
IMAGE_TAG equ 12349292h
FOOTER_TAG equ 69692388h
BIOS_SEG equ 07C0h
int3 textequ <xchg bx, bx>
intro macro
cli
mov ax, cs
mov ds, ax
mov es, ax
lss sp, farptr(9000h, 0)
mov eax, cr0
and eax, 9FFFFFFBh
or al, 2
mov cr0, eax
mov eax, cr4
and ax, 9FB7h
or eax, 600h
mov cr4, eax
cld
finit
sti
endm
enable_nmi macro
in al, 70h
and al, 7Fh
out 70h, al
endm
disable_nmi macro
in al, 70h
or al, 80h
out 70h, al
endm
halt macro
local X
X: hlt
jmp X
endm
clrscr macro
mov ax, 3
int 10h
endm
dbgout macro txt:vararg
local A, B
cli
jmp A
B db txt
A:
clrscr
mov ax, 1301h
mov bx, 0Ah
mov cx, sizeof B
mov dx, 0
push cs
pop es
mov bp, offset B
int 10h
sti
endm
eoi macro
mov al, 20h
out 20h, al
endm
reboot macro
far_jmp 0FFFFh, 0000h
endm
far_jmp macro segarg:req, offarg:req
db 0EAh
dw offarg, segarg
endm
txt macro string:vararg
local A, B
jmp A
B db string, 0
A:
exitm <offset B>
endm
farptr macro segarg:req, offarg:req
local A, B
jmp A
B dd (segarg shl 16) or offarg
A:
exitm <B>
endm
BOOT_FOOTER macro
org boot + 510
dw 0AA55h
endm
IMAGE_FOOTER macro
org boot + BINARY_SIZE - 4
dd FOOTER_TAG
endm
option casemap:none
.model tiny, stdcall, farstack
.686p
.mmx
.xmm
.code

27
keyb.asm Executable file
View File

@ -0,0 +1,27 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
include keyb.inc
; ##########################################################################
init_keyb proc
mov ax, 0
mov fs, ax
cli
mov word ptr fs:[IVT_IRQ1], offset key_handler
mov word ptr fs:[IVT_IRQ1+2], BIOS_SEG
sti
ret
init_keyb endp
; ##########################################################################
key_handler proc uses ax
in al, 60h
mov last_key, al
eoi
iret
key_handler endp
; ##########################################################################

8
keyb.inc Executable file
View File

@ -0,0 +1,8 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
init_keyb proto
key_handler proto
IVT_IRQ1 equ 36
last_key db 0

170
main.asm Executable file
View File

@ -0,0 +1,170 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
dd IMAGE_TAG
; ##########################################################################
include rand.asm
include modex.asm
include data.asm
include font.asm
include keyb.asm
include timer.asm
include object.asm
drawhline proto :word, :word, :word, :byte
drawvline proto :word, :word, :word, :byte
; ##########################################################################
main proc
local x:sword, x2:sword, l1:sword, l2:sword, l3:sword, l4:sword, l5:sword, l6:sword
local buffer[20]:byte, start_count:dword, fps:dword, fps_count:dword, float_count:dword
mov x, -7
mov x2, 100
mov l1, 0
mov l2, 0
mov l3, 35
mov l4, 100
mov l5, 5
mov l6, 200
mov start_count, 0
mov fps, 0
mov fps_count, 0
invoke init_keyb
invoke init_timer
invoke init_objects
invoke setmodex
invoke setpalcolor, 255, -1, -1, 0
invoke setpalcolor, 200, 8, 9, 25
@@: invoke setvideomemory, 200
invoke drawgraphic, x, 50, 7, 13, addr graphic_man
inc x
.if x > 319
mov x, -7
.endif
add x2, 3
.if x2 > 319
mov x2, -7
.endif
sub l1, 3
.if l1 < -2
add l1, 240
.endif
invoke drawhline, 0, l1, 320, COLOR_GREEN
inc l1
invoke drawhline, 0, l1, 320, COLOR_GREEN
inc l1
invoke drawhline, 0, l1, 320, COLOR_GREEN
sub l1, 2
add l2, 5
.if l2 > 319
sub l2, 320
.endif
invoke drawvline, l2, 0, 240, COLOR_ORANGE
add l3, 3
.if l3 > 319
sub l3, 320
.endif
invoke drawvline, l3, 0, 240, COLOR_YELLOW
sub l4, 4
.if l4 < 0
add l4, 320
.endif
invoke drawvline, l4, 0, 240, COLOR_RED
inc l5
.if l5 > 239
mov l5, -6
.endif
invoke drawhline, 0, l5, 320, COLOR_BLUE
add l5, 3
invoke drawhline, 0, l5, 320, COLOR_BLUE
add l5, 3
invoke drawhline, 0, l5, 320, COLOR_BLUE
sub l5, 6
invoke move_objects
invoke draw_objects
inc l6
.if l6 > 800
mov l6, 100
.endif
mov ax, l6
shr ax, 2
invoke print, 20, ax, txt("0123456789 11-22-33-44-55-66-77-88-99-00"), ds
invoke print, 1, 228, txt("!#$%&'()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX"), ds
invoke print, 1, 234, txt("YZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"), ds
inc fps_count
mov eax, tick_count
sub eax, start_count
.if eax >= 1000
mov eax, fps_count
mov fps, eax
mov eax, tick_count
mov start_count, eax
mov fps_count, 0
.endif
fld timer_count
fstp float_count
invoke ltoa, fps, addr buffer, ss
invoke print, 1, 1, addr buffer, ss
invoke ltoa, tick_count, addr buffer, ss
invoke print, 1, 7, addr buffer, ss
invoke ftoa, float_count, addr buffer, ss
invoke print, 1, 13, addr buffer, ss
movzx ecx, last_key
invoke ltoa, ecx, addr buffer, ss
invoke print, 1, 19, addr buffer, ss
invoke vsync
jmp @B
main endp
; ##########################################################################
drawhline proc uses bx x:word, y:word, l:word, color:byte
assume bx:sword
mov bx, x
add l, bx
.while bx < l
invoke setpixel, bx, y, color
inc bx
.endw
assume bx:nothing
ret
drawhline endp
; ##########################################################################
drawvline proc uses bx x:word, y:word, l:word, color:byte
assume bx:sword
mov bx, y
add l, bx
.while bx < l
invoke setpixel, x, bx, color
inc bx
.endw
assume bx:nothing
ret
drawvline endp
; ##########################################################################
IMAGE_FOOTER

36
makeit.bat Executable file
View File

@ -0,0 +1,36 @@
@echo off
del gameros.obj gameros.img
if exist gameros.obj goto fileuse
if exist gameros.img goto fileuse
cls
ml /nologo /omf gameros.asm
if errorlevel 1 goto errasm
link16 /nologo /tiny gameros.obj, gameros.img, nul.map, null, nul.def
if errorlevel 1 goto errlink
dir gameros.img
del gameros.obj
goto pend
:errlink
echo _
echo Link error
goto pend
:errasm
echo _
echo Assembly Error
goto pend
:fileuse
echo _
echo ERROR: File In Use!
goto pend
:pend
pause

189
modex.asm Executable file
View File

@ -0,0 +1,189 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
include modex.inc
; ##########################################################################
setpalcolor proc palnum:byte, red:byte, green:byte, blue:byte
mov dx, PAL_REG
mov al, palnum
cli
out dx, al
inc dx
mov al, red
out dx, al
mov al, green
out dx, al
mov al, blue
out dx, al
sti
ret
setpalcolor endp
; ##########################################################################
drawline proc uses bx si x:word, y:word, w:word, graphic:word
mov bx, 0
mov si, graphic
.while bx < w
lodsb
invoke setpixel, x, y, al
inc x
inc bx
.endw
ret
drawline endp
; ##########################################################################
drawgraphic proc uses bx x:word, y:word, w:word, h:word, graphic:word
mov bx, 0
.while bx < h
invoke drawline, x, y, w, graphic
inc y
mov ax, w
add graphic, ax
inc bx
.endw
ret
drawgraphic endp
; ##########################################################################
vsync proc
mov dx, CRTC_INDEX
mov ax, active_page
mov al, 0Ch
out dx, ax
mov ax, 0Dh
out dx, ax
xor active_page, VIDEO_BUFFER_SIZE
mov dx, STATUS_REG
.repeat
in al, dx
or al, 11110110b
inc al
pause
.until zero?
ret
vsync endp
; ##########################################################################
setmodex proc
pusha
mov ax, 13h
int 10h
mov dx, SC_INDEX
mov ax, 0604h
out dx, ax
mov ax, 100h
out dx, ax
mov dx, MISC_OUTPUT
mov al, 0E7h
out dx, al
mov dx, SC_INDEX
mov ax, 300h
out dx, ax
mov dx, CRTC_INDEX
mov al, 11h
out dx, al
inc dx
in al, dx
and al, 7Fh
out dx, al
dec dx
mov si, offset CRTParms
mov cx, sizeof CRTParms / 2
rep outsw
invoke setwritemask, MASK_ALL
les di, farptr(SCREEN_SEG, 0)
xor eax, eax
mov cx, 4000h
rep stosd
popa
ret
setmodex endp
; ##########################################################################
setwritemask proc maskbits:byte
mov dx, SC_INDEX
mov al, 2
mov ah, maskbits
out dx, ax
ret
setwritemask endp
; ##########################################################################
setvideomemory proc uses di es color:byte
invoke setwritemask, MASK_ALL
les di, farptr(SCREEN_SEG, 0)
add di, active_page
mov al, color
mov ah, al
push ax
push ax
pop eax
mov cx, VIDEO_BUFFER_SIZE / 4
rep stosd
ret
setvideomemory endp
; ##########################################################################
setpixel proc uses di x:word, y:word, color:byte
.if x < 320 && y < 240 && color != COLOR_CLEAR
mov cx, x
and cx, 3
mov al, 1
shl al, cl
invoke setwritemask, al
mov ax, y
mov cx, ax
shl ax, 6
shl cx, 4
add ax, cx
mov di, x
shr di, 2
add di, ax
add di, active_page
mov ax, SCREEN_SEG
mov fs, ax
mov al, color
mov fs:[di], al
.endif
ret
setpixel endp
; ##########################################################################

43
modex.inc Executable file
View File

@ -0,0 +1,43 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
setmodex proto
setvideomemory proto :byte
setwritemask proto :byte
setpixel proto :word, :word, :byte
drawgraphic proto :word, :word, :word, :word, :word
drawline proto :word, :word, :word, :word
vsync proto
setpalcolor proto :byte, :byte, :byte, :byte
SC_INDEX equ 03C4h
CRTC_INDEX equ 03D4h
MISC_OUTPUT equ 03C2h
STATUS_REG equ 03DAh
PAL_REG equ 03C8h
SCREEN_SEG equ 0A000h
VIDEO_BUFFER_SIZE equ 4B00h
COLOR_RED equ 40
COLOR_GREEN equ 48
COLOR_BLUE equ 32
COLOR_PINK equ 36
COLOR_YELLOW equ 44
COLOR_TEAL equ 52
COLOR_WHITE equ 31
COLOR_BLACK equ 00
COLOR_LIGHT_GRAY equ 28
COLOR_DARK_GRAY equ 24
COLOR_ORANGE equ 42
COLOR_BROWN equ 06
COLOR_PURPLE equ 05
COLOR_CLEAR equ 99h
MASK_ALL equ 1111b
MASK_ONE equ 1000b
MASK_TWO equ 0100b
MASK_THREE equ 0010b
MASK_FOUR equ 0001b
CRTParms dw 00d06h, 03e07h, 04109h, 0ea10h, 0ac11h, 0df12h, 00014h, 0e715h, 00616h, 0e317h
active_page dw VIDEO_BUFFER_SIZE

100
object.asm Executable file
View File

@ -0,0 +1,100 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
include object.inc
; ##########################################################################
move_objects proc
mov di, offset balls
assume di:ptr Tball
mov bx, OBJECT_COUNT
.while bx > 0
mov al, [di].d
test al, 10b
.if !zero?
inc [di].x
.else
dec [di].x
.endif
test al, 01b
.if !zero?
inc [di].y
.else
dec [di].y
.endif
assume ax:sword
mov ax, [di].x
.if ax <= 0 || ax > 312
xor [di].d, 10b
.endif
mov ax, [di].y
.if ax <= 0 || ax > 232
xor [di].d, 01b
.endif
assume ax:nothing
add di, sizeof Tball
dec bx
.endw
assume di:nothing
ret
move_objects endp
; ##########################################################################
draw_objects proc
mov di, offset balls
assume di:ptr Tball
mov bx, OBJECT_COUNT
.while bx > 0
invoke drawgraphic, [di].x, [di].y, 7, 7, addr graphic_ball
add di, sizeof Tball
dec bx
.endw
assume di:nothing
ret
draw_objects endp
; ##########################################################################
init_objects proc uses di bx
mov di, offset balls
assume di:ptr Tball
mov bx, OBJECT_COUNT
.while bx > 0
invoke getrand, 15, 298
mov [di].x, ax
invoke getrand, 15, 218
mov [di].y, ax
invoke getrand, 0, 4
mov [di].d, al
add di, sizeof Tball
dec bx
.endw
assume di:nothing
ret
init_objects endp
; ##########################################################################

15
object.inc Executable file
View File

@ -0,0 +1,15 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
OBJECT_COUNT equ 25
init_objects proto
move_objects proto
draw_objects proto
Tball struct
x dw ?
y dw ?
d db ?
Tball ends
balls Tball OBJECT_COUNT dup(<>)

46
rand.asm Executable file
View File

@ -0,0 +1,46 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
include rand.inc
; ##########################################################################
getrand proc minimum:word, maximum:word
invoke rand
xor edx, edx
movzx ecx, maximum
sub cx, minimum
div ecx
mov ax, dx
add ax, minimum
ret
getrand endp
; ##########################################################################
rand proc
mov eax, rand_z
mov ecx, eax
shr ecx, 16
and eax, 0000FFFFh
mov edx, 36969
mul edx
add eax, ecx
mov rand_z, eax
mov eax, rand_w
mov ecx, eax
shr ecx, 16
and eax, 0000FFFFh
mov edx, 18000
mul edx
add eax, ecx
mov rand_w, eax
mov eax, rand_z
shr eax, 16
add eax, rand_w
ret
rand endp
; ##########################################################################

7
rand.inc Executable file
View File

@ -0,0 +1,7 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
rand_z dd 362436069
rand_w dd 521288629
rand proto
getrand proto :word, :word

40
timer.asm Executable file
View File

@ -0,0 +1,40 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
include timer.inc
; ##########################################################################
init_timer proc
mov ax, 0
mov fs, ax
cli
mov word ptr fs:[IVT_IRQ0], offset timer_handler
mov word ptr fs:[IVT_IRQ0+2], BIOS_SEG
mov ax, TIMER_DIVIDER
out PIT_PORT, al
mov al, ah
out PIT_PORT, al
sti
ret
init_timer endp
; ##########################################################################
timer_handler proc uses ax
local fpu_save[94]:byte
fsave fpu_save
fld timer_resolution
fld timer_count
faddp
fist tick_count
fstp timer_count
frstor fpu_save
eoi
iret
timer_handler endp
; ##########################################################################

13
timer.inc Executable file
View File

@ -0,0 +1,13 @@
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
init_timer proto
timer_handler proto
IVT_IRQ0 equ 32
TIMER_DIVIDER equ 1085
TIMER_RESOLUTION equ 0.90933344880424746720602758172
PIT_PORT equ 64
timer_resolution dt TIMER_RESOLUTION
timer_count dt 0
tick_count dd 0