Moving on: The development of Nanorail


Following the release of Homogenic, I wanted to see what I could do next and noticed the Synchrony Party was coming up. This is a demoparty that is held on a train from New York to Montreal. However, the party was actually held only one week from Rsync, so I only had a few days to complete my next intro.

As I very much liked the idea of having a demoparty on a train, I wanted to create an intro that reflected that theme as well, which got me thnking.


I've started with a mirrored perspective floor routine on the FPU, and then subdividing the floor horizontally in different segment (grass, rail, track) and coloring them on the CPU. The top half of the screen is a simple vertical gradient take from the y-position that will slowly change color over time depending on the day/night cycle.

To add further movement, i'm slowly the distance to the floor over time, so that the 'camera' will pan up and down from the track all the way up into the sky and back.

; set camera height
fild word [byte bx-6]
fidiv word [tdiv]
fmul dword [scalevalue]
fadd dword [addvalue]

; calculate perspective
fild word [bx-8]
fmul st1
fild word [bx-9]
fdiv st1
fistp word [bx-4] ; store in ax
fild word [floorval] ; floorval = 32767
fdiv st1
fist word [bx-6] ; store in cx

Text and Display Routine:

At first I had a little trouble deciding which colorscheme I would go for, before ending up with the idea of a day and night cycle, with a text in between. To make this happen, i'm drawing a text via bios routine (int 21h) on the top left of the screen at startup. Then i'm copying this text from the top left to of the screen of to the center of the screen and blowing up the pixels 3 fold.

; write text
mov ah,9
mov dx,text
int 21h
; copy text
mov di,4b46h
mov ch,09h
es lodsb
jz addcolor_skip
add al,240
loop copyloop
; clear top of screen
xor ax,ax
mov ch,161
rep stosb

Since this is only done once at startup, we need to make sure the actual effect doesn't overwrite the pixels of the text, so to avoid this, i'm skipping an extra pixel each frame, so we get this nice angled interlacing pattern between effect and text.


For sound I wanted to approximate the sound of a train on a track, but I did not have a lot of bytes left. I first looking into producing some PC speaker/Covox whitenoise, but this didn't sound right. So I went on to search if there was a GM1 sound that I could play at a low note that would approach this sound. Turned out there was: After a lot of trial and error I found the applause sound played back at a low frequency good enough to pass as a train.


Even though time was sparse, i was able to finish this production in time and win the nano intro competition at Synchrony 2020.

For more information, you can down the intro complete with sourcecode at:

Return to blog overview