Monday, 16 December 2019

Microtan65 plasma fx


I found some old test fx I made for the Microtan 65 computer and posted a quick video on twitter here   Someone asked for the source so here it is.   This was compiled with a DOS assembler called AS6502 for some reason, so some of the formatting is odd.  (eg: dfb than the usual .byte)  I haven't looked at the Microtan machine since 2016 but I think I ported this from my older 'Plasma 190 bytes' version on the c64.  That would explain why I'm generating the sinetable when there's plenty of room.




;; Plasma FX
;; I was typing G400 in the TANBUG debugger to run it.

org $0400

;; sine table generator, not very accurate but enough for 1k intros.
;; sits at $1f00 in memory

    lda #$05
    sta $63
    lda #$1f
    sta $61
    ldy #$3f
    ldx #$00
addsine
    inc $61
startsine
    lda $63
    sta $62
keepsine
    lda $61
    sta $1f00,x
    sta $1fc0,y
    eor #$ff
    sta $1f80,x
    sta $1f40,y
    inx
    dey
    bmi nomoresine
    dec $62
    bpl keepsine
    inc $61
    dec $63
    clc
    lda $64
    adc $63
    asl a
    sta $64
    bcs startsine
    bne addsine
nomoresine

;; Main loop

plasmaloop
   
;; Active graphics mode

    lda $bff0


;; Uses a lot of naughty self-modifying code :)

    lda #$02
    sta plum+$01
    lda #$00
    sta $fe
   
    ldy $24
    ldx $25
    clc
    lda #$d0
    sta sety+$01

copyy
    lda $1f00,x
    adc $1f00,y
sety
    sta $80
    txa
yfx1
    adc #$f8
    tax

    iny
    dec sety+$01
    bmi copyy

    lda #$0f
    sta $21
newline
    ldy $21

    lda $b0,y
    sta $20

plum lda #$01
    sta draw+$02
    lda $fe
    sta draw+$01
    clc
    adc #$20
    cmp $fe
    sta $fe
    bcs noplus
    inc plum+$01
noplus


    clc
    ldx #$1f
xdraw

    lda draw+$02
    cmp #$02
    bne notthis
    lda draw+$01
    cmp #$e0
    bne notthis
   
    cpx #$0c
    bcc notthis
    cpx #$14
    bcs notthis
    jmp skipdraw
   
notthis

    lda $80,x
    adc $20
    tay
    lda $1f00,y
    lsr a
    lsr a
    tay
    lda plasgfx,y
draw
    sta $0200,x
skipdraw
    dex
    bpl xdraw

notupd
    dec $21
    bpl newline

;; Update sinus add parameters



    lda $26
    adc #$fd
    sta $26
    sta $24

    lda $27
yfx3
    adc #$01
    sta $27
    sta $25

;; Turn off graphics mode to display logo

    sta $bff3

    ldx #$00
drawlogo
    lda logo1,x
    sta $02ec,x
    inx
    cpx #$08
    bne drawlogo
   
    jmp plasmaloop
   
;; Graphics look-up table for patterns

plasgfx
    dfb $00,$00,$00,$00,$00,$00,$00,$00
    dfb $00,$00,$00,$00,$01,$01,$01,$01
    dfb $11,$11,$11,$11,$11,$11,$11,$11
    dfb $09,$09,$09,$09,$09,$09,$09,$09
    dfb $19,$19,$19,$19,$19,$19,$19,$19
    dfb $87,$87,$87,$87,$87,$87,$87,$87
    dfb $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff

;; Logo character table

logo1
    dfb $4f,$52,$42,$20,$32,$30,$31,$39
end

No comments:

Post a Comment