1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-26 10:49:17 +00:00
8bitworkshop/test/ecs/score.txt

416 lines
9.3 KiB
Plaintext
Raw Normal View History

2022-02-23 17:16:47 +00:00
EVENT__start = 1
EVENT__preframe = 1
EVENT__kernel = 1
EVENT__FontTable = 1
EVENT__compute2digit = 1
EVENT__fetchdigit = 1
EVENT__FontTablePF = 1
2022-02-24 19:30:10 +00:00
EVENT__postframe = 1
2022-02-23 17:16:47 +00:00
EVENT__AddBCD4 = 1
2022-02-24 19:30:10 +00:00
EVENT__joybutton = 1
.scope Main
.zeropage
BCDScore6_digits_b0:
.res 1
BCDScore6_digits_b8:
.res 1
BCDScore6_digits_b16:
.res 1
PFColor_pfcolor_b0:
.res 1
.res 1
.res 1
BGColor_bgcolor_b0:
.res 1
BCDScore2_digits_b0:
.res 1
.res 1
TEMP:
2022-02-17 15:58:13 +00:00
Kernel6Digit__2__tmp:
.res 1
.res 1
.res 1
.res 1
.res 1
.res 1
.res 1
.res 1
.res 1
.res 1
.res 1
.res 1
.res 1
.res 1
.res 1
2022-02-17 15:58:13 +00:00
Kernel2Digit__4__tmp:
.res 1
.res 1
.res 1
.code
Main__INITDATA:
.byte 86
.byte 52
.byte 18
.byte 60
.byte 206
.byte 62
.byte 2
.byte 36
.byte 86
__Start:
2022-02-23 14:43:19 +00:00
;;; start action Init__main_init__1
.include "vcs-ca65.h"
.macpack longbranch
.define PAL 0
__NMI:
__Reset:
__BRK:
CLEAN_START
ldy #9
: lda Main__INITDATA-1,y
sta BCDScore6_digits_b0-1,y
dey
bne :-
2022-02-27 15:31:09 +00:00
;;; start action FrameLoop__start__3
2022-02-27 15:31:09 +00:00
FrameLoop__start__4__NextFrame:
FRAME_START
2022-02-27 15:31:09 +00:00
;;; start action Kernel6Digit__preframe__5
Digit0 = Kernel6Digit__2__tmp+0
Digit1 = Kernel6Digit__2__tmp+2
Digit2 = Kernel6Digit__2__tmp+4
Digit3 = Kernel6Digit__2__tmp+6
Digit4 = Kernel6Digit__2__tmp+8
Digit5 = Kernel6Digit__2__tmp+10
2022-02-27 15:31:09 +00:00
Kernel6Digit__preframe__7__BCD0 = Kernel6Digit__2__tmp+12
Kernel6Digit__preframe__7__BCD1 = Kernel6Digit__2__tmp+13
Kernel6Digit__preframe__7__BCD2 = Kernel6Digit__2__tmp+14
lda BCDScore6_digits_b0
2022-02-27 15:31:09 +00:00
sta Kernel6Digit__preframe__7__BCD0
lda BCDScore6_digits_b8
2022-02-27 15:31:09 +00:00
sta Kernel6Digit__preframe__7__BCD1
lda BCDScore6_digits_b16
2022-02-27 15:31:09 +00:00
sta Kernel6Digit__preframe__7__BCD2
ldx #0 ; leftmost bitmap
ldy #2 ; start from most-sigificant BCD value
2022-02-27 15:31:09 +00:00
Kernel6Digit__preframe__7__Loop:
lda Kernel6Digit__preframe__7__BCD0,y ; get BCD value
and #$f0 ; isolate high nibble (* 16)
lsr ; shift right 1 bit (* 8)
clc
adc #<FontTable
sta Digit0,x ; store pointer lo byte
lda #>FontTable
adc #0
sta Digit0+1,x ; store pointer hi byte
inx
inx ; next bitmap pointer
2022-02-27 15:31:09 +00:00
lda Kernel6Digit__preframe__7__BCD0,y ; get BCD value (again)
and #$f ; isolate low nibble
asl
asl
asl ; * 8
clc
adc #<FontTable
sta Digit0,x ; store pointer lo byte
lda #>FontTable
adc #0
sta Digit0+1,x ; store pointer hi byte
inx
inx ; next bitmap pointer
dey ; next BCD value
2022-02-27 15:31:09 +00:00
bpl Kernel6Digit__preframe__7__Loop ; repeat until < 0
2022-02-27 15:31:09 +00:00
;;; end action Kernel6Digit__preframe__5
KERNEL_START
2022-02-27 15:31:09 +00:00
;;; start action Kernel6Digit__kernel__8
lda PFColor_pfcolor_b0
sta COLUP0
sta COLUP1
lda #3
sta NUSIZ0
sta NUSIZ1
; set horizontal position of player objects
sta WSYNC
sta HMCLR
SLEEPR 24
sta RESP0
sta RESP1
lda #$10
sta HMP1
sta WSYNC
sta HMOVE
SLEEPR 24 ; wait 24 cycles between write to HMOVE and HMxxx
sta HMCLR
lda #1
sta VDELP0
sta VDELP1
2022-02-27 15:31:09 +00:00
;;; end action Kernel6Digit__kernel__8
2022-02-27 15:31:09 +00:00
;;; start action Kernel6Digit__kernel__11
; Display the resulting 48x8 bitmap
; using the Digit0-5 pointers.
2022-02-27 15:31:09 +00:00
Kernel6Digit__kernel__13__LoopCount = Kernel6Digit__2__tmp+12
Kernel6Digit__kernel__13__Temp = Kernel6Digit__2__tmp+13
lda BGColor_bgcolor_b0
sta WSYNC
sta COLUBK
lda #7
2022-02-27 15:31:09 +00:00
sta Kernel6Digit__kernel__13__LoopCount
SLEEPR 20 ; TODO?
2022-02-27 15:31:09 +00:00
Kernel6Digit__kernel__13__BigLoop:
ldy Kernel6Digit__kernel__13__LoopCount ; counts backwards
lda (Digit0),y ; load B0 (1st sprite byte)
sta GRP0 ; B0 -> [GRP0]
lda (Digit1),y ; load B1 -> A
sta GRP1 ; B1 -> [GRP1], B0 -> GRP0
sta WSYNC ; sync to next scanline
lda (Digit2),y ; load B2 -> A
sta GRP0 ; B2 -> [GRP0], B1 -> GRP1
lda (Digit5),y ; load B5 -> A
2022-02-27 15:31:09 +00:00
sta Kernel6Digit__kernel__13__Temp ; B5 -> temp
lda (Digit4),y ; load B4
tax ; -> X
lda (Digit3),y ; load B3 -> A
2022-02-27 15:31:09 +00:00
ldy Kernel6Digit__kernel__13__Temp ; load B5 -> Y
sta GRP1 ; B3 -> [GRP1]; B2 -> GRP0
stx GRP0 ; B4 -> [GRP0]; B3 -> GRP1
sty GRP1 ; B5 -> [GRP1]; B4 -> GRP0
sta GRP0 ; ?? -> [GRP0]; B5 -> GRP1
2022-02-27 15:31:09 +00:00
dec Kernel6Digit__kernel__13__LoopCount ; go to next line
bpl Kernel6Digit__kernel__13__BigLoop ; repeat until < 0
lda #0 ; clear the sprite registers
sta WSYNC
sta GRP0
sta GRP1
sta GRP0
sta GRP1
sta COLUBK
2022-02-27 15:31:09 +00:00
;;; end action Kernel6Digit__kernel__11
2022-02-27 15:31:09 +00:00
;;; start action Kernel2Digit__kernel__14
lda #$02
sta CTRLPF
; TODO: should be constants
; and it's wrong, too!
lda PFColor_pfcolor_b0+0
sta COLUP0
lda PFColor_pfcolor_b0+1
sta COLUP1
2022-02-27 15:31:09 +00:00
;;; end action Kernel2Digit__kernel__14
2022-02-27 15:31:09 +00:00
;;; start action Kernel2Digit__kernel__17
lda #7
sta Kernel2Digit__4__tmp+0
2022-02-27 15:31:09 +00:00
Kernel2Digit__kernel__19__Loop:
ldx #0
sta WSYNC
2022-02-27 15:31:09 +00:00
;;; start action Kernel2Digit__compute2digit__20
lda Kernel2Digit__4__tmp+1 ; load 1st pf
sta PF1 ; store 1st pf
; first digit
lda BCDScore2_digits_b0 + 0
pha
and #$0f
asl
asl
asl
2022-02-27 15:31:09 +00:00
;;; start action Kernel2Digit__fetchdigit__22
adc Kernel2Digit__4__tmp+0
tay
; TODO: select your own?
lda FontTablePF,y
2022-02-27 15:31:09 +00:00
;;; end action Kernel2Digit__fetchdigit__22
and #$0f
ldy Kernel2Digit__4__tmp+2 ; load 2nd pf
sta Kernel2Digit__4__tmp+1 + 0
; second digit
pla
and #$f0
lsr
sty PF1 ; store 2nd pf
2022-02-27 15:31:09 +00:00
;;; start action Kernel2Digit__fetchdigit__24
adc Kernel2Digit__4__tmp+0
tay
; TODO: select your own?
lda FontTablePF,y
2022-02-27 15:31:09 +00:00
;;; end action Kernel2Digit__fetchdigit__24
and #$f0
ora Kernel2Digit__4__tmp+1 + 0
sta Kernel2Digit__4__tmp+1 + 0
2022-02-27 15:31:09 +00:00
;;; end action Kernel2Digit__compute2digit__20
inx
2022-02-27 15:31:09 +00:00
;;; start action Kernel2Digit__compute2digit__26
lda Kernel2Digit__4__tmp+1 ; load 1st pf
sta PF1 ; store 1st pf
; first digit
lda BCDScore2_digits_b0 + 1
pha
and #$0f
asl
asl
asl
2022-02-27 15:31:09 +00:00
;;; start action Kernel2Digit__fetchdigit__28
adc Kernel2Digit__4__tmp+0
tay
; TODO: select your own?
lda FontTablePF,y
2022-02-27 15:31:09 +00:00
;;; end action Kernel2Digit__fetchdigit__28
and #$0f
ldy Kernel2Digit__4__tmp+2 ; load 2nd pf
sta Kernel2Digit__4__tmp+1 + 1
; second digit
pla
and #$f0
lsr
sty PF1 ; store 2nd pf
2022-02-27 15:31:09 +00:00
;;; start action Kernel2Digit__fetchdigit__30
adc Kernel2Digit__4__tmp+0
tay
; TODO: select your own?
lda FontTablePF,y
2022-02-27 15:31:09 +00:00
;;; end action Kernel2Digit__fetchdigit__30
and #$f0
ora Kernel2Digit__4__tmp+1 + 1
sta Kernel2Digit__4__tmp+1 + 1
2022-02-27 15:31:09 +00:00
;;; end action Kernel2Digit__compute2digit__26
; playfield
dec Kernel2Digit__4__tmp+0
2022-02-27 15:31:09 +00:00
bpl Kernel2Digit__kernel__19__Loop
; dex
; stx PF1
2022-02-27 15:31:09 +00:00
;;; end action Kernel2Digit__kernel__17
KERNEL_END
2022-02-27 15:31:09 +00:00
;;; start action JoyButton__postframe__32
lda INPT4 ;read button input
2022-02-27 15:31:09 +00:00
bmi JoyButton__postframe__34__NotPressed
2022-02-27 15:31:09 +00:00
;;; start action IncScore__joybutton__35
2022-02-27 15:31:09 +00:00
;;; start action BCDMath__AddBCD4__38
.ifnblank $0210
lda #<$0210
ldy #>$0210
.endif
; Adds value to 6-BCD-digit score.
; A = 1st BCD digit
; Y = 2nd BCD digit
sed ; enter BCD mode
clc ; clear carry
adc BCDScore6_digits_b0
sta BCDScore6_digits_b0
tya
adc BCDScore6_digits_b8
sta BCDScore6_digits_b8
lda BCDScore6_digits_b16
adc #0
sta BCDScore6_digits_b16
cld ; exit BCD mode
2022-02-27 15:31:09 +00:00
;;; end action BCDMath__AddBCD4__38
2022-02-27 15:31:09 +00:00
;;; end action IncScore__joybutton__35
2022-02-27 15:31:09 +00:00
JoyButton__postframe__34__NotPressed:
2022-02-27 15:31:09 +00:00
;;; end action JoyButton__postframe__32
FRAME_END
2022-02-27 15:31:09 +00:00
jmp FrameLoop__start__4__NextFrame ; loop to next frame
2022-02-27 15:31:09 +00:00
;;; end action FrameLoop__start__3
; start main routine
.segment "VECTORS"
Return: .word $6060
VecNMI:
VecReset: .word Main::__Reset
VecBRK: .word Main::__BRK
2022-02-23 14:43:19 +00:00
;;; end action Init__main_init__1
FontTable:
2022-02-27 15:31:09 +00:00
;;; start action FontTable__FontTable__41
; Font table for digits 0-9 (8x8 pixels)
;;{w:8,h:8,count:10,brev:1,flip:1};;
.byte $00,$3c,$66,$66,$76,$6e,$66,$3c,$00,$7e,$18,$18,$18,$38,$18,$18
.byte $00,$7e,$60,$30,$0c,$06,$66,$3c,$00,$3c,$66,$06,$1c,$06,$66,$3c
.byte $00,$06,$06,$7f,$66,$1e,$0e,$06,$00,$3c,$66,$06,$06,$7c,$60,$7e
.byte $00,$3c,$66,$66,$7c,$60,$66,$3c,$00,$18,$18,$18,$18,$0c,$66,$7e
.byte $00,$3c,$66,$66,$3c,$66,$66,$3c,$00,$3c,$66,$06,$3e,$66,$66,$3c
2022-02-27 15:31:09 +00:00
;;; end action FontTable__FontTable__41
FontTablePF:
2022-02-27 15:31:09 +00:00
;;; start action FontTablePF__FontTablePF__43
; Font table for digits 0-9 (4x8 pixels)
;;{w:8,h:8,count:10,brev:1,flip:1};;
.byte $00,$00,$EE,$AA,$AA,$AA,$EE,$00
.byte $00,$00,$22,$22,$22,$22,$22,$00
.byte $00,$00,$EE,$88,$EE,$22,$EE,$00
.byte $00,$00,$EE,$22,$66,$22,$EE,$00
.byte $00,$00,$22,$22,$EE,$AA,$AA,$00
.byte $00,$00,$EE,$22,$EE,$88,$EE,$00
.byte $00,$00,$EE,$AA,$EE,$88,$EE,$00
.byte $00,$00,$22,$22,$22,$22,$EE,$00
.byte $00,$00,$EE,$AA,$EE,$AA,$EE,$00
.byte $00,$00,$EE,$22,$EE,$AA,$EE,$00
;;
2022-02-27 15:31:09 +00:00
;;; end action FontTablePF__FontTablePF__43
.endscope
Main__Start = Main::__Start