diff options
author | Bad Diode <bd@badd10de.dev> | 2021-05-20 22:18:28 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-05-20 22:18:28 +0200 |
commit | ab6fdd0347920cdcda9c4c3c9c3f01996adc48db (patch) | |
tree | 02f714fdf9a10be96e1eb82b5ebc5834d04c9259 /src/main.c | |
parent | 1d6395f1b6aafce4e2e05bcf60f335bec0a8d4b3 (diff) | |
download | uxngba-ab6fdd0347920cdcda9c4c3c9c3f01996adc48db.tar.gz uxngba-ab6fdd0347920cdcda9c4c3c9c3f01996adc48db.zip |
Apply asie's first performance patch
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -61,6 +61,7 @@ system_talk(Device *d, Uint8 b0, Uint8 w) { | |||
61 | (void)b0; | 61 | (void)b0; |
62 | } | 62 | } |
63 | 63 | ||
64 | IWRAM_CODE | ||
64 | void | 65 | void |
65 | screen_talk(Device *d, Uint8 b0, Uint8 w) { | 66 | screen_talk(Device *d, Uint8 b0, Uint8 w) { |
66 | if(w && b0 == 0xe) { | 67 | if(w && b0 == 0xe) { |
@@ -181,6 +182,10 @@ handle_input(Uxn *u) { | |||
181 | devctrl->dat[3] = 0; | 182 | devctrl->dat[3] = 0; |
182 | } | 183 | } |
183 | 184 | ||
185 | static Uxn u; | ||
186 | EWRAM_BSS | ||
187 | static Uint8 umem[65536]; | ||
188 | |||
184 | int main(void) { | 189 | int main(void) { |
185 | // Register interrupts. | 190 | // Register interrupts. |
186 | irq_init(); | 191 | irq_init(); |
@@ -188,7 +193,8 @@ int main(void) { | |||
188 | 193 | ||
189 | 194 | ||
190 | // Initialize VM. | 195 | // Initialize VM. |
191 | Uxn u = {0}; | 196 | memset(&u, 0, sizeof(u)); |
197 | u.ram.dat = umem; | ||
192 | init_uxn(&u); | 198 | init_uxn(&u); |
193 | 199 | ||
194 | // Initialize text engine. | 200 | // Initialize text engine. |
@@ -208,10 +214,13 @@ int main(void) { | |||
208 | while(true) { | 214 | while(true) { |
209 | bios_vblank_wait(); | 215 | bios_vblank_wait(); |
210 | handle_input(&u); | 216 | handle_input(&u); |
217 | profile_start(); | ||
211 | evaluxn(&u, mempeek16(devscreen->dat, 0)); | 218 | evaluxn(&u, mempeek16(devscreen->dat, 0)); |
219 | int eval_cycles = profile_stop(); | ||
212 | flipbuf(&ppu); | 220 | flipbuf(&ppu); |
213 | // txt_position(0,0); | 221 | txt_position(0,0); |
214 | // txt_printf("FRAME: %d\n", frame_counter); | 222 | txt_printf("FRAME: %d\n", frame_counter); |
223 | txt_printf("EVAL: %d\n", eval_cycles); | ||
215 | time_seconds++; | 224 | time_seconds++; |
216 | frame_counter++; | 225 | frame_counter++; |
217 | } | 226 | } |