Last visit was: Sun Aug 01, 2021 4:58 am
It is currently Sun Aug 01, 2021 4:58 am



 [ 23 posts ]  Go to page Previous  1, 2
 Virtual 16-bit CPU/ISA Simpleton (emulator + assembler) 
Author Message

Joined: Wed Feb 03, 2021 4:13 am
Posts: 17
I decided to use Qt+QOpenGLWidget as platform for emulator.
I named virtual PC based on Simpleton4: SimpX.
For now it's just testing platform without real specifications for future use.

First run of graphic program in emulator could be seen here: https://youtu.be/pzXnAzf8gd8
It runs this code:
Code:
   mode new

   r0 <- 32768
   r1 <- ( 32768 + 4096 ) ; expression syntax is needed

start   r2 <- r0
   r3 <- 0
loop   [ r2 ] = [ r2 ] + r3
   r2 <- r2 + 1
   r3 <- r3 + 1
   void = r2 - r1 ; cmp (result is ignored)
   jnz loop
   pc <- start

Screen space is located at address 32768 in the CPU address space.
It is monochrome bitmap with 16 pixels per word, 256 pixels per line and 256 lines per screen.
So, overall video memory size is 4Kw.
Program just increments every word of video memory in increasing increments.
Emulator makes 1000 CPU steps per frame, so framerate is visually slow.

After some fixes and improvements Simpleton repositary on github will be replaced by SimpX repositary.


Mon May 24, 2021 3:09 am

Joined: Wed Feb 03, 2021 4:13 am
Posts: 17
Emulation of SimpX goes online!
Link: http://alxhost.tk/SimpX/SimpX.html
To run first demo select file 'test0.asm' in the left panel and click 'Emulation->Run' menu.
It' interesting to hear about FPS (are shown in the bottom status line) with full-screen and 200/300/400% (selected in 'View') menu. To go back to full-document scale just change size of Browser window in any way (for example: minimize/maximize).


Thu Jun 10, 2021 2:54 pm

Joined: Wed Jan 09, 2013 6:54 pm
Posts: 1627
Looks nice! I'm getting about 66 FPS normally and 81 FPS at 200%.


Thu Jun 10, 2021 3:01 pm

Joined: Wed Feb 03, 2021 4:13 am
Posts: 17
BigEd wrote:
Looks nice! I'm getting about 66 FPS normally and 81 FPS at 200%.

Thanks for testing!
Qt+WebAssembly is really cool thing to implement this cross-standalone-cross-web application, but I feel it could be much more speedy. But anyway these results make me happy.


Thu Jun 10, 2021 3:33 pm

Joined: Wed Feb 03, 2021 4:13 am
Posts: 17
Github page for Simpleton 4 is removed. It is replaced by SimpX project: https://github.com/aa-dav/SimpX which is Qt project for Simpleton with assembler and emulator.

Github page: https://github.com/aa-dav/SimpX (including most actual documentation https://github.com/aa-dav/SimpX#readme)
Online emulator and assembler: http://alxhost.tk/SimpX/SimpX.html


Sun Jun 20, 2021 3:47 pm

Joined: Mon Oct 07, 2019 2:41 am
Posts: 255
Notice how clean 16 bits computers are if you don't try to add bytes. E instruction could be a byte swap.
<16..9><8..1> --> <8..1><16..9>


Sun Jun 20, 2021 10:05 pm

Joined: Wed Feb 03, 2021 4:13 am
Posts: 17
oldben wrote:
Notice how clean 16 bits computers are if you don't try to add bytes.

I agree! Absence of bytes was the most disturbing idea for me at first. But the more I think about it the more I like it.

Quote:
E instruction could be a byte swap.
<16..9><8..1> --> <8..1><16..9>

There is no need in separate byte swap in Simpleton because it could be achieved as 'rrci dest reg 8' ('dest <= reg >> 8' in new syntax). (Cyclic) Rotate Right (updating Carry) does it.
Need of so called hardware 'barrel shifter' to do such things in 1 cycle is another thing which concerns me beacuse of Simpleton hardware becomes more complex than I wanted.
I thought about it and think that rotate by 8 could be implemented as separate hardware circuit (so byte swap is still 1-clock in ALU) and 1-7 and 9-15 offsets could be implemented with additional clocks per bit offset. Alternatively it could be 4/8/12 bits offsets as 1-clock bases (so, nibble granularity is fastest) with 1-3 clock penalty for 1-3 bit step.
However - why not barrel shifter? :)

It's interesting that Shift Left through Carry by 1 bit is just 'add dest src src' ('dest = src + src' in new syntax) and (Cyclic) Rotate Left through Carry is 'addc dest src src' ('dest = src +c src' in new syntax). (I got it from MSP 430 documentation) These instructions are not counterparts for rrc and rrci commands in Simpleton, but could be helpful. In fact rlc and rlci commands could be achieved by rrc/rrci with 16-offset operand in X.


Sun Jun 20, 2021 10:52 pm

Joined: Wed Feb 03, 2021 4:13 am
Posts: 17
Current SimpX can handle input from keyboard and gamepads (but gamepads are not working in web compilation, hmmm, sad)

Single input-output port controls it in the way simpliest for the hardware: by writing to port portInput we set line (single bit) of input wire.
Reading from port gives 16 signals on the wires. 16 bits of wires x 16 bit of inputs gives 256 possible input signals through portInput.
128 first signals corresponds to USB code keys: https://gist.github.com/MightyPork/6da2 ... 55fdc73db2
But codes 1, 2 and 3 corressponds to CTRL, SHIFT and ALT.

http://alxhost.tk/SimpX/SimpX.html selecting test0.asm and executing menu command "Emulator->Compile and run" will run program showing input in hex codes (first 64 keys of USB keycodes and first gamepad, but not working online). May not work if current language setting of keyboard is not english.


Wed Jul 07, 2021 5:27 am
 [ 23 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: AhrefsBot, CCBot, SemrushBot and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software