# Emulating Collapse OS within Dusk

Dusk OS has units to conveniently run Collapse OS under one of its emulators.
This is useful for testing both the emulator and Collapse OS' boot code for
this architecture.

These convenient environments are in the /cos/ directory. For example, if you
want to emulate the 6502 Collapse OS, you would load /cos/6502.fs.

These machines are built upon the VirtIO struct, about which you should read
at doc/emul/virtio.

Meanwhile, here's an example usage:

f<< /cos/6502.fs
...
Collapse OS ready to launch
" 2 3 + .\r" vio :puts vio :flush cpu :run
Collapse OS ok
2 3 + .
5 ok
 ok
42 " I'm in Dusk and the proof is %d\n" console :printf
I'm in Dusk and the proof is 42
 ok
vio :enter
: foo ." Now I'm in Collapse OS. proof: \n unparsed" ;
 ok
foo
Now I'm in Collapse OS. proof: \n unparsed ok
bye
 ok
." back to Dusk!\n"
back to Dusk!
 ok
