gr: thinking/cracking updated

This commit is contained in:
Vince Weaver 2021-07-03 15:40:34 -04:00
parent 9552d1483f
commit 49e936326f
3 changed files with 240 additions and 193 deletions

View File

@ -14,7 +14,7 @@ thinking.dsk: HELLO THINKING RAINBOW_BOX T2 THINKING_FLIP T3 THINKING_SLOW \
$(DOS33) -y thinking.dsk SAVE A HELLO
$(DOS33) -y thinking.dsk BSAVE -a 0xc00 THINKING
$(DOS33) -y thinking.dsk BSAVE -a 0x36b THINKING_BOT
$(DOS33) -y thinking.dsk BSAVE -a 0x36b CRACKING
$(DOS33) -y thinking.dsk BSAVE -a 0xc00 CRACKING
$(DOS33) -y thinking.dsk BSAVE -a 0x36b CRACKING_BOT
$(DOS33) -y thinking.dsk BSAVE -a 0xC00 THINKING_FLIP
$(DOS33) -y thinking.dsk BSAVE -a 0xC00 THINKING_SLOW
@ -51,7 +51,7 @@ thinking_bot.o: thinking_bot.s
###
CRACKING: cracking.o
ld65 -o CRACKING cracking.o -C $(LINKERSCRIPTS)/apple2_36b.inc
ld65 -o CRACKING cracking.o -C $(LINKERSCRIPTS)/apple2_c00.inc
cracking.o: cracking.s
ca65 -o cracking.o cracking.s -l cracking.lst

View File

@ -1,131 +1,41 @@
; Print-shop Style THINKING
; Print-shop Style CRACKING
; without pageflip
; by Vince `deater` Weaver <vince@deater.net>
.include "zp.inc"
.include "hardware.inc"
; zero page addresses
; 161 -- original with page flip removed
; 159 -- remove extraneous store to YY
; 158 -- cond jump for jmp
GBASL = $26
GBASH = $27
; 0-------------------------
; 0 1111111111111111111111 0
; 0 1 22222222222222222221 0
; if XX < YY COL++
COL = $F0
CURRENT_BITMAP = $F1
BITMAP_PTR = $F2
XSAVE = $F3
SAVED_YY = $F3
YSAVE = $F4
SAVED_XX = $F4
ADJUSTED_YY = $F5
COL = $F0
XSTART = $F1
XSTOP = $F2
YSTART = $F3
YSTOP = $F4
OFFSET = $F5
CURRENT = $F6
YY = $F7
BASE = $F8
XS = $F9
; 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
big_loop:
lda #0
sta YY
sta COL ; consistent starting color
; not technically needed
ldx #0
yloop:
txa
jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear)
print_thinking_loop:
lda COL
and #$7
tay
lda color_lookup,Y
sta COLOR
;=======================
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 #20
bne yloop
;==========================
; done drawing rainbow box
;==========================
;==========================
; 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
jsr print_thinking_frame
;===================
; WAIT
@ -133,7 +43,184 @@ blarch:
lda #255
jsr WAIT ; A = 0 at end
beq big_loop
beq 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
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
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)
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
@ -160,16 +247,3 @@ 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

@ -4,24 +4,25 @@
; by Vince `deater` Weaver <vince@deater.net>
.include "zp.inc"
.include "hardware.inc"
; 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
COL = $F0
XSTART = $F1
XSTOP = $F2
YSTART = $F3
YSTOP = $F4
OFFSET = $F5
CURRENT_BITMAP = $F6
BITMAP_PTR = $F7
BASE = $F8
XSAVE = $F9
SAVED_YY= $F9
YSAVE = $FA
SAVED_XX= $FA
ADJUSTED_YY = $FB
; 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:
@ -46,9 +47,10 @@ print_thinking_loop:
;=============================
; print thinking
;=============================
; print thinking frame
;=============================
;=============================
print_thinking_frame:
ldx #0 ; reset YY to 0
@ -122,7 +124,8 @@ skip_plot:
; if YY is < 10 do following, otherwise reverse
cpx #10
txa ; put YY in A (saved bytes later)
cmp #10
bcc counting_up
counting_down:
@ -131,15 +134,10 @@ counting_down:
lda #19
sec
sbc SAVED_YY
sta ADJUSTED_YY
; YY now going from 10..0
jmp detect_adjust_dir
; YY (in A) now going from 10..0
counting_up:
lda SAVED_YY
sta ADJUSTED_YY
detect_adjust_dir:
@ -186,8 +184,6 @@ col_dec:
dec COL
col_down_same:
; ldy YSAVE
; fallthrough
color_adjust_none:
@ -195,59 +191,34 @@ color_adjust_none:
;============================
; inc XX for next pixel
iny
iny ; inc XX
cpy #40
cpy #40 ; if we hit 40, done line
beq done_done
tya
and #$7
tya ; if we are multiple of 8
and #$7 ; then need to increment bitmap ptr
beq inc_pointer
bne thinking_xloop
done_done:
;=============================================
; reverse the colors on bottom half of screen
; adjust color for next line
; cpx #10
; beq blarch
; bcc blurgh
inc COL
; jmp blarch
;blurgh:
; inc COL
;blarch:
;=======================
; move to next line
inx
cpx #20
beq done_yloop
bne yloop
jmp yloop
done_yloop:
;============================================
; done frame, increment color for next round
;============================================
;==========================
; done drawing rainbow box
;==========================
;==========================
; 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
rts
@ -264,10 +235,6 @@ done_yloop:
;
; 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
@ -276,3 +243,9 @@ thinking_data:
.byte $88,$54,$56,$94,$65
.byte $88,$54,$96,$94,$45
.byte $88,$54,$14,$15,$79
color_lookup:
; magenta, pink, orange, yellow, lgreen, aqua, mblue, lblue
.byte $33,$BB,$99,$DD,$CC,$EE,$66,$77