The Vesp kernel is assumed to be stored in locations 0x1000 through 0x11FF. It will be copied into RAM blocks 0x0700 and 0x0800. We will
use the MXF and MXT instructions to do the copying. Since we have only one index register, we must load and save the running addresses for
the Hard disk and RAM in and out of the IX register. The following assignments of locations and registers are in effect in the current version
of Vesp 2.1 which incorporates the kernel loading part into the bootstrapping. The actual bootstrap code follows after the memory map.
/* Vesp Memory Map (Subject to Further Revision)
------------------------------------------------
Memory[0x000]--A |
Memory[0x001]--B |
Memory[0x002]--IX |
Memory[0x003]--VAR |
-Bootstrap code begins here | Block 0
Memory[0x008]----cursor position -x |
Memory[0x009]----cursor-position -y |
Memory[0x00A]----pixel color (or ASCII code) |
Memory[0x00B]----display mode |
Memory[0x00C]----pixel pattern(when not ASCII) |
Memory[0x00D]----space |
Memory[0x00E]----carriage return |
Memory[0x00F]----temp |
|
Memory[0x020]----boot-vector begins here |
------------------------------------------------
Memory[0x100]------Keyboard driver and ASCII |
Memory[0x101]------tables are stored here |
|
|
Memory[0x2FF] | Blocks 1,2 (Keyboard input driver)
|
|
|
|
|
|
------------------------------------------------
Memory[0x300]------Frame buffer (video) and |
Memory[0x301]------video drivers are |
Memory[0x302]------ stored here |
|
|
Memory[0x6FF]------ |
|
|
| Blocks 3,4,5,6 (Screen output)
| 16x64 screen = 2^10 (1024 locations)
|
|
|
------------------------------------------------
Memory[0x700]------VESP Kernel Code |
Memory[0x701]------OS routines and code |
Memory[0x8FF]------ |
|
| Blocks 7,8 Operating System (Kernel)
|
|
|
|
------------------------------------------------
Memory[0x900]------User space -1 |
|
|
|
------------------------------------------------
|
Memory[0xA00]------User space -2 |
|
|
------------------------------------------------
|
Memory[0xB00]------User space -3 |
|
| Block 9 through 15 User space
------------------------------------------------
| (application and user programs)
Memory[0xC00]------User space -4 |
|
|
------------------------------------------------
|
Memory[0xD00]------User space -5 |
|
|
------------------------------------------------
------------------------------------------------
|
Memory[0xE00]------User space -6 |
|
|
------------------------------------------------
------------------------------------------------
|
Memory[0xF00]------User space -7 |
|
|
------------------------------------------------
*/
//vesp's boot code begins at location 0x0020.
// When vesp starts, it will first load the boot code from vesp.Bootsrap into vesp.MEMORY[0x0020-..]
//Boot code will
//1- clear the screen
//2- write "vesp is booting..." into the frame buffer
//3- load kernel into memory blocks 7 and 8
//4- insert an artificial delay
//5- load "vesp:" into the framebuffer
//6- blink a cursor for command entry.
// initialize the screen variables
vesp.BOOTSTRAP[0] = 0x2008; vesp.BOOTSTRAP[1] = 0x0000; // Clear location 8 (cursor-x) //020-021
vesp.BOOTSTRAP[2] = 0x2009; vesp.BOOTSTRAP[3] = 0x0000; // Clear location 9 (cursor-y) //022-023
vesp.BOOTSTRAP[4] = 0x200A; vesp.BOOTSTRAP[5] = 0x000F; // Set location A (pixel color) //024-025
vesp.BOOTSTRAP[6] = 0x200B; vesp.BOOTSTRAP[7] = 0x0000; // Set display mode (ASCII) //026-027
vesp.BOOTSTRAP[8] = 0x200C; vesp.BOOTSTRAP[9] = 0x002B; // Set pixel symbol ('+' sign) //028-029
// clear the frame buffer (insert white space)
vesp.BOOTSTRAP[10] = 0x2002; vesp.BOOTSTRAP[11] = 0x0300; // Load IX with 0x300 //02A-02B
vesp.BOOTSTRAP[12] = 0x2000; vesp.BOOTSTRAP[13] = 0x0400; // Load 0x400 into A //02C-02D
vesp.BOOTSTRAP[14] = 0x2008; vesp.BOOTSTRAP[15] = 0x0020; // Load space into location 0x008 //02E-02F
vesp.BOOTSTRAP[16] = 0x5034; vesp.BOOTSTRAP[17] = 0xF008; // If A is 0 then jump out of the loop //030-031
// Load space into the next framebuffer location
vesp.BOOTSTRAP[18] = 0x9000; // Decrement A //032
vesp.BOOTSTRAP[19] = 0x4030; // Loop back to check if A is 0 //033
// insert a carriage return at the end of each line
vesp.BOOTSTRAP[20] = 0x2002; vesp.BOOTSTRAP[21] = 0x033F; // Load IX with 0x033F //034-035
vesp.BOOTSTRAP[22] = 0x2000; vesp.BOOTSTRAP[23] = 0x0010; // Load 0x0010 into A //036-037
vesp.BOOTSTRAP[24] = 0x2009; vesp.BOOTSTRAP[25] = '\n'; // Load carriage ret into location 0x009 //038-039
// The location for carriage return is vesp.MEMORY[9].
vesp.BOOTSTRAP[26] = 0x2001; vesp.BOOTSTRAP[27] = 0x003F; // load B with 63 //03A-03B
vesp.BOOTSTRAP[28] = 0x5049; vesp.BOOTSTRAP[29] = 0xF009; // If A is 0 then jump out of the loop //03C-03D
// Load carriage return into the next framebuffer location
vesp.BOOTSTRAP[30] = 0x9000; // Decrement A //03E
vesp.BOOTSTRAP[31] = 0x300A; vesp.BOOTSTRAP[32] = 0x0000; // save A into temp [0x00A] //03F-040
vesp.BOOTSTRAP[33] = 0x3000; vesp.BOOTSTRAP[34] = 0x0002; // copy IX into A //041-042
vesp.BOOTSTRAP[35] = 0x0000; // add //043
vesp.BOOTSTRAP[36] = 0x3002; vesp.BOOTSTRAP[37] = 0x0000; // save A into IX //044-045
vesp.BOOTSTRAP[38] = 0x3000; vesp.BOOTSTRAP[39] = 0x000A; // Restore A from temp //046-047
vesp.BOOTSTRAP[40] = 0x403C; // Loop back to check if A is 0 //048
// write the message "vesp is booting..."
vesp.BOOTSTRAP[41] = 0x2300; vesp.BOOTSTRAP[42] = 0x0076; // write v //049-04A
vesp.BOOTSTRAP[43] = 0x2301; vesp.BOOTSTRAP[44] = 0x0065; // write e //04B-04C
vesp.BOOTSTRAP[45] = 0x2302; vesp.BOOTSTRAP[46] = 0x0073; // write s //04D-04E
vesp.BOOTSTRAP[47] = 0x2303; vesp.BOOTSTRAP[48] = 0x0070; // write p //04F-050
vesp.BOOTSTRAP[49] = 0x2304; vesp.BOOTSTRAP[50] = 0x0020; // write ' ' //051-052
vesp.BOOTSTRAP[51] = 0x2305; vesp.BOOTSTRAP[52] = 0x0069; // write i //053-054
vesp.BOOTSTRAP[53] = 0x2306; vesp.BOOTSTRAP[54] = 0x0073; // write s //055-056
vesp.BOOTSTRAP[55] = 0x2307; vesp.BOOTSTRAP[56] = 0x0020; // write ' ' //057-058
vesp.BOOTSTRAP[57] = 0x2308; vesp.BOOTSTRAP[58] = 0x0062; // write b //059-05A
vesp.BOOTSTRAP[59] = 0x2309; vesp.BOOTSTRAP[60] = 0x006F; // write o //05B-05C
vesp.BOOTSTRAP[61] = 0x230A; vesp.BOOTSTRAP[62] = 0x006F; // write o //05D-05E
vesp.BOOTSTRAP[63] = 0x230B; vesp.BOOTSTRAP[64] = 0x0074; // write t //05F-060
vesp.BOOTSTRAP[65] = 0x230C; vesp.BOOTSTRAP[66] = 0x0069; // write i //061-062
vesp.BOOTSTRAP[67] = 0x230D; vesp.BOOTSTRAP[68] = 0x006E; // write n //063-064
vesp.BOOTSTRAP[69] = 0x230E; vesp.BOOTSTRAP[70] = 0x0067; // write g //065-066
vesp.BOOTSTRAP[71] = 0x230F; vesp.BOOTSTRAP[72] = 0x002E; // write . //067-068
vesp.BOOTSTRAP[73] = 0x2310; vesp.BOOTSTRAP[74] = 0x002E; // write . //069-06A
vesp.BOOTSTRAP[75] = 0x2311; vesp.BOOTSTRAP[76] = 0x002E; // write . //06B-06C
// display the prompt: "loading kernel:"
vesp.BOOTSTRAP[77] = 0x2340; vesp.BOOTSTRAP[78] = 0x006C; // write l //06D-06E
vesp.BOOTSTRAP[79] = 0x2341; vesp.BOOTSTRAP[80] = 0x006F; // write o //06F-070
vesp.BOOTSTRAP[81] = 0x2342; vesp.BOOTSTRAP[82] = 0x0061; // write a //071-071
vesp.BOOTSTRAP[83] = 0x2343; vesp.BOOTSTRAP[84] = 0x0064; // write d //072-073
vesp.BOOTSTRAP[85] = 0x2344; vesp.BOOTSTRAP[86] = 0x0069; // write i //074-075
vesp.BOOTSTRAP[87] = 0x2345; vesp.BOOTSTRAP[88] = 0x006E; // write n //076-077
vesp.BOOTSTRAP[89] = 0x2346; vesp.BOOTSTRAP[90] = 0x0067; // write g //078-079
vesp.BOOTSTRAP[91] = 0x2347; vesp.BOOTSTRAP[92] = 0x0020; // write ' ' //07A-07B
vesp.BOOTSTRAP[93] = 0x2348; vesp.BOOTSTRAP[94] = 0x006B; // write k //07C-07D
vesp.BOOTSTRAP[95] = 0x2349; vesp.BOOTSTRAP[96] = 0x0065; // write e //07E-07F
vesp.BOOTSTRAP[97] = 0x234A; vesp.BOOTSTRAP[98] = 0x0072; // write r //080-081
vesp.BOOTSTRAP[99] = 0x234B; vesp.BOOTSTRAP[100]= 0x006E; // write n //082-083
vesp.BOOTSTRAP[101]= 0x234C; vesp.BOOTSTRAP[102]= 0x0065; // write e //084-085
vesp.BOOTSTRAP[103]= 0x234D; vesp.BOOTSTRAP[104]= 0x006C; // write l //086-087
vesp.BOOTSTRAP[105]= 0x234E; vesp.BOOTSTRAP[106]= 0x002E; // . //088-089
vesp.BOOTSTRAP[107]= 0x234F; vesp.BOOTSTRAP[108]= 0x002E; // . //08A-08B
// Load the kernel from vesp.HDISK[1000-11FF] into vesp.MEMORY[0700-08FF]
vesp.BOOTSTRAP[109]=0x2002; vesp.BOOTSTRAP[110]= 0x1000; // Load IX with 0x1000 //08C-08D
vesp.BOOTSTRAP[111]=0x2007; vesp.BOOTSTRAP[112]= 0x0700; // Load loc.7 with 0x0700 //08E-08F
vesp.BOOTSTRAP[113]=0x2000; vesp.BOOTSTRAP[114] = 0x0200; // Load 0x200 into A //090-091
vesp.BOOTSTRAP[115]=0x2003; vesp.BOOTSTRAP[116] = 0x0000; // Load 0 into location 0x003 //092-093
vesp.BOOTSTRAP[117]=0x50A1; vesp.BOOTSTRAP[118] = 0xE001; // If A is 0 then jump out of the loop //094-095
// Move the next instruction into B
vesp.BOOTSTRAP[119]=0x3006; vesp.BOOTSTRAP[120]= 0x0002; // Save IX (the address in HDISK) //096-097
vesp.BOOTSTRAP[121]=0x3002; vesp.BOOTSTRAP[122]= 0x0007; // Load address in kernel frame into IX //098-099
vesp.BOOTSTRAP[123]=0xF001; // move next instruction into kernel frame //09A
vesp.BOOTSTRAP[124]=0x3007; vesp.BOOTSTRAP[125]= 0x0002; // Save IX(the address in kernel frame) //09B-09C
vesp.BOOTSTRAP[126]=0x3002; vesp.BOOTSTRAP[127]= 0x0006; // Restore IX (the address in HDISK) //09D-09E
vesp.BOOTSTRAP[128]=0x9000; // Decrement A //09F
vesp.BOOTSTRAP[129]=0x4095; // Loop back to check if A is 0 //0A0
vesp.BOOTSTRAP[130]=0x7000; // Hallt will be replaced once the kernel code is implemented. //0A1
|