Muos: Beginnings
18|10|09
The first little part of the Muos (µos) bootloader is working. So, here you go.
[org 0x7C00]Of course, I don't advocate copying/running code from the internet and hoping for the best. Especially since this code is pretty much as low-level as it get's. This could really **** up your computer (<- warranty). This basically loads a pure binary file from the 2nd sector on a floppy disk. Pure binary doesn't include c or almost anything except assembly. For example,
[bits 16]
;--------------------------------------------
main:
; reset disk
mov ah, 0x00 ; reset function
mov dl, 0x00 ; drive
int 0x13 ; disk int
; read disk
mov bx, 0x8000 ; segment
mov es, bx
mov bx, 0x0000 ; offset
mov ah, 0x02 ; read function
mov al, 0x03 ; sectors
mov ch, 0x00 ; cylinder
mov cl, 0x02 ; sector
mov dh, 0x00 ; head
mov dl, 0x00 ; drive
int 0x13 ; disk int
; run kernel (0x0000:0x8000)
jmp word 0x8000:0x0000
;--------------------------------------------
times 510 - ($ - $$) db 0x00
db 0x55, 0xAA
[org 0x8000]This is pretty easy to compile using NASM, although here's how I do it
[bits 16]
;--------------------------------------------
main:
mov ah, 0x0E ; print function
mov al, '.' ; ascii char
int 0x10 ; IO int
jmp $
@echo offThis relies on you having
2>NUL del muos.img
2>NUL del boot.bin
2>NUL del load.bin
nasm boot.asm -f bin -o boot.bin 2>>err.txt
nasm load.asm -f bin -o load.bin 2>>err.txt
2>NUL dd if=boot.bin of=muos.img
2>NUL dd if=load.bin of=muos.img bs=512 seek=1
2>NUL del boot.bin
2>NUL del load.bin
2>NUL dd if=muos.img of=\\.\a:
od muos.img -t x1
type err.txt
2>NUL del err.txt
2>NUL qemu -fda \\.\a: -boot a
- Gnu tools
- qemu
- NASM
Writing An OS
21|9|09
Work has completley stopped on the site and any bugs won't be fixed now because I've moved away from web programming into low-level system programming such as writing an OS. My OS is called MuOS because it is a µ OS and µ is pronounced Mu so Mu+OS. I haven't yet hosted a site for it but sometime soon it should appear on here
The main reason for building an OS is that I don't like either linux or windows much (and macs are too expensive ;). The aims of MuOS are:
- cuztomisability
- extensibility
- lightweightility (no bloatware, adware, malware)
A few places to start learning assembly or C are:
Some useful tools for OS dev on Windows include:The Status Of np labs
31|8|09
As you probably know, I haven't posted for about a month. This is mainly because the site is in quite desperate need of renovation. And now, I've become less interested in advancing the physics engine
The problem with the physics engine is that I can't find the right form of equation that makes it easy to manipulate the variables to change the shape of it's graph. I'm thinking of maybe polynomials of degree 5-7 but this is a wild guess and I've got no idea.
Also, I'm becoming less interested in web-dev in general and have started learning c/c++ and assembly. Hopefully this will lead to an OS (operating system). I'm doing well with this so far and should be able to post some links/tutorials/code pretty soon (don't hold me to that ;) ). The OS is called muos (there's probably 100's called that) and Is at a very early stage. If anyone would like the source for the physics engine or anything from the server just ask.
So, the message is that np labs is becoming an OS dev/low level blog and discontinuing any more physics posts (although I'm not ruling out flash).
Interesting AS3 Functionality
17|7|09
I just noticed some interesting functionality in AS3 (although it should work in all languages that support function references). To explain, I'll start with an example
var obj = {r:Math.random()};If we reference this objects' property, we get the same number every time we reference it. But, if we remove the brackets from the 'Math.random()' which instead of referencing the output of the function, references the function itself. So, when we reference the object we reference it like line #2 instead of like line #1.
trace(obj.r)We have to use the brackets on the second version because it is actually a function. So whenever we reference the second type, it gives us a different number every time. Go ahead and try it out with other functions, it will work with any function at all.
trace(obj.r())
Update To css.js
25|5|09
Object.prototype.$ = function (s) {
c=(this==window)?document:this;
t=/[.#]/.exec(s);
v=/[^.#]+/.exec(s);
if(!t){
return c.getElementsByTagName(v);
}else if (t == '#') {
return c.getElementById(v);
}else if(t == '.'){
return([].slice.call(c.getElementsByTagName('*'))).filter(function(e){
return(e.className==v);
});
};
};