VOGONS


First post, by orac81

User metadata
Rank Newbie
Rank
Newbie

Hi, this a little 64 byte demo of mine I thought I might share here..

https://github.com/orac81/miniapples/raw/refs … in/magixfly.zip

MAGIXFLY.ZIP (9k)

The attachment magicfly_screen.png is no longer available

This is an old-school DOS/VGA graphics demo program.

It gives the (classic) effect of flying over a changing landscape.

The x86 assembler source code (MAGIXFLY.ASM) is included, and there are comments with suggestions for changes, if you want to experiment.

It can run on an 8086 (or later) PC with VGA under MSDOS/Freedos. An FPU is not needed.

For modern PCs, it will run on Linux/Windows in DOSBOX, or other emulators.

To run, boot DOS and type:

MAGIXFLY.COM <ENTER>

Hit ESC to exit the demo. Type CLS or MODE 80 to return to 80 col display.

All variables held in registers, which makes the code smaller/faster.

AX,DX,SI are temp calc regs.

DS (data seg) points to VGA screen (A000h)

BX = Pixel position for plotting.

CX = time (frame count)

DI - Y position (for fx calc)

BP = X position (for fx calc)

It uses the open source NETWORK x86 assembler, NASM, but can easily be adapted to others.

Build with: NAS2COM magixfly

or NASM -f bin magixfly.asm -o magixfly.com

The demo isnt wildly new/original, but does have a few little ideas of its own, and it all neatly fits into 63 bytes. Enjoy!

https://github.com/orac81

Reply 1 of 10, by zyzzle

User metadata
Rank Member
Rank
Member

Thanks for sharing. I love little neat demos like this. Keep them alive in 2025! Raw ASM is so efficient and lean. It puts modern programming bloated "obfuscations" to shame.

Reply 2 of 10, by orac81

User metadata
Rank Newbie
Rank
Newbie

Thanks!
I have added a Turbo-c version to that archive, with my TCTINY build utility/library for TurboC. With that, the C version of the same demo builds to only 144 Bytes, so it is possible to build small programs like that with a high level language. Here is the TC version:

/* MAGIXFLY.C  - Tiny MSDOS 3d flying effect demo in 144 bytes.
(by orac81)

Simple demo of ultra-small compilation using TurboC 3.

To compile: tctiny.bat tc3path magixfly
ie: tctiny \m\tc3\bin magixfly

(needs MASM and exe2bin, or TASM)
*/

include "tctiny.c"

unsigned char far *pVdu;

unsigned int frame; /* Frame count */

void main()
{
register unsigned int x;
unsigned int y;
unsigned int calcy;

IO_VIDEOMODE (0x13); /* Set VGA video mode 13h 320x200x256 */

do {
pVdu = (char far *) ((long) 0xa0000000L);
for (y=10; y<210; y++) {
calcy = ((2560/y) + frame) ;
for (x=320; x; x --) {
*pVdu = (BYTE) (((((x<<4)/y) ^ calcy) + (frame >> 8)) & 31) ;
pVdu ++;
}
}
frame ++;
IO_GETKEY (x); /* See if ESC key hit */
} while (x == 0);
}

Here is the TCTINY lib with some more such demos..

https://github.com/orac81/miniapples/ra ... ctiny.zip

https://github.com/orac81

Reply 3 of 10, by zyzzle

User metadata
Rank Member
Rank
Member

Ha.. Of course, I don't include Turbo C in the list of those modern bloated obfuscations such as Java, Javascript, Rust, Python, etc, etc.

Reply 4 of 10, by orac81

User metadata
Rank Newbie
Rank
Newbie

I posted this up on pouet, and of course someone comes along and rejigs the code, so it now compiles to just 52 Bytes! Without the exit check it would be about 48 bytes.
The end tests for loopX/loopY are really ingenious.

But I bet no one can improve on this.. 🙂

; MAGIXFLY.ASM by orac81, improved by rrrola.
; 52 byte flying demo.
; es:di = pixel address, bx=time, bp=y, cx=x

OFFSETY equ 12

org 100h

mov al,19
int 10h ; Screen mode 19 - VGA 320x200x256 (Using default VGA palette)
push 0A000h
pop es

reloop:
mov bp,OFFSETY

loopY:
inc bp
mov ax,0A00h
cwd ; dx=0 (ax=2560)
div bp
add ax,bx
xchg ax,si

mov cx,320
loopX:
imul ax,cx,16
cwd ; dx=0 (ax<=5120)
div bp
xor ax,si
add al,bh
and al,31
stosb ; (es:di) = al
test di,di
loopnz loopX ; X--; if (X) goto loopX;
jnz loopY
; di=0 after the loop

inc bx

mov ah,1
int 16h
je reloop

ret

https://github.com/orac81

Reply 5 of 10, by Max Headroom

User metadata
Rank Newbie
Rank
Newbie

Just for kicks I converted your demo to Bruce's C compiler and AS86 assembler from its package. It works! Files attached.
Somehow I even saved one more byte! 😀

Reply 6 of 10, by orac81

User metadata
Rank Newbie
Rank
Newbie

MH: Thanks for that! Some of the early DOS C compilers were really efficient, and can be tweaked for small code by hacking the default libs. I was going to try Pacific C, and Whitesmiths C, which had a rep for speed:

https://github.com/hansake/Whitesmiths-C-compiler

I updated magixfly, (same link) making it 8086 compatible, now 54 bytes, also added CGA version.

Also added cgaplasma:
https://github.com/orac81/miniapples/raw/refs … ain/cgaplas.zip

https://github.com/orac81

Reply 7 of 10, by gerry

User metadata
Rank Oldbie
Rank
Oldbie

this is cool, especially the ports between c compilers of the time, i'd bet it works well in masm or tasm too, directly or inline.

I like the explicit use of registers, it's the kind of thing that used to go on in z80 and other old 8 and 16 bit computer demo programming too

I used to love all these demos and so on back in the early internet when enthusiasts would do things in asm c, pascal and qb to see what is possible, how far systems could be pushed and so on

These demos inspired others and sometimes even led to games and game engine ideas

Reply 8 of 10, by Grzyb

User metadata
Rank l33t
Rank
l33t

Traditionally, there were three categories of demos:
- full size
- 64 KB
- 4 KB

Later, there came the 256-Byte species.

Now, are we witnessing the birth of yet another category?

Kiełbasa smakuje najlepiej, gdy przysmażysz ją laserem!

Reply 9 of 10, by Max Headroom

User metadata
Rank Newbie
Rank
Newbie

Have a look here, Grzibby. 😉

Reply 10 of 10, by Max Headroom

User metadata
Rank Newbie
Rank
Newbie
orac81 wrote on 2025-05-07, 12:16:

MH: Thanks for that! Some of the early DOS C compilers were really efficient

If you like earlier C compilers probably Sphinx C-- may also be interesting to you. It already has nice built-in graphics capabilities.