please dont rip this site
Home About Projects PIC code SX code

Code Generation Project

The project deals with highly optimized assembly code generation for PIC and SX microcontrollers. Now three generators are available. The programs are written in C/C++ and use a very convenient cgihtml C library written by Eugene Kim for interfacing with CGI. With it, an online application is no harder than a command line one.

  1. Constant division/multiplication.

    It takes a lot of burden off your back when you need to multiply or divide an integer variable by a floating point constant, especially if it has to be done many times. Also it can be used to efficiently code the bit shifts (after all, a shift is a multiplication too). See also the description of the techniques used in this code generator. Supports both PICs and SXs.

  2. Looking for keywords in a text stream.

    For example, this code generator could generate a program for you that would check what text commands are received by a serial link, and return the command code. You can specify incomplete word match and case sensitivity. PIC only.

  3. Delay loop generation.

    Generates cycle precise fixed delays using nested loops. It is based on an optimization algorithm that searches for best counters values to minimize the counters number. See also cycle precise variable delays. PIC only.

Code Converter from PIC to SX

Well, SX microcontrollers have almost identical instruction set to the low end PIC generation. But unfortunately the mnemonics are radically different. It really takes some time to adjust. Also a huge base of code exists for PICs, which would be nice to have for these newer (and faster!) micros. So I wrote a program to facilitate the conversion. It is not fully automatic, because some instructions like 'addlw' or 'sublw' are better translated manually, but it helps.

The program translates MPASM compatible code to SASM, the standard SX assembler.

Colorer utility

This utility is designed to make colored HTML listings for SX/PIC assembly programs. The input listing can be either plain text or HTML, but output is always HTML.

The code is parsed into several different classes which correspond to the style sheet classes (CSS). The classes are:

.Inst Instructions (mnemonics)
.Dir Directives
.Comm Comments
.Num Numerical constants
.Str String constants
.Sym Symbols, operators
.Id All unrecognized keywords

You need to specify the style sheet URL in the form to make the utility use the class names. Without the URL, a listing is simply converted to HTML and the classes are not used.

It is quite economical to use styles instead of or similar tags. The file size grows typically less than 100% (relative to the original plain text input). Additionally, it is very easy to change the colors and fonts with an external style sheet file, no need to modify the HTML listings.

Another possibility with this utility is the ability to link the mnemonics and selected keywords to the pages explaining their usage. By default, this feature is disabled. If you need it, specify a list of keywords and URLs. There is an example for SX asm in the form.

The colorer utility is written in C/C++ and Flex (a text scanner generator). The keywords were "hardcoded" as the goal of this project was a good performance (it is going to be used on the and sites). However, I wouldn't use Flex next time for that stuff. It's much easier to debug and customize a C program than the Flex rules!

Charset Extractor

This program extracts characters from a bitmap, and encodes them to a table. With the program you can pack the pixel lines (either rows or columns) of a character to multiple binary words in any order of bits. Very flexible. You will find there also a few charset examples for several resolutions (from 4x6 to 12x16).

file: /Techref/member/NG--944/projects.htm, 7KB, , updated: 2004/1/5 20:11, local time: 2024/7/18 03:59, owner: NG--944,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> Projects</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?