pouët.net

Gespensterwald 64b by Desire [web]

                                                    .
                                                   .
                                                  . ..
                                                   .: .
                                                  ..:. .
                                                  .:::.
                                                  ::|:..
                                                  :|||:.
                                             ____ |||||: ____
                          _ __ ____ ________\\    ||||||    //__ _
                                                  |:::::
    ___ _________/\ ________ ___/\    __   ____/\   _ ______
  _\\__\\__.____  \\    ___/  _ //___(__)_. __  \\      ___/
           |   /    \  __)____ \/    \    |_ /  _/____ __)______ ___ _
           |________/________________/___ `/_\        \_ ____  //__//
                                     yop \/   \________/     \/
                                                  ......
              *    d E S i R E    *    _ ____     ||||||     ___ _
                                            //___ :||||: ___\\
                                                  ::||::
                                                  .:|::.
                                                   .::.
                                                  . :. .
                                                   .. .
                                                     .
                                                    .
                 G E S P E N S T E R W A L D
                      64 byte msdos intro
                        HellMood/DESiRE
					  
Near where i live, there is a very cool location 
named "Gespensterwald". A forest, located on a cliff
directly at the baltic sea. It can be beautiful at
times, but also haunting at others. Dedicated 2 Cha ♥

Technically, this is yet a another raycaster, exploring
3D sierpinski structures, while filling the unused space
with ambient drone sounds. New this time is breaking
the comfort of the "LOOP" instruction, which is very
efficient but also sends the ray in the wrong direction.
Instead, CX is used for the frameloop, which enables
another trick to save bytes for time influence
(freezing SI, and using just the high byte to increment
AH with "add ax,bp", thus saving another byte)
The geometry has special behaviour, as for the projection
MUL and IMUL are combined, thus mixing top-left and
middle centered projections, resulting in structures
getting thinned out in the depth. As a side effect, only
a part of the screen is filled, which allows for very
efficient "black bars" creation on top and bottom with
a simple offset (two bytes).

The submitted version (62 bytes) works as is in MS/FreeDos
it is very fast though. There is another version without
sound, synced to the timer, which is 44 bytes, also working
on all Dos Versions. A size way lower than 40 bytes can be
achieved with cutting alignment and color mapping, but
exploring that further is a thing for the future ;)

db 60                 ; 1st run piano, then french horn
db 0x9b,25,114        ; play note 25 with volume 114
nop                   ; align executable music data
mov al,13h            ; set graphic mode
int 10h               ; 320x200 pixels, 256 colors
Y: mov cl,62          ; 62 = length of this code
push si               ; save pointer to music data
mov dx,0x330          ; MIDI port (requires UART)
rep outsb             ; send code as data to MIDI port
pop si                ; restore pointer to music data
push 0xa000           ; set ES to start of visible screen
pop es                ; 2 extra bytes to work everywhere
X: mov bl,126         ; Depth D, start at ~0 (signed)
L: inc bx             ; D++, advance ray
mov ax,0xcccd         ; Rrrola trick, convert screen
mul di                ; ... pointer DI to Y,X in DH, DL
mov al,dh             ; get Y in AL
add al,92             ; center forest in the middle
imul bl               ; Y' projection, result in AH
xchg ax,dx            ; save Y' in DH, get X in AL
mul bl                ; X' projection, result in AH
add ax,bp             ; X'' = X' + T (high byte of BP)
or ah,bl              ; sierpinski pyramid formula
and ah,dh             ; H = ( X'' | D ) & Y'
jnz L                 ; if not hit, continue ray
xchg bx,ax            ; get number of steps in AL
inc ax                ; map number of steps ...
shr al,3              ; .. to black white scale
stosb                 ; write pixel value and advance
imul di,byte 85       ; antiflicker, rough look
loop X                ; frame loop (65536 pixels)
add bp,si             ; T++, high byte of BP (SI=100h)
jmp short Y           ; repeat, also change instrument...
					  
                      G R E E T I N G S   
         \                                                          
\ \       \\  sensenstahl,homecoded,rrrola,frag,T$                  
 \ \   \   \\  Optimus,Trixter,igor,gentleman,Vile                  
        \   \\  Whizart,g0blinish,Rudi,ryg,Tomcat                  
         \   \\  orbitaldecay,wysiwtf,Kuemmel,p01,Lara              
          \   \\  Oscar Toledo,Drift,maugli,Harekiet            
               \\  superogue,blossom,alia,iONic
                \\  Dresdenboy,mrsbeanbag,DevEd