mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-10 13:11:50 +09:00
mock splash screen for the portable
This commit is contained in:
68
assets/bios/tandemport.js
Normal file
68
assets/bios/tandemport.js
Normal file
@@ -0,0 +1,68 @@
|
||||
con.curs_set(0)
|
||||
con.clear()
|
||||
let t=`${system.maxmem()>>>10} Kbytes System`
|
||||
// 0b_HL where H is top pixel
|
||||
// H-bits
|
||||
let imgh = [
|
||||
[252,0,3,0,0],
|
||||
[48,0,3,0,0],
|
||||
[51,239,191,102,255],
|
||||
[51,237,191,66,219],
|
||||
[52,45,161,126,219],
|
||||
[54,109,179,124,219]];
|
||||
// L-bits
|
||||
let imgl = [
|
||||
[252,0,3,0,0],
|
||||
[51,207,31,60,254],
|
||||
[48,109,191,66,219],
|
||||
[54,109,179,102,219],
|
||||
[52,45,161,96,219],
|
||||
[51,237,159,60,219]];
|
||||
let imgc = [32,220,223,219]
|
||||
for (let y=0;y<imgh.length;y++) {
|
||||
for (let x=0;x<imgh[0].length;x++) {
|
||||
for (let b=7;b>=0;b--) {
|
||||
con.mvaddch(y+1,1+x*8+7-b,imgc[(imgh[y][x]>>b&1)<<1|imgl[y][x]>>b&1])
|
||||
}}}
|
||||
con.move(8,1+(40-t.length>>1))
|
||||
print(t)
|
||||
// wait arbitrary time
|
||||
for (let b=0;b<system.maxmem()*10;b++) {
|
||||
sys.poke(0,(Math.random()*255)|0)
|
||||
sys.poke(0,0)
|
||||
}
|
||||
con.clear();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// probe bootable device
|
||||
|
||||
var _BIOS = {};
|
||||
|
||||
// Syntax: [Port, Drive-number]
|
||||
// Port #0-3: Serial port 1-4
|
||||
// #4+ : Left for future extension
|
||||
// Drive-number always starts at 1
|
||||
_BIOS.FIRST_BOOTABLE_PORT = [0,1]; // ah screw it
|
||||
|
||||
Object.freeze(_BIOS);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// load a bootsector using 'LOADBOOT'
|
||||
let portNumber = 0;
|
||||
let driveStatus = 0;
|
||||
while (portNumber < 4) {
|
||||
if (com.areYouThere(portNumber)) {
|
||||
com.sendMessage(portNumber, "LOADBOOT");
|
||||
driveStatus = com.getStatusCode(portNumber);
|
||||
if (driveStatus == 0) break;
|
||||
}
|
||||
portNumber += 1;
|
||||
}
|
||||
if (portNumber < 4) {
|
||||
eval(com.fetchResponse(portNumber).trimNull());
|
||||
}
|
||||
else {
|
||||
printerrln("No bootable medium found.");
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class AppLoader {
|
||||
// val vm = VM(64.kB(), TheRealWorld(), arrayOf(GenericBios))
|
||||
//VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{BasicBios.INSTANCE, BasicRom.INSTANCE});
|
||||
//VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{OEMBios.INSTANCE, BasicRom.INSTANCE});
|
||||
VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{QuickBios.INSTANCE, BasicRom.INSTANCE});
|
||||
VM vm = new VM(32 << 10, new TheRealWorld(), new VMProgramRom[]{TandemBios.INSTANCE, BasicRom.INSTANCE});
|
||||
//VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{TBASRelBios.INSTANCE});
|
||||
|
||||
EmulInstance reference = new EmulInstance(appConfig, vm, "net.torvald.tsvm.peripheral.ReferenceGraphicsAdapter", "assets/disk0");
|
||||
|
||||
@@ -68,6 +68,25 @@ object BasicBios : VMProgramRom {
|
||||
override fun get(addr: Int): Byte = contents[addr]
|
||||
}
|
||||
|
||||
object TandemBios : VMProgramRom {
|
||||
private val contents: ByteArray
|
||||
|
||||
init {
|
||||
val bytes = File("./assets/bios/tandemport.js").readBytes()
|
||||
contents = bytes.sliceArray(0 until minOf(65536, bytes.size))
|
||||
}
|
||||
|
||||
override fun readAll(): String {
|
||||
// check if bios is compressed in gzip
|
||||
return if (contents.startsWith(GZIP_HEADER))
|
||||
CompressorDelegate.decomp(contents).toString(VM.CHARSET)
|
||||
else
|
||||
contents.toString(VM.CHARSET)
|
||||
}
|
||||
|
||||
override fun get(addr: Int): Byte = contents[addr]
|
||||
}
|
||||
|
||||
object BasicRom : VMProgramRom {
|
||||
private val contents: ByteArray
|
||||
|
||||
|
||||
Reference in New Issue
Block a user