Skip to content

Instantly share code, notes, and snippets.

Forth Systems Performance Analysis

Introduction

Forth, a unique stack-based programming language, has seen numerous implementations over the years. Each implementation brings its distinct features and optimizations, resulting in a spectrum of performance characteristics. We analyzed several Forth systems to discern patterns and insights that might guide future developers or users in system selection or optimization.

The Dataset

@jemo07
jemo07 / Armv8-a_opcoded.md
Last active August 6, 2023 17:02
Armv8-a opcodes list

ARMv8-A opcodes with their corresponding details:

Mnemonic Format With (bits) Binary Hex Shamt Binary Start (Hex) End (Hex)
ADC R 6 000110 6 - - -
ADD R 6 000010 2 000000 A0A 0B
ADDI I 6 100100 24 - - -
ADR I 6 100101 25 - - -
AND R 6 000010 2 000100 A0A 0B
ANDI I 6 100100 24 - - -
@jemo07
jemo07 / forthVM.c
Last active July 15, 2023 19:28
Forth VM ( WIP )
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#define RAM_SIZE 8192
#define STACK_SIZE 8
typedef struct {
uint32_t p;
uint32_t i;
@jemo07
jemo07 / blinky_Icestik.v
Created July 14, 2023 18:10
iCESTICK Bliky Example.
/*
* Top module for iCEstick blinky
*
* Make circular pattern on red LEDs, flash green LEDs.
*
* Generate test signals at 6.28MHz and 0.749Hz.
*/
module top(input CLK
, output LED1
@jemo07
jemo07 / x86 to ARMv8-A.s
Last active July 12, 2023 21:49
A simple cheat-sheet for ARMv8a to X86 assembly.
x86 ARMv8-A // DESCRIPTION
------------------------------------------------
MOV reg, reg MOV reg, reg // Move register to register
MOV reg, mem LDR reg, [mem] // Move memory to register
MOV mem, reg STR reg, [mem] // Move register to memory
ADD reg, reg ADD reg, reg, reg // Add register to register
SUB reg, reg SUB reg, reg, reg // Subtract register from register
AND reg, reg AND reg, reg, reg // Bitwise AND register with register
OR reg, reg ORR reg, reg, reg // Bitwise OR register with register
@jemo07
jemo07 / RefacoredServoSmoothing.fth
Last active July 9, 2023 19:38
Forht Factored Servo Smooting
\ (c) Jose Morales
\ Based on https://gist.github.com/jemo07/50d3f81d76ed8f660e9a3b1910553cee
\ Define Variable
VARIABLE pos \ ramp position
VARIABLE dur \ ramp duration
VARIABLE t \ previous time
VARIABLE val \ current value
VARIABLE A \ origin value
@jemo07
jemo07 / SmoothServoMovements.fth
Last active July 9, 2023 19:33
Smooth Servo Movments in FORTH
\ Sorce https://www.pmdcorp.com/resources/type/articles/get/mathematics-of-motion-control-profiles-article
\ Source https://www.instructables.com/Servo-Ramping-and-Soft-Start/
\ https://www.instructables.com/Servo-Ramping-and-Soft-Start/
\ (c) Jose Morales
\ FORTH ALGORITHM FOR SMOOTHING SERVO MOVEMENTS
\ Define Variable
VARIABLE pos \ ramp position
VARIABLE dur \ ramp duration
@jemo07
jemo07 / Floodfill.md
Created July 7, 2023 22:59
Improving Floodfill algorithm.

Flood Fill Algorithm with Convolutional Scanning

In this article, we will discuss an efficient approach to solve a maze using a combination of the flood fill algorithm and convolutional scanning. This method allows us to quickly identify possible moves and choose the best one based on the current state of the maze.

Introduction

The flood fill algorithm is a simple and widely used algorithm to determine connected areas in an image or a grid. It starts at a given point and spreads out to fill all connected areas with a new value. In the context of a maze, we can use the flood fill algorithm to assign a cost to each cell, which represents the number of moves required to reach that cell from the start.

Convolutional scanning, on the other hand, is a technique commonly used in image processing to apply a filter (or a "kernel") to an image. By using a 3x3 kernel, we can "scan" a small portion of the maze at once, which can be much faster than filling each cell individually.

// Key Value Store
// Redis Like Implementation
// copyright Jose Morales
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
@jemo07
jemo07 / 6502-assembler-gforth.fs
Last active July 8, 2023 00:36
A 6502 assembler on Gforth
\ 6502 ASSEMBLER for Gforth
\ Register Assignment
hex E0 constant XSAVE
hex DC constant W
hex DE constant UP
hex D9 constant IP
hex D1 constant N
\ Nucleus Locations