-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path05-spriteMult.c
More file actions
executable file
·53 lines (44 loc) · 1.08 KB
/
Copy path05-spriteMult.c
File metadata and controls
executable file
·53 lines (44 loc) · 1.08 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
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2026 Naohiko Shimizu <nshimizu@ip-arch.jp>
#include "ppusample.h"
void main(void) {
int i,count;
unsigned char d;
struct sprite *spdata = (void*)0x0200;
PPUCTRL = CTRL_VALUE;
PPUMASK = PPU_OFF;
SetPPUAdr(0x3F00); /* set background pallete table */
PPUDAT = 0x00;
PPUDAT = 0x01;
PPUDAT = 0x10;
PPUDAT = 0x20;
SetPPUAdr(0x3F11); /* set sprite pallete table (pallete 0 is common to BG */
PPUDAT = 0x01;
PPUDAT = 0x10;
PPUDAT = 0x38;
for(i=1;i<64;i++) spdata[i].v_pos=255;
SetPPUAdr(0x2000);
for(i=0;i<960;i++) /* clear name table */
PPUDAT = 0;
SetPPUAdr(0x23C0);
for(i=0;i<64;i++) /* clear attribute */
PPUDAT = 0;
PPUSTATUS;
PPUCTRL = 0x00;
PPUMASK = PPU_ON;
count=0;
for(i=0;i<10;i++) {
do {
while(PPU_VBLANK == 0);
} while(count++<60);
count=0;
PPUSCR = 0x00;
PPUSCR = 0x00;
spdata[i].v_pos = 119; /* y pos */
spdata[i].chr = '0'+i;
spdata[i].attr = SP_PALETTE(0) ; /* sprite attribute */
spdata[i].h_pos = 32+i*10; /* x pos */
OAMDMA = 0x02;
}
while(1);
}