aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-20 17:02:47 +0200
committerBad Diode <bd@badd10de.dev>2021-05-20 17:02:47 +0200
commit707b6dac805bcc4f2b5e297ff3ce4b82538bcff0 (patch)
tree23799c789848b6dd75ba7fb124bc903d9328776b /src
parentbe6617308ea796d2a41007a7bee1472884e189f7 (diff)
downloaduxngba-707b6dac805bcc4f2b5e297ff3ce4b82538bcff0.tar.gz
uxngba-707b6dac805bcc4f2b5e297ff3ce4b82538bcff0.zip
Add README and some example roms
Diffstat (limited to 'src')
-rw-r--r--src/main.c6
-rw-r--r--src/uxn/devices/ppu.c19
-rw-r--r--src/uxn/roms/automata.rombin0 -> 255 bytes
-rw-r--r--src/uxn/roms/dvd.rombin0 -> 317 bytes
-rw-r--r--src/uxn/roms/piano.rombin0 -> 2815 bytes
5 files changed, 14 insertions, 11 deletions
diff --git a/src/main.c b/src/main.c
index c302480..e91a2f2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -142,9 +142,9 @@ int main(void) {
142 evaluxn(&u, mempeek16(devscreen->dat, 0)); 142 evaluxn(&u, mempeek16(devscreen->dat, 0));
143 flipbuf(&ppu); 143 flipbuf(&ppu);
144 int eval_cycles = profile_stop(); 144 int eval_cycles = profile_stop();
145 txt_position(0,0); 145 // txt_position(0,0);
146 txt_printf("FRAME: %d \n", frame_counter); 146 // txt_printf("FRAME: %d \n", frame_counter);
147 txt_printf("EVAL: %d \n", eval_cycles); 147 // txt_printf("EVAL: %d \n", eval_cycles);
148 drawing_cycles = 0; 148 drawing_cycles = 0;
149 frame_counter++; 149 frame_counter++;
150 } 150 }
diff --git a/src/uxn/devices/ppu.c b/src/uxn/devices/ppu.c
index 0935329..d70afdd 100644
--- a/src/uxn/devices/ppu.c
+++ b/src/uxn/devices/ppu.c
@@ -167,8 +167,8 @@ putpixel(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 color) {
167 size_t tile_y = y / 8; 167 size_t tile_y = y / 8;
168 size_t start_col = x % 8; 168 size_t start_col = x % 8;
169 size_t start_row = y % 8; 169 size_t start_row = y % 8;
170 Uint32 pos = (start_row + ((tile_x + tile_y * 30) * 8)); 170 size_t pos = (start_row + ((tile_x + tile_y * 30) * 8));
171 Uint32 shift = start_col * 4; 171 size_t shift = start_col * 4;
172 layer[pos] = (layer[pos] & (~(0xF << shift))) | (color << shift); 172 layer[pos] = (layer[pos] & (~(0xF << shift))) | (color << shift);
173 dirty_tiles[tile_y] |= 1 << tile_x; 173 dirty_tiles[tile_y] |= 1 << tile_x;
174} 174}
@@ -180,13 +180,16 @@ puticn(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color,
180 size_t tile_y = y / 8; 180 size_t tile_y = y / 8;
181 size_t start_col = x % 8; 181 size_t start_col = x % 8;
182 size_t start_row = y % 8; 182 size_t start_row = y % 8;
183 Uint32 pos = (start_row + ((tile_x + tile_y * 30) * 8)); 183 size_t shift_left = start_col * 4;
184 Uint32 shift_left = start_col * 4; 184 size_t shift_right = (8 - start_col) * 4;
185 Uint32 shift_right = (8 - start_col) * 4;
186 Uint32 *layer_ptr = &layer[pos];
187 if (flipy) flipy = 7;
188 185
189 Uint32 *lut = flipx ? unpack_icon_lut : unpack_icon_lut_flipx; 186 if (flipy) {
187 flipy = 7;
188 }
189
190 size_t pos = (start_row + ((tile_x + tile_y * 30) * 8));
191 size_t *layer_ptr = &layer[pos];
192 size_t *lut = flipx ? unpack_icon_lut : unpack_icon_lut_flipx;
190 193
191 // There are 4 possible cases: 194 // There are 4 possible cases:
192 // 1. The sprite is exactly at the tile boundary. We can just copy the 195 // 1. The sprite is exactly at the tile boundary. We can just copy the
diff --git a/src/uxn/roms/automata.rom b/src/uxn/roms/automata.rom
new file mode 100644
index 0000000..57c505c
--- /dev/null
+++ b/src/uxn/roms/automata.rom
Binary files differ
diff --git a/src/uxn/roms/dvd.rom b/src/uxn/roms/dvd.rom
new file mode 100644
index 0000000..4de8d72
--- /dev/null
+++ b/src/uxn/roms/dvd.rom
Binary files differ
diff --git a/src/uxn/roms/piano.rom b/src/uxn/roms/piano.rom
new file mode 100644
index 0000000..0556ccf
--- /dev/null
+++ b/src/uxn/roms/piano.rom
Binary files differ