gr: tunnel: need 10 more bytes
This commit is contained in:
parent
369a2b1275
commit
fa8995df4e
|
@ -1,7 +1,18 @@
|
||||||
|
|
||||||
|
; 186 bytes -- original
|
||||||
|
; 178 bytes -- not using line 7 of lookup table
|
||||||
|
; 168 bytes -- color can wrap
|
||||||
|
; 167 bytes -- unnecessary clc
|
||||||
|
; 163 bytes -- no need to init color at beginning
|
||||||
|
; 154 bytes -- optimize some calculations
|
||||||
|
|
||||||
H2 = $2C
|
H2 = $2C
|
||||||
V2 = $2D
|
V2 = $2D
|
||||||
COLOR = $30
|
COLOR = $30
|
||||||
|
QL = $F5
|
||||||
|
QH = $F6
|
||||||
|
VL = $F7
|
||||||
|
VH = $F8
|
||||||
P = $F9
|
P = $F9
|
||||||
Q = $FA
|
Q = $FA
|
||||||
J = $FB
|
J = $FB
|
||||||
|
@ -22,10 +33,47 @@ tunnel:
|
||||||
; 1 GR:N=23
|
; 1 GR:N=23
|
||||||
|
|
||||||
jsr SETGR
|
jsr SETGR
|
||||||
; bit FULLGR
|
|
||||||
|
|
||||||
lda #23
|
.if 0
|
||||||
sta NEWCOLOR
|
make_table:
|
||||||
|
lda #$2
|
||||||
|
sta VH
|
||||||
|
lda #$0
|
||||||
|
tay
|
||||||
|
sta VL
|
||||||
|
bigloop:
|
||||||
|
lda #0
|
||||||
|
sta QL
|
||||||
|
sta QH
|
||||||
|
tax
|
||||||
|
qqloop:
|
||||||
|
clc
|
||||||
|
lda VL
|
||||||
|
adc QL
|
||||||
|
sta QL
|
||||||
|
lda VH
|
||||||
|
adc QH
|
||||||
|
sta QH
|
||||||
|
inx
|
||||||
|
cmp #$28
|
||||||
|
bcc qqloop
|
||||||
|
|
||||||
|
txa
|
||||||
|
sta lookup,Y
|
||||||
|
iny
|
||||||
|
|
||||||
|
clc
|
||||||
|
lda VL
|
||||||
|
adc #$24
|
||||||
|
sta VL
|
||||||
|
lda #0
|
||||||
|
adc VH
|
||||||
|
sta VH
|
||||||
|
|
||||||
|
cmp #$A
|
||||||
|
bne bigloop
|
||||||
|
.endif
|
||||||
|
|
||||||
|
|
||||||
forq:
|
forq:
|
||||||
|
|
||||||
|
@ -40,7 +88,8 @@ qloop:
|
||||||
|
|
||||||
; 3 FOR I=0 TO 19:IF 20-I>A(P,Q) THEN 7
|
; 3 FOR I=0 TO 19:IF 20-I>A(P,Q) THEN 7
|
||||||
fori:
|
fori:
|
||||||
ldx #0
|
tax ; X is 0
|
||||||
|
|
||||||
iloop:
|
iloop:
|
||||||
lda Q
|
lda Q
|
||||||
asl
|
asl
|
||||||
|
@ -60,25 +109,23 @@ iloop:
|
||||||
|
|
||||||
inc P
|
inc P
|
||||||
|
|
||||||
txa
|
; A is already 20-I at this point, carry is clear
|
||||||
eor #$ff
|
adc #19
|
||||||
sec
|
|
||||||
adc #39
|
|
||||||
sta Z
|
sta Z
|
||||||
sta H2
|
tay
|
||||||
sta V2
|
dey
|
||||||
dec H2
|
sty H2
|
||||||
dec V2
|
sty V2
|
||||||
|
|
||||||
txa
|
stx J
|
||||||
clc
|
inc J
|
||||||
adc #1
|
|
||||||
sta J
|
|
||||||
|
|
||||||
; 6 COLOR=N+P:HLIN J,W AT I:HLIN J,W AT Z:VLIN J,W AT I:VLIN J,W AT Z
|
; 6 COLOR=N+P:HLIN J,W AT I:HLIN J,W AT Z:VLIN J,W AT I:VLIN J,W AT Z
|
||||||
|
|
||||||
|
; c always 0?
|
||||||
|
|
||||||
lda P
|
lda P
|
||||||
clc
|
; clc
|
||||||
adc NEWCOLOR
|
adc NEWCOLOR
|
||||||
jsr SETCOL
|
jsr SETCOL
|
||||||
|
|
||||||
|
@ -117,19 +164,13 @@ skip:
|
||||||
inx
|
inx
|
||||||
cpx #19
|
cpx #19
|
||||||
bne iloop
|
bne iloop
|
||||||
|
blah:
|
||||||
dec Q
|
dec Q
|
||||||
bpl qloop
|
bpl qloop
|
||||||
|
|
||||||
inc NEWCOLOR
|
inc NEWCOLOR
|
||||||
|
|
||||||
lda NEWCOLOR
|
; wrapping 255 to 0 is OK
|
||||||
cmp #32
|
|
||||||
bne blah
|
|
||||||
|
|
||||||
lda #16
|
|
||||||
sta NEWCOLOR
|
|
||||||
blah:
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
; 8 GOTO 2
|
; 8 GOTO 2
|
||||||
|
@ -139,14 +180,37 @@ end:
|
||||||
|
|
||||||
; 0 DIM A(9,9):FOR I=0 TO 8:FOR J=0 TO 8:A(I,J)=40/(2+I+J/7):NEXTJ,I
|
; 0 DIM A(9,9):FOR I=0 TO 8:FOR J=0 TO 8:A(I,J)=40/(2+I+J/7):NEXTJ,I
|
||||||
lookup:
|
lookup:
|
||||||
.byte 20,13,10,8,6,5,5,4
|
|
||||||
.byte 18,12, 9,7,6,5,4,4
|
|
||||||
.byte 17,12, 9,7,6,5,4,4
|
|
||||||
.byte 16,11, 9,7,6,5,4,4
|
.byte 20,13,10,8,7,6,5,4 ; 2.0 3.0 4,0 5,0 6.0 7.0 8.0 9.0
|
||||||
.byte 15,11, 8,7,6,5,4,4
|
.byte 19,13,10,8,7,6,5,4 ; 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1
|
||||||
.byte 14,10, 8,7,5,5,4,4
|
.byte 18,12,9,8,6,5,5,4
|
||||||
.byte 14,10, 8,6,5,5,4,4
|
.byte 17,12,9,7,6,5,5,4
|
||||||
.byte 13,10, 8,6,5,5,4,4
|
.byte 16,11,9,7,6,5,5,4
|
||||||
|
.byte 15,11,9,7,6,5,5,4
|
||||||
|
.byte 14,10,8,7,6,5,5,4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; (P*7)+Q
|
||||||
|
; .byte 20,18,17,16,15,14,14
|
||||||
|
; .byte 13,12,12,11,11,10,10
|
||||||
|
; .byte 10, 9, 9, 9, 8, 8, 8
|
||||||
|
; .byte 8, 7, 7, 7, 7, 7, 6
|
||||||
|
; .byte 6, 6, 6, 6, 6, 5, 5
|
||||||
|
; .byte 5, 4, 4, 4, 4, 4, 4
|
||||||
|
; .byte 4, 4, 4, 4, 4, 4, 4
|
||||||
|
|
||||||
|
; (Q<<8)|P Q 6..0 P 0..6
|
||||||
|
; .byte 20,13,10,8,6,5,5,4 ; 0
|
||||||
|
; .byte 18,12, 9,7,6,5,4,4 ; 1
|
||||||
|
; .byte 17,12, 9,7,6,5,4,4 ; 2
|
||||||
|
; .byte 16,11, 9,7,6,5,4,4 ; 3
|
||||||
|
; .byte 15,11, 8,7,6,5,4,4 ; 4
|
||||||
|
; .byte 14,10, 8,7,5,5,4,4 ; 5
|
||||||
|
; .byte 14,10, 8,6,5,5,4,4 ; 6
|
||||||
|
|
||||||
; need for bot
|
; need for bot
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,10 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
double x,y;
|
double x,y;
|
||||||
|
|
||||||
|
// 6.2 FLOAT POINT
|
||||||
|
|
||||||
|
// 2 3 4 5 6 7 8
|
||||||
|
// 2.1 3.1 4.1 5.1 6.1
|
||||||
for(y=0;y<1;y+=1.0/7.0) {
|
for(y=0;y<1;y+=1.0/7.0) {
|
||||||
printf("%.2lf: ",y);
|
printf("%.2lf: ",y);
|
||||||
for(x=2.0+y;x<=9.0+y;x++) {
|
for(x=2.0+y;x<=9.0+y;x++) {
|
||||||
|
@ -22,5 +26,43 @@ int main(int argc, char **argv) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 6.2 FLOAT POINT
|
||||||
|
|
||||||
|
// 2 3 4 5 6 7 8
|
||||||
|
// 2.1 3.1 4.1 5.1 6.1
|
||||||
|
int q;
|
||||||
|
for(y=0;y<7;y++) {
|
||||||
|
q=y*0x24;
|
||||||
|
for(x=0x200+q;x<=0x900+q;x+=0x100) {
|
||||||
|
printf("%.0lf,",0x2800/x);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
|
y=7;
|
||||||
|
q=0;
|
||||||
|
yloop:
|
||||||
|
x=0x200+q;
|
||||||
|
xloop:
|
||||||
|
printf("%02X,",(int)(0x2800/x));
|
||||||
|
|
||||||
|
x=x+0x100;
|
||||||
|
if (x<0xA00+q) goto xloop;
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
q=q+0x24;
|
||||||
|
y=y-1;
|
||||||
|
if (y>=0) goto yloop;
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 40/(2+I+J/7)
|
||||||
|
// 0.1 0.2 0.3 ... 0.7
|
||||||
|
// 1.0 1.1
|
||||||
|
|
Loading…
Reference in New Issue