mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-12 15:30:55 +00:00
entropy: shave off a few more bytes
This commit is contained in:
parent
7c156eb49f
commit
3b64e895c3
@ -17,6 +17,9 @@
|
|||||||
; 144 bytes: first working version (including DOS33 4-byte size/addr)
|
; 144 bytes: first working version (including DOS33 4-byte size/addr)
|
||||||
; 141 bytes: nextx: cache XPOS in X register
|
; 141 bytes: nextx: cache XPOS in X register
|
||||||
; 140 bytes: nexty: we know state of carry flag
|
; 140 bytes: nexty: we know state of carry flag
|
||||||
|
; 139 bytes: change jmp to bcs
|
||||||
|
; 138 bytes: jmp at end now fits into a bcs
|
||||||
|
; 136 bytes: store YPOS on stack
|
||||||
|
|
||||||
;BLT=BCC, BGE=BCS
|
;BLT=BCC, BGE=BCS
|
||||||
|
|
||||||
@ -73,7 +76,8 @@ entropy:
|
|||||||
|
|
||||||
eloop:
|
eloop:
|
||||||
lda #4 ; FOR Y=4 to 189 STEP 6
|
lda #4 ; FOR Y=4 to 189 STEP 6
|
||||||
sta YPOS
|
; sta YPOS
|
||||||
|
pha
|
||||||
yloop:
|
yloop:
|
||||||
lda #4 ; FOR X=4 to 278 STEP 6
|
lda #4 ; FOR X=4 to 278 STEP 6
|
||||||
sta XPOS
|
sta XPOS
|
||||||
@ -108,20 +112,18 @@ xloop:
|
|||||||
|
|
||||||
; Compare to E
|
; Compare to E
|
||||||
|
|
||||||
; ldy #>TEN
|
|
||||||
; lda #<TEN
|
|
||||||
jsr MUL10
|
jsr MUL10
|
||||||
jsr MUL10
|
jsr MUL10
|
||||||
|
|
||||||
jsr CONINT
|
jsr CONINT
|
||||||
debug:
|
|
||||||
; X is now RND(1)*100
|
; X is now RND(1)*100
|
||||||
|
|
||||||
cpx EPOS
|
cpx EPOS
|
||||||
bcc less ; branch if less than EPOS
|
bcc less ; branch if less than EPOS
|
||||||
more:
|
more:
|
||||||
lda #1 ; the boring case
|
lda #1 ; the boring case
|
||||||
jmp done
|
bne done ; branch always
|
||||||
less:
|
less:
|
||||||
; SCALE=RND(1)*E*20+1
|
; SCALE=RND(1)*E*20+1
|
||||||
; EPOS is E*100, so RND(1)*(EPOS/10)*2+1
|
; EPOS is E*100, so RND(1)*(EPOS/10)*2+1
|
||||||
@ -133,7 +135,6 @@ less:
|
|||||||
|
|
||||||
lda EPOS
|
lda EPOS
|
||||||
jsr FLOAT ; convert value in A to float in FAC
|
jsr FLOAT ; convert value in A to float in FAC
|
||||||
; jsr MOVAF ; mov FAC into ARG
|
|
||||||
jsr DIV10 ; FAC=FAC/10
|
jsr DIV10 ; FAC=FAC/10
|
||||||
|
|
||||||
ldy #>RND_EXP
|
ldy #>RND_EXP
|
||||||
@ -145,15 +146,17 @@ less:
|
|||||||
|
|
||||||
jsr CONINT ; convert to int (in X)
|
jsr CONINT ; convert to int (in X)
|
||||||
|
|
||||||
inx
|
inx ; add 1
|
||||||
txa ; move to A
|
txa ; move to A
|
||||||
|
|
||||||
done:
|
done:
|
||||||
sta HGR_SCALE ; set scale value
|
sta HGR_SCALE ; set scale value
|
||||||
|
|
||||||
ldy XPOSH ; setup X and Y co-ords
|
ldy XPOSH ; setup X and Y co-ords
|
||||||
ldx XPOS
|
ldx XPOS
|
||||||
lda YPOS
|
pla
|
||||||
|
pha
|
||||||
|
; lda YPOS
|
||||||
jsr HPOSN ; X= (y,x) Y=(a)
|
jsr HPOSN ; X= (y,x) Y=(a)
|
||||||
|
|
||||||
|
|
||||||
@ -181,19 +184,22 @@ nextx: ; NEXT X
|
|||||||
;============
|
;============
|
||||||
; 20
|
; 20
|
||||||
nexty: ; NEXT Y
|
nexty: ; NEXT Y
|
||||||
lda YPOS ; y+=6
|
pla
|
||||||
|
; lda YPOS ; y+=6
|
||||||
adc #5 ; carry always set coming in, so only add 5
|
adc #5 ; carry always set coming in, so only add 5
|
||||||
sta YPOS
|
; sta YPOS
|
||||||
|
pha
|
||||||
cmp #189 ; see if less than 189
|
cmp #189 ; see if less than 189
|
||||||
bcc yloop ; if so, loop
|
bcc yloop ; if so, loop
|
||||||
|
|
||||||
nexte: ; NEXT E
|
nexte: ; NEXT E
|
||||||
|
pla
|
||||||
inc EPOS
|
inc EPOS
|
||||||
lda EPOS
|
lda EPOS
|
||||||
cmp #15
|
cmp #15
|
||||||
bcc eloop ; branch if <15
|
bcc eloop ; branch if <15
|
||||||
|
|
||||||
jmp entropy
|
bcs entropy
|
||||||
|
|
||||||
shape_table:
|
shape_table:
|
||||||
; .byte 1,0 ; 1 shape
|
; .byte 1,0 ; 1 shape
|
||||||
|
Loading…
x
Reference in New Issue
Block a user