pouët.net

firecraft by sibCrew

; ..firecraft
; --wbcbz7 -- ob.ol.2o24
; 128b/pc/dos/textmoooooode at dihalt'2o24
;
; protip: better start working on your prods a couple of days before deadline,
; not two hours before :)
;
; this one is a bit interactive! jam your keyboard or wiggle your mouse
; (since it uses HLT for timing)
;
; if PCem is correct, works even on XT/CGA :D locks the keyboard out tho
;
; come to multimatograf 2024 - 28-30 april - events.retroscene.org

        org     0x100
        use16

start:
        int     0x10            ; set 40x25

        mov     ah, 0xB8        ; set textmode frame buffer segment
        mov     es, ax
    
        ; frame loop
.loop:
        ror     bx, 1

        ; frame limit
        hlt
        mov     dx, 0x3DA
.2:
        in      al, dx
        test    al, 8
        jz      .2

        in      al, 0x40
        mov     cl, al

        xor     di, di
.smloop:
        mov     al, [es:di]
        or      al, [es:di+82]
        or      al, [es:di+2]
        add     al, cl
        sbb     ah, ah                  ; saturation
        and     ah, al
        in      al, 0x40
        and     al, bh
        add     al, ah
        mov     ah, 0x01
        stosw
        out     0x61, al
        cmp     di, (40 * 26 * 2)
        jnz     .smloop

        in      al, 0x40
        and     ax, bp
        test    al, 0x80
        jz      .done

        ; draw logo
        mov     si, multik
        in      al, 0x40
        and     ax, 0x1e
        add     ax, (40*((25 - 12)/2) + 8)*2
        mov     di, ax
.lineloop:
        mov     bh, 1
        or      bl, [si]
        jz      .done
.charloop:
        shr     bx, 1
        jz      .next_byte
        sbb     ax, ax
        jz      .advance
        and     ax, 0x0CB1
        mov     [es:di], ax
        out     0x42, al
.advance:
        add     di, 4
        jmp     .charloop

.next_byte:
        sub     di, -(2*80 - 32)
        inc     si
        jmp     .lineloop
        
.done:
        inc     bp
        ; kbhit()
        in      al, 0x60
        dec     al
        jnz     .loop

        ; and back to dos
        ret

multik      db 129, 195, 231, 255, 255, 255, 255, 126, 0