Commit Graph

897 Commits

Author SHA1 Message Date
Devine Lu Linvega ff6d9e39ca (uxnemu) Fixes issue where non-zero console/type occurs even when empty, fixed by hikari_no_yume 2023-06-29 14:23:16 -07:00
Weeble f5c816d215 (screen.c) Fix sprite draw at screen edge
Problem - Sprites can be drawn at X/Y coordinates >= 0xfff9 to appear
partially over the left/upper screen boundary. But the dirty-rectangle
calculation doesn't account for this, so these updates will only appear
on the screen if something *else* dirties this area of the screen. This
can be observed in /projects/examples/devices/screen.tal where these
edges of the screen show stale content.

Solution - Detect wrapping and expand the dirty rectangle appropriately.
Change screen_change to take Uint16 to make sure values are truncated to
the intended range. Ignore changes that are fully off the screen.
2023-06-29 07:41:42 -07:00
Devine Lu Linvega e930804c4b Do not print message on quit 2023-06-09 09:29:25 -07:00
Devine Lu Linvega fe10cfecef Improved usage standard message 2023-06-08 09:47:18 -07:00
neauoire 5dd7fec729 Removed clear between redraws and moved to set_window_size 2023-06-07 08:23:42 -07:00
neauoire e147b46b55 Snake_cased some SDL variables 2023-06-07 08:03:28 -07:00
Devine Lu Linvega 1d4ae74e41 Removed multiplication from SET macro in uxn core 2023-05-17 20:39:03 -07:00
Sevan Janiyan 305b8469b0 Use the correct definition to obtain snprintf(3)
At some point snprintf(3) prototype became guarded off in stdio.h.
Defining _C99_SOURCE makes it visible.
On legacy Darwin, such a guard was not present so the definition
has no impact on the build, but on "modern" macos it has the desired
effect.
Build tested on OS X 10.4 and macos 10.15.
2023-05-15 08:32:48 -07:00
Sevan Janiyan b5b3177c68 Switch to using SDL_CreateRGBSurface() SDL_CreateRGBSurfaceWithFormat() was introduced in SDL 2.0.5 whereas SDL_CreateRGBSurface() is available since SDL 2.0. This allows uxn to run on legacy systems where it's not possible to reach SDL 2.0.5 but prior versions are, such as Mac OS X Tiger. 2023-05-14 19:34:55 -07:00
Sevan Janiyan 822a7fea54 Use the audio format native to host AUDIO_S16 defaults to little endian format which causes issues when running on big endian systems. Use AUDIO_S16SYS instead which sets to whatever endian the system uxn is being built on is. 2023-05-14 19:34:55 -07:00
d_m 310ba97ef6 Improve screen vector timing somewhat.
This patch tries to improve the accuracy of our
screen refresh timing. Notably, it tries to ensure
we don't introduce extra delay in our timing based
on how long the screen vector takes to evaluate.

We also try to ensure we only call SDL_Delay when
we have at least 1ms to wait.
2023-05-09 13:12:23 -07:00
Devine Lu Linvega 09d9990a62 (screen) Fixes warnings 2023-05-04 20:45:52 -07:00
Devine Lu Linvega 77edd1dbbf (screen) Renamed pixels attr to layer 2023-05-04 20:32:44 -07:00
Devine Lu Linvega d80885ee22 (screen) Housekeeping 2023-05-04 20:17:38 -07:00
Devine Lu Linvega 98bd2a7849 (screen) Use uxn_screen global 2023-05-04 17:43:44 -07:00
Devine Lu Linvega 9416a0e813 Removed layer struct 2023-05-04 11:33:31 -07:00
Devine Lu Linvega 8f98281d89 (screen) Only repaint changed pixels 2023-05-04 11:15:16 -07:00
Sigrid Solveig Haflínudóttir c7f3014fe9 zoom: ignore if 0, ie if the screen is somehow TOO small to do any scaling 2023-05-02 22:53:07 +00:00
Devine Lu Linvega 83ba7e05ea Added mock behavior for the friend port 2023-05-02 10:31:33 -07:00
Matus Laslofi d2e054346f Declare snprintf to fix builds on macOS
For some reason on macOS, the functions `snprintf` and `vsnprintf` are
not in the X/Open 5 (ANSI C89) standard but rather in the X/Open
6 (ISO C99). A simplest solution seems to be to declaring the missing
functions before using them, which is what I did here. Another option
is to use the C99 standard with `#define _XOPEN_SOURCE 600`, which
seems to be an overkill for such a niche issue.

Quoting from the STANDARDS section in `man 3 snprintf` on macOS:

> ...the snprintf() and vsnprintf() functions conform to ISO/IEC
> 9899:1999 (“ISO C99”)...
2023-05-01 09:27:49 -07:00
Devine Lu Linvega ce0cc5a352 Do not center on resize 2023-04-26 12:04:44 -07:00
Devine Lu Linvega 0da70d6bd1 Allow tiny sizes for the screen 2023-04-26 12:01:45 -07:00
Devine Lu Linvega ebf31ecb03 (uxnemu) Removed debug line 2023-04-22 14:57:26 -07:00
Devine Lu Linvega 40d6c889bc Set Console/type after memory is initialized 2023-04-22 14:56:12 -07:00
Devine Lu Linvega 3038d5c40b (console) Use 0x00 for no-queue 2023-04-17 11:27:54 -07:00
Devine Lu Linvega d8bee29626 (console) Use 0x1 for no-args 2023-04-17 11:19:37 -07:00
Devine Lu Linvega 98282cb1a6 Moved error printing to system.c 2023-04-17 11:03:11 -07:00
Devine Lu Linvega 9a882a64c7 (uxnemu) Write arguments end in console device 2023-04-17 10:41:03 -07:00
Devine Lu Linvega 1bf0ffc5e5 (uxnemu) Display usage when no roms and no params 2023-04-17 10:29:39 -07:00
Devine Lu Linvega 453f491918 (uxnemu) Display new zoom values in usage 2023-04-17 09:59:00 -07:00
Devine Lu Linvega 72e23f0260 (uxnemu) Simplified boot sequence 2023-04-17 09:48:27 -07:00
Devine Lu Linvega d1dc143912 (uxnemu) Only set zoom scale once on boot 2023-04-17 09:36:55 -07:00
Devine Lu Linvega a9527fbd95 (console.tal) Added input type port to example 2023-04-16 22:03:44 -07:00
Devine Lu Linvega fbba9b304d (console) Implemented 0x17 port with stream type based on design by zzo38 2023-04-16 21:13:50 -07:00
Devine Lu Linvega 32fa0f95c3 (uxn.c) Catch div-by-zero errors 2023-04-15 09:52:08 -07:00
Devine Lu Linvega 25cc4a1329 (screen.tal) Improved screen testing rom 2023-04-14 19:51:05 -07:00
Devine Lu Linvega c7203de2ea (uxn.c) Less indirections in uxn core 2023-04-14 10:30:08 -07:00
Devine Lu Linvega 99874908e4 (screen.c) Skip blit when color is 0 2023-04-14 10:19:57 -07:00
Devine Lu Linvega 0f75b123a4 (screen) sprite address wrapping 2023-04-14 10:05:15 -07:00
Devine Lu Linvega 04554dd1d3 (screen.c) Reduced number of variables indirections 2023-04-14 09:51:50 -07:00
Devine Lu Linvega b6e6839d25 (screen.c) Removed pixel function 2023-04-13 21:57:17 -07:00
Devine Lu Linvega d0db4f9223 (screen.c) Improved readability of the code 2023-04-13 21:33:16 -07:00
Devine Lu Linvega 891204610a Fixed issue with screen/fill layer 2023-04-13 09:58:09 -07:00
Devine Lu Linvega 2acc7edb6f Added comment for blending LUT 2023-04-13 09:53:05 -07:00
Devine Lu Linvega d043ce633d (screen.c) Faster drawing of pixel 2023-04-13 09:42:59 -07:00
Devine Lu Linvega a44dbd9696 (screen.c) Merge all checks 2023-04-12 20:00:17 -07:00
Devine Lu Linvega 8aae16a9d0 (screen) Removed clamp function 2023-04-12 19:20:11 -07:00
Devine Lu Linvega 540847694e Removed screen_wipe 2023-04-12 14:35:48 -07:00
Devine Lu Linvega be138f5952 Removed FIXED_SIZE flag 2023-04-12 12:22:17 -07:00
Devine Lu Linvega 11e9b635c8 Removed mono mode to screen 2023-04-12 11:58:32 -07:00
Lior Stern 847b3f2b56 uxnemu: Add dpad support
More info about joyhats in SDL2:
	https://wiki.libsdl.org/SDL2/SDL_JoyHatEvent
2023-04-12 11:08:48 -07:00
Devine Lu Linvega 344c5c9904 Added flip-x/flip-y to pixel fill mode 2023-04-11 11:31:36 -07:00
Devine Lu Linvega 07e8306616 (screen) Created static fill function 2023-04-11 11:11:12 -07:00
Devine Lu Linvega 24dbc7d5f8 (screen) Rename screen_clear to screen_fill 2023-04-11 10:42:32 -07:00
Devine Lu Linvega daa421c259 (uxn.c) Cache stack pointer 2023-04-11 10:32:23 -07:00
Devine Lu Linvega fc8400dcac (uxn.c) Formatting 2023-04-11 10:24:54 -07:00
Devine Lu Linvega 3973bc2ab8 Made the uxn stacks private again 2023-04-11 10:14:29 -07:00
Devine Lu Linvega 6f55ed496c (uxncli) Fixed issue with DateTime device mask 2023-04-08 08:53:56 -07:00
Devine Lu Linvega eaf7d095ec (system.c) The debug port will always print the stacks, even if empty 2023-04-06 17:50:03 -07:00
Devine Lu Linvega 00ed056e51 (uxnasm) Added support for label sized pads 2023-04-04 20:02:33 -07:00
Devine Lu Linvega 3b10969f9e Fixed issue where a screen redraw might occur after it has been unset 2023-04-02 20:27:15 -07:00
Devine Lu Linvega 8b43d0d7ae Removed redundant pixel param from screen routines 2023-03-27 08:38:54 -07:00
Sigrid Solveig Haflínudóttir 8a3c86a879 core: in plan 9 C it does not wrap around, fix the crash 2023-03-20 16:29:46 +00:00
Sigrid Solveig Haflínudóttir 37afbc25fb file: sprintf → snprintf 2023-03-20 16:58:45 +01:00
Sigrid Solveig Haflínudóttir 562153d09e fix a few long-standing compilation warnings 2023-03-20 16:58:09 +01:00
Devine Lu Linvega e386c3aeaa Fixed issue with Windows builds 2023-03-19 14:12:14 -07:00
Deadly Headshot 05fd9771ca A more elegant solution to the Windows bugs in filepaths and MinGW compilation 2023-03-19 14:11:42 -07:00
Devine Lu Linvega 7d66d81e63 Fixed issue with datetime mask 2023-03-17 21:45:03 -07:00
Devine Lu Linvega 4f9b375895 Fixed issue with device deo mask in uxnemu 2023-03-14 12:40:31 -07:00
Andrew Alderwick c701b95541 Detect stack overflows with greater than 255 bytes. 2023-03-13 06:04:33 +00:00
Andrew Alderwick 4464b1ec56 Correct SET values for NIP. 2023-03-13 06:03:44 +00:00
Devine Lu Linvega b68af3d173 Replaced macros in PUT2/PUSH2 2023-03-12 18:29:08 -07:00
Devine Lu Linvega 1de2cea576 Ordered the SWP writes 2023-03-12 16:15:27 -07:00
Devine Lu Linvega 3ecbfe5e03 Make use of macros in PUT/PUSH 2023-03-12 15:54:20 -07:00
Devine Lu Linvega 4e77d3d5ae Renamed PEEK16/POKE16 to PEEK2/POKE2 2023-03-12 15:25:52 -07:00
Devine Lu Linvega 43ce262a07 Moved opcodes side-by-side 2023-03-12 15:16:10 -07:00
Devine Lu Linvega 6c068b7774 Removed device page from addressable memory 2023-03-12 14:56:44 -07:00
Devine Lu Linvega bdd071cab4 Archived old core 2023-03-12 14:49:58 -07:00
Devine Lu Linvega 13ab0e5d95 Temporarily override uxn.c with fast until I can port the devices macros 2023-03-11 23:00:32 -08:00
Sigrid Solveig Haflínudóttir 8420c81d52 system.h: no need to redefine the same macro 2023-03-12 02:39:20 +01:00
Devine Lu Linvega 75af0e3cad Removed redundant mask in SFT opcode 2023-03-08 09:25:55 -08:00
Devine Lu Linvega c4856aabf0 Added missing ports in device mask 2023-03-07 19:48:24 -08:00
Devine Lu Linvega 77c8e82419 Moved dei/deo masks into emulators 2023-03-06 10:36:24 -08:00
Devine Lu Linvega 76be67efa0 (uxn-fast.c) Housekeeping 2023-03-06 08:40:00 -08:00
Devine Lu Linvega d08efece3d (uxn-fast.c) Removed redundant macro 2023-03-06 08:31:08 -08:00
Devine Lu Linvega 2c20d282a8 (uxn-fast) Standardized STH opcodes 2023-03-05 11:35:53 -08:00
Devine Lu Linvega 9f4231c59a (uxn-fast) Housekeeping 2023-03-05 11:33:33 -08:00
Devine Lu Linvega 3da461e14d (uxn-fast) Housekeeping 2023-03-05 11:31:37 -08:00
Devine Lu Linvega 211c4afa2d (uxn-fast) Use macros for STH 2023-03-05 11:29:58 -08:00
Devine Lu Linvega 8ae1c191d7 (uxn-fast.c) Removed function pointers, instead use exterm 2023-03-05 10:44:23 -08:00
Devine Lu Linvega 3190cf3238 Catch overflow in lit opcodes 2023-03-05 10:02:26 -08:00
Devine Lu Linvega 268ec45780 (Screen) Use fast timer if vector short is set 2023-03-04 11:07:11 -08:00
Devine Lu Linvega 3457f665a7 Use device masks for DEI 2023-03-04 10:51:23 -08:00
Devine Lu Linvega aeceaf75bf Removed file dei event 2023-03-03 21:04:26 -08:00
Devine Lu Linvega 9ac7f06fde (uxn-fast) Housekeeping 2023-03-03 20:47:20 -08:00
Devine Lu Linvega 4cacc0d26b Removed unused deo param 2023-03-03 20:37:43 -08:00
Devine Lu Linvega 8f979ec0fe Use uxn-fast in bug until the callback masks are ported 2023-03-03 12:02:42 -08:00
Devine Lu Linvega 32539d02a9 Added file device mask 2023-03-03 11:16:24 -08:00
Devine Lu Linvega 6eac5226e1 (bunnymark) Ported to immediate opcodes 2023-03-03 11:03:38 -08:00
Devine Lu Linvega 895bfc8675 (mandelbrot.tal) Migrated to immediate opcodes 2023-03-02 20:45:19 -08:00