Git Product home page Git Product logo

vc64's Introduction

vc64

Description

vc64 is a just-for-fun project made in Rust. It uses macroquad to make a cross-platform virtual console of sorts that you program in (NASM) x86-64 assembly. In it's current state, it only supports the following features:

  • 7 colors
  • clear the screen
  • get state of 9 keys
  • draw rectangles (currently uses u64 instead of f32, so poor precision)
  • basic sprite drawing

However, the hope is for these features to be implemented by the end:

  • 16x16 sprite table (written in src/sprites.asm)
  • 4-color pallette with 32 available colors
  • Dynamically-linked object files instead of only statically-linked files
  • TBD

Usage

The current implementation is ~100 lines and easy to read, so documentation would be superfluous at this stage. However, src/main.asm holds an example program to familiarize you with the concepts.

There are two assembly source files: src/windows_main.asm and src/unix_main.asm. This is necessary since Windows and Unix use different calling conventions. The build script will automatically assemble the correct source file for your target OS, but you must manually tranlate between the two. To build, you MUST have nasm in your path!

Building

Unix

Make sure you have Rust installed. Clone the repository once per game, then cd into the folder and run cargo build. This will produce a standalone executable in target/debug/. That is your game.

Windows

Make sure you have Rust and Visual Studio installed, along with VS' C++ tools. Then you can run cargo build as usual. A common indicator that your Windows assembly source is using the wrong calling convention is if it immediately panics with the text "Invalid key code: ".

vc64's People

Contributors

kyllingene avatar

Watchers

 avatar

vc64's Issues

`windows_main.asm` gives STATUS_ACCESS_VIOLATION

Describe the bug
Something in about running the Windows build generates the following error a couple seconds after the window appears:

error: process didn't exit successfully: `target\debug\vc64.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

To Reproduce
Steps to reproduce the behavior:

  1. Pull the latest changes
  2. Execute cargo run in a valid Windows environment
  3. See error

Desktop (please complete the following information):

  • OS: Windows 11
  • Version 0.1.0

Potential fixes
The issue is most likely me mishandling the stack/calling convention in src/windows_main.asm, but it may also have something to do with the janky trickery in src/main.rs:93.

Windows/OSX action

Describe the solution you'd like
Implement actions to build vc64 on Windows/MacOS instead of just Linux.

Additional context
An issue is getting NASM on them, as neither have apt.

Unix build gives odd warnings

Describe the bug
When running cargo run (or directly running the executable) in WSL, the shell says that it panicked with the message Can't open PCM device, but continues running without issue.

Warnings
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
thread '<unnamed>' panicked at 'Can't open PCM device.', /home/hest/.cargo/registry/src/github.com-1ecc6299db9ec823/quad-snd-0.2.3/src/alsa_snd.rs:27:9

To Reproduce
Steps to reproduce the behavior:

  1. Execute cargo run in a console (so far only tested on WSL)
  2. Check terminal output

Expected behavior
On Windows, this behavior is absent, as expected.

Desktop (please complete the following information):

  • OS: Windows (WSL)
  • Version: 0.1.0

Unix build seems to run faster

Describe the bug
On Unix (WSL),

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows (WSL)
  • Version 0.1.0

Possible fix
Supply a f64 dt argument to update

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.