Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Release 70.800
Browse files Browse the repository at this point in the history
  • Loading branch information
0xF6 committed May 22, 2020
1 parent d27da15 commit a81dd96
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 213 deletions.
2 changes: 1 addition & 1 deletion acc/acc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net5.0</TargetFramework>
<PackageId>flame.compiler</PackageId>
<RuntimeIdentifiers>win10-x64;osx.10.14-x64;linux-x64</RuntimeIdentifiers>
<Version>0.70.504-beta</Version>
<Version>0.70.800</Version>
<Authors>Yuuki Wesp</Authors>
<Product>flame.compiler</Product>
<Copyright>Yuuki Wesp (C) 2020</Copyright>
Expand Down
2 changes: 1 addition & 1 deletion etc/visual-code/AncientAssembly/.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Language="en-US" Id="ancient-asm" Version="0.70.2" Publisher="rijndael"/>
<Identity Language="en-US" Id="ancient-asm" Version="0.70.4" Publisher="rijndael"/>
<DisplayName>Ancient Assembly</DisplayName>
<Description xml:space="preserve">Ancient Assembly developmemnt environment (8bit cpu)</Description>
<Tags>ancient,8bit,assembly,8bit assembly,__ext_.asm,__ext_.ancient</Tags>
Expand Down
209 changes: 16 additions & 193 deletions etc/visual-code/AncientAssembly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,206 +54,29 @@
</details>


---

## History
> Ancient VM proof of concept of the language, toolskit, virtual machine and ecosystem
> A VM with 50+ instructions, SIMD Vector calculation, modularity, language and compiler, cli tool and package register of modules and extensions
Once i read an [article on Wikipedia](https://en.wikibooks.org/wiki/Creating_a_Virtual_Machine/Register_VM_in_C) about writing custom VM and interpreter bytecode.
So, i wanted to give it a try.
Initially, i planned to write a 4-bit CPU emulator, afterwards i wrote it - but with the development of the source code, bit rate of instructions increased, and emulator has a programming language that is very similar to Assembler language (and CSS, yeah).
It was a wonderful experience, i faced unusual problems and came up with quite unusual solutions.
Since then, i continued to develop and improve different kinds of features in this project afterwards.
I do not pursue any goals (except of course vm speed and language usability), and i do not expect my VM to be useful - but if you have any ideas on how to improve the project I’d be happy to hear from you.
---


# 📡 Installation

##### Env flags
```yaml
- VM_TRACE : 1\0 - enable or disable trace logging (default 0)
- VM_ERROR : 1\0 - enable or disable error logging (default 1)
- VM_KEEP_MEMORY : 1\0 - when halt cpu disable or enable clearing memory table (default 0 - clearing)
- VM_MEM_FAST_WRITE: 1\0 - enable or disable fast-write mode to devices (see fast-mode addressing)
- C69_BIOS_HPET : 1\0 - enable using hardware hper timer (default 0)
- VM_WARMUP_DEV : 1\0 - enable warm-up devices on plug-connect (default 1)
- VM_SHUTDOWN_DEV : 1\0 - enable shutdown devices on halting processor (default 1)
- VM_SYM_ENCODING : "utf8" - set encoding of debug symbols (default "IBM037")
```bash
$ yarn global add @rune/cli
$ rune install vm
```

##### Memory table:
example:
```assembler
.ldx &(0x11) <| $(0x0) - disable trace
```
list:
```yaml
- 0x11 : 1\0 - enable or disable trace logging (default 0)
- 0x12 : 1\0 - enable or disable error logging (default 1)
- 0x13 : 1\0 - when halt cpu disable or enable clearing memory table (default 0 - clearing)
- 0x14 : 1\0 - enable or disable fast-write mode to devices (see fast-mode addressing)
- 0x18 : 1\0 - enable float-mode
- 0x19 : 1\0 - enable stack-forward flag
- 0x20 : 1\0 - control stack flag (north flag)
- 0x21 : 1\0 - control stack flag (east flag)
- 0x22 : 1\0 - bios read-access flag
```
##### Bios table:
###### public memory [READ]:
```yaml
- 0x00 - return current ticks (u32)
- 0x01 - return hpet enabled or not
- 0x02 - return memory channel
- 0xFX - private memory randge
```
###### private memory [READ]:
```yaml
- 0xF1 : return hpet enabled or not
- 0xF2 : return use virtual stack forwarding or not
- 0xF3 : return use forward in standalone memory sector or not
- 0xF6 : return using guarding with violation memory write or not (default bios_guard_flag has enabled)
```
###### public\private memory [WRITE]:
```yaml
- 0x1 : 1\0 - set hpet use or not (default value depends on the firmware)
- 0xA : reseting hpet and system timers
- 0xD : call system interrupts for N-value ms
- 0xC : call clearing RAM (need enabled bios_guard_flag, and disabled southFlag)
- 0xF : set at private memory range value (need southFlag)
```
##### remarks:
###### fast-mode addressing
`Write speedUp to device memory (x12~ times), but disables the ability to write to certain sections of device memory.`
###### READ\WRITE operation for bios
`Need southFlag enabled for READ\WRITE operation for private memory, otherwise will be calling CorruptedMemoryException and halting cpu`
###### bios_guard_flag
`Some memory segments are not allowed to READ\WRITE operation when bios_guard_flag is enabled `
###### create external function
`todo :)`
##### Command docs

```csharp
-- legend:
- cell_id - memory cell in processor cache
- value - hex number
- &() - reference cell id
- $() - value
- ![~name] - reference label define
- <| and |>- pipe operator
- ~- - when operator
```


```csharp
// refer and jumper
// set reference current program offset to cell_id
.ref.t &(cell_id)
// read from cell_id offset program and go to
.jump.t &(cell_id)
// other jumper
.jump.e &(cell_id) ~- &(0x9) &(0x6) // if 0x9 cell value more or equal 0x6 cell value
.jump.g &(cell_id) ~- &(0x9) &(0x6) // if 0x9 cell value more 0x6 cell value
.jump.u &(cell_id) ~- &(0x9) &(0x6) // if 0x9 cell value less 0x6 cell value
.jump.y &(cell_id) ~- &(0x9) &(0x6) // if 0x9 cell value less or equal 0x6 cell value
# 💻 OS Support

// manage processor
OS | Version | Architectures
------------------------------|-------------------------------|----------------
Windows 10 | 1607+ | x64, ARM32
OSX | 10.14+ | x64
Linux | | x64, ARM32, ARM64

.halt // halting cpu
.warm // warm-up cpu

// etc
.swap &(source) &(target) // swap value
// math instruction
.mul &(result_cell) &(cellValue1) &(cellValue2)
.add &(result_cell) &(cellValue1) &(cellValue2)
.div &(result_cell) &(cellValue1) &(cellValue2)
.sub &(result_cell) &(cellValue1) &(cellValue2)
.pow &(result_cell) &(cellValue1) &(cellValue2)
.sqrt &(result_cell) &(cellValue)
// advanced math (need float-mode) (advanced math operation send result to stack)
.abs &(cell_value)
.acos &(cell_value)
.atan &(cell_value)
.acosh &(cell_value)
.atanh &(cell_value)
.asin &(cell_value)
.asinh &(cell_value)
.cbrt &(cell_value)
.cell &(cell_value) // celling
.cos &(cell_value)
.cosh &(cell_value)
.flr &(cell_value) // floor
.exp &(cell_value) // exponent
.log &(cell_value)
.log10 &(cell_value)
.tan &(cell_value)
.tanh &(cell_value)
.sin &(cell_value)
.sinh &(cell_value)
.trc &(cell_value) // truncate
.bitd &(cell_value) // bit decrement
.biti &(cell_value) // bit increment
.atan2 &(cell_value) &(cell_value)
.min &(cell_value) &(cell_value)
.max &(cell_value) &(cell_value)
.lpstr !{"test string"} // stage to stack it string
.unlock &(0x5) str // pull from stack and stage in 0x5 cell and make 'str' type
// init evaluation stack and pulling data from normal stack
.locals init #(
[0x0] u32 // int
[0x1] u2 // bool
)
// call external function (see 'create external function')
call !{some_function(u32, u8)}
.prune // clear evaluation stack
// manage device and etc
.mvt &($device_id) &(action_id) <| $(value) // push raw value to device_id.action_id in bus
.mvd &($device_id) &(action_id) <| &(cell_value) // push value from cell to device_id.action_id in bus
.mvx &($device_id) &(action_id) <| &(value_ref) // encode memory and send char-data to device
// float-point
.ldx &(0x18) <| $(0x1) // set float mode
// remark: all math operation support float mode
.orb &(n) // grub next 'n'-count values and stage to stack
.val @float_t("10.4") // encode float value
.pull &(target_cell) // read from stack float value and insert to target_cell
// debugger
.brk.s // standard break - now break
.brk.n // break on next cycle execute
.brk.a // break on after next cycle execute
// other
.inc &(cell) // cell++
.dec &(cell) // cell--
// raw write instruction
.raw 0xABCDEFE0 // (warm)
.mvj &($device_id) &(action_id) <| @string_t("test string") // cast string to mvt instruction
```

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2F0xF6%2Fancient_cpu.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2F0xF6%2Fancient_cpu?ref=badge_large)

<p align="center">
<a href="https://ko-fi.com/P5P7YFY5">
<img src="https://www.ko-fi.com/img/githubbutton_sm.png">
</a>
</p>
# Documentation
See [Docs](https://docs.vm.runic.cloud)
16 changes: 10 additions & 6 deletions etc/visual-code/AncientAssembly/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "ancient-asm",
"displayName": "Ancient Assembly",
"description": "Ancient Assembly developmemnt environment (8bit cpu)",
"version": "0.70.2",
"displayName": "Ancient VM Language",
"description": "Ancient VM developmemnt environment",
"version": "0.70.4",
"icon": "images/icon.png",
"galleryBanner": {
"color": "#18c7b1",
Expand All @@ -25,9 +25,13 @@
"Programming Languages"
],
"keywords": [
"ancient",
"8bit",
"assembly"
"assembly",
"virtual-machine",
"cli",
"intermediate-language",
"il",
"assembler-language",
"language"
],
"activationEvents": [
"onLanguage:asm",
Expand Down
10 changes: 5 additions & 5 deletions etc/visual-code/AncientAssembly/syntaxes/asm.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<array>
<dict>
<key>match</key>
<string>(?i)((^|\s+)\~label|.warm|init|.prune|.halt|\s+ert)\b</string>
<string>(?i)((^|\s+)\~label|#use|.sig|@|.ret|.warm|init|.prune|.halt|\s+ert)\b</string>
<key>name</key>
<string>keyword.control.error</string>
</dict>
Expand Down Expand Up @@ -143,11 +143,11 @@
<key>name</key>
<string>string.quoted.double</string>
</dict>
<dict>
<dict>
<key>begin</key>
<string>%</string>
<string>!{</string>
<key>end</key>
<string>%</string>
<string>}</string>
<key>name</key>
<string>string.quoted.double</string>
</dict>
Expand Down Expand Up @@ -201,7 +201,7 @@
<array>
<dict>
<key>match</key>
<string>([uif]((2|8|16|32|64|128)))\b</string>
<string>(str|void|[uif]((2|8|16|32|64|128)))\b</string>
<key>name</key>
<string>support.type.asm</string>
</dict>
Expand Down
4 changes: 1 addition & 3 deletions etc/visual-code/AncientAssembly/syntaxes/neeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
.wtd
.rfd
.jump.p
.page
.call.i
.prune
.page
36 changes: 36 additions & 0 deletions etc/visual-code/AncientAssembly/syntaxes/snippets.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
{
".sig": {
"prefix": [
".sig"
],
"body": [
".sig @${0:functionName}({1:types}) -> {2:returnType}"
],
"description": "Signature function defined operation"
},
".call.i": {
"prefix": [
".call.i"
],
"body": [
".call.i !{${0:target}}"
],
"description": "Call function operation"
},
".prune": {
"prefix": [
".prune"
],
"body": [
".prune"
],
"description": "prune operation"
},
".ret": {
"prefix": [
".ret"
],
"body": [
".ret"
],
"description": "return operation"
},
".abs": {
"prefix": [
".abs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Authors>Yuuki Wesp</Authors>
<Company>Ancient Project</Company>
<Version>0.70.701.120</Version>
<Version>0.70.800</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Sprache" Version="2.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>0.70.675.37</Version>
<Version>0.70.800</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageIconUrl>https://raw.githubusercontent.com/ancientproject/cli/master/resource/icon.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/0xF6/ancient_cpu</PackageProjectUrl>
Expand Down
2 changes: 1 addition & 1 deletion submodules/runtime
2 changes: 1 addition & 1 deletion vm/csharp/vm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
win10-arm64;
win10-arm;
</RuntimeIdentifiers>
<Version>0.70.756-beta</Version>
<Version>0.70.800</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Copyright>Yuuki Wesp (C) 2020</Copyright>
</PropertyGroup>
Expand Down

0 comments on commit a81dd96

Please sign in to comment.