mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-04-18 05:38:36 +01:00
Merge branch 'master' into sound-dev
This commit is contained in:
commit
16004d084b
33 changed files with 722 additions and 269 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -2,17 +2,17 @@
|
|||
*.bin
|
||||
*.ZXE
|
||||
*.MAP
|
||||
src/Boot/
|
||||
/src/Boot
|
||||
*.ELF
|
||||
*.elf
|
||||
*.sys
|
||||
*.SYS
|
||||
src/EFI/
|
||||
build/limine
|
||||
build/ovmf
|
||||
/src/EFI
|
||||
/build/limine
|
||||
/build/ovmf
|
||||
*.iso
|
||||
*.raw
|
||||
*.hdd
|
||||
*.o
|
||||
*.d
|
||||
zealbooter/limine.h
|
||||
/zealbooter/limine.h
|
||||
|
|
|
@ -2,15 +2,13 @@
|
|||
|
||||
[](https://discord.gg/rK6U3xdr7D) [](https://github.com/Zeal-Operating-System/ZealOS/wiki)
|
||||
|
||||
The Zeal Operating System is a modernized, professional fork of the 64-bit Temple Operating System. Guiding principles of development include transparency, full user control, and adherence to public-domain/open-source implementations.
|
||||
The Zeal Operating System is a modernized fork of the 64-bit Temple Operating System. Guiding principles of development include transparency, full user control, and adherence to public-domain/open-source implementations.
|
||||
|
||||

|
||||
|
||||
ZealOS strives to be simple, documented, and require as little of a knowledge gap as possible. One person should be able to comprehend the entire system in at least a semi-detailed way within a few days of study.
|
||||
Simplify, don't complicate; make accessible, don't obfuscate.
|
||||
|
||||
> The CIA encourages code obfuscation. They make it more complicated than necessary.\
|
||||
—Terry A. Davis
|
||||
**Simplify, don't complicate; make accessible, don't obfuscate.**
|
||||
|
||||
Features in development include:
|
||||
- [32-bit color VBE graphics](https://github.com/TempleProgramming/HolyGL)
|
||||
|
|
|
@ -64,7 +64,7 @@ umount_tempdisk
|
|||
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..."
|
||||
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit
|
||||
|
||||
LIMINE_BINARY_BRANCH="v4.x-branch-binary"
|
||||
LIMINE_BINARY_BRANCH="v5.x-branch-binary"
|
||||
|
||||
if [ -d "limine" ]
|
||||
then
|
||||
|
@ -74,8 +74,7 @@ then
|
|||
git remote set-head origin $LIMINE_BINARY_BRANCH
|
||||
git switch $LIMINE_BINARY_BRANCH
|
||||
git pull
|
||||
rm limine-deploy
|
||||
rm limine-version
|
||||
rm limine
|
||||
|
||||
cd ..
|
||||
fi
|
||||
|
@ -84,13 +83,13 @@ if [ ! -d "limine" ]; then
|
|||
fi
|
||||
make -C limine
|
||||
|
||||
touch limine/Limine-HDD.HH
|
||||
echo "/*\$WW,1\$" > limine/Limine-HDD.HH
|
||||
cat limine/LICENSE.md >> limine/Limine-HDD.HH
|
||||
echo "*/\$WW,0\$" >> limine/Limine-HDD.HH
|
||||
cat limine/limine-hdd.h >> limine/Limine-HDD.HH
|
||||
sed -i 's/const uint8_t/U8/g' limine/Limine-HDD.HH
|
||||
sed -i "s/\[\]/\[$(grep -o "0x" ./limine/limine-hdd.h | wc -l)\]/g" limine/Limine-HDD.HH
|
||||
touch limine/Limine-BIOS-HDD.HH
|
||||
echo "/*\$WW,1\$" > limine/Limine-BIOS-HDD.HH
|
||||
cat limine/LICENSE >> limine/Limine-BIOS-HDD.HH
|
||||
echo "*/\$WW,0\$" >> limine/Limine-BIOS-HDD.HH
|
||||
cat limine/limine-bios-hdd.h >> limine/Limine-BIOS-HDD.HH
|
||||
sed -i 's/const uint8_t/U8/g' limine/Limine-BIOS-HDD.HH
|
||||
sed -i "s/\[\]/\[$(grep -o "0x" ./limine/limine-bios-hdd.h | wc -l)\]/g" limine/Limine-BIOS-HDD.HH
|
||||
|
||||
mount_tempdisk
|
||||
echo "Extracting MyDistro ISO from vdisk ..."
|
||||
|
@ -101,11 +100,11 @@ sudo cp -rf $TMPMOUNT/* $TMPISODIR
|
|||
sudo rm $TMPISODIR/Boot/OldMBR.BIN 2> /dev/null
|
||||
sudo rm $TMPISODIR/Boot/BootMHD2.BIN 2> /dev/null
|
||||
sudo mkdir -p $TMPISODIR/EFI/BOOT
|
||||
sudo cp limine/Limine-HDD.HH $TMPISODIR/Boot/Limine-HDD.HH
|
||||
sudo cp limine/Limine-BIOS-HDD.HH $TMPISODIR/Boot/Limine-BIOS-HDD.HH
|
||||
sudo cp limine/BOOTX64.EFI $TMPISODIR/EFI/BOOT/BOOTX64.EFI
|
||||
sudo cp limine/limine-cd-efi.bin $TMPISODIR/Boot/Limine-CD-EFI.BIN
|
||||
sudo cp limine/limine-cd.bin $TMPISODIR/Boot/Limine-CD.BIN
|
||||
sudo cp limine/limine.sys $TMPISODIR/Boot/Limine.SYS
|
||||
sudo cp limine/limine-uefi-cd.bin $TMPISODIR/Boot/Limine-UEFI-CD.BIN
|
||||
sudo cp limine/limine-bios-cd.bin $TMPISODIR/Boot/Limine-BIOS-CD.BIN
|
||||
sudo cp limine/limine-bios.sys $TMPISODIR/Boot/Limine-BIOS.SYS
|
||||
sudo cp ../zealbooter/zealbooter.elf $TMPISODIR/Boot/ZealBooter.ELF
|
||||
sudo cp ../zealbooter/Limine.CFG $TMPISODIR/Boot/Limine.CFG
|
||||
echo "Copying DVDKernel.ZXE over ISO Boot/Kernel.ZXE ..."
|
||||
|
@ -113,13 +112,13 @@ sudo mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE
|
|||
sudo rm $TMPISODIR/Tmp/DVDKernel.ZXE 2> /dev/null
|
||||
umount_tempdisk
|
||||
|
||||
xorriso -joliet "on" -rockridge "on" -as mkisofs -b Boot/Limine-CD.BIN \
|
||||
xorriso -joliet "on" -rockridge "on" -as mkisofs -b Boot/Limine-BIOS-CD.BIN \
|
||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||
--efi-boot Boot/Limine-CD-EFI.BIN \
|
||||
--efi-boot Boot/Limine-UEFI-CD.BIN \
|
||||
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
||||
$TMPISODIR -o ZealOS-limine.iso
|
||||
|
||||
./limine/limine-deploy ZealOS-limine.iso
|
||||
./limine/limine bios-install ZealOS-limine.iso
|
||||
|
||||
if [ "$TESTING" = true ]; then
|
||||
if [ ! -d "ovmf" ]; then
|
||||
|
|
|
@ -578,9 +578,39 @@ U0 RotateMan(F64 d)
|
|||
}
|
||||
}
|
||||
|
||||
CTask *mouse_task = NULL;
|
||||
CTask *game_task = Fs;
|
||||
F64 mouse_scale = 32.0;
|
||||
|
||||
U0 MouseHandler()
|
||||
{
|
||||
Bool button;
|
||||
I64 x;
|
||||
|
||||
while (MouseRawQueueFind(game_task))
|
||||
{
|
||||
button = mouse_hard.raw_bttns[0];
|
||||
x = mouse_hard.raw_data.x;
|
||||
|
||||
if (button || x != 0)
|
||||
MouseRawReset; // Mark mouse data as consumed
|
||||
if (button)
|
||||
MessagePostWait(game_task, MESSAGE_KEY_DOWN_UP, CH_SPACE, 0);
|
||||
if (x != 0)
|
||||
man_é += (x / mouse_scale) / MICRO_STEPS;
|
||||
|
||||
Sleep(10);
|
||||
}
|
||||
mouse_task = NULL;
|
||||
}
|
||||
|
||||
U0 CastleFrankenstein()
|
||||
{
|
||||
I64 sc;
|
||||
Bool is_raw = TRUE;
|
||||
|
||||
MouseRaw(is_raw);
|
||||
mouse_task = Spawn(&MouseHandler, NULL, "MouseHandler");
|
||||
|
||||
MenuPush(
|
||||
"File {"
|
||||
|
@ -594,6 +624,9 @@ U0 CastleFrankenstein()
|
|||
" Left(,,SC_CURSOR_LEFT);"
|
||||
" Right(,,SC_CURSOR_RIGHT);"
|
||||
" Fire(,CH_SPACE);"
|
||||
" MouseMode(,'m');"
|
||||
" MouseScaleUp(,'+');"
|
||||
" MouseScaleDown(,'-');"
|
||||
"}"
|
||||
);
|
||||
|
||||
|
@ -618,6 +651,30 @@ U0 CastleFrankenstein()
|
|||
Fire;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
if (is_raw)
|
||||
{
|
||||
is_raw = FALSE;
|
||||
MouseRaw(is_raw);
|
||||
Kill(mouse_task);
|
||||
}
|
||||
else
|
||||
{
|
||||
is_raw = TRUE;
|
||||
MouseRaw(is_raw);
|
||||
mouse_task = Spawn(&MouseHandler, NULL, "MouseHandler");
|
||||
}
|
||||
break;
|
||||
|
||||
case '+':
|
||||
case '=':
|
||||
mouse_scale *= 0.9;
|
||||
break;
|
||||
|
||||
case '-':
|
||||
mouse_scale *= 1.1;
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
Init;
|
||||
break;
|
||||
|
@ -664,6 +721,7 @@ fs_done:
|
|||
}
|
||||
|
||||
CastleFrankenstein;
|
||||
MouseRaw(FALSE);
|
||||
&
|
||||
|
||||
|
||||
|
|
59
src/Demo/Graphics/Usage.ZC
Executable file
59
src/Demo/Graphics/Usage.ZC
Executable file
|
@ -0,0 +1,59 @@
|
|||
|
||||
U0 UsageDrawIt(CTask *, CDC *dc)
|
||||
{
|
||||
I64 i, b;
|
||||
CCPU *c;
|
||||
F64 f;
|
||||
|
||||
dc->thick = 1;
|
||||
|
||||
dc->color = GREEN;
|
||||
GrPrint(dc, 8, 8, "CPU");
|
||||
|
||||
dc->color = DKGRAY;
|
||||
GrRect(dc, 8, 16, 100, 8 + 16 * (mp_count - 1));
|
||||
|
||||
dc->color = GREEN;
|
||||
for (i = 0; i < mp_count; i++)
|
||||
{
|
||||
c = &cpu_structs[i];
|
||||
|
||||
f = 100.0 * (1.0 - c->idle_factor);
|
||||
if (f < 1.0)
|
||||
f = 1.0;
|
||||
|
||||
GrRect(dc, 8, 16 + (16*i), ToI64(f), 8);
|
||||
}
|
||||
|
||||
b = sys_code_bp->alloced_u8s - sys_code_bp->used_u8s;
|
||||
if (sys_data_bp)
|
||||
b += sys_data_bp->alloced_u8s - sys_data_bp->used_u8s;
|
||||
|
||||
f = 1.0 * b / MemBIOSTotal;
|
||||
|
||||
|
||||
dc->color = RED;
|
||||
GrPrint(dc, 116, 8, "RAM");
|
||||
|
||||
dc->color = DKGRAY;
|
||||
GrRect(dc, 116, 16, 100, 8);
|
||||
dc->color = RED;
|
||||
GrRect(dc, 116, 16, ToI64(100.0 * (1.0 - f)), 8);
|
||||
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
U0 Usage()
|
||||
{
|
||||
SettingsPush;
|
||||
DocClear;
|
||||
DocCursor;
|
||||
Fs->draw_it = &UsageDrawIt;
|
||||
StrCopy(Fs->task_title, "Usage");
|
||||
|
||||
while (CharGet(,FALSE) != CH_SHIFT_ESC) {};
|
||||
|
||||
SettingsPop;
|
||||
};
|
||||
|
||||
Usage;
|
|
@ -1,94 +1,136 @@
|
|||
#define VGAP_IDX 0x3C4
|
||||
#define VGAP_DATA 0x3C5
|
||||
#define VGAR_MAP_MASK 0x02
|
||||
|
||||
U8 rev[256], //The VGA bits are backward
|
||||
image[640 * 480 / 8]; //We need read-modify write.
|
||||
//0xA0000 alias memory can't be read.
|
||||
|
||||
U32 image[GR_HEIGHT * GR_WIDTH];
|
||||
|
||||
U0 MGInit()
|
||||
{
|
||||
I64 i, j;
|
||||
MemSet(image, BLACK32, sizeof(image));
|
||||
}
|
||||
|
||||
MemSet(image, 0, sizeof(image));
|
||||
MemSet(rev, 0, sizeof(rev));
|
||||
for (i = 0; i < 256; i++)
|
||||
for (j = 0; j < 8; j++)
|
||||
if (Bt(&i, j))
|
||||
Bts(&rev[i], 7 - j);
|
||||
}
|
||||
|
||||
U0 MGUpdate()
|
||||
{//Copy image to VGA memory
|
||||
{//Copy image to framebuffer memory
|
||||
//For better performance we could only write what's changed.
|
||||
//0xA0000 alias is slower than normal RAM.
|
||||
OutU8(VGAP_IDX, VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA, 0xF);//All color planes at once -- Black and White
|
||||
MemCopy(text.vga_alias, image,sizeof(image)); //Alias of 0xA0000
|
||||
MemCopy(text.fb_alias, image, sizeof(image));
|
||||
}
|
||||
|
||||
|
||||
U0 MGPlot(I64 x,I64 y)
|
||||
{
|
||||
if (0 <= x < 640 && 0 <= y < 480)
|
||||
Bts(image,y * 640 + x ^ 7);
|
||||
if (0 <= x < GR_WIDTH && 0 <= y < GR_HEIGHT)
|
||||
image[x + y * GR_WIDTH] = WHITE32;
|
||||
}
|
||||
|
||||
U0 MGHLine(I64 x1, I64 x2, I64 y)
|
||||
{//Warning! No clipping
|
||||
//For performance, we do as many whole-bytes as possible.
|
||||
U8 *ptr;
|
||||
I64 i, w, leading, trailing, whole_bytes;
|
||||
|
||||
U0 MGHLine(I64 x1, I64 x2, I64 y)
|
||||
{//No clipping
|
||||
I64 x;
|
||||
|
||||
if (y >= GR_HEIGHT)
|
||||
return;
|
||||
if (x2 < x1)
|
||||
SwapI64(&x1, &x2);
|
||||
ptr = image + y * 640 / 8 + x1 >> 3;
|
||||
w = x2 - x1 + 1;
|
||||
leading = 8 - x1 & 7;
|
||||
trailing = (x2 + 1) & 7;
|
||||
if (leading + trailing > w)
|
||||
*ptr |= rev[(0xFF00 >> leading & (0x00FF << trailing) >> 8)];
|
||||
else
|
||||
if (x1 < 0)
|
||||
x1 = 0;
|
||||
if (x2 < x1)
|
||||
SwapI64(&x1, &x2);
|
||||
x = x1;
|
||||
|
||||
while (x <= x2 && x < GR_WIDTH)
|
||||
{
|
||||
whole_bytes = (w - leading - trailing) >> 3;
|
||||
if (leading)
|
||||
*ptr++ |= rev[(0xFF00 >> leading) & 0xFF];
|
||||
for (i = 0; i < whole_bytes; i++)
|
||||
*ptr++ = 0xFF;
|
||||
if (trailing)
|
||||
*ptr++ |= rev[(0x00FF << trailing) >> 8];
|
||||
image[x + y * GR_WIDTH] = WHITE32;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
U0 MGLine(I64 x1,I64 y1,I64 x2,I64 y2)
|
||||
{//Warning! No clipping
|
||||
I64 dx=x2-x1,dy=y2-y1;
|
||||
{//No clipping
|
||||
I64 x_start, x_end, y_start, y_end, x, y, dx, dy, c;
|
||||
|
||||
x1 <<= 32; x2 <<= 32;
|
||||
y1 <<= 32; y2 <<= 32;
|
||||
if (AbsI64(dx) > AbsI64(dy))
|
||||
c = 0;
|
||||
x_start = MinI64(x1, x2);
|
||||
|
||||
if (x_start == x1)
|
||||
{
|
||||
dy = dy << 32 / AbsI64(dx);
|
||||
dx = SignI64(dx) << 32;
|
||||
while (x1 != x2)
|
||||
y_start = y1;
|
||||
x_end = x2;
|
||||
y_end = y2;
|
||||
}
|
||||
else // x2
|
||||
{
|
||||
y_start = y2;
|
||||
x_end = x1;
|
||||
y_end = y1;
|
||||
}
|
||||
|
||||
x = x_start;
|
||||
y = y_start;
|
||||
dx = x_end - x_start;
|
||||
|
||||
if (y_end < y_start)
|
||||
{
|
||||
dy = y_start - y_end;
|
||||
|
||||
if (dx >= dy)
|
||||
{
|
||||
MGPlot(x1.i32[1], y1.i32[1]);
|
||||
x1 += dx; y1 += dy;
|
||||
while (x <= x_end)
|
||||
{
|
||||
MGPlot(x, y);
|
||||
c += dy;
|
||||
if (c >= dx)
|
||||
{
|
||||
c -= dx;
|
||||
y--;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (y > y_end)
|
||||
{
|
||||
MGPlot(x, y);
|
||||
c += dx;
|
||||
if (c >= dy)
|
||||
{
|
||||
c -= dy;
|
||||
x++;
|
||||
}
|
||||
y--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dx = dx << 32 / AbsI64(dy);
|
||||
dy = SignI64(dy) << 32;
|
||||
while (y1 != y2)
|
||||
dy = y_end - y_start;
|
||||
|
||||
if (dx >= dy)
|
||||
{
|
||||
MGPlot(x1.i32[1], y1.i32[1]);
|
||||
x1 += dx;
|
||||
y1 += dy;
|
||||
while (x <= x_end)
|
||||
{
|
||||
MGPlot(x, y);
|
||||
c += dy;
|
||||
if (c >= dx)
|
||||
{
|
||||
c -= dx;
|
||||
y++;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (y <= y_end)
|
||||
{
|
||||
MGPlot(x, y);
|
||||
c += dx;
|
||||
if (c >= dy)
|
||||
{
|
||||
c -= dy;
|
||||
x++;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
MGPlot(x1.i32[1], y1.i32[1]);
|
||||
}
|
||||
|
||||
|
||||
U0 MGCircle(I64 x, I64 y, F64 r)
|
||||
{
|
||||
F64 s, c, x1, y1, x2, y2;
|
||||
|
@ -118,31 +160,34 @@ U0 MGCircle(I64 x, I64 y, F64 r)
|
|||
MGPlot(x+x1,y+y1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
U0 MiniGrLibDemo()
|
||||
{
|
||||
I64 i;
|
||||
|
||||
MGInit;
|
||||
|
||||
for (i = 0; i < 100; i++)
|
||||
MGHLine(200 + i, 400 + i, 300 + i);
|
||||
MGHLine(200 + i, 400 + i, 400 + i);
|
||||
|
||||
for (i = 0; i < 500; i += 10)
|
||||
MGLine(i, 0, 0, 480 - i);
|
||||
for (i = 0; i < GR_HEIGHT + 20; i += 10)
|
||||
MGLine(i, 0, 0, GR_HEIGHT - i);
|
||||
|
||||
for (i = 0; i < 300; i += 4)
|
||||
MGCircle(200, 100 + i, i);
|
||||
MGCircle(400, 200 + i, i);
|
||||
|
||||
MGUpdate;
|
||||
Busy(1500000);
|
||||
|
||||
|
||||
/*
|
||||
We are returning graphics to normal operations under ZealOS.
|
||||
It is not normal to by-pass the ZealOS graphcis routines.
|
||||
The ZealOS graphics don't know VGA has changed.
|
||||
This bit tells ZealOS to update whole screen.
|
||||
The ZealOS graphics don't know the framebuffer has changed.
|
||||
This function tells ZealOS to update whole screen.
|
||||
*/
|
||||
//<CTRL-ALT-v> will flush screen VGA cache.
|
||||
//<CTRL-ALT-v> will flush screen VGA cache and un-set framebuffer-busy bit.
|
||||
LFBFlush;
|
||||
}
|
||||
|
||||
MiniGrLibDemo;
|
||||
MiniGrLibDemo;
|
||||
|
|
|
@ -1,4 +1,31 @@
|
|||
$WW,1$$FG,5$$TX+CX,"ChangeLog"$$FG$
|
||||
$IV,1$----03/22/23 22:27:05----$IV,0$
|
||||
* Raised version number to 2.03.
|
||||
* Created $LK+PU,"CMouseRawQueue",A="MN:CMouseRawQueue"$ to track tasks in raw-mouse mode, placed in $LK+PU,"CMouseHardStateGlobals mouse_hard.raw_queue",A="FF:::/Kernel/KernelA.HH,*raw_queue"$.
|
||||
* Created $LK+PU,"MouseRawQueueFind",A="MN:MouseRawQueueFind"$ to check whether a given task is in raw-mouse mode, externed in $LK+PU,"KernelC.HH",A="FF:::/Kernel/KernelC.HH,MouseRawQueueFind("$.
|
||||
* Created $LK+PU,"MouseRawWatcher",A="MN:MouseRawWatcher"$ and $LK+PU,"MouseRawWatcherInner",A="MN:MouseRawWatcherInner"$ to watch for killed tasks and remove them from raw_queue, spawned in $LK+PU,"KMain",A="FF:::/Kernel/KMain.ZC,&MouseRawWatcher:2"$.
|
||||
* Added task parameter to $LK+PU,"MouseRaw",A="MN:MouseRaw"$, changed behaviour from a global toggle to a task-based queue of $LK+PU,"CMouseRawQueue",A="MN:CMouseRawQueue"$ entries.
|
||||
* Changed $LK+PU,"MouseHardHandler",A="MN:MouseHardHandler"$ to use $LK+PU,"MouseRawQueueFind",A="MN:MouseRawQueueFind"$ with $LK+PU,"sys_focus_task",A="MN:sys_focus_task"$ to determine if currently in raw-mode or not, added $LK+PU,"clearing mouse.show, mouse.lb, mouse.rb",A="FF:::/Kernel/SerialDev/Mouse.ZC,mouse.lb = FALSE"$ to fix bug where clicking to refocus a mouse-raw application would register a repeated click on unfocus.
|
||||
* Added raw_queue init to $LK+PU,"KbdMouseInit",A="FF:::/Kernel/SerialDev/Mouse.ZC,QueueInit(mouse_hard.raw_queue);"$.
|
||||
* Changed $LK+PU,"CastleFrankenstein MouseHandler",A="FF:::/Demo/Games/CastleFrankenstein.ZC,MouseHandler"$ while loop condition to use $LK+PU,"MouseRawQueueFind",A="MN:MouseRawQueueFind"$ with game_task as parameter, added raw-mouse keybind descriptions to game's $LK+PU,"MenuPush",A="FF:::/Demo/Games/CastleFrankenstein.ZC,MouseMode"$.
|
||||
|
||||
$IV,1$----03/17/23 17:44:24----$IV,0$
|
||||
* Rewrote $LK+PU,"MiniGrLib",A="FI:::/Demo/Lectures/MiniGrLib.ZC"$, replaced old VGA-specific code to work with 32-bit framebuffer.
|
||||
|
||||
$IV,1$----03/14/23 03:23:46----$IV,0$
|
||||
* Created %o Bool $LK+PU,"StrPrint",A="FF:::/Kernel/StrPrint.ZC,'o'"$ format code, updated $LK+PU,"Print.DD",A="FI:::/Doc/Print.DD"$ with new %o code and previously undocumented format codes.
|
||||
|
||||
$IV,1$----03/13/23 18:06:09----$IV,0$
|
||||
* Raised version number to 2.02.
|
||||
|
||||
$IV,1$----02/25/23 16:35:04----$IV,0$
|
||||
* Created $LK+PU,"MouseRaw",A="MN:MouseRaw"$ and $LK+PU,"MouseRawReset",A="MN:MouseRawReset"$, externs added to $LK+PU,"KernelC.HH",A="FF:::/Kernel/KernelC.HH,MouseRaw("$, functions used in $MA-X+PU,"Mouse.ZC",LM="Find(\"MouseRawReset;\", \"::/Kernel/SerialDev/Mouse.ZC\");View;"$.
|
||||
* Added members to $LK+PU,"CMouseHardStateGlobals",A="MN:CMouseHardStateGlobals"$ and used in $MA-X+PU,"Mouse.ZC",LM="Find(\"raw_data\", \"::/Kernel/SerialDev/Mouse.ZC\");Find(\"raw_mode\", \"::/Kernel/SerialDev/Mouse.ZC\");Find(\"raw_bttns\", \"::/Kernel/SerialDev/Mouse.ZC\");View;"$:
|
||||
- CD3I64 raw_data
|
||||
- Bool raw_bttns[5]
|
||||
- Bool raw_mode
|
||||
* $MA-X+PU,"Update CastleFrankenstein to use new MouseRaw functionality.",LM="Find(\"mouse_task\", \"::/Demo/Games/CastleFrankenstein.ZC\");Find(\"MouseHandler\", \"::/Demo/Games/CastleFrankenstein.ZC\");Find(\"MouseRaw\", \"::/Demo/Games/CastleFrankenstein.ZC\");View;"$
|
||||
|
||||
$IV,1$----12/21/22 03:38:35----$IV,0$
|
||||
* Raised version number to 2.01.
|
||||
* Created $LK+PU,"FreeAll",A="MN:FreeAll"$ method to /Kernel/Memory/MAllocFree.ZC and extern to $LK+PU,"/Kernel/KernelC.HH",A="FF:::/Kernel/KernelC.HH,FreeAll"$.
|
||||
|
|
|
@ -21,6 +21,16 @@ For $FG,2$"%c"$FG$ or $FG,2$"%C"$FG$, the <aux_format_num> repeats the char that
|
|||
|
||||
$ID,2$$FG,2$"%n"$FG$ floating point in engineering notation, exponents being multiples of three. If it has a <aux_format> code, it will display scientific units letters.
|
||||
|
||||
$FG,2$"%e"$FG$ floating point in engineering notation, exponents not restricted to multiples of three.
|
||||
|
||||
$FG,2$"%d"$FG$ Whole number.
|
||||
|
||||
$FG,2$"%u"$FG$ Unsigned whole number.
|
||||
|
||||
$FG,2$"%f"$FG$ Floating point number.
|
||||
|
||||
$FG,2$"%g"$FG$ Right-aligned rounded-up integer of floating point number.
|
||||
|
||||
$FG,2$"%S"$FG$ $LK,"Define",A="MN:Define"$() entry.
|
||||
|
||||
$FG,2$"%C"$FG$ $LK,"ToUpper",A="MN:ToUpper"$() character.
|
||||
|
@ -52,6 +62,12 @@ $FG,2$"%Z"$FG$ $LK,"DefineListLoad",A="MN:DefineListLoad"$() subentry. Pass sub_
|
|||
$FG,2$"%Q"$FG$ convert "\" to "\\" and quote to backslash quote. (For use in creating strs in strs.)
|
||||
|
||||
$FG,2$"%q"$FG$ rev a $FG,2$"%Q"$FG$.
|
||||
|
||||
$FG,2$"%x"$FG$ Hex number.
|
||||
|
||||
$FG,2$"%b"$FG$ Binary number$FG$.
|
||||
|
||||
$FG,2$"%o"$FG$ Bool$FG$.
|
||||
$ID,-2$
|
||||
|
||||
$FG,5$$TX+CX,"Print Family"$$FG$
|
||||
|
|
9
src/Home/Net/Drivers/PCNet.ZC
Normal file → Executable file
9
src/Home/Net/Drivers/PCNet.ZC
Normal file → Executable file
|
@ -67,8 +67,8 @@
|
|||
#define PCNET_CTRL_IDON 8
|
||||
#define PCNET_CTRL_RINT 10
|
||||
|
||||
#define PCNET_RX_BUFF_COUNT 32 // Linux & Shrine Driver use 32 and 8 for
|
||||
#define PCNET_TX_BUFF_COUNT 8 // these, we could allow more if wanted.
|
||||
#define PCNET_RX_BUFF_COUNT 64
|
||||
#define PCNET_TX_BUFF_COUNT 64
|
||||
|
||||
#define PCNET_DESCRIPTORf_ENP 24
|
||||
#define PCNET_DESCRIPTORf_STP 25
|
||||
|
@ -411,8 +411,9 @@ U8 *PCNetInitBlockSetup()
|
|||
U32 p_setup;
|
||||
|
||||
u_setup->mode = 0;
|
||||
u_setup->rlen = 5 << 4;
|
||||
u_setup->tlen = 3 << 4;
|
||||
u_setup->rlen = ToI64(Log2(PCNET_RX_BUFF_COUNT)) << 4;
|
||||
u_setup->tlen = ToI64(Log2(PCNET_TX_BUFF_COUNT)) << 4;
|
||||
|
||||
MemCopy(u_setup->mac, pcnet.mac_address, 6);
|
||||
u_setup->reserved = 0;
|
||||
MemSet(u_setup->ladr, 0, 8);
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
#define PCIV_E1000 0x8086
|
||||
#define PCID_82545EM 0x100F
|
||||
|
||||
|
||||
#define PCIV_VIRTIO 0x1AF4
|
||||
//#define PCID_VIRTIO_NET 0x1000
|
||||
#define PCID_VIRTIO_NET 0x1000
|
||||
|
||||
U0 NetDriverInclude(U8 *driver)
|
||||
{
|
||||
|
@ -19,42 +18,63 @@ U0 NetDriverInclude(U8 *driver)
|
|||
Free(filename);
|
||||
}
|
||||
|
||||
class CNetDriver:CQueue
|
||||
{
|
||||
U16 vendor_id;
|
||||
U16 device_id;
|
||||
U8 *filename; // relative to Drivers/ folder, not absolute
|
||||
};
|
||||
|
||||
CQueue *net_drivers = CAlloc(sizeof(CQueue));
|
||||
QueueInit(net_drivers);
|
||||
|
||||
U0 NetDriverRegister(U16 vendor_id=NULL, U16 device_id=NULL, U8 *filename)
|
||||
{
|
||||
|
||||
CNetDriver *driver;
|
||||
|
||||
if (!vendor_id && !device_id)
|
||||
return;
|
||||
|
||||
driver = CAlloc(sizeof(CNetDriver));
|
||||
|
||||
driver->vendor_id = vendor_id;
|
||||
driver->device_id = device_id;
|
||||
driver->filename = StrNew(filename);
|
||||
|
||||
QueueInsertRev(driver, net_drivers);
|
||||
}
|
||||
|
||||
|
||||
U0 NetDriverInit()
|
||||
{
|
||||
CPCIDev *net_driver_pci = PCIDevFind(PCIC_NETWORK);
|
||||
Bool found = FALSE;
|
||||
Bool found = FALSE;
|
||||
CNetDriver *net_driver;
|
||||
CPCIDev *net_pci;
|
||||
|
||||
switch (net_driver_pci->vendor_id)
|
||||
// register NIC PCI details with driver (file)name
|
||||
NetDriverRegister(PCIV_VIRTIO, PCID_VIRTIO_NET, "VirtIONet");
|
||||
NetDriverRegister(PCIV_E1000, PCID_82545EM, "E1000");
|
||||
NetDriverRegister(PCIV_PCNET, PCID_PCNET, "PCNet");
|
||||
|
||||
// iterate registered drivers until match is found, if any found
|
||||
net_driver = net_drivers->next;
|
||||
|
||||
while (net_driver != net_drivers)
|
||||
{
|
||||
case PCIV_PCNET:
|
||||
switch (net_driver_pci->device_id)
|
||||
{
|
||||
case PCID_PCNET:
|
||||
NetDriverInclude("PCNet");
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case PCIV_E1000:
|
||||
switch (net_driver_pci->device_id)
|
||||
{
|
||||
case PCID_82545EM:
|
||||
NetDriverInclude("E1000");
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case PCIV_VIRTIO:
|
||||
NetDriverInclude("VirtIONet");
|
||||
net_pci = PCIDevFind(,, net_driver->vendor_id, net_driver->device_id);
|
||||
if (net_pci)
|
||||
{
|
||||
found = TRUE;
|
||||
NetDriverInclude(net_driver->filename);
|
||||
break;
|
||||
}
|
||||
net_driver = net_driver->next;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
ClassRep(net_driver_pci);
|
||||
ClassRep(net_pci);
|
||||
throw('NODRIVER');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
CTask *net_log_task = NULL;
|
||||
|
||||
U0 NetLogTask(I64)
|
||||
{
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
Refresh;
|
||||
}
|
||||
}
|
||||
|
||||
U0 NetLogSave()
|
||||
{
|
||||
StrCopy(net_log_task->put_doc->filename.name, "::/Home/Net/Log.DD");
|
||||
|
@ -31,14 +22,29 @@ U0 NetLogInit()
|
|||
|
||||
DocPrint(net_log_task->put_doc, "$$WW+H,1$$");
|
||||
|
||||
// net_log_task->put_doc->max_entries = I64_MAX;
|
||||
|
||||
Bts(&net_log_task->win_inhibit, WIf_SELF_FOCUS);
|
||||
}
|
||||
|
||||
U0 NetLogBottom()
|
||||
{//Move cursor, cur_entry, to bottom.
|
||||
Bool unlock;
|
||||
CDoc *doc = net_log_task->put_doc;
|
||||
|
||||
unlock = DocLock(doc);
|
||||
doc->cur_entry = doc;
|
||||
doc->cur_col = 0;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
U0 NetLog(U8 *format, ...)
|
||||
{ // Output text to NetLogTask as Log.
|
||||
U8 *buf = StrPrintJoin(NULL, format, argc, argv);
|
||||
|
||||
DocBottom(net_log_task->put_doc);
|
||||
NetLogBottom;
|
||||
|
||||
DocPrint(net_log_task->put_doc, "%s\n", buf);
|
||||
|
||||
Free(buf);
|
||||
|
@ -48,7 +54,8 @@ U0 NetWarn(U8 *format, ...)
|
|||
{ // Output text to NetLogTask as Warning.
|
||||
U8 *buf = StrPrintJoin(NULL, format, argc, argv);
|
||||
|
||||
DocBottom(net_log_task->put_doc);
|
||||
NetLogBottom;
|
||||
|
||||
DocPrint(net_log_task->put_doc, "$$BG,BROWN$$$$WHITE$$%s$$BG$$$$FG$$\n", buf);
|
||||
|
||||
Free(buf);
|
||||
|
@ -58,7 +65,8 @@ U0 NetErr(U8 *format, ...)
|
|||
{ // Output text to NetLogTask as Error.
|
||||
U8 *buf = StrPrintJoin(NULL, format, argc, argv);
|
||||
|
||||
DocBottom(net_log_task->put_doc);
|
||||
NetLogBottom;
|
||||
|
||||
DocPrint(net_log_task->put_doc, "$$BG,RED$$$$WHITE$$%s$$BG$$$$FG$$\n", buf);
|
||||
|
||||
Free(buf);
|
||||
|
@ -68,7 +76,8 @@ U0 NetDebug(U8 *format, ...)
|
|||
{ // Output text to NetLogTask as Debug.
|
||||
U8 *buf = StrPrintJoin(NULL, format, argc, argv);
|
||||
|
||||
DocBottom(net_log_task->put_doc);
|
||||
NetLogBottom;
|
||||
|
||||
DocPrint(net_log_task->put_doc, "$$BG,YELLOW$$$$DKGRAY$$%s$$BG$$$$FG$$\n", buf);
|
||||
|
||||
Free(buf);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
Cd(__DIR__);;
|
||||
#define PALETTES_PATH "~/PaletteEditor/Palettes/"
|
||||
#include "PaletteSelect"
|
||||
#include "PaletteGod"
|
||||
#include "PaletteEdit"
|
|
@ -38,13 +38,10 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c)
|
|||
|
||||
CSliderState *s = c->state;
|
||||
I64 size = (c->win_task->pix_width / 16),
|
||||
border = size / 16,
|
||||
size2 = (c->win_task->pix_height / 32),
|
||||
// slider_amount = 3,
|
||||
i, k, j,// l,
|
||||
i,
|
||||
pos, col,
|
||||
bias;
|
||||
CBGR24 tempColor;
|
||||
|
||||
///////////////////////
|
||||
// CURRENT SELECTION //
|
||||
|
@ -53,17 +50,8 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c)
|
|||
// current color box preview
|
||||
dc->color = BLACK;
|
||||
GrPrint(dc, 10, 10, "Preview:");
|
||||
GrPrint(dc, 10, 26, "Current Color: #%d", selected_color);
|
||||
|
||||
// pixel loop for current color preview
|
||||
for (i = 0; i <= 12; i++)
|
||||
for (j = 0; j <= 12; j++)
|
||||
{
|
||||
tempColor = gr_palette[selected_color];
|
||||
if (i < border || i > 12 - border || j < border || j > 12 - border)
|
||||
tempColor = 0x000000;
|
||||
DrawPixel(c->win_task->pix_left + 78 + i, t + 7 + j, tempColor);
|
||||
}
|
||||
GrPrint(dc, 10, 26, "Current Color: #%d", selected_color + 1);
|
||||
if (selected_color == 15)
|
||||
dc->color = LTGRAY;
|
||||
else if (gr_palette[selected_color] > 0xCCCCCC)
|
||||
|
@ -72,7 +60,9 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c)
|
|||
dc->color = 15;
|
||||
GrRect(dc, 94, 8, 58, 12);
|
||||
|
||||
// #Hex value
|
||||
dc->color = selected_color;
|
||||
GrRect(dc, 78, 8, 12, 12);
|
||||
GrPrint(dc, 95, 10, "#%x%x%x", gr_palette[selected_color].r,
|
||||
gr_palette[selected_color].g,
|
||||
gr_palette[selected_color].b);
|
||||
|
@ -152,27 +142,10 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c)
|
|||
|
||||
for (i = 0; i < COLORS_NUM; i++)
|
||||
{
|
||||
for (j = 0; j <= size; j++)
|
||||
{
|
||||
for (k = 0; k <= size; k++)
|
||||
{
|
||||
tempColor = gr_palette[i];
|
||||
// black borders
|
||||
if (k < border || k > size - border || j < border || j > size - border - 1)
|
||||
{
|
||||
if (selected_color == i)
|
||||
tempColor = 0xFFFFFF;
|
||||
else
|
||||
tempColor = 0x000000;
|
||||
}
|
||||
// color preview
|
||||
DrawPixel(c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k, tempColor);
|
||||
}
|
||||
}
|
||||
// color label and text preview
|
||||
// TODO: THIS LOGIC DOESNT WORK ON LIGHT THEMES
|
||||
// if color too light or too dark add bg
|
||||
|
||||
|
||||
if (i == 15)
|
||||
dc->color = LTGRAY;
|
||||
else if (gr_palette[i] < gr_palette[15])
|
||||
|
@ -183,23 +156,31 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c)
|
|||
dc->color = LTRED;*/
|
||||
else
|
||||
dc->color = 15;
|
||||
|
||||
if (i == selected_color)
|
||||
dc->color = 0;
|
||||
GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18);
|
||||
GrRect(dc, (size * i), c->win_task->pix_height - (size - size / 2), size, size * 1.5);
|
||||
|
||||
GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18);
|
||||
|
||||
|
||||
|
||||
if (i == selected_color)
|
||||
dc->color = 15;
|
||||
else
|
||||
dc->color = i;
|
||||
|
||||
bias = (size / 2) - 4;
|
||||
if (i >= 9)
|
||||
bias = (size / 2) - 8;
|
||||
GrPrint(dc, bias + (i * size), c->win_task->pix_height - (size * .6) + (size / 4), "%d", i + 1);
|
||||
GrPrint(dc, 10, (size2 * 2) + 70 + 16 * i, "#%d: Test", i + 1);
|
||||
|
||||
GrPrint(dc, bias + (i * size), c->win_task->pix_height - (size * .6) + (size / 4), "%d", i);
|
||||
GrPrint(dc, 10, (size2 * 2) + 70 + 16 * i, "#%d: Test", i);
|
||||
// Border for preview box
|
||||
GrRect(dc, (size * i)-2, c->win_task->pix_height - (size*1.5)-1, size+2, size+1);
|
||||
// preview box
|
||||
dc->color = i;
|
||||
GrRect(dc, (size * i), c->win_task->pix_height - (size*1.5), size, size);
|
||||
}
|
||||
|
||||
|
||||
|
@ -373,12 +354,15 @@ public U0 PaletteEditor()
|
|||
" PreviousColor(,,SC_CURSOR_UP);"
|
||||
" NextColor(,,SC_CURSOR_RIGHT);"
|
||||
" NextColor(,,SC_CURSOR_DOWN);"
|
||||
" RandomColor(,'r');"
|
||||
" RandomPalette(,'R');"
|
||||
"}"
|
||||
"About {"
|
||||
" Info(,CH_CTRLI);"
|
||||
"}"
|
||||
);
|
||||
DocClear;
|
||||
DocCursor(OFF);
|
||||
WinBorder(ON);
|
||||
|
||||
CCtrl *c = SliderNew;
|
||||
|
@ -435,13 +419,20 @@ public U0 PaletteEditor()
|
|||
if (selected_color == 15)
|
||||
selected_color = -1;
|
||||
SelectColor(selected_color + 1, c);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CH_CTRLO:
|
||||
current_palette = "";
|
||||
current_palette = PaletteSelect;
|
||||
break;
|
||||
case 'r':
|
||||
gr_palette[selected_color] = ColorGod;
|
||||
LFBFlush;
|
||||
break;
|
||||
case 'R':
|
||||
PaletteGod;
|
||||
break;
|
||||
case CH_CTRLI:
|
||||
PopUpOk("\n\n Use the arrows to select color\n\n # to manually input hex value","\n\n\n\t\tMade by y4my4m\n\n");
|
||||
break;
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
|
||||
public U0 PaletteGodGenerate()
|
||||
{
|
||||
I64 i;
|
||||
CBGR24 palette;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
palette = GodPick & 0xFFFFFF;
|
||||
gr_palette[i] = palette;
|
||||
LFBFlush;
|
||||
}
|
||||
CBGR24 ColorGod(Bool instant=TRUE)
|
||||
{// Generate a random color, seed-based or not
|
||||
if (instant)
|
||||
return RandI32 & 0xFFFFFF;
|
||||
else
|
||||
return GodPick & 0xFFFFFF;
|
||||
}
|
||||
|
||||
PaletteGodGenerate;
|
||||
public U0 PaletteGod(Bool seedUse=FALSE, Bool instant=TRUE)
|
||||
{// Generate a random palette, seed-based or not
|
||||
I64 i;
|
||||
|
||||
if (seedUse) Seed(GodPick);
|
||||
|
||||
for (i=0; i < 16; i++)
|
||||
gr_palette[i] = ColorGod(instant);
|
||||
LFBFlush;
|
||||
}
|
||||
|
|
10
src/Home/PaletteEditor/Palettes/SandyBeach.ZC
Executable file
10
src/Home/PaletteEditor/Palettes/SandyBeach.ZC
Executable file
|
@ -0,0 +1,10 @@
|
|||
public CBGR24 gr_palette_sandy_beach[COLORS_NUM] = {
|
||||
0x000000, 0x000088, 0x008800, 0x006060, 0x002288, 0x4B0082, 0xA52A2A, 0xAAAAAA, 0x444444, 0x4169E1, 0xADFF2F, 0x00AAAA, 0xFF8888, 0x9932CC, 0xC09020, 0xFFF8DF
|
||||
};
|
||||
public U0 PaletteSetSandyBeach(Bool persistent=TRUE)
|
||||
{
|
||||
GrPaletteSet(gr_palette_sandy_beach);
|
||||
LFBFlush;
|
||||
if (persistent)
|
||||
fp_set_std_palette = &PaletteSetSandyBeach;
|
||||
}
|
10
src/Home/PaletteEditor/Palettes/Tradition.ZC
Executable file
10
src/Home/PaletteEditor/Palettes/Tradition.ZC
Executable file
|
@ -0,0 +1,10 @@
|
|||
public CBGR24 gr_palette_tradition[COLORS_NUM] = {
|
||||
0xE8E8E9, 0x374B88, 0x4FBC2C, 0x29CACE, 0xDD0000, 0x8C33FF, 0x875721, 0x7F7A7C, 0x15171C, 0x2EA1FF, 0x4FFF00, 0xFFBB, 0x690000, 0x6E3FFC, 0xFFCC00, 0xC0F14
|
||||
};
|
||||
public U0 PaletteSetTradition(Bool persistent=TRUE)
|
||||
{
|
||||
GrPaletteSet(gr_palette_tradition);
|
||||
LFBFlush;
|
||||
if (persistent)
|
||||
fp_set_std_palette = &PaletteSetTradition;
|
||||
}
|
|
@ -13,7 +13,7 @@ CTask *sys_winmgr_task,
|
|||
U8 *rev_bits_table; //Table with U8 bits reversed
|
||||
CDate local_time_offset;
|
||||
F64 *pow10_I64,
|
||||
sys_os_version = 2.01;
|
||||
sys_os_version = 2.03;
|
||||
|
||||
CAutoCompleteDictGlobals acd;
|
||||
CAutoCompleteGlobals ac;
|
||||
|
|
|
@ -211,6 +211,8 @@ U0 KMain()
|
|||
KbdInit;
|
||||
"Spawn(&MouseHardDriverInstall);\n\n";
|
||||
Spawn(&MouseHardDriverInstall);
|
||||
"Spawn(&MouseRawWatcher,, \"MouseRawWatcher\");\n";
|
||||
Spawn(&MouseRawWatcher,, "MouseRawWatcher");
|
||||
|
||||
"Load(\"Compiler\");\n";
|
||||
Cd("/Compiler");
|
||||
|
|
|
@ -3728,17 +3728,25 @@ public class CKbdStateGlobals
|
|||
};
|
||||
|
||||
#help_index "Mouse"
|
||||
class CMouseRawQueue:CQueue
|
||||
{
|
||||
CTask *task;
|
||||
};
|
||||
|
||||
public class CMouseHardStateGlobals
|
||||
{
|
||||
CD3I64 pos, //Position in pixels
|
||||
prescale;
|
||||
prescale,
|
||||
raw_data;
|
||||
CD3 scale;
|
||||
F64 speed; //Output: How fast the user is moving it.
|
||||
I64 timestamp, //Output: TSCGet when event.
|
||||
install_attempts, //Private
|
||||
pkt_size; //Private
|
||||
CFifoU8 *fifo, *fifo2; //Private
|
||||
CQueue *raw_queue;
|
||||
Bool bttns[5],
|
||||
raw_bttns[5],
|
||||
has_wheel,
|
||||
has_ext_bttns,
|
||||
enabled,
|
||||
|
|
|
@ -503,6 +503,9 @@ extern I64 KbdMessagesQueue();
|
|||
public extern U0 KbdTypeMatic(U8 delay);
|
||||
extern Bool MouseHardDriverInstall();
|
||||
public extern Bool MouseHardEnable(Bool val=TRUE);
|
||||
public extern Bool MouseRaw(Bool val, CTask *task=NULL);
|
||||
public extern U0 MouseRawReset(Bool val=TRUE);
|
||||
extern CMouseRawQueue *MouseRawQueueFind(CTask *task);
|
||||
public extern I64 PressAKey();
|
||||
public extern I64 CharScan();
|
||||
public extern Bool KeyScan(I64 *_ch=NULL, I64 *_scan_code=NULL, Bool echo=FALSE);
|
||||
|
|
|
@ -44,6 +44,115 @@ U0 MouseUpdate(I64 x, I64 y, I64 z, Bool l, Bool r)
|
|||
LBEqual(&kbd.scan_code, SCf_MS_R_DOWN, mouse.rb);
|
||||
}
|
||||
|
||||
public U0 MouseRawReset()
|
||||
{
|
||||
mouse_hard.raw_data.x = 0;
|
||||
mouse_hard.raw_data.y = 0;
|
||||
mouse_hard.raw_data.z = 0;
|
||||
mouse_hard.raw_bttns[0] = FALSE;
|
||||
mouse_hard.raw_bttns[1] = FALSE;
|
||||
mouse_hard.raw_bttns[2] = FALSE;
|
||||
mouse_hard.raw_bttns[3] = FALSE;
|
||||
mouse_hard.raw_bttns[4] = FALSE;
|
||||
}
|
||||
|
||||
CMouseRawQueue *MouseRawQueueFind(CTask *task)
|
||||
{
|
||||
CMouseRawQueue *entry = mouse_hard.raw_queue->next;
|
||||
|
||||
while (entry != mouse_hard.raw_queue)
|
||||
{
|
||||
if (entry->task == task)
|
||||
return entry;
|
||||
entry = entry->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U0 MouseRawWatcherInner(CTask *task, CMouseRawQueue *entry, Bool *_found)
|
||||
{
|
||||
CTask *task2;
|
||||
|
||||
if (task == entry->task)
|
||||
*_found = TRUE;
|
||||
|
||||
task2 = task->next_child_task;
|
||||
while (!*_found && task2 != (&task->next_child_task)(U8 *) - offset(CTask.next_sibling_task))
|
||||
{
|
||||
MouseRawWatcherInner(task2, entry, _found);
|
||||
task2 = task2->next_sibling_task;
|
||||
}
|
||||
}
|
||||
|
||||
U0 MouseRawWatcher()
|
||||
{
|
||||
CMouseRawQueue *entry, *next_entry;
|
||||
I64 i;
|
||||
CCPU *c;
|
||||
Bool found;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
entry = mouse_hard.raw_queue->next;
|
||||
while (entry != mouse_hard.raw_queue)
|
||||
{
|
||||
found = FALSE;
|
||||
next_entry = entry->next;
|
||||
PUSHFD
|
||||
CLI
|
||||
for (i = 0; i < mp_count; i++)
|
||||
{
|
||||
c = &cpu_structs[i];
|
||||
MouseRawWatcherInner(c->executive_task, entry, &found);
|
||||
}
|
||||
POPFD
|
||||
|
||||
if (!found)
|
||||
{
|
||||
QueueRemove(entry);
|
||||
Free(entry);
|
||||
}
|
||||
|
||||
entry = next_entry;
|
||||
}
|
||||
Sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
public Bool MouseRaw(Bool val, CTask *task=NULL)
|
||||
{ // Places mouse in "raw" mode, button presses will not go to windows manager when true
|
||||
CMouseRawQueue *entry;
|
||||
Bool old_val;
|
||||
|
||||
if (!task)
|
||||
task = Fs;
|
||||
|
||||
if (val)
|
||||
{
|
||||
old_val = TRUE;
|
||||
if (!MouseRawQueueFind(task))
|
||||
{
|
||||
entry = CAlloc(sizeof(CMouseRawQueue));
|
||||
entry->task = task;
|
||||
QueueInsertRev(entry, mouse_hard.raw_queue);
|
||||
old_val = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
old_val = FALSE;
|
||||
if (entry = MouseRawQueueFind(task))
|
||||
{
|
||||
QueueRemove(entry);
|
||||
Free(entry);
|
||||
old_val = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return old_val;
|
||||
}
|
||||
|
||||
U0 MouseSet(I64 x=I64_MAX, I64 y=I64_MAX, I64 z=I64_MAX, I64 l=I64_MAX, I64 r=I64_MAX)
|
||||
{//Note: Generates a message. See $LK,"MouseSet",A="FF:::/Demo/Games/Zing.ZC,MouseSet"$().
|
||||
if (!(0 <= x < sys_framebuffer_width))
|
||||
|
@ -78,6 +187,7 @@ U0 MouseInit()
|
|||
mouse.timestamp = TSCGet;
|
||||
mouse.dbl_time = 0.175;
|
||||
GridInit;
|
||||
MouseRawReset;
|
||||
}
|
||||
|
||||
U0 MouseHardPacketRead()
|
||||
|
@ -194,6 +304,7 @@ Bool MouseHardReset()
|
|||
catch
|
||||
Fs->catch_except = TRUE;
|
||||
|
||||
MouseRawReset;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -255,19 +366,22 @@ U0 MouseHardHandler()
|
|||
{
|
||||
I64 i, dx, dy, dz;
|
||||
U8 mouse_buf[4];
|
||||
Bool is_raw_mode;
|
||||
|
||||
if (mouse_hard.raw_queue->next == mouse_hard.raw_queue)
|
||||
is_raw_mode = FALSE; // queue check branch skips func call stack push/pop, small speedup
|
||||
else
|
||||
is_raw_mode = MouseRawQueueFind(sys_focus_task);
|
||||
|
||||
if (!is_raw_mode)
|
||||
MouseHardSetPre;
|
||||
|
||||
MouseHardSetPre;
|
||||
for (i = 0; i < 4; i++)
|
||||
mouse_buf[i] = 0;
|
||||
for (i = 0; i < mouse_hard.pkt_size; i++)
|
||||
if (!FifoU8Remove(mouse_hard.fifo2, &mouse_buf[i]))
|
||||
mouse_buf[i] = 0;
|
||||
|
||||
mouse_hard.bttns[0] = mouse_buf[0] & 1;
|
||||
mouse_hard.bttns[1] = (mouse_buf[0] & 2) >> 1;
|
||||
mouse_hard.bttns[2] = (mouse_buf[0] & 4) >> 2;
|
||||
mouse_hard.bttns[3] = (mouse_buf[3] & 0x10) >> 4;
|
||||
mouse_hard.bttns[4] = (mouse_buf[3] & 0x20) >> 5;
|
||||
if (mouse_buf[0] & 0x10)
|
||||
dx = mouse_buf[1]-256;
|
||||
else
|
||||
|
@ -281,11 +395,36 @@ U0 MouseHardHandler()
|
|||
else
|
||||
dz = mouse_buf[3] & 7;
|
||||
|
||||
mouse_hard.prescale.x += dx;
|
||||
mouse_hard.prescale.y += dy;
|
||||
mouse_hard.prescale.z += dz;
|
||||
|
||||
MouseHardSetPost;
|
||||
if (is_raw_mode)
|
||||
{
|
||||
// buttons / position data need to by consumed by app
|
||||
// buttons stay down, positions keep accumulating until
|
||||
// consumed by app and reset with MouseRawReset
|
||||
mouse_hard.raw_bttns[0] |= mouse_buf[0] & 1;
|
||||
mouse_hard.raw_bttns[1] |= (mouse_buf[0] & 2) >> 1;
|
||||
mouse_hard.raw_bttns[2] |= (mouse_buf[0] & 4) >> 2;
|
||||
mouse_hard.raw_bttns[3] |= (mouse_buf[3] & 0x10) >> 4;
|
||||
mouse_hard.raw_bttns[4] |= (mouse_buf[3] & 0x20) >> 5;
|
||||
mouse_hard.raw_data.x += dx;
|
||||
mouse_hard.raw_data.y += dy;
|
||||
mouse_hard.raw_data.z += dz;
|
||||
mouse.show = FALSE;
|
||||
mouse.lb = FALSE;
|
||||
mouse.rb = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse_hard.bttns[0] = mouse_buf[0] & 1;
|
||||
mouse_hard.bttns[1] = (mouse_buf[0] & 2) >> 1;
|
||||
mouse_hard.bttns[2] = (mouse_buf[0] & 4) >> 2;
|
||||
mouse_hard.bttns[3] = (mouse_buf[3] & 0x10) >> 4;
|
||||
mouse_hard.bttns[4] = (mouse_buf[3] & 0x20) >> 5;
|
||||
mouse_hard.prescale.x += dx;
|
||||
mouse_hard.prescale.y += dy;
|
||||
mouse_hard.prescale.z += dz;
|
||||
mouse.show = TRUE;
|
||||
MouseHardSetPost;
|
||||
}
|
||||
}
|
||||
|
||||
U0 MouseHardSet(I64 x, I64 y, I64 z, I64 l, I64 r)
|
||||
|
@ -405,5 +544,7 @@ U0 KbdMouseInit()
|
|||
mouse_hard.prescale.z = 0 / mouse_hard.scale.z;
|
||||
mouse_hard.pos.x = sys_framebuffer_width >> 1;
|
||||
mouse_hard.pos.y = sys_framebuffer_height >> 1;
|
||||
mouse_hard.raw_queue = CAlloc(sizeof(CQueue)); // head of CMouseRawQueue queue
|
||||
QueueInit(mouse_hard.raw_queue);
|
||||
MemCopy(&mouse_hard_last, &mouse_hard, sizeof(CMouseHardStateGlobals));
|
||||
}
|
||||
|
|
|
@ -439,6 +439,12 @@ to avoid this.
|
|||
ptr = argv[cur_arg++];
|
||||
break;
|
||||
|
||||
case 'o': // Bool
|
||||
if (cur_arg >= argc)
|
||||
throw('StrPrint');
|
||||
ptr = DefineSub(ToBool(argv[cur_arg++]), "ST_FALSE_TRUE");
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
if (cur_arg >= argc)
|
||||
throw('StrPrint');
|
||||
|
@ -656,7 +662,7 @@ sp_out_inf:
|
|||
break;
|
||||
}
|
||||
|
||||
sp_out_f:
|
||||
sp_out_f:
|
||||
if (dec_len < 0)
|
||||
dec_len = 0;
|
||||
n = Log10(d);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#define LIMINE_HDD_FILE "/Boot/Limine-HDD.HH"
|
||||
#define LIMINE_HDD_FILE "/Boot/Limine-BIOS-HDD.HH"
|
||||
#define LIMINE_HDD_INSTALLER "/System/Boot/LimineMHDIns.ZC"
|
||||
#include LIMINE_HDD_FILE
|
||||
#include LIMINE_HDD_INSTALLER
|
||||
|
@ -127,8 +127,8 @@ U0 OSMerge(U8 dst_drv, U8 src_drv=':')
|
|||
|
||||
CopyTree("B:/", dst);
|
||||
|
||||
ExePrint("Del(\"%C:/Boot/Limine-CD.BIN\");", dst_drv);
|
||||
ExePrint("Del(\"%C:/Boot/Limine-CD-EFI.BIN\");", dst_drv);
|
||||
ExePrint("Del(\"%C:/Boot/Limine-BIOS-CD.BIN\");", dst_drv);
|
||||
ExePrint("Del(\"%C:/Boot/Limine-UEFI-CD.BIN\");", dst_drv);
|
||||
ExePrint("Del(\"%C:/Boot/Limine.CFG\");", dst_drv);
|
||||
ExePrint("Del(\"%C:/boot.catalog\");", dst_drv);
|
||||
|
||||
|
@ -245,8 +245,8 @@ U0 InstallDrive(U8 drv_let)
|
|||
|
||||
ExePrint("CopyTree(\"::/\",\"%C:/\");", drv_let);
|
||||
|
||||
ExePrint("Del(\"%C:/Boot/Limine-CD.BIN\");", drv_let);
|
||||
ExePrint("Del(\"%C:/Boot/Limine-CD-EFI.BIN\");", drv_let);
|
||||
ExePrint("Del(\"%C:/Boot/Limine-BIOS-CD.BIN\");", drv_let);
|
||||
ExePrint("Del(\"%C:/Boot/Limine-UEFI-CD.BIN\");", drv_let);
|
||||
ExePrint("Del(\"%C:/Boot/Limine.CFG\");", drv_let);
|
||||
ExePrint("Del(\"%C:/boot.catalog\");", drv_let);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ Bool LimineCFGMake(U8 drv_let)
|
|||
bd = drive->bd;
|
||||
drv_let = Drive2Letter(drive);
|
||||
|
||||
filename_sys = MStrPrint("%C:/Boot/Limine.SYS", drv_let);
|
||||
filename_sys = MStrPrint("%C:/Boot/Limine-BIOS.SYS", drv_let);
|
||||
filename_elf = MStrPrint("%C:/Boot/ZealBooter.ELF", drv_let);
|
||||
filename_zxe = MStrPrint("%C:/Boot/Kernel.ZXE", drv_let);
|
||||
if (FileFind(filename_sys) && FileFind(filename_elf) && FileFind(filename_zxe))
|
||||
|
|
|
@ -15,7 +15,7 @@ U0 LoadDocDefines()
|
|||
//$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/System/Boot/BootDVD.ZC,DD_BOOT_HIGH_LOC_DVD"$
|
||||
|
||||
$TR,"LineRep"$
|
||||
$ID,2$DefinePrint("DD_ZEALOS_LOC","98,709");
|
||||
$ID,2$DefinePrint("DD_ZEALOS_LOC","98,756");
|
||||
$ID,-2$
|
||||
DefinePrint("DD_MP_VECT", "%08X", MP_VECT_ADDR);
|
||||
DefinePrint("DD_MP_VECT_END", "%08X", MP_VECT_ADDR + COREAP_16BIT_INIT_END - COREAP_16BIT_INIT - 1);
|
||||
|
|
|
@ -54,6 +54,7 @@ public U0 PaletteSetDark(Bool persistent=TRUE)
|
|||
//*(drv_text_attr(U8 *) + 1) = BROWN;
|
||||
}
|
||||
//********************************************************************************
|
||||
|
||||
public CBGR24 gr_palette_light[COLORS_NUM] = {
|
||||
0x000000, 0x0148A4, 0x3B7901, 0x057C7E, 0xBB2020, 0x9E42AE, 0xB57901, 0xB2B6AF,
|
||||
0x555753, 0x678FBB, 0x82BC49, 0x0097A2, 0xE26A6A, 0xC671BC, 0xC7AB00, 0xFEF1F0
|
||||
|
|
|
@ -395,6 +395,7 @@ U0 GrUpdateScreen32()
|
|||
while (src < size) //draw 2 pixels at a time
|
||||
*dst++ = gr_palette[*src++ & 0xFF] | gr_palette[*src++ & 0xFF] << 32;
|
||||
|
||||
|
||||
GrCalcScreenUpdates;
|
||||
|
||||
if (LBtr(&sys_semas[SEMA_FLUSH_VBE_IMAGE], 0))
|
||||
|
|
|
@ -41,7 +41,7 @@ U0 Cvt(U8 *ff_mask="*", U8 *fu_flags="+r+l-i+S")
|
|||
Find("ExtDft", ff_mask, fu_flags, "ExtDefault");
|
||||
Find("ExtChg", ff_mask, fu_flags, "ExtChange");
|
||||
Find("RegDft", ff_mask, fu_flags, "RegDefault");
|
||||
Find("\"HC\"", ff_mask, fu_flags, "\"CC\"");
|
||||
Find("\"HC\"", ff_mask, fu_flags, "\"ZC\"");
|
||||
Find("CDrv", ff_mask, fu_flags, "CDrive");
|
||||
Find("CDbgInfo", ff_mask, fu_flags, "CDebugInfo");
|
||||
Find("dbg_info", ff_mask, fu_flags, "debug_info");
|
||||
|
@ -74,7 +74,7 @@ U0 Cvt(U8 *ff_mask="*", U8 *fu_flags="+r+l-i+S")
|
|||
Find("DrvTextAttrGet", ff_mask,fu_flags,"DriveTextAttrGet");
|
||||
Find("DrvIsWritable", ff_mask,fu_flags,"DriveIsWritable");
|
||||
Find("gr_palette_std", ff_mask,fu_flags,"gr32_palette_std");
|
||||
Find("GetKey",ff_mask, fu_flags,"KeyGet");
|
||||
Find("GetKey", ff_mask,fu_flags,"KeyGet");
|
||||
Find("STD_DISTRO_DVD_CFG", ff_mask,fu_flags,"STD_DISTRO_DVD_CONFIG");
|
||||
Find("CBGR48", ff_mask,fu_flags,"CBGR24");
|
||||
Find("CFreeLst", ff_mask,fu_flags,"CFreeList");
|
||||
|
@ -92,6 +92,28 @@ U0 Cvt(U8 *ff_mask="*", U8 *fu_flags="+r+l-i+S")
|
|||
Find("ScanChar",ff_mask,fu_flags,"CharScan");
|
||||
Find("fp_final_scrn_update",ff_mask,fu_flags,"fp_final_screen_update");
|
||||
|
||||
//Added by y4my4m April 25 2023
|
||||
Find("FifoI64Cnt", ff_mask,fu_flags,"FifoI64Count");
|
||||
Find("FifoI64Rem", ff_mask,fu_flags,"FifoI64Remove");
|
||||
Find("FifoU8Cnt", ff_mask,fu_flags,"FifoU8Count");
|
||||
Find("FifoU8Rem", ff_mask,fu_flags,"FifoU8Remove");
|
||||
Find("AdamErr", ff_mask,fu_flags,"SysErr");
|
||||
Find("AdamLog", ff_mask,fu_flags,"SysLog");
|
||||
Find("CHashGlblVar", ff_mask,fu_flags,"CHashGlobalVar");
|
||||
Find("HTT_GLBL_VAR", ff_mask,fu_flags,"HTT_GLOBAL_VAR");
|
||||
Find("fp_draw_ms", ff_mask,fu_flags,"fp_draw_mouse");
|
||||
Find("fp_draw_grab_ms", ff_mask,fu_flags,"fp_draw_grab_mouse");
|
||||
Find("fp_final_scrn_update",ff_mask,fu_flags,"fp_final_screen_update");
|
||||
Find("DCColorChg", ff_mask,fu_flags,"DCColorChange");
|
||||
Find("Adam(", ff_mask,fu_flags,"Sys("); // using Adam( not to rename lists that contain the name Adam
|
||||
Find("KbdMsHndlr", ff_mask,fu_flags,"KbdMouseHandler");
|
||||
Find("WinMsUpdate", ff_mask,fu_flags,"WinMouseUpdate");
|
||||
Find("RWF_SHOW_DOLLAR", ff_mask,fu_flags,"RAWF_SHOW_DOLLAR");
|
||||
Find("RWF_LAST_DOLLAR", ff_mask,fu_flags,"RAWF_LAST_DOLLAR");
|
||||
Find("RWF_IN_DOLLAR", ff_mask,fu_flags,"RAWF_IN_DOLLAR");
|
||||
Find("RWF_SCROLL", ff_mask,fu_flags,"RAWF_SCROLL");
|
||||
Find("RawDr", ff_mask,fu_flags,"RawDumpRegs");
|
||||
|
||||
"\n$$BK,1$$$$LTRED$$Might want to go over these$$FG$$$$BK,0$$\n";
|
||||
Find("MemSet", ff_mask, fu_flags);
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -1,8 +1,11 @@
|
|||
# Nuke built-in rules and variables.
|
||||
override MAKEFLAGS += -rR
|
||||
|
||||
# This is the name that our final kernel executable will have.
|
||||
# Change as needed.
|
||||
override KERNEL := zealbooter.elf
|
||||
|
||||
# Convenience macro to reliably declare overridable command variables.
|
||||
# Convenience macro to reliably declare user overridable variables.
|
||||
define DEFAULT_VAR =
|
||||
ifeq ($(origin $1),default)
|
||||
override $(1) := $(2)
|
||||
|
@ -15,75 +18,90 @@ endef
|
|||
# It is highly recommended to use a custom built cross toolchain to build a kernel.
|
||||
# We are only using "cc" as a placeholder here. It may work by using
|
||||
# the host system's toolchain, but this is not guaranteed.
|
||||
$(eval $(call DEFAULT_VAR,CC,cc))
|
||||
override DEFAULT_CC := cc
|
||||
$(eval $(call DEFAULT_VAR,CC,$(DEFAULT_CC)))
|
||||
|
||||
# Same thing for "ld" (the linker).
|
||||
$(eval $(call DEFAULT_VAR,LD,ld))
|
||||
override DEFAULT_LD := ld
|
||||
$(eval $(call DEFAULT_VAR,LD,$(DEFAULT_LD)))
|
||||
|
||||
# User controllable CFLAGS.
|
||||
CFLAGS ?= -g -O2 -pipe -Wall -Wextra
|
||||
# User controllable C flags.
|
||||
override DEFAULT_CFLAGS := -g -O2 -pipe
|
||||
$(eval $(call DEFAULT_VAR,CFLAGS,$(DEFAULT_CFLAGS)))
|
||||
|
||||
# User controllable preprocessor flags. We set none by default.
|
||||
CPPFLAGS ?=
|
||||
# User controllable C preprocessor flags. We set none by default.
|
||||
override DEFAULT_CPPFLAGS :=
|
||||
$(eval $(call DEFAULT_VAR,CPPFLAGS,$(DEFAULT_CPPFLAGS)))
|
||||
|
||||
# User controllable nasm flags.
|
||||
NASMFLAGS ?= -F dwarf -g
|
||||
override DEFAULT_NASMFLAGS := -F dwarf -g
|
||||
$(eval $(call DEFAULT_VAR,NASMFLAGS,$(DEFAULT_NASMFLAGS)))
|
||||
|
||||
# User controllable linker flags. We set none by default.
|
||||
LDFLAGS ?=
|
||||
override DEFAULT_LDFLAGS :=
|
||||
$(eval $(call DEFAULT_VAR,LDFLAGS,$(DEFAULT_LDFLAGS)))
|
||||
|
||||
# Internal C flags that should not be changed by the user.
|
||||
override CFLAGS += \
|
||||
-std=gnu11 \
|
||||
-ffreestanding \
|
||||
override CFLAGS += \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-std=gnu11 \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-fno-stack-check \
|
||||
-fno-lto \
|
||||
-fno-pie \
|
||||
-fno-pic \
|
||||
-m64 \
|
||||
-march=x86-64 \
|
||||
-mabi=sysv \
|
||||
-mno-80387 \
|
||||
-mno-mmx \
|
||||
-mno-sse \
|
||||
-mno-sse2 \
|
||||
-mno-red-zone \
|
||||
-mcmodel=kernel \
|
||||
-MMD \
|
||||
-I. \
|
||||
-I./lib
|
||||
-fno-stack-check \
|
||||
-fno-lto \
|
||||
-fno-PIE \
|
||||
-fno-PIC \
|
||||
-m64 \
|
||||
-march=x86-64 \
|
||||
-mabi=sysv \
|
||||
-mno-80387 \
|
||||
-mno-mmx \
|
||||
-mno-sse \
|
||||
-mno-sse2 \
|
||||
-mno-red-zone \
|
||||
-mcmodel=kernel
|
||||
|
||||
# Internal C preprocessor flags that should not be changed by the user.
|
||||
override CPPFLAGS := \
|
||||
-I. \
|
||||
-I./lib \
|
||||
$(CPPFLAGS) \
|
||||
-MMD \
|
||||
-MP
|
||||
|
||||
# Internal linker flags that should not be changed by the user.
|
||||
override LDFLAGS += \
|
||||
-nostdlib \
|
||||
-static \
|
||||
-m elf_x86_64 \
|
||||
override LDFLAGS += \
|
||||
-m elf_x86_64 \
|
||||
-nostdlib \
|
||||
-static \
|
||||
-z max-page-size=0x1000 \
|
||||
-T linker.ld
|
||||
|
||||
# Check if the linker supports -no-pie and enable it if it does
|
||||
# Check if the linker supports -no-pie and enable it if it does.
|
||||
ifeq ($(shell $(LD) --help 2>&1 | grep 'no-pie' >/dev/null 2>&1; echo $$?),0)
|
||||
override LDFLAGS += -no-pie
|
||||
endif
|
||||
|
||||
# Internal nasm flags that should not be changed by the user.
|
||||
override NASMFLAGS += \
|
||||
-Wall \
|
||||
-f elf64
|
||||
|
||||
# Use find to glob all *.c, *.S, and *.asm files in the directory and extract the object names.
|
||||
override CFILES := $(shell find . -type f -name '*.c')
|
||||
override ASFILES := $(shell find . -type f -name '*.S')
|
||||
override NASMFILES := $(shell find . -type f -name '*.asm')
|
||||
override OBJ := $(CFILES:.c=.o) $(ASFILES:.S=.o) $(NASMFILES:.asm=.o)
|
||||
override HEADER_DEPS := $(CFILES:.c=.d) $(ASFILES:.S=.d)
|
||||
# Use "find" to glob all *.c, *.S, and *.asm files in the tree and obtain the
|
||||
# object and header dependency file names.
|
||||
override CFILES := $(shell find -L . -type f -name '*.c')
|
||||
override ASFILES := $(shell find -L . -type f -name '*.S')
|
||||
override NASMFILES := $(shell find -L . -type f -name '*.asm')
|
||||
override OBJ := $(CFILES:.c=.c.o) $(ASFILES:.S=.S.o) $(NASMFILES:.asm=.asm.o)
|
||||
override HEADER_DEPS := $(CFILES:.c=.c.d) $(ASFILES:.S=.S.d)
|
||||
|
||||
# Default target.
|
||||
.PHONY: all
|
||||
all: $(KERNEL)
|
||||
|
||||
limine.h:
|
||||
curl https://raw.githubusercontent.com/limine-bootloader/limine/trunk/limine.h -o $@ || cp ../build/limine/limine.h limine.h || echo "ERROR"
|
||||
curl -Lo $@ https://github.com/limine-bootloader/limine/raw/trunk/limine.h || cp ../build/limine/limine.h limine.h || echo "ERROR"
|
||||
|
||||
# Link rules for the final kernel executable.
|
||||
$(KERNEL): $(OBJ)
|
||||
|
@ -93,15 +111,15 @@ $(KERNEL): $(OBJ)
|
|||
-include $(HEADER_DEPS)
|
||||
|
||||
# Compilation rules for *.c files.
|
||||
%.o: %.c limine.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||
%.c.o: %.c limine.h
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||
|
||||
# Compilation rules for *.S files.
|
||||
%.o: %.S limine.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||
%.S.o: %.S limine.h
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||
|
||||
# Compilation rules for *.asm (nasm) files.
|
||||
%.o: %.asm
|
||||
%.asm.o: %.asm
|
||||
nasm $(NASMFLAGS) $< -o $@
|
||||
|
||||
# Remove object files and the final executable.
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
#include <stb_sprintf.h>
|
||||
#include <limine.h>
|
||||
|
||||
static volatile struct limine_terminal_request terminal_request = {
|
||||
.id = LIMINE_TERMINAL_REQUEST,
|
||||
.revision = 0
|
||||
};
|
||||
//static volatile struct limine_terminal_request terminal_request = {
|
||||
// .id = LIMINE_TERMINAL_REQUEST,
|
||||
// .revision = 0
|
||||
//};
|
||||
|
||||
#define PRINT_BUFFER_SIZE 8192
|
||||
|
||||
|
@ -15,14 +15,14 @@ int printf(const char *format, ...)
|
|||
{
|
||||
va_list args;
|
||||
char buffer[PRINT_BUFFER_SIZE];
|
||||
struct limine_terminal *terminal;
|
||||
//struct limine_terminal *terminal;
|
||||
size_t length;
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
length = vsnprintf(buffer, PRINT_BUFFER_SIZE, format, args);
|
||||
terminal = terminal_request.response->terminals[0];
|
||||
terminal_request.response->write(terminal, buffer, length);
|
||||
//terminal = terminal_request.response->terminals[0];
|
||||
//terminal_request.response->write(terminal, buffer, length);
|
||||
|
||||
va_end(args);
|
||||
|
||||
|
|
|
@ -40,9 +40,13 @@ SECTIONS
|
|||
*(.data .data.*)
|
||||
} :data
|
||||
|
||||
/* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */
|
||||
/* unnecessary zeros will be written to the binary. */
|
||||
/* If you need, for example, .init_array and .fini_array, those should be placed */
|
||||
/* above this. */
|
||||
.bss : {
|
||||
*(COMMON)
|
||||
*(.bss .bss.*)
|
||||
*(COMMON)
|
||||
} :data
|
||||
|
||||
/* Discard .note.* and .eh_frame since they may cause issues on some hosts. */
|
||||
|
|
|
@ -21,7 +21,7 @@ static volatile struct limine_memmap_request memmap_request = {
|
|||
|
||||
static volatile struct limine_framebuffer_request framebuffer_request = {
|
||||
.id = LIMINE_FRAMEBUFFER_REQUEST,
|
||||
.revision = 1
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
static volatile struct limine_smbios_request smbios_request = {
|
||||
|
|
Loading…
Reference in a new issue