diff --git a/graphics/gr/plasmagoria/plasmag_hgr.s b/graphics/gr/plasmagoria/plasmag_hgr.s new file mode 100644 index 00000000..8dac3576 --- /dev/null +++ b/graphics/gr/plasmagoria/plasmag_hgr.s @@ -0,0 +1,197 @@ +; PLASMAGORIA, Tiny version + +; original code by French Touch + +; trying to see how small I can get it + + +; note can use $F000 (or similar) for color lookup to get passable +; effect on fewer bytes + +; 347 bytes -- initial with FAC +; 343 bytes -- optimize init +; 340 bytes -- move Table1 + Table2 to zero page +; 331 bytes -- init not necessary +; 319 bytes -- inline precalc + display + init lores colors +; 316 bytes -- fallthrough in make_tiny + +.include "hardware.inc" + + +;Table1 = $8000 +;Table2 = $8000+64 + +; Page Zero + +GBASL = $26 +GBASH = $27 + +COMPT1 = $30 +COMPT2 = $31 + +PARAM1 = $60 +PARAM2 = $61 +PARAM3 = $62 +PARAM4 = $63 + +Table1 = $A0 ; 40 bytes +Table2 = $D0 ; 40 bytes + + +; ============================================================================= +; ROUTINE MAIN +; ============================================================================= + +plasma_debut: + jsr HGR ; have table gen appear on hgr page1 + bit FULLGR + + jsr make_tables + + bit LORES ; set lo-res + + +lores_colors_fine=$8100 + +; ============================================================================ +; init lores colors (inline) +; ============================================================================ + +init_lores_colors: + ldx #0 + ldy #0 +; 347 + +init_lores_colors_loop: + lda lores_colors_lookup,X + sta lores_colors_fine,Y + iny + sta lores_colors_fine,Y + iny + sta lores_colors_fine,Y + iny + sta lores_colors_fine,Y + iny + beq done_init_lores_colors + + inx + txa + and #$f + tax + jmp init_lores_colors_loop + +done_init_lores_colors: + +; ============================================================================ + +do_plasma: + ; init + +; lda #02 +; ldx #5 +;init_loop: +; sta COMPT1,X +; dex +; bne init_loop + +BP3: + +; ============================================================================ +; Precalculate some values (inlined) +; ROUTINES PRE CALCUL +; ============================================================================ +precalc: + lda PARAM1 ; self modify various parts + sta pc_off1+1 + lda PARAM2 + sta pc_off2+1 + lda PARAM3 + sta pc_off3+1 + lda PARAM4 + sta pc_off4+1 + + ; Table1(X) = sin1(PARAM1+X)+sin2(PARAM1+X) + ; Table2(X) = sin3(PARAM3+X)+sin1(PARAM4+X) + + ldx #$28 ; 40 +pc_b1: +pc_off1: + lda sin1 +pc_off2: + adc sin2 + sta Table1,X +pc_off3: + lda sin3 +pc_off4: + adc sin1 + sta Table2,X + + inc pc_off1+1 + inc pc_off2+1 + inc pc_off3+1 + inc pc_off4+1 + + dex + bpl pc_b1 + + inc PARAM1 + inc PARAM1 + dec PARAM2 + inc PARAM3 + dec PARAM4 + +; ============================================================================ +; Display Routines +; ROUTINES AFFICHAGES +; ============================================================================ + +; Display "Normal" +; AFFICHAGE "NORMAL" + +display_normal: + + ldx #23 ; lines 0-23 lignes 0-23 + +display_line_loop: + + txa + jsr GBASCALC + + ldy #39 ; col 0-39 + + lda Table2,X ; setup base sine value for row + sta display_row_sin_smc+1 +display_col_loop: + lda Table1,Y ; load in column sine value +display_row_sin_smc: + adc #00 ; add in row value + sta display_lookup_smc+1 ; patch in low byte of lookup +display_lookup_smc: + lda lores_colors_fine ; attention: must be aligned + sta (GBASL),Y + dey + bpl display_col_loop + dex + bpl display_line_loop + +; ============================================================================ + + inc COMPT1 + bne BP3 + + dec COMPT2 + bne BP3 + + beq do_plasma ; bra + + + + + +lores_colors_lookup: +.byte $00,$88,$55,$99,$ff,$bb,$33,$22,$66,$77,$44,$cc,$ee,$dd,$99,$11 + + +.include "make_tables.s" + + diff --git a/graphics/gr/plasmagoria/plasmag_outline.s b/graphics/gr/plasmagoria/plasmag_outline.s new file mode 100644 index 00000000..c4ef5144 --- /dev/null +++ b/graphics/gr/plasmagoria/plasmag_outline.s @@ -0,0 +1,202 @@ +; PLASMAGORIA, hi-res version + +; original code by French Touch + + +.include "hardware.inc" + +hposn_high=$6000 +hposn_low =$6100 + +;Table1 = $8000 +;Table2 = $8000+64 + +HGR = $F3E2 + +; Page Zero + +GBASL = $26 +GBASH = $27 + +COMPT1 = $30 +COMPT2 = $31 + +PARAM1 = $60 +PARAM2 = $61 +PARAM3 = $62 +PARAM4 = $63 + +Table1 = $A0 ; 40 bytes +Table2 = $D0 ; 40 bytes + + +; ============================================================================= +; ROUTINE MAIN +; ============================================================================= + +plasma_debut: + jsr HGR ; have table gen appear on hgr page1 + bit FULLGR + + jsr build_tables + +lores_colors_fine=$8100 + +; ============================================================================ +; init lores colors (inline) +; ============================================================================ + +init_lores_colors: + ldx #0 + ldy #0 +; 347 + +init_lores_colors_loop: + lda lores_colors_lookup,X + sta lores_colors_fine,Y + iny + sta lores_colors_fine,Y + iny + sta lores_colors_fine,Y + iny + sta lores_colors_fine,Y + iny + beq done_init_lores_colors + + inx + txa + and #$f + tax + jmp init_lores_colors_loop + +done_init_lores_colors: + +; ============================================================================ + +do_plasma: + ; init + +; lda #02 +; ldx #5 +;init_loop: +; sta COMPT1,X +; dex +; bne init_loop + +BP3: + +; ============================================================================ +; Precalculate some values (inlined) +; ROUTINES PRE CALCUL +; ============================================================================ +precalc: + lda PARAM1 ; self modify various parts + sta pc_off1+1 + lda PARAM2 + sta pc_off2+1 + lda PARAM3 + sta pc_off3+1 + lda PARAM4 + sta pc_off4+1 + + ; Table1(X) = sin1(PARAM1+X)+sin2(PARAM1+X) + ; Table2(X) = sin3(PARAM3+X)+sin1(PARAM4+X) + + ldx #$28 ; 40 +pc_b1: +pc_off1: + lda sin1 +pc_off2: + adc sin2 + sta Table1,X +pc_off3: + lda sin3 +pc_off4: + adc sin1 + sta Table2,X + + inc pc_off1+1 + inc pc_off2+1 + inc pc_off3+1 + inc pc_off4+1 + + dex + bpl pc_b1 + + inc PARAM1 + inc PARAM1 + dec PARAM2 + inc PARAM3 + dec PARAM4 + +; ============================================================================ +; Display Routines +; ROUTINES AFFICHAGES +; ============================================================================ + +; Display "Normal" +; AFFICHAGE "NORMAL" + +display_normal: + + ldx #23 ; lines 0-23 lignes 0-23 + +display_line_loop: + + txa + pha + asl + asl + asl + tax + lda hposn_high,X + sta output_smc+2 + lda hposn_low,X + sta output_smc+1 + pla + tax + + ldy #39 ; col 0-39 + + lda Table2,X ; setup base sine value for row + sta display_row_sin_smc+1 +display_col_loop: + lda Table1,Y ; load in column sine value +display_row_sin_smc: + adc #00 ; add in row value + sta display_lookup_smc+1 ; patch in low byte of lookup +display_lookup_smc: + lda lores_colors_fine ; attention: must be aligned + +output_smc: + sta $2000,Y + + dey + bpl display_col_loop + dex + bpl display_line_loop + +; ============================================================================ + + inc COMPT1 + bne BP3 + + dec COMPT2 + bne BP3 + + beq do_plasma ; bra + + + + + +lores_colors_lookup: +.byte $00,$88,$55,$99,$ff,$bb,$33,$22,$66,$77,$44,$cc,$ee,$dd,$99,$11 + +.include "hgr_table.s" + +.align 256 +sin1: +.incbin "tables" +sin2=sin1+256 +sin3=sin2+256 diff --git a/graphics/gr/starfield/Makefile b/graphics/gr/starfield/Makefile index 9f43cae7..3633953a 100644 --- a/graphics/gr/starfield/Makefile +++ b/graphics/gr/starfield/Makefile @@ -13,9 +13,10 @@ $(DOS33): cd ../../../utils/dos33fs-utils && make starfield.dsk: $(DOS33) HELLO STARFIELD_DEMO STARFIELD_1K STARFIELD.BAS \ - STARSMALL STARBOT STARBOT_LOOKUP + STARSMALL STARBOT STARBOT_LOOKUP STAR_HORIZ.BAS cp $(EMPTY_DISK)/empty.dsk starfield.dsk $(DOS33) -y starfield.dsk SAVE A HELLO + $(DOS33) -y starfield.dsk SAVE A STAR_HORIZ.BAS $(DOS33) -y starfield.dsk SAVE A STARFIELD.BAS $(DOS33) -y starfield.dsk BSAVE -a 0x1000 STARFIELD_DEMO $(DOS33) -y starfield.dsk BSAVE -a 0x1000 STARFIELD_1K @@ -33,6 +34,11 @@ HELLO: hello.bas STARFIELD.BAS: starfield.bas $(TOKENIZE) < starfield.bas > STARFIELD.BAS +### + +STAR_HORIZ.BAS: star_horiz.bas + $(TOKENIZE) < star_horiz.bas > STAR_HORIZ.BAS + ### diff --git a/graphics/gr/starfield/star_horiz.bas b/graphics/gr/starfield/star_horiz.bas new file mode 100644 index 00000000..9b59b7df --- /dev/null +++ b/graphics/gr/starfield/star_horiz.bas @@ -0,0 +1,13 @@ +0 REM RYAN NORSE STARFIELD +1 GR:DIM X(32),Y(32),V(32),Z(32) +2FOR S=1 TO 32:X(S)=RND(1)*39:GOSUB100:NEXT +3FORS=1TO32 +4COLOR=0:PLOTX(S),Y(S):X(S)=X(S)-V(S) +5IFX(S)<0THENX(S)=39:GOSUB100 +8COLOR=Z(S):PLOT X(S),Y(S):NEXT +9GOTO3 +100 Y(S)=RND(1)*39:V(S)=RND(1) +110 Z=5:IFV(S)>0.3THENZ=7 +120IFV(S)>0.7THENZ=15 +130Z(S)=Z +140 RETURN diff --git a/graphics/gr/starfield/star_horiz_orig.bas b/graphics/gr/starfield/star_horiz_orig.bas new file mode 100644 index 00000000..d533f77d --- /dev/null +++ b/graphics/gr/starfield/star_horiz_orig.bas @@ -0,0 +1,15 @@ +0 REM RYAN NORSE STARFIELD +1 GR:DIM X(32),Y(32),V(32) +'2FOR I=1 TO 32:X(I)=INT(RND(1)*39)+1:Y(I)=INT(RND(1)*39)+1:V(I)=RND(1):NEXT +100 FOR S=1 TO 32 +110 X(S)=X(S)-V(S) +120 IF X(S)<1 THEN X(S)=39:Y(S)=INT(RND(1)*39):V(S)=RND(1) +130 NEXT S +140 FOR S=1 TO 32 +150 Z=5 +160 IF V(S)>0.3 THEN Z=7 +160 IF V(S)>0.7 THEN Z=15 +170 COLOR=Z +180 PLOT X(S),Y(S) +190 NEXT S +200 GOTO 100