gr: thinking: working for basic bot

This commit is contained in:
Vince Weaver 2021-07-02 01:20:34 -04:00
parent fc09032b26
commit 4f9db6bf4c
6 changed files with 117 additions and 102 deletions

View File

@ -18,7 +18,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
XOR_ZOOM.BAS MOD9_HGR.BAS SIER_HGR.BAS MOVE.BAS SINE.BAS XDRAW128.BAS \
GATOR.BAS CURSOR.BAS STARGATE.BAS TUNNEL.BAS STARFIELD.BAS \
STAROOPS.BAS HGRSTARFIELD.BAS COOL_BOT.BAS WEB.BAS ORB.BAS \
FIREWORKS.BAS
FIREWORKS.BAS THINKING.BAS
# cp $(EMPTY_DISK)/empty.dsk appleiibot.dsk
cp empty.dsk appleiibot.dsk
@ -94,6 +94,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
$(DOS33) -y appleiibot.dsk SAVE A WEB.BAS
$(DOS33) -y appleiibot.dsk SAVE A ORB.BAS
$(DOS33) -y appleiibot.dsk SAVE A FIREWORKS.BAS
$(DOS33) -y appleiibot.dsk SAVE A THINKING.BAS
####
@ -400,6 +401,11 @@ QR.BAS: qr.bas
####
THINKING.BAS: thinking.bas
$(TOKENIZE) < thinking.bas > THINKING.BAS
####
RLE.BAS: rle.bas
$(TOKENIZE) < rle.bas > RLE.BAS

View File

@ -3,7 +3,7 @@
#include <stdio.h>
#include <unistd.h>
#define OFFSET 32
#define OFFSET 35
#define OFFSET2 35
//#define OFFSET 35
@ -48,6 +48,7 @@ int main(int argc, char **argv) {
in[i+0],pv,third,val);
if (val>0x7e) fprintf(stderr,"error0, too big! in=%x pv=%x e=%x val=%x\n",
in[i+0],pv,third,val);
if (val=='\"') fprintf(stderr,"error0, additional quotation marks\n");
// printf("%c",val); //(in[i + 0] >> 2) + OFFSET);
//printf("%c",val); //(in[i + 0] >> 2) + OFFSET);
enc2[enc_ptr]=val;
@ -115,10 +116,12 @@ int main(int argc, char **argv) {
if (mode==END_AT_3F5) {
fprintf(stderr,"Ending at $3F5\n");
printf("1FORI=0TO%d:POKE%d+I,4*PEEK(%d+I)-"
"192+(PEEK(%d+I/3)-%d)/4^(I-INT(I/3)*3):NEXT\n",
"%d+(PEEK(%d+I/3)-%d)/4^(I-INT(I/3)*3):NEXT\n",
filesize-1,
0x3f5-filesize+3,
2125,2125+filesize,OFFSET2);
2125,
64+4*OFFSET,
2125+filesize,OFFSET2);
printf("2&\"%s%s\n",enc2,enc);
}
@ -128,10 +131,12 @@ int main(int argc, char **argv) {
fprintf(stderr,"Beginning at $3F5\n");
printf("1FORI=0TO%d:POKE%d+I,4*PEEK(%d+I)-"
"192+(PEEK(%d+I/3)-%d)/4^(I-INT(I/3)*3):NEXT\n",
"%d+(PEEK(%d+I/3)-%d)/4^(I-INT(I/3)*3):NEXT\n",
filesize-1,
0x3f5,
2126,2126+filesize,OFFSET2);
2126,
4*OFFSET+64,
2126+filesize,OFFSET2);
printf("2&\"%s%s\n",enc2,enc);
}

View File

@ -0,0 +1,2 @@
1FORI=0TO140:POKE875+I,4*PEEK(2125+I)-204+(PEEK(2266+I/3)-35)/4^(I-INT(I/3)*3):NEXT
2&"/@qY2Tn[3I8Dp\o:4]Sb3T?[%ipSqk(T6i6_'YpT[3JnLp_4X>W6[qec=l4Y:4oaemj5o1V4loFV1domk4f`\mdbZr;]rcY?\Xj\lLNbH37AUhX?DUhH@(RH<G4MFHWLUFXXDUH37Q7J3S4.U'0\$[)V+^\L%4=#/0D'4%Q#3EW#S:K.7#'#T4C'+$7_

View File

@ -12,7 +12,7 @@ thinking.dsk: HELLO THINKING RAINBOW_BOX T2 THINKING_FLIP T3 THINKING_SLOW \
THINKING_ATTEMPT6
cp $(EMPTYDISK) thinking.dsk
$(DOS33) -y thinking.dsk SAVE A HELLO
$(DOS33) -y thinking.dsk BSAVE -a 0xC00 THINKING
$(DOS33) -y thinking.dsk BSAVE -a 0x36b THINKING
$(DOS33) -y thinking.dsk BSAVE -a 0xC00 THINKING_FLIP
$(DOS33) -y thinking.dsk BSAVE -a 0xC00 THINKING_SLOW
$(DOS33) -y thinking.dsk BSAVE -a 0xC00 THINKING_ATTEMPT2
@ -32,7 +32,7 @@ HELLO: hello.bas
###
THINKING: thinking.o
ld65 -o THINKING thinking.o -C $(LINKERSCRIPTS)/apple2_c00.inc
ld65 -o THINKING thinking.o -C $(LINKERSCRIPTS)/apple2_36b.inc
thinking.o: thinking.s
ca65 -o thinking.o thinking.s -l thinking.lst

View File

@ -2,11 +2,20 @@
; by Vince `deater` Weaver <vince@deater.net>
; 158 bytes -- blargh
.include "zp.inc"
.include "hardware.inc"
; 161 -- original with page flip removed
; 159 -- remove extraneous store to YY
; 158 -- cond jump for jmp
; 0-------------------------
; 0 1111111111111111111111 0
; 0 1 22222222222222222221 0
; if XX < YY COL++
COL = $F0
XSTART = $F1
XSTOP = $F2
@ -15,8 +24,8 @@ YSTOP = $F4
OFFSET = $F5
CURRENT = $F6
YY = $F7
BLARGH = $F8
BLARGHH = $F9
BASE = $F8
XS = $F9
thinking:
@ -25,35 +34,13 @@ thinking:
big_loop:
; COL value doesn't matter?
; 0,0 to 39,39
; 1,2 to 38,37
lda #0
sta YSTART
sta XSTART
sta YY
lda #20
sta YSTOP
asl
sta XSTOP
box_loop:
ldx YSTART
ldx #0
yloop:
txa
jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H
; ; ( a trashed, C clear)
lda GBASL
sta BLARGH
lda GBASH
clc
adc #4
sta BLARGHH
jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear)
lda COL
and #$7
@ -61,91 +48,90 @@ yloop:
lda color_lookup,Y
sta COLOR
ldy XSTART
xloop:
lda COLOR
and (BLARGH),Y
sta (GBASL),Y
iny
cpy XSTOP
bne xloop
;=======================
ldy #0
xloop:
inc_pointer:
inc YY
stx XS
; skip if out of range
cpx #7
bcc draw_color
cpx #14
bcs draw_color
ldx YY
lda thinking_data-1-35,X
sta CURRENT
thinking_xloop:
ror CURRENT
bcs skip_color
draw_color:
lda COLOR
sta (GBASL),Y
skip_color:
no_draw:
ldx XS
iny
cpy #40
beq done_done
tya
and #$7
beq inc_pointer
bne thinking_xloop
done_done:
;=======================
cpx #9
beq blarch
bcc blurgh
inc COL
jmp blarch
blurgh:
dec COL
blarch:
inx
cpx YSTOP
cpx #20
bne yloop
inc COL
inc XSTART
dec XSTOP
inc YSTART
dec YSTOP
lda YSTOP
cmp #10
bne box_loop
;==========================
; done drawing rainbow box
;==========================
;==========================
; write THINKING
;==========================
.if 0
thinking_loop:
lda #7
ldx #0
thinking_yloop:
sta YY
; lda YY
jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear)
ldy #0
inc_pointer:
inx
lda thinking_data-1,X
sta CURRENT
thinking_xloop:
ror CURRENT
bcc no_draw
lda #$00
sta (GBASL),Y
no_draw:
iny
tya
and #$7
beq inc_pointer
cpy #39
bne thinking_xloop
inc YY
lda YY
cmp #14
bne thinking_yloop
.endif
;==========================
; flip pages
;==========================
;===================
; increment color
; after loop we are +10
; so -1 actually means increment 1 (because we mod 8 it)
; inc COL
; inc COL
dec COL
dec COL
;===================
; wait
; WAIT
lda #255
jsr WAIT
jsr WAIT ; A = 0 at end
beq big_loop
@ -162,6 +148,10 @@ no_draw:
;
; 7*5 bytes = 35 bytes
color_lookup:
; magenta, pink, orange, yellow, lgreen, aqua, mblue, lblue
.byte $33,$BB,$99,$DD,$CC,$EE,$66,$77
thinking_data:
.byte $BE,$54,$14,$15,$39
.byte $88,$D4,$94,$34,$45
@ -173,11 +163,11 @@ thinking_data:
color_lookup:
; magenta, pink, orange, yellow, lgreen, aqua, mblue, lblue
.byte $33,$BB,$99,$DD,$CC,$EE,$66,$77
; for apple II bot entry at $3F5
; at +8A, so 36B
jmp thinking

View File

@ -0,0 +1,12 @@
MEMORY {
ZP: start = $00, size = $1A, type = rw;
RAM: start = $36f, size = $8E00, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}