hgr: entropytext: getting smaller

This commit is contained in:
Vince Weaver 2021-05-22 00:21:36 -04:00
parent d6ab755bbe
commit cc7339d734
3 changed files with 243 additions and 13 deletions

View File

@ -8,7 +8,7 @@ LINKERSCRIPTS = ../../../linker_scripts
all: xdraw.dsk
xdraw.dsk: HELLO TINY_XDRAW TINY_COOL TINY_LINES TINY_CENTER NYAN XDRAW_TEST SHIMMER SHIMMER_BOT ENTROPY_TEXT
xdraw.dsk: HELLO TINY_XDRAW TINY_COOL TINY_LINES TINY_CENTER NYAN XDRAW_TEST SHIMMER SHIMMER_BOT ENTROPY_TEXT ENTROPY_TEXTBOT
cp $(EMPTYDISK) xdraw.dsk
$(DOS33) -y xdraw.dsk SAVE A HELLO
$(DOS33) -y xdraw.dsk BSAVE -a 0xE7 TINY_XDRAW
@ -20,6 +20,7 @@ xdraw.dsk: HELLO TINY_XDRAW TINY_COOL TINY_LINES TINY_CENTER NYAN XDRAW_TEST SHI
$(DOS33) -y xdraw.dsk BSAVE -a 0xC00 SHIMMER
$(DOS33) -y xdraw.dsk BSAVE -a 0x3f5 SHIMMER_BOT
$(DOS33) -y xdraw.dsk BSAVE -a 0x3f5 ENTROPY_TEXT
$(DOS33) -y xdraw.dsk BSAVE -a 0x3f5 ENTROPY_TEXTBOT
###
@ -101,6 +102,15 @@ ENTROPY_TEXT: entropy_text.o
entropy_text.o: entropy_text.s
ca65 -o entropy_text.o entropy_text.s -l entropy_text.lst
###
ENTROPY_TEXTBOT: entropy_textbot.o
ld65 -o ENTROPY_TEXTBOT entropy_textbot.o -C $(LINKERSCRIPTS)/apple2_3f5.inc
entropy_textbot.o: entropy_textbot.s
ca65 -o entropy_textbot.o entropy_textbot.s -l entropy_textbot.lst
@ -108,4 +118,4 @@ entropy_text.o: entropy_text.s
####
clean:
rm -f *~ *.o *.lst HELLO TINY_COOL TINY_XDRAW TINY_LINES TINY_CENTER NYAN XDRAW_TEST SHIMMER
rm -f *~ *.o *.lst HELLO TINY_COOL TINY_XDRAW TINY_LINES TINY_CENTER NYAN XDRAW_TEST SHIMMER ENTROPY_TEXT ENTROPY_TEXTBOT

View File

@ -216,17 +216,6 @@ shape_table:
; 280/6= 48 roughly ; 36*6 wide = 216, 280-216/2=32 to 248
; 160/6 = 26 roughly ; 42 high, 160-42/2 = 118/2=59, say 60?
;0123456701234567012345670123456701234567
; # #
; #
; # #### #### # # ### ####
; ##### # # # # ## # #
; # # ###### ### # # ######
; # # # # # # #
; #### #### #### # # ####
;0123456701234567012345670123456701234567
;0123456701234567012345670123456701234567
; # ### ###
; # # #

View File

@ -0,0 +1,231 @@
; Roughly based on "Entropy" by Dave McKellar of Toronto
; A Two-line BASIC program Found on Beagle Brother's Apple Mechanic Disk
;
; It is XORing vector squares across the screen. Randomly the size
; is changed while doing this.
; 24001 ROT=0:FOR I=1 TO 15: READ A,B: POKE A,B: NEXT: DATA
; 232,252,233,29,7676,1,7678,4,7679,0,7680,18,7681,63,
; 7682,36,7683,36,7684,45,7685,45,7686,54,7687,54,7688,63,
; 7689,0
; 24002 FOR I=1 TO 99: HGR2: FOR E=.08 TO .15 STEP .01:
; FOR Y=4 to 189 STEP 6: FOR X=4 to 278 STEP 6:
; SCALE=(RND(1)<E)*RND(1)*E*20+1: XDRAW 1 AT X,Y:
; NEXT: NEXT: NEXT: NEXT
; if E=.08 IF RND<20 RND(1)*.08 < .1
; If (RND(1)<E) THEN SCALE = RND(1)*E*20+1 = 1 .. 2 (2.6)
; IF (RND(1)>E) THEN SCALE = 1
; if E=.15 IF RND<38
; If (RND(1)<E) THEN SCALE = RND(1)*E*20+1 = 1 .. 4
; IF (RND(1)>E) THEN SCALE = 1
XREG = $46
YREG = $47
SEEDL = $4E
SEEDH = $4F
FRAME = $CC
FRAMEH = $CD
HGR_SCALE = $E7
DISP_PAGE = $ED
DRAW_PAGE = $EE
XHIGH = $F1 ; credits
HGR = $F3E2
HGR2 = $F3D8
HPOSN = $F411
XDRAW0 = $F65D
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
RESTORE = $FF3F
entropy_text:
jsr HGR2 ; Hi-res graphics, no text at bottom
; Y=0, A=0 after this call
; sta LOGO_OFFSET
sta FRAME
sta XHIGH
iny ; default is 1
sty HGR_SCALE
ldy #60 ; FOR Y=60 to 102 STEP 6
logo_yloop:
ldx #34 ; FOR X=32 to 248 STEP 6
logo_xloop:
logo_offset_smc:
asl desire_boxes
bcc skip_xdraw
jsr do_xdraw
skip_xdraw:
logo_nextx: ; NEXT X
inc FRAME
lda FRAME
and #$7
bne no_inc_offset
inc logo_offset_smc+1
no_inc_offset:
txa
clc ; 1
adc #6 ; x+=6 ; 2
tax
;cmp #248
cmp #18 ; this is 272?
bne logo_xloop
logo_nexty:
clc
tya
adc #6 ; y+=6
tay
cpy #102
bne logo_yloop ; if so, loop
;======================================
; do the effect
;======================================
eloop:
ldy #6 ; Y=0 to 180 STEP 6
yloop:
ldx #0
stx XHIGH
ldx #4 ; FOR X=4 to 278 STEP 6
xloop:
lda #1 ; default is 1
sta HGR_SCALE
cpy #54
bcc random_scale ; blt
cpy #108
bcc done_scale ; bge
random_scale:
lda $F000
bmi done_scale
cmp #20
bcs done_scale
inc HGR_SCALE
done_scale:
jsr do_xdraw
nextx: ; NEXT X
inc random_scale+1
; starting at 4 so hit 256, overflow to high bit
; finally end at 280 which is 24?
txa
clc ; 1
adc #6 ; x+=6 ; 2
tax
beq xwrap
cmp #24
bne xloop
beq nexty
xwrap:
inc XHIGH
jmp xloop
nexty:
; carry always set if we get here?
clc
tya
adc #6 ; y+=6
tay
cpy #156
bne yloop ; if so, loop
beq eloop
do_xdraw:
stx XREG ; save X
sty YREG ; save Y
; setup X and Y co-ords
tya ; YPOS into A
ldy XHIGH ; XHIGH in Y
; XPOS already in X
jsr HPOSN ; X= (y,x) Y=(a)
ldx #<shape_table ; point to our shape
ldy #>shape_table
lda #0 ; ROT=0
jsr XDRAW0 ; XDRAW 1 AT X,Y
; Both A and X are 0 at exit
jmp RESTORE ; restore FLAGS/X/Y/A
; we saved X/Y earlier
shape_table:
.byte 18,63,36,36,45,45,54,54,63,0 ; shape data (a square)
; 280/6= 48 roughly ; 36*6 wide = 216, 280-216/2=32 to 248
; 160/6 = 26 roughly ; 42 high, 160-42/2 = 118/2=59, say 60?
;0123456701234567012345670123456701234567
; # ### ###
; # # #
; ##### ##### ##### # #### # #
; # # # # # # # # ## # #
; # # # # # # # # # #
; ### # # ### # ### # #### ### ###
; # #
;0123456701234567012345670123456701234567
desire_boxes:
.byte $00,$00,$02,$03,$B8
.byte $00,$00,$02,$00,$A0
.byte $3E,$f9,$F2,$78,$A0
.byte $42,$85,$0A,$98,$A0
.byte $42,$85,$0A,$80,$A0
.byte $3A,$B9,$72,$7B,$B8
.byte $00,$81,$00,$00,$00