Git Product home page Git Product logo

vlahb's People

Contributors

coding-with-adam avatar glouw avatar kully avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

moneytech

vlahb's Issues

streamline GIF or JPGS -> ASM Sprite

Would be great to automate the GIF -> file.asm or JPEG -> file.asm process

We could give a function a link to a raw file online, rather than downloading it.

write functional tests

for both ASM and LANG:

Ideas:

  • test program exits upon a failure
  • store PASSES and FAILES in slots of RAM
  • throw in a visual display for the passes/total tests (only complication is that you would need a test to ensure that printing to the screen (BLIT) is functional as we are relying on the code to produce an error message - so sticking to unittest or a python script is probably best)

variables get lost when pushing/popping the stack

Consider this script

LD R[0] 45
LD R[1] 41
CALL FOO

MAIN:
    LD R[0] 7
    LD R[1] 4
    CALL MATH_SUB

    // what should be in R[0],R[1] right now?

    RETURN


MATH_SUB:
    SUB R[0] R[1]
    LD R[4100] R[0]
    RETURN

The current way VLAHB is written, 7 and 4 will be the values of R[0] and R[1] after the RETURN in MATH_SUB. This is an issue as I want to be able to remember and retrieve easily the very first init values I load in RAM without having them lost somewhere in RAM (specifically between indices 0-4095).

Add MALLOC Opcode to asm and vm

Reserve some 1024 slots after RAM to be designated for a heap.

If we call

malloc(8)

in LANG, it should give 8 free consecutive slots from the heap

Game Ideas

  • Bresenham line algorithm
  • rotating cube
  • primitive MSPaint Clone
  • pong
  • a machine learning program
  • conway's game of life

Some more todos

  • increase the stack frame from 16 to 128 (make a PR)

  • write fibo.asm

  • add opcodes and asm commands for <=, <, >, >=

  • Assembler should exit if assembly goes past stack size

  • make some test.asm files to test that opcodes work as expected

  • improve the debug printing in terminal - multiple options for output style for fun

  • make code in asm more DRY - ๐Ÿ (don't repeat yourself)

  • add ASCII codes for VLAHB

  • make all ASM hexadecimal compatible
    eg LD R[4] 0XFF0000FFFF and ADD R[0X0F] 42 should work fine

Add Array Support

Brainstorming

Just label and data:

MARIO:
   00043232
   08373919
   ...

LD VRAM[0] MARIO

a way of giving width, x and y

LD VRAM X Y MARIO WIDTH

(just use VRAM_INDEX_FROM_X_Y or build X,Y straight into program)

get fps up to 60

optimize, optimize, optimize

notes:
-screen size affects fps
-printing debug messages affects fps

Challenge: Add a Sound Engine to VLAHB

Would be amazing to have opcodes for moving bits into SRAM (Sound Ram?). Could emulate video game music. Perhaps better for a separate project but putting this idea here to remember.

Get rid of unused RAM/ROM slots

Since the max index of RAM I can reference in an opcode is 0XFFFF, which is 65,535 in base10, the RAM and ROM arrays should not have more slots than this.

See these lines in vm.c

Stack Underflow/Overflow is Broken

LD R[0]
SUB R[0] 1
ADD R[0] 1
EXIT

should exit with R[0] = 0 but this is not the case.

I noticed one of the debug print statements show a -1 in RAM, which should never happen.

MUL doesnt work

LD R[4099] 1
MUL R[4099] 0XFFFFFFFF

this code should result in R[4099] being equal to 0XFFFFFFFF, but it wraps back to 0. Probably has to do with the new stack overflow underflow function.

Feature: Add Keyboard Input

Probably out of the scope of this project, but putting down if anybody feels inspired to contribute to this project and add.

Biggest Potential: be able to code games! ๐Ÿ˜ธ

consistent regex parse

Eg. In regexes, use (...) to extract out the pattern rather than doing something like:

if R[0], set to arg[2:-1]

Make Visualization for the CPU

Create a grid of nXn pixels such that each color at [x, y] represents the value at a particular slot in RAM. Could be a useful tool for debugging. (Pygame?)

Would be useful for a debugger to have an easy way to control the speed of the CPU
eg. x0.5 speed, x0.25 speed

VRAM

Video RAM

VRAM is a list (array)
len of VRAM: 800 X 600
Each slot in VRAM is 4 bytes: the 4 bytes together are ARGB (alpha, red, green, blue)
Index VRAM like this: VRAM[x + y * 800]

Syntax:

# i == integer

V[i] i,i,i,i # direct load to VRAM
V[i] R[i],R[i],R[i],R[i]  # load RAM slots into VRAM slot
V[i] V[i]  # load VRAM slot into VRAM

Write Custom Sublime/TextEditor Styling for ASM Syntax

The standard sublime 3 .asm syntax works great so far. What's needed is...

  • 0XFFFF values are same color as ints
  • a different color for LABELS:
  • a different color for opcodes such as LD, ADD, SUB, GOTO, CALL, etc
  • find a way to treat ; as the symbol for comments -> eventually replace // with ; for the comment symbol

Other suggestions?

Opcode Cleanup in Utils

  • rename keys in opcode_lookup_dict in util.py so they easily convey meaning of opcode**
  • put all opcodes behind 0XFF, reserved for EXIT

**Can we make LD REGISTERS TO VRAM W VRAM INDEX make more sense to a new user? ๐Ÿ˜…

How should GOTO 42 of a specific ASM file work?

If GOTO 0 is in your file, your PC is gonna shoot to the top of the huge mega giant hex file that contains all of the hex files code.

Should we even care about this? Should everything be wrapped in labels anyways?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.