Coder Social home page Coder Social logo

travispaul / mlcd Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 144 KB

Utility for drawing to a Dreamcast Visual Memory Unit's LCD (Maple LCD)

License: BSD 2-Clause "Simplified" License

Makefile 0.13% C 98.45% Roff 0.64% Lua 0.77%
dreamcast netbsd vmu

mlcd's Introduction

mlcd

Command line utility and Lua module for drawing graphics to a Dreamcast Visual Memory Unit's LCD (Maple LCD).

Usage

To draw to the first VMU LCD connected to the system:

$ mlcd -d img.bmp > /dev/mlcd0.0

See test/example.lua for using the lua module.

-- Draw a point moving through the center of the display
local mlcd = require 'mlcd'
local x = 0
mlcd.draw("/dev/mlcd0.0", function ()
        mlcd.clear()
        mlcd.point(x, mlcd.HEIGHT / 2)
        x = x + 1
        if x == mlcd.WIDTH then
                x = 0
        end
end)

To run from the command line:

$ lua example.lua

Examples

MLCD MLCD

-b ASCII binary

Prints a "#" or " " for each pixel, useful for previewing files.

$ mlcd -b mlcd.bmp
                                 #########
                             #################
                          ##########
                       ##########
  ##               ###########
# #####        ##############     #######
#  ########################################
 # ################################
 #  ############################
  # ##########################
  #  #######################
   # #####################
   #  ##################
    #  ###############
    #  ###########
     #  #######
     #
      #
      #
       #    #   #        #   ####   ###  ###
       #    ##  #  ###  ###  #   # #     #  #
        #   ### # #   #  #   ####   ###  #   #
        #   # ### #####  #   #   #     # #   #
         #  #  ## #      #   #   # #   # #   #
         #  #   #  ###    ## ####   ###  ####
          #
          #
           #
           #
            #
            #

-c C code

Can be used to replace the default boot image in the mlcd NetBSD driver.

$ mlcd -c mlcd.bmp
static const char initimg48x32[192] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7f, 0xc0,
0x00, 0x00, 0x00, 0x07, 0xff, 0xfc,
0x00, 0x00, 0x00, 0x3f, 0xf0, 0x00,
0x00, 0x00, 0x01, 0xff, 0x80, 0x00,
0x30, 0x00, 0x1f, 0xfc, 0x00, 0x00,
0xbe, 0x01, 0xff, 0xf8, 0x3f, 0x80,
0x9f, 0xff, 0xff, 0xff, 0xff, 0xe0,
0x5f, 0xff, 0xff, 0xff, 0xe0, 0x00,
0x4f, 0xff, 0xff, 0xff, 0x00, 0x00,
0x2f, 0xff, 0xff, 0xfc, 0x00, 0x00,
0x27, 0xff, 0xff, 0xf0, 0x00, 0x00,
0x17, 0xff, 0xff, 0xc0, 0x00, 0x00,
0x13, 0xff, 0xff, 0x00, 0x00, 0x00,
0x09, 0xff, 0xfc, 0x00, 0x00, 0x00,
0x09, 0xff, 0xc0, 0x00, 0x00, 0x00,
0x04, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x08, 0x80, 0x47, 0x8e, 0x70,
0x01, 0x0c, 0x9c, 0xe4, 0x50, 0x48,
0x00, 0x8e, 0xa2, 0x47, 0x8e, 0x44,
0x00, 0x8b, 0xbe, 0x44, 0x41, 0x44,
0x00, 0x49, 0xa0, 0x44, 0x51, 0x44,
0x00, 0x48, 0x9c, 0x37, 0x8e, 0x78,
0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00, 0x00, 0x00
};

-a aslc86k

Print aslc86k code that can be used in VMU games.

$ mlcd -a mlcd.bmp
.byte %00000000,%00000000,%00000000,%00000000,%00000000,%00000000
.byte %00000000,%00000000,%00000000,%00000000,%01111111,%11000000
.byte %00000000,%00000000,%00000000,%00000111,%11111111,%11111100
.byte %00000000,%00000000,%00000000,%00111111,%11110000,%00000000
.byte %00000000,%00000000,%00000001,%11111111,%10000000,%00000000
.byte %00110000,%00000000,%00011111,%11111100,%00000000,%00000000
.byte %10111110,%00000001,%11111111,%11111000,%00111111,%10000000
.byte %10011111,%11111111,%11111111,%11111111,%11111111,%11100000
.byte %01011111,%11111111,%11111111,%11111111,%11100000,%00000000
.byte %01001111,%11111111,%11111111,%11111111,%00000000,%00000000
.byte %00101111,%11111111,%11111111,%11111100,%00000000,%00000000
.byte %00100111,%11111111,%11111111,%11110000,%00000000,%00000000
.byte %00010111,%11111111,%11111111,%11000000,%00000000,%00000000
.byte %00010011,%11111111,%11111111,%00000000,%00000000,%00000000
.byte %00001001,%11111111,%11111100,%00000000,%00000000,%00000000
.byte %00001001,%11111111,%11000000,%00000000,%00000000,%00000000
.byte %00000100,%11111110,%00000000,%00000000,%00000000,%00000000
.byte %00000100,%00000000,%00000000,%00000000,%00000000,%00000000
.byte %00000010,%00000000,%00000000,%00000000,%00000000,%00000000
.byte %00000010,%00000000,%00000000,%00000000,%00000000,%00000000
.byte %00000001,%00001000,%10000000,%01000111,%10001110,%01110000
.byte %00000001,%00001100,%10011100,%11100100,%01010000,%01001000
.byte %00000000,%10001110,%10100010,%01000111,%10001110,%01000100
.byte %00000000,%10001011,%10111110,%01000100,%01000001,%01000100
.byte %00000000,%01001001,%10100000,%01000100,%01010001,%01000100
.byte %00000000,%01001000,%10011100,%00110111,%10001110,%01111000
.byte %00000000,%00100000,%00000000,%00000000,%00000000,%00000000
.byte %00000000,%00100000,%00000000,%00000000,%00000000,%00000000
.byte %00000000,%00010000,%00000000,%00000000,%00000000,%00000000
.byte %00000000,%00010000,%00000000,%00000000,%00000000,%00000000
.byte %00000000,%00001000,%00000000,%00000000,%00000000,%00000000
.byte %00000000,%00001000,%00000000,%00000000,%00000000,%00000000

Tips and Tricks

Clear screen

$ dd if=/dev/zero of=/dev/mlcd0.0 count=192

Draw random pixels

$ dd if=/dev/urandom of=/dev/mlcd0.0 count=192

Cross compile on NetBSD

You can build the tools using build.sh.

$ /path/to/tools/bin/nbmake-dreamcast 

mlcd's People

Contributors

travispaul avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.