Merge branch 'master' into fontbook

This commit is contained in:
Arsenic Blood 2024-03-11 03:31:02 -04:00 committed by GitHub
commit 9b82ba8278
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 944 additions and 112 deletions

69
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,69 @@
name: Build ZealOS ISOs
on:
push:
branches:
- 'master'
paths-ignore:
- '**.md'
- 'screenshots/**'
- '**/LICENSE'
pull_request:
branches:
- 'master'
paths-ignore:
- '**.md'
- 'screenshots/**'
- '**/LICENSE'
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install Dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install build-essential git xorriso qemu-system-x86
- name: Enable KVM Group Perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Run ISOs Build Script
timeout-minutes: 10
if: ${{ success() }}
run: |
cd build
./build-iso.sh --headless
cd ..
- name: ISO Check
if: ${{ success() && hashFiles('./build/*.iso') == '' }}
run: |
echo "ISOs not built!"
exit 1
- name: Releasing Latest ISOs
if: ${{ success() && github.event_name == 'push'}}
uses: "GutPuncher/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "Pre-Built ISOs [${{ github.sha }}]"
files: ./build/*.iso
- name: OK
if: ${{ success() }}
run: |
echo "Build OK"

View file

@ -1,6 +1,6 @@
# ZealOS # ZealOS
[![Discord](https://img.shields.io/discord/934200098144022609?color=7289DA&label=Discord&logo=discord&logoColor=white)](https://discord.gg/rK6U3xdr7D) [![](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://zeal-operating-system.github.io/ZealOS-wiki/) [![Discord](https://img.shields.io/discord/934200098144022609?color=7289DA&label=Discord&logo=discord&logoColor=white)](https://discord.gg/rK6U3xdr7D) [![](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://zeal-operating-system.github.io/ZealOS-wiki/) [![Build ZealOS ISOs](https://github.com/Zeal-Operating-System/ZealOS/actions/workflows/build.yml/badge.svg)](https://github.com/Zeal-Operating-System/ZealOS/actions/workflows/build.yml)
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. 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.

Binary file not shown.

View file

@ -13,8 +13,10 @@ then
exit exit
fi fi
# Uncomment if you use doas instead of sudo [ "$1" = "--headless" ] && QEMU_HEADLESS='-display none'
#alias sudo=doas
KVM=''
(lsmod | grep -q kvm) && KVM=' -accel kvm'
# Set this true if you want to test ISOs in QEMU after building. # Set this true if you want to test ISOs in QEMU after building.
TESTING=false TESTING=false
@ -50,7 +52,7 @@ set +e
echo "Making temp vdisk, running auto-install ..." echo "Making temp vdisk, running auto-install ..."
$QEMU_BIN_PATH/qemu-img create -f raw $TMPDISK 1024M $QEMU_BIN_PATH/qemu-img create -f raw $TMPDISK 1024M
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit $QEMU_HEADLESS
echo "Copying all src/ code into vdisk Tmp/OSBuild/ ..." echo "Copying all src/ code into vdisk Tmp/OSBuild/ ..."
rm ../src/Home/Registry.ZC 2> /dev/null rm ../src/Home/Registry.ZC 2> /dev/null
@ -62,9 +64,9 @@ sudo cp -r ../src/* $TMPMOUNT/Tmp/OSBuild
umount_tempdisk umount_tempdisk
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..." 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 $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit $QEMU_HEADLESS
LIMINE_BINARY_BRANCH="v5.x-branch-binary" LIMINE_BINARY_BRANCH="v6.x-branch-binary"
if [ -d "limine" ] if [ -d "limine" ]
then then
@ -73,6 +75,8 @@ then
git fetch git fetch
git remote set-head origin $LIMINE_BINARY_BRANCH git remote set-head origin $LIMINE_BINARY_BRANCH
git switch $LIMINE_BINARY_BRANCH git switch $LIMINE_BINARY_BRANCH
git config --local pull.ff true
git config --local pull.rebase true
git pull git pull
rm limine rm limine
@ -130,11 +134,11 @@ if [ "$TESTING" = true ]; then
cd .. cd ..
fi fi
echo "Testing limine-zealbooter-xorriso isohybrid boot in UEFI mode ..." echo "Testing limine-zealbooter-xorriso isohybrid boot in UEFI mode ..."
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS
echo "Testing limine-zealbooter-xorriso isohybrid boot in BIOS mode ..." echo "Testing limine-zealbooter-xorriso isohybrid boot in BIOS mode ..."
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS
echo "Testing native ZealC MyDistro legacy ISO in BIOS mode ..." echo "Testing native ZealC MyDistro legacy ISO in BIOS mode ..."
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso $QEMU_HEADLESS
fi fi
# comment these 2 lines if you want lingering old Distro ISOs # comment these 2 lines if you want lingering old Distro ISOs

22
build/git-pr-switch.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/sh
#
# Checkout a (PR) fork branch locally for testing.
#
#
echo
echo "git-pr-switch.sh -- Checkout a (PR) fork branch locally for testing."
echo
echo "Clean up your working directory before running this script."
echo
read -p "Enter fork author username: " FORK_USERNAME
echo $FORK_USERNAME
read -p "Enter fork branch name: " FORK_BRANCH
echo $FORK_BRANCH
FORK_LOCAL=$FORK_BRANCH"-testing"
echo "Creating new local branch for testing: "$FORK_LOCAL" ..."
git checkout -B $FORK_LOCAL
echo "Pulling changes from user's branch into new local branch..."
git pull https://github.com/$FORK_USERNAME/ZealOS.git $FORK_BRANCH

View file

@ -90,6 +90,7 @@ else
umount_vdisk umount_vdisk
[ -f ../src/Tmp/AUTO.ISO.C ] && mv ../src/Tmp/AUTO.ISO.C ./AUTO.ISO [ -f ../src/Tmp/AUTO.ISO.C ] && mv ../src/Tmp/AUTO.ISO.C ./AUTO.ISO
echo "Finished." echo "Finished."
cd ../
git status git status
;; ;;
vm) vm)

View file

@ -584,9 +584,9 @@ Bool MoveDo(GameState *state, I64 piece_num, I64 x2, I64 y2, Bool final)
game_over = TRUE; game_over = TRUE;
} }
GameSnapShot; GameSnapShot;
} }
return ToBool(score_adjust); return ToBool(score_adjust);
} }
I64 MoveFind(I64 x, I64 y, Move *mvs, I64 mv_cnt) I64 MoveFind(I64 x, I64 y, Move *mvs, I64 mv_cnt)
@ -664,18 +664,25 @@ I64 MoveCnt(GameState *state)
{ {
I64 i, res = 0, mv_cnt; I64 i, res = 0, mv_cnt;
Move mvs[32]; Move mvs[32];
Bool king_stalemate = TRUE;
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
{
if (state->pieces[i].player == state->cur_player) if (state->pieces[i].player == state->cur_player)
{ {
mv_cnt = PieceMoves(state, i, mvs); mv_cnt = PieceMoves(state, i, mvs);
mv_cnt = ChkPieceMoves(state, i, mvs,mv_cnt); mv_cnt = ChkPieceMoves(state, i, mvs,mv_cnt);
res += mv_cnt; res += mv_cnt;
} }
return res; if (state->pieces[i].type != P_KING && state->pieces[i].player >= 0)
king_stalemate = FALSE;
}
if (king_stalemate)
return 0;
else
return res;
} }
U0 DrawIt(CTask *task, CDC *dc) U0 DrawIt(CTask *task, CDC *dc)
{ {
I64 i, x, y, z, k0, k1; I64 i, x, y, z, k0, k1;

View file

@ -6,7 +6,7 @@ that you can place ctrls on the
wall paper. wall paper.
See $LK,"::/Demo/Graphics/Slider.ZC"$ See $LK,"::/Demo/Graphics/Slider.ZC"$
and $LK,"::/Demo/Graphics/WallPaperFish.ZC"$ and $LK,"::/Demo/Graphics/WallPapers/WallPaperFish.ZC"$
before messing with this program. before messing with this program.
It must be "System Included". It must be "System Included".

View file

@ -0,0 +1,498 @@
#help_index "Windows"
class CWallPaperGlobals
{
I64 last_calc_idle_count, last_swap_counter[MP_PROCESSORS_NUM];
F64 last_calc_idle_delta_time;
U8 top_line[STR_LEN];
} *wall = CAlloc(sizeof(CWallPaperGlobals));
wall->last_calc_idle_delta_time = 1.0;
class CTaskWallPaperData
{
I64 alloced_u8s, used_u8s;
U8 caller_stack[4096 - $$];
};
U0 UserTerm()
{
CTask *user = User;
user->border_src = BDS_CONST;
user->text_attr = DKGRAY << 4 + BLUE;
user->title_src = TTS_LOCKED_CONST;
user->title_src = user->display_doc->filename.name;
DocClear(user->border_doc, TRUE);
DocClear;
user->win_width = GR_WIDTH / 2;
WinHorz((user->win_width/8) - ((user->win_width/2)/6),
(user->win_width/8) + ((user->win_width/2)/6) - 1, user);
user->win_height = GR_HEIGHT / 2;
WinVert((user->win_height/8) - ((user->win_height/2)/7),
(user->win_height/8) + ((user->win_height/2)/7) - 1, user);
I64 initialWinTop = user->win_top;
I64 initialWinLeft = user->win_left;
user->win_top = (GR_HEIGHT/2)/8;
user->win_bottom = (GR_HEIGHT/2)/8;
user->win_left = (GR_WIDTH/2)/8;
user->win_right = (GR_WIDTH/2)/8;
while(user->win_left > initialWinLeft){
user->win_left--;
user->win_right++;
Sleep(2);
}
while(user->win_top > initialWinTop){
user->win_top--;
user->win_bottom++;
Sleep(10);
}
// WinToTop(user);
// WinZBufUpdate;
Dir;
}
U0 WallPaper(CTask *_task)
{
I64 i, j, k, l = TEXT_ROWS - 1;
CTask *task;
CTaskWallPaperData *wpd;
CHashTable *old_hash = Fs->hash_table;
CCPU *c;
CDateStruct ds;
U8 *st;
_task->text_attr = DKGRAY << 4 + LTGRAY;
if (sys_data_bp)
{
TextPrint(Fs, 0, l--, DKGRAY << 4 + YELLOW,
"%010X/%010X %010X/%010X%12td%12td%12td",
sys_data_bp->used_u8s, sys_data_bp->alloced_u8s,
sys_code_bp->used_u8s, sys_code_bp->alloced_u8s,
cmp.compiled_lines, blkdev.read_count, blkdev.write_count);
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY,
"______Data_Heap______ ______Code_Heap______ "
"___Lines___ ___Reads___ __Writes___");
}
else
{
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY,
"%010X/%010X%12td%12td%12td",
sys_code_bp->used_u8s, sys_code_bp->alloced_u8s,
cmp.compiled_lines, blkdev.read_count, blkdev.write_count);
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY,
"____CodeData_Heap____ "
"___Lines___ ___Reads___ ___Writes__");
}
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY, "ProgressBars:%016X %016X %016X %016X",
progress1, progress2, progress3, progress4);
for (i = 0; i < mp_count; i++)
{
c = &cpu_structs[i];
if (winmgr.t->calc_idle_count != wall->last_calc_idle_count)
{
wall->last_calc_idle_delta_time = winmgr.t->calc_idle_delta_time;
wall->last_swap_counter[i] = winmgr.t->last_swap_counter[i];
winmgr.t->last_swap_counter[i] = c->swap_counter;
}
task = c->executive_task;
do
{
wpd = &task->wallpaper_data;
if (!TaskValidate(task))
break;
if (!(winmgr.updates & 5))
{
if (c == Gs)
Fs->hash_table = task->hash_table;
else //precaution
Fs->hash_table = old_hash;
StrPrint(wpd->caller_stack, " %p ", TaskCaller(task, 0));
for (j = 1; j < 16; j++)
{
if ((k = TaskCaller(task, j)) > 0)
CatPrint(wpd->caller_stack, "? %p ", k);
}
}
TextPrint(Fs, 0, l--, DKGRAY << 4 + YELLOW, wpd->caller_stack);
j = UnusedStack(task);
if (j < 0)
Panic("Stack Overflow", task);
if (!(winmgr.updates & 15))
{
wpd->alloced_u8s = TaskMemAlloced(task);
wpd->used_u8s = TaskMemUsed(task);
}
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY,
" %-18ts #%08X %010X %010X/%010X %04X:%02tX:%08X",
task->task_title, task, j, wpd->used_u8s, wpd->alloced_u8s,
task->task_flags, task->display_flags, task->win_inhibit);
if (!TaskValidate(task))
break;
task = task->next_task;
}
while (task != c->executive_task);
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY, "CPU%02X %2tf%% ContextSwaps/s:%9,d", i,
100.0 * (1.0 - c->idle_factor), ToI64((winmgr.t->last_swap_counter[i]
- wall->last_swap_counter[i]) / wall->last_calc_idle_delta_time));
}
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY,
" ___Description____ #__Task__ UnusedStack _UsedMem_/_AllocMem_ ______Flags_____");
if (!(winmgr.updates & 15) || !*wall->top_line)
{
Date2Struct(&ds, Now);
i = sys_code_bp->alloced_u8s - sys_code_bp->used_u8s;
if (sys_data_bp)
i += sys_data_bp->alloced_u8s - sys_data_bp->used_u8s;
StrPrint(wall->top_line,
" ≡ %3tZ %02d/%02d/%02d %02d:%02d:%02d │ FPS: %2tf │ Mem: %010X │ CPU: ",
ds.day_of_week, "ST_DAYS_OF_WEEK", ds.mon, ds.day_of_mon, ds.year % 100,
ds.hour, ds.min, ds.sec, winmgr.fps, i);
}
TextPrint(Fs, 0, 0, DKGRAY << 4 + LTGRAY, wall->top_line);
if (screencast.record)
TextPrint(Fs, 44 - 4, 0, DKGRAY << 4 + LTGREEN, "*");
for (i = 0; i < mp_count; i++)
{
c = &cpu_structs[i];
if (i & 1)
TextPrint(Fs, 60 + i * 2, 0, DKGRAY << 4 + LTGRAY, "%2tf", 100.0 * (1.0 - c->idle_factor));
else
TextPrint(Fs, 60 + i * 2, 0, DKGRAY << 4 + LTGREEN, "%2tf", 100.0 * (1.0 - c->idle_factor));
}
st = ScanCode2KeyName(kbd.last_down_scan_code);
TextPrint(Fs, TEXT_COLS - 25, 0, DKGRAY << 4 + LTGREEN, "%25ts", st);
Free(st);
Fs->hash_table = old_hash;
wall->last_calc_idle_count = winmgr.t->calc_idle_count;
}
$SP,"<1>",BI=1$
$SP,"<2>",BI=2,BP="::/Demo/Graphics/WallPapers/WallPaperDesktop/DesktopIcons.DD,1"$
$SP,"<3>",BI=3,BP="::/Demo/Graphics/WallPapers/WallPaperDesktop/DesktopIcons.DD,2"$
$SP,"<4>",BI=4,BP="::/Demo/Graphics/WallPapers/WallPaperDesktop/DesktopIcons.DD,3"$
$SP,"<5>",BI=5$
$SP,"<6>",BI=6$
U0 DrawTermBttn(CDC *dc, CCtrl *c)
{
Sprite3(dc, c->left-8, c->top-8, 0, $IB,"<1>",BI=1$);
}
U0 LeftClickTermBttn(CCtrl *, I64, I64, Bool down)
{
if (down)
User;
}
CCtrl *TermBttnNew()
{
I64 min_x, max_x, min_y, max_y;
CCtrl *c = SysCAlloc(sizeof(CCtrl));
c->win_task = sys_winmgr_task;
c->flags = CTRLF_SHOW;
c->type = CTRLT_GENERIC;
c->draw_it = &DrawTermBttn;
c->left_click = &LeftClickTermBttn;
SpriteExtents($IB,"<1>",BI=1$, &min_x, &max_x, &min_y, &max_y);
//min must be zero
c->left = sys_winmgr_task->pix_width - (max_x - min_x + 1);
c->right = c->left + (max_x - min_x + 1) - 1;
c->top = sys_winmgr_task->pix_height - (max_y - min_y + 1);
c->bottom = c->top + (max_y - min_y + 1) - 1;
QueueInsert(c, sys_winmgr_task->last_ctrl);
TaskDerivedValsUpdate(sys_winmgr_task);
return c;
}
//// HOME
U0 DrawHomeIcon(CDC *dc, CCtrl *c)
{
c->top = (sys_task->win_bottom * 8) + 26;
c->bottom = c->top + 60 + 8;
//dc->color = PURPLE;
//GrRect(dc, c->left, c->top, c->right, c->bottom);
Sprite3(dc, c->left, c->top, -1, $IB,"<2>",BI=2$);
}
U0 LeftClickHomeIcon(CCtrl *, I64, I64, Bool down)
{
if (down)
Spawn(&UserTerm, , "User Terminal");
}
CCtrl *HomeIconNew()
{
I64 min_x, max_x, min_y, max_y;
CCtrl *c = SysCAlloc(sizeof(CCtrl));
c->win_task = sys_winmgr_task;
c->flags = CTRLF_SHOW;
c->type = CTRLT_GENERIC;
c->draw_it = &DrawHomeIcon;
c->left_click = &LeftClickHomeIcon;
SpriteExtents($IB,"<2>",BI=2$, &min_x, &max_x, &min_y, &max_y);
//min must be zero
c->left = 8;
c->right = c->left + (max_x - min_x + 1) - 1;
c->top = (sys_task->win_bottom*8) + (max_y - min_y + 1);
c->bottom = c->top + max_y + 8;
QueueInsert(c, sys_winmgr_task->last_ctrl);
TaskDerivedValsUpdate(sys_winmgr_task);
return c;
}
//// TELNET
U0 DrawTelnetIcon(CDC *dc, CCtrl *c)
{
c->top = (sys_task->win_bottom * 8) + 16*2 + 80;
//dc->color = RED;
//GrRect(dc, c->left, c->top, c->right, c->bottom);
Sprite3(dc, c->left, c->top, -1, $IB,"<3>",BI=3$);
}
U0 LeftClickTelnetIcon(CCtrl *, I64, I64, Bool down)
{
if (down)
PopUp("ExeFile2(\"~/Net/Programs/Telnet/Telnet.ZC\");");
}
CCtrl *TelnetIconNew()
{
I64 min_x, max_x, min_y, max_y;
CCtrl *c = SysCAlloc(sizeof(CCtrl));
c->win_task = sys_winmgr_task;
c->flags = CTRLF_SHOW;
c->type = CTRLT_GENERIC;
c->draw_it = &DrawTelnetIcon;
c->left_click = &LeftClickTelnetIcon;
SpriteExtents($IB,"<3>",BI=3$, &min_x, &max_x, &min_y, &max_y);
//min must be zerocp
c->left = 8;
c->right = c->left + (max_x - min_x);
c->top = (sys_task->win_bottom*8) + (max_y - min_y + 1) * 2;
c->bottom = c->top + max_y + 16;
QueueInsert(c, sys_winmgr_task->last_ctrl);
TaskDerivedValsUpdate(sys_winmgr_task);
return c;
}
//// PALETTE EDITOR
U0 DrawPaletteIcon(CDC *dc, CCtrl *c)
{
c->top = (sys_task->win_bottom * 8) + 16*3 + 130;
//dc->color = RED;
//GrRect(dc, c->left, c->top, c->right, c->bottom);
Sprite3(dc, c->left, c->top, -1, $IB,"<4>",BI=4$);
}
U0 LeftClickPaletteIcon(CCtrl *, I64, I64, Bool down)
{
if (down)
PopUp("ExeFile2(\"~/PaletteEditor/Run.ZC\");");
}
CCtrl *PaletteIconNew()
{
I64 min_x, max_x, min_y, max_y;
CCtrl *c = SysCAlloc(sizeof(CCtrl));
c->win_task = sys_winmgr_task;
c->flags = CTRLF_SHOW;
c->type = CTRLT_GENERIC;
c->draw_it = &DrawPaletteIcon;
c->left_click = &LeftClickPaletteIcon;
SpriteExtents($IB,"<7>",BI=7$, &min_x, &max_x, &min_y, &max_y);
//min must be zerocp
c->left = 8;
c->right = c->left + (max_x - min_x);
c->top = (sys_task->win_bottom*8) + (max_y - min_y + 1) * 3;
c->bottom = c->top + max_y + 16;
QueueInsert(c, sys_winmgr_task->last_ctrl);
TaskDerivedValsUpdate(sys_winmgr_task);
return c;
}
U0 DrawNetLogBttn(CDC *dc, CCtrl *c)
{
Sprite3(dc, c->left-8, c->top-8, 0, $IB,"<5>",BI=5$);
}
U0 LeftClickNetLogBttn(CCtrl *, I64, I64, Bool down)
{
if(down)
Sys("NetLogToggle;");
}
CCtrl *NetLogIconNew()
{
I64 min_x, max_x, min_y, max_y;
CCtrl *c = SysCAlloc(sizeof(CCtrl));
c->win_task = sys_winmgr_task;
c->flags = CTRLF_SHOW;
c->type = CTRLT_GENERIC;
c->draw_it = &DrawNetLogBttn;
c->left_click = &LeftClickNetLogBttn;
SpriteExtents($IB,"<5>",BI=5$, &min_x, &max_x, &min_y, &max_y);
//min must be zero
c->left = sys_winmgr_task->pix_width - (max_x - min_x + 1);
c->right = c->left + (max_x - min_x + 1) - 1;
c->top = sys_winmgr_task->pix_height - (max_y - min_y + 1) - 40;
c->bottom = c->top + (max_y - min_y + 1) - 1;
QueueInsert(c, sys_winmgr_task->last_ctrl);
TaskDerivedValsUpdate(sys_winmgr_task);
return c;
}
U0 DrawShowStatsBttn(CDC *dc, CCtrl *c)
{
Sprite3(dc, c->left-8, c->top-8, 0, $IB,"<6>",BI=6$);
}
U0 LeftClickShowStatsBttn(CCtrl *, I64, I64, Bool down)
{
if(down)
Sys("WallPaperToggle;");
}
CCtrl *ShowStatsIconNew()
{
I64 min_x, max_x, min_y, max_y;
CCtrl *c = SysCAlloc(sizeof(CCtrl));
c->win_task = sys_winmgr_task;
c->flags = CTRLF_SHOW;
c->type = CTRLT_GENERIC;
c->draw_it = &DrawShowStatsBttn;
c->left_click = &LeftClickShowStatsBttn;
SpriteExtents($IB,"<6>",BI=6$, &min_x, &max_x, &min_y, &max_y);
//min must be zero
c->left = sys_winmgr_task->pix_width - (max_x - min_x + 1);
c->right = c->left + (max_x - min_x + 1) - 1;
c->top = sys_winmgr_task->pix_height - (max_y - min_y + 1) - 80;
c->bottom = c->top + (max_y - min_y + 1) - 1;
QueueInsert(c, sys_winmgr_task->last_ctrl);
TaskDerivedValsUpdate(sys_winmgr_task);
return c;
}
U0 WallPaperInit(Bool enableTermIcon = TRUE, Bool enableDesktopIcons = TRUE)
{
if (Fs != sys_task)
{
"Must be System Included with SHIFT-F5.\n"
"(Would crash when code mem was freed.)\n";
return;
}
if(enableTermIcon)
{
TermBttnNew;
NetLogIconNew;
ShowStatsIconNew;
}
if(enableDesktopIcons)
{
HomeIconNew;
TelnetIconNew;
PaletteIconNew;
}
gr.fp_wall_paper = &WallPaper;
}
WallPaperInit;; N L
TERMINALn 6 5 1  BBS !60&Telnet9 N L
NetLog8 N L
Stats

View file

@ -0,0 +1,99 @@
// HOME VERSION
U0 UserStartUp()
{//Run each time a user a spawned
DocTermNew;
Type("::/Doc/Start.DD");
LBts(&Fs->display_flags, DISPLAYf_SHOW);
Fs->title_src = TTS_LOCKED_CONST;
Fs->title_src = Fs->display_doc->filename.name;
WinToTop;
WinZBufUpdate;
Dir;
}
U0 ServerStartUp()
{//Run each time a server task is spawned.
DocTermNew;
LBts(&Fs->display_flags, DISPLAYf_SHOW);
Fs->title_src = TTS_LOCKED_CONST;
WinToTop;
WinZBufUpdate;
}
U0 StartUpTasks()
{
//////////////////////////
// SysLog Window Config //
//////////////////////////
DocCursor(OFF);
Fs->title_src = TTS_LOCKED_CONST;
Fs->title_src = "SysLog";
DocClear(Fs->border_doc, TRUE);
/////////////////////////
// Initial Term Config //
/////////////////////////
CTask *user = User;
user->border_src = BDS_CONST;
user->text_attr = DKGRAY << 4 + BLUE;
user->title_src = TTS_LOCKED_CONST;
user->title_src = user->display_doc->filename.name;
DocClear(user->border_doc, TRUE);
user->win_width = GR_WIDTH / 2;
WinHorz((user->win_width/8) - ((user->win_width/2)/7),
(user->win_width/8) + ((user->win_width/2)/7) - 1, user);
user->win_height = GR_HEIGHT / 2;
WinVert((user->win_height/8) - ((user->win_height/2)/8),
(user->win_height/8) + ((user->win_height/2)/8) - 1, user);
I64 initialWinTop = user->win_top;
I64 initialWinLeft = user->win_left;
user->win_top = (GR_HEIGHT/2)/8;
user->win_bottom = (GR_HEIGHT/2)/8;
user->win_left = (GR_WIDTH/2)/8;
user->win_right = (GR_WIDTH/2)/8;
while(user->win_left > initialWinLeft){
user->win_left--;
user->win_right++;
Sleep(2);
}
while(user->win_top > initialWinTop){
user->win_top--;
user->win_bottom++;
Sleep(10);
}
WinToTop(user);
WinZBufUpdate;
"\n\n Boot Time:$$RED$$%7.3fs$$FG$$\n", tS;
//XTalk(user, "Cd; #include \"Once\";\n");
Silent; //no output to screen
//ACInit("/*;!*/Bible.TXT;!*/Clementine.TXT;!*/PCIDevices.DD;!*/HTML/*;!*/ChangeLog.DD");
Silent(OFF); //no output to screen
//AutoComplete(OFF);
//if (sys_boot_src.u16[0] != BOOT_SRC_RAM)
// PopUp("ExeFile2(\"::/System/ZSplash.ZC\");");
}
#include "~/PaletteEditor/Palettes/Tradition"
PaletteSetTradition;
StartUpTasks;
"\n\n $$PURPLE$$ZealOS$$FG$$ V%0.2f\t%D %T\n\n", sys_os_version, sys_compile_time, sys_compile_time;

View file

@ -0,0 +1,5 @@
Cd(__DIR__);;
Copy("HomeSys.ZC", "~/HomeSys.ZC");
Copy("DesktopIcons.DD", "~/DesktopIcons.DD");
Copy("../WallPaperDesktop.ZC", "::/System/WallPaper.ZC");

View file

@ -7,7 +7,7 @@ $FG,5$$WW,1$$TX+CX,"ZealOS Charter"$$FG$
* Low line count and low code complexity is the highest good, so it is easy to learn the whole thing. Users should see the light at the end of the tunnel. * Low line count and low code complexity is the highest good, so it is easy to learn the whole thing. Users should see the light at the end of the tunnel.
* There is a limit of 100,000 lines of code for all time, not including applications and demos. Currently, there are $TX,"98,661",D="DD_ZEALOS_LOC"$ lines of code. $FG,4$3rd party libraries are banned from being required$FG$ because they circumvent the intent of this limit. The vision is a Commodore 64 ROM -- a fixed core API that is the only dependency of applications. Dependency on components and libraries creates a hell that is no longer blissful. * There is a limit of 100,000 lines of code for all time, not including applications and demos. Currently, there are $TX,"98,756",D="DD_ZEALOS_LOC"$ lines of code. $FG,4$3rd party libraries are banned from being required$FG$ because they circumvent the intent of this limit. The vision is a Commodore 64 ROM -- a fixed core API that is the only dependency of applications. Dependency on components and libraries creates a hell that is no longer blissful.
* The primary metric for resolving all ZealOS code governance issues is how fast the compiler compiles itself and the kernel with $LK,"BootHDIns",A="MN:BootHDIns"$(). The secondary metric is how understandable the code is. The $LK,"ZealC",A="FI:::/Doc/ZealC.DD"$ language should be changed to optimize these metrics, as Terry Davis did when he changed type casting from prefix to $LK+PU,"postfix",A="FF:::/Doc/ZealC.DD,postfix"$. * The primary metric for resolving all ZealOS code governance issues is how fast the compiler compiles itself and the kernel with $LK,"BootHDIns",A="MN:BootHDIns"$(). The secondary metric is how understandable the code is. The $LK,"ZealC",A="FI:::/Doc/ZealC.DD"$ language should be changed to optimize these metrics, as Terry Davis did when he changed type casting from prefix to $LK+PU,"postfix",A="FF:::/Doc/ZealC.DD,postfix"$.
@ -23,6 +23,8 @@ $FG,5$$WW,1$$TX+CX,"ZealOS Charter"$$FG$
* $FG,4$No GPU$FG$. We want one processing platform, the CPU, for everything. * $FG,4$No GPU$FG$. We want one processing platform, the CPU, for everything.
* $FG,4$No encryption$FG$, $FG,4$No compression$FG$. All formats, files, protocols, and algorithms must operate entirely in unobfuscated plain-text. Decrypting, encrypting, decompressing, and compressing creates redundant overhead that makes programs slow and complicated. Encoding/decoding of unencrypted uncompressed data in binary formats (.ZXE, .BIN, .GR, .GR32, DolDoc sprite binary data, etc.) is permitted.
* Full access to everything. All memory, I/O ports, instructions, and similar things must never be off limits. All functions, variables and class members will be accessible. There are no C++ $FG,2$public$FG$/$FG,2$private$FG$ protections and all functions, even secondary ones in the kernel, can be called. * Full access to everything. All memory, I/O ports, instructions, and similar things must never be off limits. All functions, variables and class members will be accessible. There are no C++ $FG,2$public$FG$/$FG,2$private$FG$ protections and all functions, even secondary ones in the kernel, can be called.
* $FG,2$Single-address-map$FG$ as though paging is not used. Long mode requires paging, however, so the nearest thing is keeping all memory $FG,2$identity-mapped$FG$. * $FG,2$Single-address-map$FG$ as though paging is not used. Long mode requires paging, however, so the nearest thing is keeping all memory $FG,2$identity-mapped$FG$.

View file

@ -27,7 +27,7 @@ $LK,"::/Demo/RandDemo.ZC"$
$LK,"::/Demo/KeyBitMap.ZC"$ $LK,"::/Demo/KeyBitMap.ZC"$
$LK,"::/Demo/Graphics/WinZBuf.ZC"$ $LK,"::/Demo/Graphics/WinZBuf.ZC"$
$LK,"::/Demo/Graphics/Elephant.ZC"$ $LK,"::/Demo/Graphics/Elephant.ZC"$
$LK,"::/Demo/Graphics/WallPaperFish.ZC"$ //Press SHIFT-F5 to System Include $LK,"::/Demo/Graphics/WallPapers/WallPaperFish.ZC"$ //Press SHIFT-F5 to System Include
$LK,"::/Demo/Games/Digits.ZC"$ $LK,"::/Demo/Games/Digits.ZC"$
$LK,"::/Demo/Progress.ZC"$ //has some ASM, just ignore $LK,"::/Demo/Progress.ZC"$ //has some ASM, just ignore
$LK,"::/Demo/Graphics/Symmetry.ZC"$ $LK,"::/Demo/Graphics/Symmetry.ZC"$
@ -77,7 +77,7 @@ $LK,"::/Demo/MultiCore/Palindrome.ZC"$
$LK,"::/Demo/MultiCore/MPAdd.ZC"$ $LK,"::/Demo/MultiCore/MPAdd.ZC"$
$LK,"::/Demo/MultiCore/Lock.ZC"$ $LK,"::/Demo/MultiCore/Lock.ZC"$
$LK,"::/Demo/Graphics/Slider.ZC"$ $LK,"::/Demo/Graphics/Slider.ZC"$
$LK,"::/Demo/Graphics/WallPaperCtrl.ZC"$ //Press SHIFT-F5 to System Include $LK,"::/Demo/Graphics/WallPapers/WallPaperCtrl.ZC"$ //Press SHIFT-F5 to System Include
$LK,"::/Demo/Graphics/ScrollBars.ZC"$ $LK,"::/Demo/Graphics/ScrollBars.ZC"$
$LK,"::/Demo/RegistryDemo.ZC"$ $LK,"::/Demo/RegistryDemo.ZC"$
$LK,"::/Demo/Games/FlapBat.ZC"$ $LK,"::/Demo/Games/FlapBat.ZC"$

View file

@ -107,7 +107,7 @@ $FG,2$Merge("C:/","D:/","+r+d");$FG$ to check your changes.
* $LK,"GrFloodFill",A="MN:GrFloodFill"$() is slow. $LK,"GrRect",A="MN:GrRect"$() is fast. * $LK,"GrFloodFill",A="MN:GrFloodFill"$() is slow. $LK,"GrRect",A="MN:GrRect"$() is fast.
* You can customize the $FG,2$wallpaper$FG$. See $LK,"::/Demo/Graphics/WallPaperFish.ZC"$. * You can customize the $FG,2$wallpaper$FG$. See $LK,"::/Demo/Graphics/WallPapers/WallPaperFish.ZC"$.
* Your RAM disks will not be reformatted when you reboot if the memory location has not changed and it finds the disk intact. * Your RAM disks will not be reformatted when you reboot if the memory location has not changed and it finds the disk intact.

View file

@ -59,6 +59,7 @@
#define PCNET_INT_TINTM 9 // Transmit Interrupt Mask #define PCNET_INT_TINTM 9 // Transmit Interrupt Mask
#define PCNET_INT_RINTM 10 // Receive Interrupt Mask #define PCNET_INT_RINTM 10 // Receive Interrupt Mask
#define PCNET_FEATURE_ASTRPRCV 10
#define PCNET_FEATURE_APADXMT 11 #define PCNET_FEATURE_APADXMT 11
#define PCNET_BCR_MISC_CONFIG_ASEL 1 #define PCNET_BCR_MISC_CONFIG_ASEL 1
@ -455,7 +456,7 @@ U0 PCNetInterruptCSRSet()
U0 PCNetTXAutoPadEnable() U0 PCNetTXAutoPadEnable()
{/* AMD PCNet datasheet p.1-958 {/* AMD PCNet datasheet p.1-958
Setting bit 11 (Auto Pad Transmit) allows Setting bit 11 (Auto Pad Transmit) allows
shoft transmit frames to be automatically short transmit frames to be automatically
extended to 64 bytes. */ extended to 64 bytes. */
U32 csr = PCNetCSRRead(PCNET_CSR_FEATURECTRL); U32 csr = PCNetCSRRead(PCNET_CSR_FEATURECTRL);
@ -465,6 +466,19 @@ U0 PCNetTXAutoPadEnable()
PCNetCSRWrite(PCNET_CSR_FEATURECTRL, csr); PCNetCSRWrite(PCNET_CSR_FEATURECTRL, csr);
} }
U0 PCNetRXAutoStripEnable()
{/* AMD PCNet datasheet p.1-958
Setting bit 10 (Auto Strip Receive) allows
pad and FCS fields to be automatically
stripped. ONLY WORKS ON 802.3!!! */
U32 csr = PCNetCSRRead(PCNET_CSR_FEATURECTRL);
Bts(&csr, PCNET_FEATURE_ASTRPRCV);
PCNetCSRWrite(PCNET_CSR_FEATURECTRL, csr);
}
U0 PCNetConfigModeExit() U0 PCNetConfigModeExit()
{/* AMD PCNet datasheet p.1-954 {/* AMD PCNet datasheet p.1-954
PCNet controller can be started PCNet controller can be started
@ -563,6 +577,11 @@ I64 PCNetTransmitPacketAllocate(U8 **packet_buffer_out, I64 length)
return de_index; return de_index;
} }
U8 *EthernetMACGet()
{
return pcnet.mac_address;
}
U0 PCNetTransmitPacketFinish(I64 de_index) U0 PCNetTransmitPacketFinish(I64 de_index)
{/* Release ownership of the packet to the PCNet card {/* Release ownership of the packet to the PCNet card
by setting the OWN bit to 1. */ by setting the OWN bit to 1. */
@ -574,11 +593,23 @@ U0 PCNetTransmitPacketFinish(I64 de_index)
de_index, PCIBt(&entry->status1, PCNET_DESCRIPTORf_OWN)); de_index, PCIBt(&entry->status1, PCNET_DESCRIPTORf_OWN));
} }
U0 EthernetFrameFinish(I64 de_index) U0 NetDriverTransmitPacketFinish(I64 de_index)
{//Alias for driver Finish TX function. {//Alias for driver-specific Finish TX function.
PCNetTransmitPacketFinish(de_index); PCNetTransmitPacketFinish(de_index);
} }
I64 NetDriverPacketBufferGet(I64 de_index)
{
return pcnet.tx_buffer_addr_phys + de_index * ETHERNET_FRAME_SIZE;
}
I64 NetDriverPacketLengthGet(I64 de_index)
{
CPCNetDescriptorEntry *entry = &pcnet.tx_de_buffer[de_index * sizeof(CPCNetDescriptorEntry)];
return U16_MAX - (entry->status1 & 0xFFFF) + 1;
}
I64 PCNetPacketReceive(U8 **packet_buffer_out, U16 *packet_length_out) I64 PCNetPacketReceive(U8 **packet_buffer_out, U16 *packet_length_out)
{/* Receives the packet at the current RX DE index. Parameters {/* Receives the packet at the current RX DE index. Parameters
are both pointers, since we modify the value at the packet_buffer_out, are both pointers, since we modify the value at the packet_buffer_out,
@ -604,7 +635,13 @@ I64 PCNetPacketReceive(U8 **packet_buffer_out, U16 *packet_length_out)
NetDebug("PCNET RECEIVE PACKET: de_index incremented = 0x%0X", pcnet.current_rx_de_index); NetDebug("PCNET RECEIVE PACKET: de_index incremented = 0x%0X", pcnet.current_rx_de_index);
*packet_buffer_out = pcnet.rx_buffer_addr_phys + de_index * ETHERNET_FRAME_SIZE; *packet_buffer_out = pcnet.rx_buffer_addr_phys + de_index * ETHERNET_FRAME_SIZE;
*packet_length_out = packet_length;
// ASTRPRCV causes 802.3 packets to be stripped and FCS to be checked
U16 ethertype = (*packet_buffer_out)[ETHERNET_ETHERTYPE_OFFSET + 1] | (*packet_buffer_out)[ETHERNET_ETHERTYPE_OFFSET] << 8;
if (ethertype < ETHERNET_v2_MTU)
*packet_length_out = ethertype;
else
*packet_length_out = packet_length - FCS_LENGTH; // ethertype ii TODO: Validate FCS
return de_index; return de_index;
} }
@ -732,6 +769,8 @@ U0 PCNetInit()
PCNetTXAutoPadEnable; PCNetTXAutoPadEnable;
PCNetRXAutoStripEnable;
PCNetAutoLinkSelect; PCNetAutoLinkSelect;
PCNetEnableFullDuplex; PCNetEnableFullDuplex;
@ -809,11 +848,6 @@ I64 EthernetFrameAllocate(U8 **packet_buffer_out,
return de_index; return de_index;
} }
U8 *EthernetMACGet()
{
return pcnet.mac_address;
}
U0 NetStop() U0 NetStop()
{ // Halt network activity by setting STOP bit on Status CSR. { // Halt network activity by setting STOP bit on Status CSR.
U32 csr = PCNetCSRRead(PCNET_CSR_CTRLSTATUS); U32 csr = PCNetCSRRead(PCNET_CSR_CTRLSTATUS);
@ -833,4 +867,4 @@ U0 NetStart()
PCNetCSRWrite(PCNET_CSR_CTRLSTATUS, csr); PCNetCSRWrite(PCNET_CSR_CTRLSTATUS, csr);
} }
PCNetInit; PCNetInit;

View file

@ -167,15 +167,15 @@ I64 EthernetFrameAllocate(U8 **buffer_out, U8 *src_addr, U8 *dst_addr,
I64 index; I64 index;
if (!MemCompare(dst_addr, &VirtioNet.mac, 6)) { // if (!MemCompare(dst_addr, &VirtioNet.mac, 6)) {
frame = loopback_frame; // frame = loopback_frame;
loopback_length = length; // loopback_length = length;
index = I64_MAX; // index = I64_MAX;
} else { // } else {
index = @virtio_net_alloc_tx_packet(&frame, 14 + length/*, flags*/); index = @virtio_net_alloc_tx_packet(&frame, 14 + length/*, flags*/);
if (index < 0) if (index < 0)
return index; return index;
} // }
MemCopy(frame + 0, dst_addr, 6); MemCopy(frame + 0, dst_addr, 6);
MemCopy(frame + 6, src_addr, 6); MemCopy(frame + 6, src_addr, 6);
@ -186,15 +186,26 @@ I64 EthernetFrameAllocate(U8 **buffer_out, U8 *src_addr, U8 *dst_addr,
return index; return index;
} }
I64 EthernetFrameFinish(I64 index) { //I64 EthernetFrameFinish(I64 index) {
if (index == I64_MAX && loopback_frame && loopback_length) { I64 NetDriverTransmitPacketFinish(I64 index) {
NetQueuePush(loopback_frame, loopback_length); // if (index == I64_MAX && loopback_frame && loopback_length) {
loopback_length = 0; // NetQueuePush(loopback_frame, loopback_length);
return 0; // loopback_length = 0;
} // return 0;
// }
return @virtio_net_finish_tx_packet(index); return @virtio_net_finish_tx_packet(index);
} }
I64 NetDriverPacketBufferGet(I64 de_index)
{
return tx_buffers + de_index * ETHERNET_FRAME_SIZE;
}
I64 NetDriverPacketLengthGet(I64 de_index)
{ // TODO: ... de_index in Alec's VirtIO-Net driver don't match up to any way to get packet length...
return ETHERNET_FRAME_SIZE;
}
U8 *EthernetMACGet() { return &VirtioNet.mac; } U8 *EthernetMACGet() { return &VirtioNet.mac; }
I64 @virtio_net_init() { I64 @virtio_net_init() {

View file

@ -24,8 +24,8 @@ U0 ChatMessageTask(I64)
while (message = StrGet("> ",, SGF_SHIFT_ESC_EXIT)) while (message = StrGet("> ",, SGF_SHIFT_ESC_EXIT))
{ {
DocBottom(chat_display_task->put_doc); DocBottom(chat_display_task->put_doc);
DocPrint(chat_display_task->put_doc, // DocPrint(chat_display_task->put_doc,
"$$BG,BLUE$$$$BLACK$$<local>$$FG$$$$BG$$ %s\n", message); // "$$BG,BLUE$$$$BLACK$$<local>$$FG$$$$BG$$ %s\n", message);
TCPSocketSendString(tcp, message); TCPSocketSendString(tcp, message);

View file

@ -37,7 +37,7 @@ U0 ChatServerBroadcast(CTCPSocket *tcp_socket, I64 length)
{ {
dest_socket = conn->socket; dest_socket = conn->socket;
if (dest_socket != tcp_socket) // if (dest_socket != tcp_socket)
{ {
addr.address = EndianU32(dest_socket->destination_address(CSocketAddressIPV4).address.address); addr.address = EndianU32(dest_socket->destination_address(CSocketAddressIPV4).address.address);
@ -51,7 +51,10 @@ U0 ChatServerBroadcast(CTCPSocket *tcp_socket, I64 length)
ip_string = NetworkToPresentation(AF_INET, &addr); ip_string = NetworkToPresentation(AF_INET, &addr);
// TODO: is NetworkToPresentation backwards? or, do socket addrs store BE or LE ? // TODO: is NetworkToPresentation backwards? or, do socket addrs store BE or LE ?
message_prefix = MStrPrint("$$BG,PURPLE$$$$BLACK$$<%s>$$FG$$$$BG$$ %%0%dts", ip_string, length); if (dest_socket == tcp_socket)
message_prefix = MStrPrint("$$BG,PURPLE$$$$BLACK$$<%s (you)>$$FG$$$$BG$$ %%0%dts", ip_string, length);
else
message_prefix = MStrPrint("$$BG,PURPLE$$$$BLACK$$<%s>$$FG$$$$BG$$ %%0%dts", ip_string, length);
message = MStrPrint(message_prefix, buffer); message = MStrPrint(message_prefix, buffer);

View file

@ -127,9 +127,11 @@ CARPHash *ARPCachePut(U32 ip_address, U8 *mac_address)
} }
U0 ARPLocalIPV4Set(U32 ip_address) U0 ARPLocalIPV4Set(U32 ip_address)
{ // takes in little endian IP, stores into globals as Big Endian { // takes in little endian IP, stores into arp_globals as Big Endian and into ARP cache as Little Endian
arp_globals.local_ipv4 = EndianU32(ip_address); arp_globals.local_ipv4 = EndianU32(ip_address);
ARPCachePut(ip_address, EthernetMACGet);
ARPSend(ARP_REPLY, ARPSend(ARP_REPLY,
ethernet_globals.ethernet_broadcast, ethernet_globals.ethernet_broadcast,
EthernetMACGet, EthernetMACGet,

View file

@ -1,8 +1,8 @@
class CEthernetFrame class CEthernetFrame
{ {
U8 source_address[6]; U8 source_address[MAC_ADDRESS_LENGTH];
U8 padding[2]; U8 padding[2];
U8 destination_address[6]; U8 destination_address[MAC_ADDRESS_LENGTH];
U16 ethertype; U16 ethertype;
U8 *data; U8 *data;
@ -12,32 +12,30 @@ class CEthernetFrame
class CEthernetGlobals class CEthernetGlobals
{ {
U8 ethernet_null[6]; U8 ethernet_null[MAC_ADDRESS_LENGTH];
U8 ethernet_broadcast[6]; U8 ethernet_broadcast[MAC_ADDRESS_LENGTH];
} ethernet_globals; } ethernet_globals;
U0 EthernetGlobalsInit() U0 EthernetGlobalsInit()
{ {
I64 i; I64 i;
for (i = 0; i < 6; i++) for (i = 0; i < MAC_ADDRESS_LENGTH; i++)
{ {
ethernet_globals.ethernet_null[i] = 0; ethernet_globals.ethernet_null[i] = 0;
ethernet_globals.ethernet_broadcast[i] = 0xFF; ethernet_globals.ethernet_broadcast[i] = 0xFF;
} }
} }
//TODO: check length , figure out the length+4
U0 EthernetFrameParse(CEthernetFrame *frame_out, U8 *frame, U16 length) U0 EthernetFrameParse(CEthernetFrame *frame_out, U8 *frame, U16 length)
{ {
//TODO: Check length ! We need to figure out what // length is assumed to NOT include the FCS.
//lengths are appropriate
//Shrine also says MemCopy has a // Shrine says MemCopy has a high overhead.
//high overhead. Almost tempted to say that means that a lot // Almost tempted to say that means that a lot
//of the current system should be done with less extra allocation // of the current system should be done with
//altogether, more passing. // less extra allocation altogether, more passing.
//In practice, MemCopy causes the most slowdown on bare-metal. // In practice, MemCopy causes the most slowdown on bare-metal.
NetLog("ETHERNET FRAME PARSE: Parsing frame, copying out to frame_out param."); NetLog("ETHERNET FRAME PARSE: Parsing frame, copying out to frame_out param.");
@ -49,7 +47,22 @@ U0 EthernetFrameParse(CEthernetFrame *frame_out, U8 *frame, U16 length)
frame_out->data = frame + ETHERNET_DATA_OFFSET; frame_out->data = frame + ETHERNET_DATA_OFFSET;
frame_out->length = length - ETHERNET_MAC_HEADER_LENGTH - 4; // He has a comment literally just saying "??". + or - 4? frame_out->length = length - ETHERNET_MAC_HEADER_LENGTH;
} }
EthernetGlobalsInit; U0 EthernetFrameFinish(I64 de_index)
{//Alias for generic driver Finish TX function.
U8 *data = NetDriverPacketBufferGet(de_index);
I64 length = NetDriverPacketLengthGet(de_index);
U8 *mac = EthernetMACGet();
Bool is_loopback = !MemCompare(mac, data, MAC_ADDRESS_LENGTH); // check the TX packet MAC against local MAC
// software loopback the TX packet to RX NetQueue if it's loopback
if (is_loopback)
NetQueueLazyPush(data, length);
NetDriverTransmitPacketFinish(de_index);
}
EthernetGlobalsInit;

View file

@ -5,11 +5,14 @@
#define ETHERNET_ETHERTYPE_OFFSET 12 #define ETHERNET_ETHERTYPE_OFFSET 12
#define ETHERNET_DATA_OFFSET 14 #define ETHERNET_DATA_OFFSET 14
#define MAC_ADDRESS_LENGTH 6 #define MAC_ADDRESS_LENGTH 6
#define FCS_LENGTH 4
/* Ethernet Frame Size. /* Ethernet Frame Size.
Linux uses 1544, OSDev and Shrine use 1548. Based on IEEE 802.3as, max frame size was agreed upon as 2000 bytes. */ Linux uses 1544, OSDev and Shrine use 1548. Based on IEEE 802.3as, max frame size was agreed upon as 2000 bytes. */
#define ETHERNET_FRAME_SIZE 2000 #define ETHERNET_FRAME_SIZE 2000
#define ETHERNET_v2_MTU 1500
#define HTYPE_ETHERNET 1 #define HTYPE_ETHERNET 1
#define HLEN_ETHERNET 6 #define HLEN_ETHERNET 6
#define PLEN_IPV4 4 #define PLEN_IPV4 4

View file

@ -37,6 +37,16 @@ U0 NetQueueEntryHandle(CNetQueueEntry *entry)
EthernetFrameParse(&ethernet_frame, entry->frame, entry->packet_length); EthernetFrameParse(&ethernet_frame, entry->frame, entry->packet_length);
U8 *mac = EthernetMACGet();
Bool is_our_mac = !MemCompare(mac, ethernet_frame.destination_address, MAC_ADDRESS_LENGTH); // check the RX packet MAC against local MAC
Bool is_broadcast = !MemCompare(ethernet_globals.ethernet_broadcast, ethernet_frame.destination_address, MAC_ADDRESS_LENGTH); // check the RX packet MAC against broadcast MAC
if (!is_our_mac && !is_broadcast)
{
NetLog("HANDLE NETQUEUE ENTRY: Not for us, discarding.");
return;
}
switch (ethernet_frame.ethertype) switch (ethernet_frame.ethertype)
{ {
case ETHERTYPE_ARP: case ETHERTYPE_ARP:

View file

@ -68,5 +68,32 @@ U0 NetQueuePush(U8 *data, I64 length)
MPInt(I_NETHANDLER, INT_DEST_CPU); MPInt(I_NETHANDLER, INT_DEST_CPU);
} }
U0 NetQueueLazyPull()
{
PUSHFD
CLI
if (net_queue->next != net_queue)
{
NetLog("NETQUEUE LAZY PULL: Generating NetHandler interrupt.");
MPInt(I_NETHANDLER, INT_DEST_CPU);
}
POPFD
}
U0 NetQueueLazyPush(U8 *data, I64 length)
{ // Push into NetQueue, don't trigger interrupt in this func.
// Trigger interrupt by Spawn-ing another Task to check queue.
CNetQueueEntry *entry = CAlloc(sizeof(CNetQueueEntry));
entry->packet_length = length;
MemCopy(entry->frame, data, length);
QueueInsert(entry, net_queue->last);
Spawn(&NetQueueLazyPull,, "NetQueueLazyPull");
}
NetQueueInit;
NetQueueInit;

View file

@ -110,6 +110,16 @@ Bool MyPutKey(I64 ch, I64 sc)
} }
return TRUE; return TRUE;
case SC_F12:
if (!(sc & SCF_SHIFT))
{
if (sc & SCF_KEY_DESC)
KeyDescSet("Cmd /SysLogToggle");
else
SysLogToggle;
}
return TRUE;
case SC_DELETE: case SC_DELETE:
if (sc & SCF_SHIFT) if (sc & SCF_SHIFT)
{ {

View file

@ -40,4 +40,4 @@ U0 StartUpTasks()
StartUpTasks; StartUpTasks;
"\nZealOS V%0.2f\t%D %T\n\n", sys_os_version, sys_compile_time, sys_compile_time; "\n%s\n\n", sys_os_version_nice;

View file

@ -286,6 +286,7 @@ I64 AHCIAtapiCapacityGet(CBlkDev *bd)
cmd_fis->type = FISt_H2D; cmd_fis->type = FISt_H2D;
PCIBts(&cmd_fis->desc, AHCI_CF_DESCf_C); //Set Command bit in H2D FIS. PCIBts(&cmd_fis->desc, AHCI_CF_DESCf_C); //Set Command bit in H2D FIS.
cmd_fis->command = ATA_PACKET; cmd_fis->command = ATA_PACKET;
cmd_fis->lba1 = 8;
cmd_table->acmd[0] = ATAPI_READ_CAPACITY >> 8; cmd_table->acmd[0] = ATAPI_READ_CAPACITY >> 8;
AHCIPortWait(bd->port_num, tS + 2); AHCIPortWait(bd->port_num, tS + 2);

View file

@ -47,9 +47,9 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
} }
else if (ch == '\n') else if (ch == '\n')
{ {
RawPutChar(CH_SPACE); do
while (text.raw_col % text.cols)
RawPutChar(CH_SPACE); RawPutChar(CH_SPACE);
while (text.raw_col % text.cols);
} }
else if (Bt(char_bmp_displayable, ch)) else if (Bt(char_bmp_displayable, ch))
{ {

View file

@ -1,18 +1,18 @@
public U64 sys_font_aux[256] = { public U64 sys_font_aux[256] = {
0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000,
0x000000FF00000000, 0x0000000000000000,
0x000000FF00FF0000, 0x0000000000000000,
0x1818181818181818, 0x0000000000000000,
0x6C6C6C6C6C6C6C6C, 0x0000000000000000,
0x181818F800000000, 0x0000000000000000,
0x6C6C6CEC0CFC0000, 0x0000000000000000,
0x1818181F00000000, 0x0000000000000000,
0x6C6C6C6F607F0000, 0x0000000000000000,
0x000000F818181818, 0x0000000000000000,
0x000000FC0CEC6C6C, 0x0000000000000000,
0x0000001F18181818, 0x0000000000000000,
0x0000007F606F6C6C, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000,

View file

@ -1,18 +1,18 @@
public U64 sys_font_std[256] = { public U64 sys_font_std[256] = {
0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000,
0x000000FF00000000, 0x0000000000000000,
0x000000FF00FF0000, 0x0000000000000000,
0x1818181818181818, 0x0000000000000000,
0x6C6C6C6C6C6C6C6C, 0x0000000000000000,
0x181818F800000000, 0x0000000000000000,
0x6C6C6CEC0CFC0000, 0x0000000000000000,
0x1818181F00000000, 0x0000000000000000,
0x6C6C6C6F607F0000, 0x0000000000000000,
0x000000F818181818, 0x0000000000000000,
0x000000FC0CEC6C6C, 0x0000000000000000,
0x0000001F18181818, 0x0000000000000000,
0x0000007F606F6C6C, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000,

View file

@ -504,6 +504,14 @@ I64 Sys(U8 *format, ...)
return res; return res;
} }
U0 SysLogToggle()
{
if (Bt(&sys_task->display_flags, DISPLAYf_SHOW))
LBtr(&sys_task->display_flags, DISPLAYf_SHOW);
else
LBts(&sys_task->display_flags, DISPLAYf_SHOW);
}
U0 SysLog(U8 *format, ...) U0 SysLog(U8 *format, ...)
{//Display text in sys_task. {//Display text in sys_task.
U8 *buf = StrPrintJoin(NULL, format, argc, argv); U8 *buf = StrPrintJoin(NULL, format, argc, argv);

View file

@ -14,6 +14,10 @@ U8 *rev_bits_table; //Table with U8 bits reversed
CDate local_time_offset; CDate local_time_offset;
F64 *pow10_I64, F64 *pow10_I64,
sys_os_version = 2.03; sys_os_version = 2.03;
U64 sys_os_version_sub = 117;
U8 *sys_os_version_str;
U8 *sys_os_version_full;
U8 *sys_os_version_nice;
CAutoCompleteDictGlobals acd; CAutoCompleteDictGlobals acd;
CAutoCompleteGlobals ac; CAutoCompleteGlobals ac;

View file

@ -152,7 +152,10 @@ U0 KMain()
//Before this point use $LK,"Sound",A="MN:Sound"$() and $LK,"Busy",A="MN:Busy"$() //Before this point use $LK,"Sound",A="MN:Sound"$() and $LK,"Busy",A="MN:Busy"$()
//to debug. After this point, use $LK,"RawPrint",A="MN:RawPrint"$() //to debug. After this point, use $LK,"RawPrint",A="MN:RawPrint"$()
LBts(&sys_run_level, RLf_RAW); LBts(&sys_run_level, RLf_RAW);
"\nZealOS V%0.2f\t%D %T\n", sys_os_version, sys_compile_time, sys_compile_time; sys_os_version_str = MStrPrint("ZealOS V%0.2f.%d", sys_os_version, sys_os_version_sub);
sys_os_version_nice = MStrPrint("%s\t%D %T\n", sys_os_version_str, sys_compile_time, sys_compile_time);
sys_os_version_full = MStrPrint("%s-%d.%d\n", sys_os_version_str, sys_compile_time.date, sys_compile_time.time);
"\n%s\n", sys_os_version_full;
"_________________________________\n\n"; "_________________________________\n\n";
"TimerInit;\n"; "TimerInit;\n";

View file

@ -780,7 +780,7 @@ class CSema
#define CTRL_ALT_DEL 0 #define CTRL_ALT_DEL 0
#define CTRL_ALT_C 1 #define CTRL_ALT_C 1
#define CTRL_ALT_X 2 #define CTRL_ALT_X 2
#define CTRL_ALT_TAB 3 #define CTRL_ALT_N 3
#help_index "Hash" #help_index "Hash"
public class CHash public class CHash

View file

@ -437,6 +437,7 @@ public extern I64 Scale2Mem(I64 min, I64 max, I64 limit=2*1024*1024*1024);
public extern U0 SysErr( U8 *format, ...); public extern U0 SysErr( U8 *format, ...);
public extern U0 SysWarn(U8 *format, ...); public extern U0 SysWarn(U8 *format, ...);
public extern U0 SysLog( U8 *format, ...); public extern U0 SysLog( U8 *format, ...);
public extern U0 SysLogToggle();
public extern I64 ExeCmdLine(CCompCtrl *cc); public extern I64 ExeCmdLine(CCompCtrl *cc);
public extern U0 JobDel(CJob *tmpc); public extern U0 JobDel(CJob *tmpc);
public extern I64 JobsHandler(I64 run_flags, CTask *task=NULL); public extern I64 JobsHandler(I64 run_flags, CTask *task=NULL);
@ -581,6 +582,10 @@ public extern I64 MessageScan(I64 *_arg1=NULL, I64 *_arg2=NULL, I64 mask=~1, CTa
public extern U0 QuickSort( U8 *base, I64 num, I64 width, I64 (*fp_compare)(U8 *e1, U8 *e2)); public extern U0 QuickSort( U8 *base, I64 num, I64 width, I64 (*fp_compare)(U8 *e1, U8 *e2));
public extern U0 QuickSortI64(I64 *base, I64 num, I64 (*fp_compare)(I64 e1, I64 e2)); public extern U0 QuickSortI64(I64 *base, I64 num, I64 (*fp_compare)(I64 e1, I64 e2));
public extern F64 sys_os_version; public extern F64 sys_os_version;
public extern U64 sys_os_version_sub;
public extern U8 *sys_os_version_str;
public extern U8 *sys_os_version_full;
public extern U8 *sys_os_version_nice;
#help_index "Misc/Progress Bars" #help_index "Misc/Progress Bars"
public extern U0 ProgressBarsReset(U8 *path=NULL); public extern U0 ProgressBarsReset(U8 *path=NULL);

View file

@ -179,7 +179,7 @@ U0 CtrlAltM(I64)
U0 CtrlAltN(I64) U0 CtrlAltN(I64)
{ {
LBts(sys_ctrl_alt_flags, CTRL_ALT_TAB); LBts(sys_ctrl_alt_flags, CTRL_ALT_N);
} }
U0 CtrlAltT(I64) U0 CtrlAltT(I64)

View file

@ -176,7 +176,7 @@ _YIELD::
MOV RSI, U64 CTask.next_task[RSI] MOV RSI, U64 CTask.next_task[RSI]
RESTORE_RSI_TASK: RESTORE_RSI_TASK:
TEST U64 [SYS_CTRL_ALT_FLAGS], 1 << CTRL_ALT_DEL|1 << CTRL_ALT_TAB|1 << CTRL_ALT_X|1 << CTRL_ALT_C TEST U64 [SYS_CTRL_ALT_FLAGS], 1 << CTRL_ALT_DEL | 1 << CTRL_ALT_N | 1 << CTRL_ALT_X | 1 << CTRL_ALT_C
JNZ HANDLE_SYSF_KEY_EVENT JNZ HANDLE_SYSF_KEY_EVENT
RESTORE_RSI_TASK2: RESTORE_RSI_TASK2:
@ -230,7 +230,7 @@ HANDLE_SYSF_KEY_EVENT:
JE RESTORE_EXECUTIVE_TASK_IF_READY JE RESTORE_EXECUTIVE_TASK_IF_READY
LOCK LOCK
BTR U32 [RAX], CTRL_ALT_TAB BTR U32 [RAX], CTRL_ALT_N
JNC @@05 JNC @@05
CALL &TaskFocusNext CALL &TaskFocusNext
JMP I32 RESTORE_FS_TASK JMP I32 RESTORE_FS_TASK

View file

@ -421,12 +421,7 @@ U0 KbdBuildSC(U8 raw_byte, Bool in_irq, U8 *_last_raw_byte, I64 *_last_sc)
CtrlAltDel(sc); CtrlAltDel(sc);
else else
{ {
if (sc & 255 == SC_ESC) ch = ScanCode2Char(sc & 255);
ch = 't';
else if (sc & 255 == SC_TAB)
ch = 'n';
else
ch = ScanCode2Char(sc & 255);
if ('a' <= ch <= 'z') if ('a' <= ch <= 'z')
{ {
sc &= ~(SCF_NEW_KEY | SCF_NEW_KEY << 32); sc &= ~(SCF_NEW_KEY | SCF_NEW_KEY << 32);

View file

@ -242,7 +242,7 @@ and take address.
*/ */
U8 *buf, *ptr, **pptr; U8 *buf, *ptr, **pptr;
Bool left_justify = FALSE; Bool left_justify = FALSE;
I64 ch, cur_arg = 0, i, len, *i_ptr, dec_len; I64 ch, cur_arg = 0, len, *i_ptr, dec_len;
F64 *d_ptr; F64 *d_ptr;
if (!format) if (!format)
@ -301,9 +301,9 @@ and take address.
} }
} }
buf = MAlloc(len + 1); buf = MAlloc(len + 1);
for (i = 0; i < len; i++) MemCopy(buf, src, len);
buf[i] = *src++; buf[len] = 0;
buf[i] = 0; src += len;
switch (ch) switch (ch)
{ {
case 's': case 's':

Binary file not shown.

View file

@ -78,7 +78,7 @@ U0 RedSeaISO9660(U8 *iso_filename, U8 drv_let)
iso_pri->file_structure_version = 1; iso_pri->file_structure_version = 1;
StrCopy(iso_pri->publisher_id, "ZealOS RedSea"); StrCopy(iso_pri->publisher_id, "ZealOS RedSea");
st = MStrPrint("ZealOS V%0.2f %D %T", sys_os_version, Now, Now); st = MStrPrint("%s %D %T", sys_os_version_str, Now, Now);
StrCopy(iso_pri->preparer_id, st); StrCopy(iso_pri->preparer_id, st);
Free(st); Free(st);

View file

@ -4,7 +4,7 @@ U0 LoadDocDefines()
{ {
CZXE *zxe = mem_boot_base - sizeof(CZXE); CZXE *zxe = mem_boot_base - sizeof(CZXE);
DefinePrint("DD_OS_NAME_VERSION", "ZealOS V%0.2f", sys_os_version); DefinePrint("DD_OS_NAME_VERSION", sys_os_version_str);
DefinePrint("DD_ZEALOS_AGE", "%0.1f", (Now - Str2Date("9/1/2019")) / ToF64(1 << 32) / CDATE_YEAR_DAYS); DefinePrint("DD_ZEALOS_AGE", "%0.1f", (Now - Str2Date("9/1/2019")) / ToF64(1 << 32) / CDATE_YEAR_DAYS);
DefinePrint("DD_TEMPLEOS_AGE", "%0.1f", (Str2Date("8/11/2018") - Str2Date("8/1/2003")) / ToF64(1 << 32) / CDATE_YEAR_DAYS); DefinePrint("DD_TEMPLEOS_AGE", "%0.1f", (Str2Date("8/11/2018") - Str2Date("8/1/2003")) / ToF64(1 << 32) / CDATE_YEAR_DAYS);
@ -15,7 +15,7 @@ U0 LoadDocDefines()
//$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/System/Boot/BootDVD.ZC,DD_BOOT_HIGH_LOC_DVD"$ //$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/System/Boot/BootDVD.ZC,DD_BOOT_HIGH_LOC_DVD"$
$TR,"LineRep"$ $TR,"LineRep"$
$ID,2$DefinePrint("DD_ZEALOS_LOC","98,756"); $ID,2$DefinePrint("DD_ZEALOS_LOC","99,737");
$ID,-2$ $ID,-2$
DefinePrint("DD_MP_VECT", "%08X", MP_VECT_ADDR); 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); DefinePrint("DD_MP_VECT_END", "%08X", MP_VECT_ADDR + COREAP_16BIT_INIT_END - COREAP_16BIT_INIT - 1);

View file

@ -137,11 +137,11 @@ public U0 DocClear(CDoc *doc=NULL, Bool clear_holds=FALSE)
{//Clear all doc entries, except +H, hold entries. {//Clear all doc entries, except +H, hold entries.
Bool unlock; Bool unlock;
text.raw_col = 0;
if (!doc && !(doc = DocPut)) if (!doc && !(doc = DocPut))
{ {
if (IsRaw) if (IsRaw)
{ {
text.raw_col = 0;
MemSet(text.fb_alias, BLACK32, text.buffer_size); MemSet(text.fb_alias, BLACK32, text.buffer_size);
} }
return; return;

2
src/System/God/GodDoodle.ZC Normal file → Executable file
View file

@ -129,7 +129,7 @@ public U8 *GodDoodleSprite(U8 *hex = NULL)
WinMax; WinMax;
if (!hex) if (!hex)
PopUpOk("The $LK+PU,"Holy Spirit ",A="FI::: /Adam/God / HSNotes.DD "$ can puppet you.\n\n" PopUpOk("The $LK+PU,"Holy Spirit ",A="FI::: /Adam/God / HSNotes.DD "$ can puppet you.\n\n"
"Press $$GREEN$$<SPACE>$$FG$$ until it finishes."); "Press $$GREEN$$<SPACE>$$FG$$ until it finishes.");
god.doodle_ch = 0; god.doodle_ch = 0;

View file

@ -51,10 +51,6 @@ U0 KeyMapCtrlAltFamily(Bool no_shift, Bool shift)
no_shift_f = 0; no_shift_f = 0;
if (no_shift) if (no_shift)
KeyMapKeyPrint(SC_DELETE + SCF_CTRL + SCF_ALT + no_shift_f, &Reboot, "Cmd /Reboot"); KeyMapKeyPrint(SC_DELETE + SCF_CTRL + SCF_ALT + no_shift_f, &Reboot, "Cmd /Reboot");
if (no_shift)
KeyMapKeyPrint(SC_ESC + SCF_CTRL + SCF_ALT + no_shift_f, &User, "Cmd /Terminal Window");
if (no_shift)
KeyMapKeyPrint(SC_TAB + SCF_CTRL + SCF_ALT + no_shift_f, &WinToTop, "Cmd /Next Focus Task");
for (i = 0; i < 26; i++) for (i = 0; i < 26; i++)
if (keydev.fp_ctrl_alt_cbs[i]) if (keydev.fp_ctrl_alt_cbs[i])

Binary file not shown.