X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=fifth.git;a=blobdiff_plain;f=doc%2Femulator.html;fp=doc%2Femulator.html;h=0000000000000000000000000000000000000000;hp=d1495d45d38ea9a8bdf5979dcdedbfe2f249d295;hb=7ad7475c2abf891a92b457339aaa0c20c40634d1;hpb=791dce846c524feca7b344307597c1d1224ba1de diff --git a/doc/emulator.html b/doc/emulator.html deleted file mode 100644 index d1495d4..0000000 --- a/doc/emulator.html +++ /dev/null @@ -1,130 +0,0 @@ -FIFTH - - -
-
-    

Emulator & virtual CPU

- - - -Using CPU emulator slows it down but I shouldn't now -think too mutch about, and waste my time on batteling with problems whitch -results on complex design of PC hardware. Also it allows me to use existing DOS and -resident drivers services in real mode. So I don't need to deal with -hardware too mutch. It also allows me to use all free XMS for flat -code & data storage. - -Current emulator emulates 1 CPU. It has 2 stacks, -~50 instructions, and 4GB flat address space (theoretically). -I'm not sure that DOS 6.22 that I currently prefer can handle more than -64 MB of RAM. While I tried to keep instructionset simple, -I was forced to put in lot of complex instructions to make it's performance -acceptable on emulator. On actual silicon ~20 instructions is enaugh -(I think). - -Maybe one day similar system will run directly on custom silicon chip :) - - -CPU has following registers: - -IP - instruction pointer -DSP - data stack pointer -RSP - return stack pointer - -Virtual CPU, commands (most of them are avaiable as ordinary commands in -programming lanquage): - -code mnemonic description - -0 nop does notheing -1 halt halt CPU ( return to DOS on emulator ) - -2 kbd@ ( -- c ) read scancode of pressed or released key. - Returns 0, if no data avaiable. -3 num ( -- n ) put immidiate number into datastack - -4 jmp jump to specified code -5 call jump to specified code, save return address to - return stack. - -6 1+ ( n -- n+1 ) -7 1- ( n -- n-1 ) - -8 dup ( n -- n n ) duplicate top of data stack -9 drop ( n -- ) drop last element in data stack - -10 if ( n -- ) jump to addr if top element was 0 -11 ret jump to code, specified in return stack. - -12 c@ ( addr -- n ) read byte from memory at specified address -13 c! ( n addr -- ) store byte to specified memory - -14 push ( DSTK -> RSTK ) move top of datastack to returnstack -15 pop ( RSTK -> DSTK ) move top of returnstack to datastack - -16 -17 rot ( n1 n2 n3 -- n2 n3 n1) rotate stack elements - -18 disk@ ( FromDiskSect ToMem -- ) read 1KB from disk into RAM -19 disk! ( FromMem ToDiskSect -- ) write 1KB to disk - -20 @ ( addr -- n ) read 32 bit number from memory -21 ! ( n addr -- ) store 32 bit number to memory - -22 over ( n1 n2 -- n1 n2 n1 ) self explaining ... -23 swap ( n1 n2 -- n2 n1 ) -,,- - -24 + ( n1 n2 -- n1+n2 ) -,,- -25 - ( n1 n2 -- n1-n2 ) -,,- - -26 * ( n1 n2 -- n1*n2 ) -,,- -27 / ( n1 n2 -- n1/n2 ) -,,- - -28 > ( n1 n2 -- result ) is true when n1 > n2 -29 < ( n1 n2 -- result ) is true when n1 < n2 - -30 not ( n1 -- not_n1 ) logical not -31 i ( -- n ) copies top of return stack into datastack - -32 cprt@ ( addr -- n ) read one byte from hardware port -33 cprt! ( n addr -- ) store one byte to hardware port - -34 i2 ( -- n ) like "i" but takes socond top stack element. -35 i3 ( -- n ) like "i" but takes third top stack element. - -36 shl ( n amount -- n ) left bit shift -37 shr ( n amount -- n ) right bit shift - -38 or ( n1 n2 -- n ) logical or -39 xor ( n1 n2 -- n ) exclusive logical or - -40 vidmap ( addr -- ) copy memory from "addr" to video memory. - -41 mouse@ ( -- x y button ) read mouse coordinates & buttons - -42 vidput ( addr1 addr2 x y -- ) put image1 into image2, at - location x, y. Does clipping, so part of a big image - can be mapped into smaller one. - -43 cmove ( addr1 addr2 amount ) move memory from addr1 to addr2 - if addr1 is greater than addr2 then count address - foward while moving, elseway starts from end and - counts backwards, so no data loss will occure on - overlapping. - -44 cfill ( c addr amount -- ) fill memory starting at "addr" - with "c" bytes. - -45 tvidput ( addr1 addr2 x y -- ) same as "vidput" but treats - color 255 in source image as transparent. - -46 depth ( -- depth ) returns current depth of data stack. - -47 charput ( colorfg colorbg addrsrc addrdest x y ) - draw character to image buffer located at "addrdest" - to specified x & y location. Decodes 8 bytes from - source to bits, used to draw character. - -
- - \ No newline at end of file