Sakura demo

Last Updated or created 2023-07-21

I think i started programming in assembly on PC around 1992. I learned a lot from my friend Edk. Who was a assembly wizard just like Sepp. Reverse engineering routines, writing emulators etc.

We made several demo’s like the one below. It must have been around 1994.

Dos emulator running our demo from 1994

Just after this one, we started a demo which could run from a 5.25″ boot disk. No dos operating system.
When starting your pc, booting from a floppy you would get a starfield, with some text (from a bootsector) ,after that it would load the next sectors, wich contained the rest of the demo.
Due to directly programming soundcard and graphics card, this was hard to pull off on different kinds of hardware.

Demo gfx

Example of assembly code for a effect.

    NAME plasma

.model small
.386
.data
colshades   db +001h, 001h,+001h
            db -001h,-001h,-000h
            db +000h,-000h,-001h
            db -000h,-000h,+000h
rgb_cols    db 256*3 dup (?)
cosptr dw 0
sinptr dw 30

.code
demo        proc near

show proc near
    xor di,di
    mov bp,200
show1:
    mov cx,320
    mov si,0
    mov dx,0
show0:
;    push ds
;    mov ax,7000h
;    mov ds,ax
;    lodsb
;    pop ds
    call getsincos
    add cosptr,1
    stosb
    loop show0
;    add dx,1
    add sinptr,1
    dec bp
    jnz show1
    ret
show endp

effect proc near
;   add cosptr,1
;    add sinptr,0
    ret
effect endp

getsincos proc near
    push di
    push ds
    mov si,cosptr
    mov di,sinptr
    mov ax,7000h
    mov ds,ax
    lodsb           ;get cos value
    cmp si,320      ;einde costab?
    jb cosok
    xor si,si
    lodsb
cosok:
    mov ah,al
    xchg si,di
    lodsb           ;get cos value
    cmp si,320      ;einde costab?
    jb sinok
    xor si,si
    lodsb
sinok:
    xchg si,di
    pop ds
    mov cosptr,si
    mov sinptr,di

    mov dx,0
    mov dl,al
    add dl,ah
    adc dh,0
    shr dx,1
    mov al,dl
;    xor al,ah
;    add al,ah
    pop di
    ret
getsincos endp

setcols proc near
    push    es
    push    ds
    pop     es
    mov     di,offset rgb_cols
    mov     si,offset colshades
    mov     dl,0    ;start with black
    mov     bh,0
    mov     bl,0
    mov     bp,4
set_rgball:
    mov     cx,64-1
set_rgb:
    mov     al,dl
    stosb
    mov     al,bh
    stosb
    mov     al,bl
    stosb
    mov     al,[si]
    add     dl,al
    mov     al,[si+1]
    add     bh,al
    mov     al,[si+2]
    add     bl,al
    loop    set_rgb
    add     si,3
    dec     bp
    jnz     set_rgball
    pop     es
    ret
setcols endp

setrgb proc near
    mov dx,3c8h
    xor al,al       ;start with colour 00h
    out dx,al
    inc dx
    mov si,offset rgb_cols
    mov cx,256*3
    rep outsb       ;set 256 RGB values
    ret
setrgb endp

wvtr proc near
    mov dx,3dah
wtv:
    in al,dx
    test al,8
    jz wtv
    ret
wvtr endp

start:
    cld
    mov ax,@data
    mov ds,ax
    mov ax,0a000h
    mov es,ax
    mov ax,13h
    int 10h         ;screen 320x200 256 colours
    call setcols
    call setrgb
    call show
    mov al,11111101b
    out 21h,al      ;disable int
mloop:
    call wvtr
;    call show
    call effect
    mov ah,1
    int 16h
    jz mloop
    xor ah,ah
    int 16h
exit:
    xor al,al
    out 21h,al      ;enable int
    mov ax,3
    int 10h         ;screen  80x25 text
    mov ax,4c00h
    int 21h         ;back to DOS
demo        endp

end start