-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathy_coord_pos.dasm
More file actions
102 lines (84 loc) · 1.29 KB
/
Copy pathy_coord_pos.dasm
File metadata and controls
102 lines (84 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
processor 6502
include "vcs.h"
include "macro.h"
seg.u variables
org $80
PlayerHeight equ 9
PlayerYPos byte
seg code
org $f000
Start:
sei
cld
ldx #$ff
txs
CLEAN_START
lda #50
sta PlayerYPos
lda #$aa
sta COLUBK
NextFrame:
lda #2
sta VSYNC
sta VBLANK
sta WSYNC
sta WSYNC
sta WSYNC
lda #0
sta VSYNC
REPEAT 37
sta WSYNC
REPEND
sta VBLANK
ldy #192
Scanline:
tya
; Here we check if current scanline is "inside" the apple sprite rect
; if it is we jump and draw the sprite
; if not we use a "zero" line inside the apple bitmap data
; and draw "an empty" sprite
sec
sbc PlayerYPos
cmp PlayerHeight
bcc DrawPlayer
lda #0
DrawPlayer:
tax
lda Player,X
sta GRP0
lda PlayerColors,X
sta COLUP0
sta WSYNC
dey
bne Scanline
lda #2
sta VBLANK
REPEAT 30
sta WSYNC
REPEND
sta VBLANK
jmp NextFrame
org $ffea
Player:
byte %00000000 ;
byte %00111100 ; ####
byte %01111110 ; ######
byte %11111111 ; ########
byte %11111111 ; ########
byte %11111111 ; ########
byte %01111110 ; ######
byte %00010000 ; #
byte %00111000 ; ###
PlayerColors:
byte $40 ; Red gradient
byte $40 ; Red gradient
byte $42 ;
byte $44 ;
byte $44 ;
byte $48 ;
byte $48 ;
byte $ca ; Dark green
byte $c4 ; Dark green
org $fffc
.word Start
.word Start