Skip to content

guitmz/ansi-escape

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

ansi-escape

Simple program to demonstrate how to control a terminals with x64 Assembly. It works by fetching information about the terminal window size using Linux syscalls and crafting ANSI escape codes to control the inputs.

Another small auxiliar tool is included that can be used display the terminal dimensions (rows and columns) and there are comments in the code to make it easier to follow and understand.

Usage

You'll need Flat Assembler and Linux 64-bit (the code can be ported to 32-bit and other assemblers without much effort since it's pretty generic).

For the main program:

$ fasm ansi.asm
$ ./ansi

For the auxiliar program:

$ gcc winsz.c -o winsz
$ ./winsz 
lines 67
columns 274

Demo

asciicast