rendered paste bodyDATA;
alloc keyboard;
alloc cursor,65636;
alloc keymem;
alloc memstring;
alloc memstringf;
alloc previewstart;
alloc memstringl;
loaded:
db 'OS loaded succesfully.',0;
keyboardcon:
db 'Keyboard found. Port number: ',0;
error:
db 'Error. Program Terminated.',0;
Loading:
db 'Booting...',0;
Terminated:
db 'Program Terminated.',0;
cWrite:
mov eax,#cursor;
mov #eax,35;
inc eax;
mov #eax,999090;
inc eax;
WriteLoop:
cmp #esi,0;
je Wend;
mov #eax,#esi;
inc eax;
mov #eax,edx;
inc eax;
inc esi;
jmp WriteLoop;
Wend:
call cNewLine;
ret
cWriteChar:
mov eax,#cursor;
mov #eax,#ebx;
inc eax;
mov #eax,edx;
inc eax;
add #cursor,2;
ret
cNewLine:
add #cursor,60;
ret
cKeyScan:
KReadloop:
mov ecx,#keyboard;
cmp #ecx,0;
je Kend;
mov #memstring,#ecx;
inc memstring;
inc #memstringl;
//mov #ecx,#ecx;
Kend:
ret
cPreview:
mov edx,000999;
mov esi,memstringf;
mov eax,#previewstart;
mov #ecx,0;
mov #eax,35;
inc #eax;
mov #eax,000119;
inc #eax;
PrevLoop:
cmp #ecx,#memstringl;
je Pend;
mov #eax,#esi;
inc #eax;
inc esi;
mov #eax,edx;
inc esi;
inc #eax;
inc #ecx;
jmp PrevLoop;
Pend:
ret
cClearKeyBuff:
mov #ecx,0;
mov eax,#memstringf;
ClearLoop:
cmp #ecx,#memstringl;
jge Cend;
mov #eax,0;
inc eax;
inc #ecx;
jmp ClearLoop;
Cend:
ret
CODE;
Boot:
mov esi,Loading;
mov edx,000090;
call cWrite;
jmp Scan;
Load:
mov #memstringl,0;
mov memstringf,memstring;
mov esi,loaded;
mov edx,000090;
call cWrite;
jmp OS;
OS:
mov #previewstart,#cursor;
call cKeyScan;
jmp KeyWrite;
KeyWrite:
call cPreview;
// call cClearKeyBuff;
jmp OS;
Scan:
mov esi,keyboardcon;
mov edx,000090;
call cWrite;
mov #ebx,49;
mov edx,000339;
// call cWriteChar;
call cNewLine;
mov #keyboard,65537;
mov #keymem,55000;
jmp Load;
Terminate:
mov esi,Terminated;
mov edx,900999;
add #cursor,60;
call cWrite;