thinking: doing some over-thinking here
This commit is contained in:
parent
49e936326f
commit
000d6df387
|
@ -5,13 +5,20 @@ TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
|
|||
LINKERSCRIPTS = ../../../linker_scripts
|
||||
EMPTYDISK = ../../../empty_disk/empty.dsk
|
||||
|
||||
all: thinking.dsk
|
||||
all: thinking.dsk cracking.dsk
|
||||
|
||||
cracking.dsk: COMBO_BOOT
|
||||
dd if=COMBO_BOOT of=cracking.dsk bs=256 count=1
|
||||
dd if=/dev/zero of=rr2.dsk bs=256 count=559
|
||||
cat rr2.dsk >> cracking.dsk
|
||||
|
||||
|
||||
thinking.dsk: HELLO THINKING RAINBOW_BOX T2 THINKING_FLIP T3 THINKING_SLOW \
|
||||
THINKING_ATTEMPT2 THINKING_ATTEMPT3 THINKING_ATTEMPT4 THINKING_ATTEMPT5 \
|
||||
THINKING_ATTEMPT6 CRACKING CRACKING_BOT THINKING_BOT
|
||||
THINKING_ATTEMPT6 CRACKING CRACKING_BOT THINKING_BOT COMBO
|
||||
cp $(EMPTYDISK) thinking.dsk
|
||||
$(DOS33) -y thinking.dsk SAVE A HELLO
|
||||
$(DOS33) -y thinking.dsk BSAVE -a 0xc00 COMBO
|
||||
$(DOS33) -y thinking.dsk BSAVE -a 0xc00 THINKING
|
||||
$(DOS33) -y thinking.dsk BSAVE -a 0x36b THINKING_BOT
|
||||
$(DOS33) -y thinking.dsk BSAVE -a 0xc00 CRACKING
|
||||
|
@ -42,6 +49,23 @@ thinking.o: thinking.s
|
|||
|
||||
###
|
||||
|
||||
COMBO: combo.o
|
||||
ld65 -o COMBO combo.o -C $(LINKERSCRIPTS)/apple2_c00.inc
|
||||
|
||||
combo.o: combo.s
|
||||
ca65 -o combo.o combo.s -l combo.lst
|
||||
|
||||
###
|
||||
|
||||
COMBO_BOOT: combo_boot.o
|
||||
ld65 -o COMBO_BOOT combo_boot.o -C $(LINKERSCRIPTS)/apple2_800.inc
|
||||
|
||||
combo_boot.o: combo_boot.s
|
||||
ca65 -o combo_boot.o combo_boot.s -l combo_boot.lst
|
||||
|
||||
|
||||
###
|
||||
|
||||
THINKING_BOT: thinking_bot.o
|
||||
ld65 -o THINKING_BOT thinking_bot.o -C $(LINKERSCRIPTS)/apple2_36b.inc
|
||||
|
||||
|
@ -155,4 +179,4 @@ t3.o: t3.s
|
|||
clean:
|
||||
rm -f *~ *.o *.lst HELLO THINKING RAINBOW_BOX T2 THINKING_FLIP T3 THINKING_SLOW \
|
||||
THINKING_ATTEMPT2 THINKING_ATTEMPT3 THINKING_ATTEMPT4 THINKING_ATTEMPT5 THINKING_ATTEMPT6 CRACKING \
|
||||
THINKING_BOT
|
||||
THINKING_BOT COMBO
|
||||
|
|
|
@ -0,0 +1,315 @@
|
|||
; Print-shop Style THINKING/CRACKING demo
|
||||
|
||||
; without pageflip
|
||||
|
||||
; by Vince `deater` Weaver <vince@deater.net>
|
||||
|
||||
; zero page addresses
|
||||
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
|
||||
COL = $F0
|
||||
CURRENT_BITMAP = $F1
|
||||
BITMAP_PTR = $F2
|
||||
XSAVE = $F3
|
||||
SAVED_YY = $F3
|
||||
YSAVE = $F4
|
||||
SAVED_XX = $F4
|
||||
ADJUSTED_YY = $F5
|
||||
FRAME = $FF
|
||||
|
||||
|
||||
; monitor routines
|
||||
GBASCALC = $F847 ; take Y-coord/2 in A, put address in GBASL/H ( A trashed, C clear)
|
||||
SETGR = $FB40 ; Init graphics, clear screen, A is $D0 after
|
||||
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
|
||||
|
||||
thinking:
|
||||
|
||||
jsr SETGR ; set lo-res 40x40 mode
|
||||
; A=$D0 afterward
|
||||
|
||||
lda #0
|
||||
sta COL ; consistent starting color
|
||||
; not technically needed
|
||||
sta FRAME
|
||||
|
||||
print_thinking_loop:
|
||||
|
||||
inc FRAME
|
||||
lda FRAME
|
||||
and #$10
|
||||
bne set_cracking
|
||||
|
||||
set_thinking:
|
||||
ldx FRAME
|
||||
lda $F000,X ; Fake RNG
|
||||
jsr WAIT
|
||||
|
||||
lda #<(thinking_data-1-30)
|
||||
; assume fits on one page, no need to set high value
|
||||
|
||||
bne done_set
|
||||
set_cracking:
|
||||
lda #255
|
||||
jsr WAIT
|
||||
|
||||
lda #<(cracking_data-1-30)
|
||||
; assume fits on one page, no need to set high value
|
||||
|
||||
done_set:
|
||||
sta source_smc+1
|
||||
|
||||
|
||||
jsr print_thinking_frame
|
||||
|
||||
;===================
|
||||
; WAIT
|
||||
|
||||
|
||||
|
||||
; ldx FRAME
|
||||
; lda $F000,X ; Fake RNG
|
||||
; and #$1f
|
||||
; adc #$3
|
||||
; tax
|
||||
;wait_loop:
|
||||
; lda #64
|
||||
; jsr WAIT ; A = 0 at end
|
||||
; dex
|
||||
; bne wait_loop
|
||||
|
||||
; beq print_thinking_loop
|
||||
|
||||
jmp print_thinking_loop
|
||||
|
||||
|
||||
;=============================
|
||||
;=============================
|
||||
; print thinking frame
|
||||
;=============================
|
||||
;=============================
|
||||
print_thinking_frame:
|
||||
|
||||
ldx #0 ; reset YY to 0
|
||||
stx BITMAP_PTR ; also reset bitmap pointer to 0
|
||||
|
||||
yloop:
|
||||
txa ; load YY
|
||||
jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H
|
||||
|
||||
;=======================
|
||||
|
||||
ldy #0 ; reset XX to 0
|
||||
xloop:
|
||||
|
||||
; this is only jumped to every 8th XX
|
||||
inc_pointer:
|
||||
inc BITMAP_PTR
|
||||
|
||||
; load current bitmap ptr into CURRENT_BITMAP
|
||||
; is a don't care if not between 7 and 14
|
||||
|
||||
stx XSAVE
|
||||
ldx BITMAP_PTR
|
||||
source_smc:
|
||||
lda thinking_data-1-30,X
|
||||
sta CURRENT_BITMAP
|
||||
ldx XSAVE
|
||||
|
||||
thinking_xloop:
|
||||
; this is called every XX
|
||||
|
||||
stx XSAVE ; save X (YY)
|
||||
sty YSAVE ; save Y (XX)
|
||||
|
||||
; if YY <6 or YY > 13 then don't draw bitmap
|
||||
cpx #6
|
||||
bcc do_plot
|
||||
cpx #13
|
||||
bcs do_plot
|
||||
|
||||
handle_bitmap:
|
||||
ror CURRENT_BITMAP ; rotate next bit from bitmap in
|
||||
lda #0
|
||||
bcs skip_plot ; skip plotting (assume BG is black)
|
||||
|
||||
do_plot:
|
||||
|
||||
lda COL ; set starting color
|
||||
and #$7
|
||||
tay
|
||||
lda color_lookup,Y ; lookup color in table
|
||||
|
||||
ldy YSAVE ; restore Y (XX)
|
||||
skip_plot:
|
||||
sta (GBASL),Y
|
||||
|
||||
;skip_plot:
|
||||
|
||||
|
||||
;==================================
|
||||
; adjust colors to make boxes
|
||||
|
||||
; 0000000000000000
|
||||
; 0111111111111110
|
||||
; 0122222222222210
|
||||
|
||||
; XX is in Y (currently also in YSAVE)
|
||||
; YY is in X (currently also in XSAVE)
|
||||
|
||||
|
||||
ldx SAVED_YY ; YY
|
||||
ldy SAVED_XX ; XX
|
||||
|
||||
|
||||
; if YY is < 10 do following, otherwise reverse
|
||||
|
||||
txa ; put YY in A (saved bytes later)
|
||||
cmp #10
|
||||
bcc counting_up
|
||||
|
||||
counting_down:
|
||||
; now doing the reverse
|
||||
|
||||
lda #19
|
||||
sec
|
||||
sbc SAVED_YY
|
||||
|
||||
; YY (in A) now going from 10..0
|
||||
|
||||
counting_up:
|
||||
sta ADJUSTED_YY
|
||||
|
||||
detect_adjust_dir:
|
||||
; if YY is < 10 do following, otherwise reverse
|
||||
|
||||
; if XX is < 10, check for inc
|
||||
; if XX is > 30 check for dex
|
||||
; else, no adjust
|
||||
|
||||
cpy #10 ; is XX < 10
|
||||
bcc color_adjust_up ; then potentially adjust UP
|
||||
cpy #30 ; is XX > 30
|
||||
bcs color_adjust_down ; then potentially adjust down
|
||||
bcc color_adjust_none ; else, do nothing
|
||||
|
||||
|
||||
color_adjust_up:
|
||||
|
||||
; if XX < YY then inc color
|
||||
; if XX >= YY then do nothing
|
||||
|
||||
cpy ADJUSTED_YY ; compare XX to YY
|
||||
bcs col_same ; bge do nothing
|
||||
|
||||
col_inc:
|
||||
inc COL
|
||||
col_same:
|
||||
|
||||
jmp color_adjust_none
|
||||
|
||||
color_adjust_down:
|
||||
|
||||
lda #39
|
||||
sec
|
||||
sbc ADJUSTED_YY
|
||||
sta ADJUSTED_YY
|
||||
|
||||
cpy ADJUSTED_YY ; compare XX to YY
|
||||
|
||||
; if XX > 39-YY then inc color
|
||||
bcc col_down_same
|
||||
|
||||
col_dec:
|
||||
dec COL
|
||||
col_down_same:
|
||||
|
||||
; fallthrough
|
||||
|
||||
color_adjust_none:
|
||||
|
||||
;============================
|
||||
; inc XX for next pixel
|
||||
|
||||
iny ; inc XX
|
||||
|
||||
cpy #40 ; if we hit 40, done line
|
||||
beq done_done
|
||||
|
||||
tya ; if we are multiple of 8
|
||||
and #$7 ; then need to increment bitmap ptr
|
||||
beq inc_pointer
|
||||
bne thinking_xloop
|
||||
done_done:
|
||||
|
||||
;=============================================
|
||||
; adjust color for next line
|
||||
|
||||
inc COL
|
||||
|
||||
;=======================
|
||||
; move to next line
|
||||
|
||||
inx
|
||||
cpx #20
|
||||
bne yloop
|
||||
|
||||
;============================================
|
||||
; done frame, increment color for next round
|
||||
;============================================
|
||||
|
||||
inc COL
|
||||
|
||||
rts
|
||||
|
||||
|
||||
;0 1 2 3 3
|
||||
;01234567|89012345|67890123|45678901|23456789
|
||||
; ***** *| * * * | * * |* * * |* ***
|
||||
; * *| * * **| * * *| * ** |* * *
|
||||
; * *| * * **| * * * | * ** |* *
|
||||
; * *|*** * * |* * ** | * * * |* *
|
||||
; * *| * * * | ** * * | * * *|* * **
|
||||
; * *| * * * | ** * *| * * *|* * *
|
||||
; * *| * * * | * * |* * * |* ****
|
||||
;
|
||||
; 7*5 bytes = 35 bytes
|
||||
|
||||
thinking_data:
|
||||
.byte $BE,$54,$14,$15,$39
|
||||
.byte $88,$D4,$94,$34,$45
|
||||
.byte $88,$D4,$54,$34,$05
|
||||
.byte $88,$57,$35,$54,$05
|
||||
.byte $88,$54,$56,$94,$65
|
||||
.byte $88,$54,$96,$94,$45
|
||||
.byte $88,$54,$14,$15,$79
|
||||
|
||||
;0 1 2 3 3
|
||||
;01234567|89012345|67890123|45678901|23456789
|
||||
; ** ***| *** | ** * |* * * |* ***
|
||||
; * * |* * * |* * *| * ** |* * *
|
||||
; * * |* * * |* * * | * ** |* *
|
||||
; * ***| ***** |* ** | * * * |* *
|
||||
; * * *| * * |* * * | * * *|* * **
|
||||
; * * |* * * |* * *| * * *|* * *
|
||||
; ** * |* * * | ** * |* * * |* ****
|
||||
; 7*5 bytes = 35 bytes
|
||||
|
||||
|
||||
cracking_data:
|
||||
.byte $EC,$38,$16,$15,$39
|
||||
.byte $22,$45,$91,$34,$45
|
||||
.byte $22,$45,$51,$34,$05
|
||||
.byte $E2,$7C,$31,$54,$05
|
||||
.byte $A2,$44,$51,$94,$65
|
||||
.byte $22,$45,$91,$94,$45
|
||||
.byte $2C,$45,$16,$15,$79
|
||||
|
||||
|
||||
color_lookup:
|
||||
; magenta, pink, orange, yellow, lgreen, aqua, mblue, lblue
|
||||
.byte $33,$BB,$99,$DD,$CC,$EE,$66,$77
|
||||
|
||||
|
Loading…
Reference in New Issue