1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-22 14:33:51 +00:00
8bitworkshop/test/ecs/score.txt

423 lines
9.5 KiB
Plaintext
Raw Normal View History

2022-02-23 17:16:47 +00:00
EVENT__main_init = 1
EVENT__start = 1
EVENT__nextframe = 1
EVENT__resetswitch = 1
EVENT__postframe = 1
EVENT__SetHorizPos = 1
EVENT__preframe = 1
EVENT__kernel = 1
EVENT__kerneldraw = 1
EVENT__kernelsetup = 1
EVENT__joybutton = 1
EVENT__FontTable = 1
EVENT__compute2digit = 1
EVENT__fetchdigit = 1
EVENT__FontTablePF = 1
EVENT__FontTablePFFancy = 1
EVENT__AddBCD4 = 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-23 14:43:19 +00:00
;;; start action FrameLoop__start__2
FrameLoop__start__2__NextFrame:
FRAME_START
2022-02-23 14:43:19 +00:00
;;; start action Kernel6Digit__preframe__3
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
Kernel6Digit__preframe__3__BCD0 = Kernel6Digit__2__tmp+12
Kernel6Digit__preframe__3__BCD1 = Kernel6Digit__2__tmp+13
Kernel6Digit__preframe__3__BCD2 = Kernel6Digit__2__tmp+14
lda BCDScore6_digits_b0
sta Kernel6Digit__preframe__3__BCD0
lda BCDScore6_digits_b8
sta Kernel6Digit__preframe__3__BCD1
lda BCDScore6_digits_b16
sta Kernel6Digit__preframe__3__BCD2
ldx #0 ; leftmost bitmap
ldy #2 ; start from most-sigificant BCD value
Kernel6Digit__preframe__3__Loop:
lda Kernel6Digit__preframe__3__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
lda Kernel6Digit__preframe__3__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
bpl Kernel6Digit__preframe__3__Loop ; repeat until < 0
2022-02-23 14:43:19 +00:00
;;; end action Kernel6Digit__preframe__3
KERNEL_START
2022-02-23 14:43:19 +00:00
;;; start action Kernel6Digit__kernel__4
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-23 14:43:19 +00:00
;;; end action Kernel6Digit__kernel__4
2022-02-23 14:43:19 +00:00
;;; start action Kernel6Digit__kernel__5
; Display the resulting 48x8 bitmap
; using the Digit0-5 pointers.
Kernel6Digit__kernel__5__LoopCount = Kernel6Digit__2__tmp+12
Kernel6Digit__kernel__5__Temp = Kernel6Digit__2__tmp+13
lda BGColor_bgcolor_b0
sta WSYNC
sta COLUBK
lda #7
sta Kernel6Digit__kernel__5__LoopCount
SLEEPR 20 ; TODO?
Kernel6Digit__kernel__5__BigLoop:
ldy Kernel6Digit__kernel__5__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
sta Kernel6Digit__kernel__5__Temp ; B5 -> temp
lda (Digit4),y ; load B4
tax ; -> X
lda (Digit3),y ; load B3 -> A
ldy Kernel6Digit__kernel__5__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
dec Kernel6Digit__kernel__5__LoopCount ; go to next line
bpl Kernel6Digit__kernel__5__BigLoop ; repeat until < 0
lda #0 ; clear the sprite registers
sta WSYNC
sta GRP0
sta GRP1
sta GRP0
sta GRP1
sta COLUBK
2022-02-23 14:43:19 +00:00
;;; end action Kernel6Digit__kernel__5
2022-02-23 14:43:19 +00:00
;;; start action Kernel2Digit__kernel__6
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-23 14:43:19 +00:00
;;; end action Kernel2Digit__kernel__6
2022-02-23 14:43:19 +00:00
;;; start action Kernel2Digit__kernel__7
lda #7
sta Kernel2Digit__4__tmp+0
Kernel2Digit__kernel__7__Loop:
ldx #0
sta WSYNC
2022-02-23 14:43:19 +00:00
;;; start action Kernel2Digit__compute2digit__8
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-23 14:43:19 +00:00
;;; start action Kernel2Digit__fetchdigit__9
adc Kernel2Digit__4__tmp+0
tay
; TODO: select your own?
lda FontTablePF,y
2022-02-23 14:43:19 +00:00
;;; end action Kernel2Digit__fetchdigit__9
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-23 14:43:19 +00:00
;;; start action Kernel2Digit__fetchdigit__10
adc Kernel2Digit__4__tmp+0
tay
; TODO: select your own?
lda FontTablePF,y
2022-02-23 14:43:19 +00:00
;;; end action Kernel2Digit__fetchdigit__10
and #$f0
ora Kernel2Digit__4__tmp+1 + 0
sta Kernel2Digit__4__tmp+1 + 0
2022-02-23 14:43:19 +00:00
;;; end action Kernel2Digit__compute2digit__8
inx
2022-02-23 14:43:19 +00:00
;;; start action Kernel2Digit__compute2digit__11
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-23 14:43:19 +00:00
;;; start action Kernel2Digit__fetchdigit__12
adc Kernel2Digit__4__tmp+0
tay
; TODO: select your own?
lda FontTablePF,y
2022-02-23 14:43:19 +00:00
;;; end action Kernel2Digit__fetchdigit__12
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-23 14:43:19 +00:00
;;; start action Kernel2Digit__fetchdigit__13
adc Kernel2Digit__4__tmp+0
tay
; TODO: select your own?
lda FontTablePF,y
2022-02-23 14:43:19 +00:00
;;; end action Kernel2Digit__fetchdigit__13
and #$f0
ora Kernel2Digit__4__tmp+1 + 1
sta Kernel2Digit__4__tmp+1 + 1
2022-02-23 14:43:19 +00:00
;;; end action Kernel2Digit__compute2digit__11
; playfield
dec Kernel2Digit__4__tmp+0
bpl Kernel2Digit__kernel__7__Loop
; dex
; stx PF1
2022-02-23 14:43:19 +00:00
;;; end action Kernel2Digit__kernel__7
KERNEL_END
2022-02-23 14:43:19 +00:00
;;; start action JoyButton__postframe__14
lda INPT4 ;read button input
bmi JoyButton__postframe__14__NotPressed
2022-02-23 14:43:19 +00:00
;;; start action IncScore__joybutton__15
2022-02-23 14:43:19 +00:00
;;; start action BCDMath__AddBCD4__16
.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-23 14:43:19 +00:00
;;; end action BCDMath__AddBCD4__16
2022-02-23 14:43:19 +00:00
;;; end action IncScore__joybutton__15
JoyButton__postframe__14__NotPressed:
2022-02-23 14:43:19 +00:00
;;; end action JoyButton__postframe__14
FRAME_END
jmp FrameLoop__start__2__NextFrame ; loop to next frame
2022-02-23 14:43:19 +00:00
;;; end action FrameLoop__start__2
; 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-23 14:43:19 +00:00
;;; start action FontTable__FontTable__17
; 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-23 14:43:19 +00:00
;;; end action FontTable__FontTable__17
FontTablePF:
2022-02-23 14:43:19 +00:00
;;; start action FontTablePF__FontTablePF__18
; 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-23 14:43:19 +00:00
;;; end action FontTablePF__FontTablePF__18
.endscope
Main__Start = Main::__Start