diff options
-rw-r--r-- | dla.s | 130 |
1 files changed, 121 insertions, 9 deletions
@@ -45,6 +45,7 @@ textbuf = $0590 fptmp = $05a0 cloksav = $a0 + seedtype = $9f ; start of init segment. gets overwritten by the main program... ; and since the rest of the xex isn't loaded yet, can't call @@ -55,6 +56,8 @@ msg: .byte "Diffusion Limited Aggregate",$9b .byte "Urchlay's ASM version 0.0.5",$9b,$9b .byte "How many particles [",.sprintf("%d", DEFAULTPART),"]? ",$0 +msg2: + .byte $9b,"Seed Type: ",$9b,"1=Dot 2=Plus 3=4Dots 4=Line [1]? ",$0 init: ; set default particles (if user just hits return) lda #<DEFAULTPART @@ -128,6 +131,31 @@ mul10loop: digitsdone: usedefault: + + ; print seed type prompt + ldx #0 +pm2loop: + lda msg2,x + beq pm2done + jsr printchrx + inx + bne pm2loop +pm2done: + +readgen: + jsr getchrx + cmp #$9b + bne noteol + lda #$31 +noteol: + cmp #$31 + bcc readgen + cmp #$35 + bcs readgen + and #$0f + tax + dex + stx seedtype rts xex_init init @@ -165,12 +193,7 @@ wl: lda #>points_y sta spawn_y+1 - ; initial point in center - lda #$7f - sta cursor_x - lda #$5f - sta cursor_y - jsr plot + jsr drawseed next_particle: ldy RANDOM ; spawn a new particle @@ -550,9 +573,17 @@ dontplot: stx DMACTL ; check neighbors. used to be a subroutine, inlined it. + ; also inlined plotsetup here. ; (-1,0) dec cursor_x - jsr plotsetup + ldx cursor_y + lda lineaddrs_l,x + sta pixptr + lda lineaddrs_h,x + sta pixptr+1 + ldx cursor_x + ldy xoffsets,x + lda xmasks,x and (pixptr),y bne stick ; (1,0) @@ -565,7 +596,15 @@ dontplot: bne stick ; (0,-1) dec cursor_y - jsr plotsetup + ldx cursor_y + lda lineaddrs_l,x + sta pixptr + lda lineaddrs_h,x + sta pixptr+1 + ldx cursor_x + ldy xoffsets,x + lda xmasks,x + sta pixmask and (pixptr),y bne stick ; (0,1) @@ -575,14 +614,87 @@ dontplot: lda (pixptr),y and pixmask bne stick - beq drunkwalk + jmp drunkwalk ; too far for a branch stick: oob: rts +;;; Subroutine: drawseed +drawseed: + ldx seedtype + lda seeds_h,x + pha + lda seeds_l,x + pha + rts + +seed_point: + ; initial point in center + lda #$7f + sta cursor_x + lda #$5f + sta cursor_y + jmp plot + +seed_long: + ; horizontal line, the width of the screen + lda #$1 + sta cursor_x + lda #$5f + sta cursor_y +slnoop: + jsr plot + inc cursor_x + lda cursor_x + cmp #$ff + bne slnoop + rts + +seed_plus: + lda #$7f + sta cursor_x + lda #$55 + sta cursor_y +sploop: + jsr plot + inc cursor_y + lda cursor_y + cmp #$69 + bne sploop + lda #$75 + sta cursor_x + lda #$5f + sta cursor_y +slloop: + jsr plot + inc cursor_x + lda cursor_x + cmp #$89 + bne slloop + rts + +seed_4pt: + lda #$75 + sta cursor_x + lda #$55 + sta cursor_y + jsr plot + lda #$68 + sta cursor_y + jsr plot + lda #$88 + sta cursor_x + jsr plot + lda #$55 + sta cursor_y + jmp plot + ;;;;; end of executable code +seeds_l: .byte <(seed_point-1),<(seed_plus-1),<(seed_4pt-1),<(seed_long-1) +seeds_h: .byte >(seed_point-1),>(seed_plus-1),>(seed_4pt-1),>(seed_long-1) + ; dlatbl.s is generated by perl script, mkdlatbl.pl .include "dlatbl.s" |