-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de00fa9
commit d4fad3e
Showing
62 changed files
with
5,724 additions
and
2,694 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ prboom2/VisualC8/ReleaseNOASMGL | |
prboom2/VisualC8/ReleaseServer | ||
prboom2/data/prboom.wad | ||
prboom2/release | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Copyright 2024 NXP | ||
# SPDX-License-Identifier: gpl-2.0-only | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(app LANGUAGES C) | ||
|
||
set(PRBOOM_FILES | ||
prboom2/src/am_map.c | ||
prboom2/src/d_client.c | ||
prboom2/src/d_items.c | ||
prboom2/src/d_main.c | ||
prboom2/src/doom_iwad.c | ||
prboom2/src/f_finale.c | ||
prboom2/src/f_wipe.c | ||
prboom2/src/g_game.c | ||
prboom2/src/global_data.c | ||
prboom2/src/hu_lib.c | ||
prboom2/src/hu_stuff.c | ||
prboom2/src/i_audio.c | ||
prboom2/src/i_main.c | ||
prboom2/src/info.c | ||
prboom2/src/i_system.c | ||
prboom2/src/i_video.c | ||
prboom2/src/lprintf.c | ||
prboom2/src/m_bbox.c | ||
prboom2/src/m_cheat.c | ||
prboom2/src/m_menu.c | ||
prboom2/src/m_random.c | ||
prboom2/src/p_ceilng.c | ||
prboom2/src/p_doors.c | ||
prboom2/src/p_enemy.c | ||
prboom2/src/p_floor.c | ||
prboom2/src/p_genlin.c | ||
prboom2/src/p_inter.c | ||
prboom2/src/p_lights.c | ||
prboom2/src/p_map.c | ||
prboom2/src/p_maputl.c | ||
prboom2/src/p_mobj.c | ||
prboom2/src/p_plats.c | ||
prboom2/src/p_pspr.c | ||
prboom2/src/p_setup.c | ||
prboom2/src/p_sight.c | ||
prboom2/src/p_spec.c | ||
prboom2/src/p_switch.c | ||
prboom2/src/p_telept.c | ||
prboom2/src/p_tick.c | ||
prboom2/src/p_user.c | ||
prboom2/src/r_data.c | ||
prboom2/src/r_draw.c | ||
prboom2/src/r_hotpath.iwram.c | ||
prboom2/src/r_main.c | ||
prboom2/src/r_patch.c | ||
prboom2/src/r_plane.c | ||
prboom2/src/r_things.c | ||
prboom2/src/sounds.c | ||
prboom2/src/s_sound.c | ||
prboom2/src/st_gfx.c | ||
prboom2/src/st_lib.c | ||
prboom2/src/st_stuff.c | ||
prboom2/src/tables.c | ||
prboom2/src/version.c | ||
prboom2/src/v_video.c | ||
prboom2/src/wi_stuff.c | ||
prboom2/src/w_wad.c | ||
prboom2/src/z_bmalloc.c | ||
prboom2/src/z_zone.c | ||
) | ||
|
||
if(CONFIG_DOOM_FIXED_RECIPROCAL_LUT) | ||
list(APPEND PRBOOM_FILES prboom2/src/m_recip.c) | ||
endif() | ||
|
||
|
||
if(CONFIG_DOOM_SHOW_NXP_LOGO) | ||
list(APPEND PRBOOM_FILES src/nxp_80x32.c) | ||
endif() | ||
|
||
target_include_directories(app PUBLIC prboom2/src) | ||
target_include_directories(app PUBLIC src) | ||
|
||
target_sources(app PRIVATE ${PRBOOM_FILES} src/i_system_zephyr.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
# Copyright 2024 NXP | ||
# SPDX-License-Identifier: gpl-2.0-only | ||
|
||
mainmenu "Doom" | ||
|
||
menu "Zephyr" | ||
|
||
source "Kconfig.zephyr" | ||
|
||
endmenu | ||
|
||
menu "Doom" | ||
|
||
config DOOM_X_RES | ||
int "Doom X resolution" | ||
default 320 | ||
|
||
config DOOM_Y_RES | ||
int "Doom Y resolution" | ||
default 240 | ||
|
||
config DOOM_ZONE_HEAP_SIZE | ||
int "Heap size (kB)" | ||
default 256 | ||
|
||
config DOOM_FIXED_RECIPROCAL_LUT | ||
bool "Use LUT for FixedReciprocal" | ||
default y | ||
help | ||
On microarchitectures without a hardware divider such as Cortex-m0 | ||
calculating the reciprocal is compute intensive. This method uses | ||
a lookup table (256kB) to approximate it. | ||
|
||
config DOOM_CALC_TAN_TABLE | ||
bool "Calculate finetangent at startup" | ||
default n | ||
help | ||
Instead of storing the LUT in flash we calculate the tan table at startup | ||
This saves a bit of flash at the cost of ram and startup time | ||
|
||
config DOOM_CALC_SIN_TABLE | ||
bool "Calculate finesine at startup" | ||
default n | ||
help | ||
Instead of storing the LUT in flash we calculate the sine table at startup | ||
This saves a bit of flash at the cost of ram and startup time | ||
|
||
config DOOM_CALC_YSLOPE | ||
bool "Calculate yslope at startup" | ||
default y | ||
help | ||
Instead of storing the LUT in flash we calculate the sine table at startup | ||
This saves a bit of flash at the cost of ram and startup time. | ||
Yslope needs to be manually generated for each resolution. | ||
|
||
config DOOM_CALC_DISTSCALE | ||
bool "Calculate distcale at startup" | ||
default y | ||
help | ||
Instead of storing the LUT in flash we calculate the sine table at startup | ||
This saves a bit of flash at the cost of ram and startup time. | ||
Distcale needs to be manually generated for each resolution. | ||
|
||
config DOOM_CALC_XTOVIEWANGLE | ||
bool "Calculate xtoviewangle at startup" | ||
default y | ||
help | ||
Instead of storing the LUT in flash we calculate the sine table at startup | ||
This saves a bit of flash at the cost of ram and startup time. | ||
Xtoviewangle needs to be manually generated for each resolution. | ||
|
||
config DOOM_CALC_VIEWANGLETOX | ||
bool "Calculate viewangletox at startup" | ||
default y | ||
help | ||
Instead of storing the LUT in flash we calculate the sine table at startup | ||
This saves a bit of flash at the cost of ram and startup time. | ||
Viewangletox needs to be manually generated for each resolution. | ||
|
||
|
||
config DOOM_NO_WIPE | ||
bool "Disable Screen wipe" | ||
default n | ||
help | ||
Disables screen wipe effect saves on ram since we don't have to allocate the | ||
frontbuffer anymore | ||
|
||
config DOOM_PRINT_MEMSTAT | ||
bool "Print memory statistics to console" | ||
default n | ||
|
||
choice DOOM_PIXEL_FORMAT | ||
prompt "Color pixel format" | ||
default DOOM_BGR565 | ||
help | ||
Specify the color pixel format for the DOOM output frame. | ||
|
||
config DOOM_RGB888 | ||
bool "RGB888" | ||
|
||
config DOOM_RGB565 | ||
bool "RGB565" | ||
|
||
config DOOM_BGR565 | ||
bool "BGR565" | ||
endchoice | ||
|
||
config DOOM_HIGHDETAIL | ||
bool "High detail mode" | ||
default n | ||
|
||
config DOOM_FPS_AMMO | ||
bool "Use ammo counter as FPS counter" | ||
default n | ||
|
||
config DOOM_ZEPHYR_BACKGROUND | ||
bool "Show Zephyr logo when hud extends 240 pixels" | ||
default n | ||
|
||
config DOOM_SHOW_NXP_LOGO | ||
bool "On startup clear framebuffer with NXP logo pattern" | ||
default n | ||
|
||
config DOOM_ZEPHYR_ADC_JOYSTICK | ||
bool "Use ADC for joystick input" | ||
select ADC | ||
default n | ||
|
||
config DOOM_ZEPHYR_TOUCH_SCREEN | ||
bool "Use Touch screen for input" | ||
default n | ||
|
||
if DOOM_ZEPHYR_TOUCH_SCREEN | ||
|
||
# Touchscreen can use different coordinate systems | ||
# Ideally this should be corrected in the touchscreen driver or input subsys | ||
|
||
config DOOM_ZEPHYR_TOUCH_SCREEN_SWAP_XY | ||
bool "Touchscreen swap x/y coordinates" | ||
default n | ||
|
||
config DOOM_ZEPHYR_TOUCH_SCREEN_INVERT_X | ||
bool "Touchscreen invert X coordinates" | ||
default n | ||
endif | ||
|
||
config DOOM_FB_DTCM | ||
bool "Place Framebuffer in DTCM memory" | ||
depends on ARM | ||
|
||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Doom-MCX | ||
|
||
![MCX-Doom](assets/doom_mcx.jpg) | ||
|
||
A port of prBoom to NXP MCXN MCU running Zephyr RTOS | ||
|
||
# Hardware | ||
|
||
![FRDM-MCXN947](assets/FRDM-MCXN947-TOP.avif) | ![LCD-PAR-S035](assets/LCD-PAR-S035-TOP.avif) | ||
:-------------------------:|:-------------------------: | ||
[FRDM Development Board for MCX N947](https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/frdm-development-board-for-mcx-n94-n54-mcus:FRDM-MCXN947) | [LCD-PAR-S035 480x320 IPS LCD](https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/3-5-480x320-ips-tft-lcd-module:LCD-PAR-S035) | ||
|
||
Optional [Joystick shield](https://duckduckgo.com/?t=h_&q=funduino+board+joystick+shield&ia=web) on FRDM-MCXN947 Arduino Header | ||
|
||
|
||
# Getting Started | ||
|
||
Before getting started, make sure you have a proper Zephyr development | ||
environment. Follow the official | ||
[Zephyr Getting Started Guide](https://docs.zephyrproject.org/latest/getting_started/index.html). | ||
|
||
### Initialization | ||
|
||
The first step is to initialize the DOOM-MCX Zephyr workspace folder (``doom-mcx-workspace``) where ``doom-mcx`` and all Zephyr modules will be cloned. Run the following | ||
command: | ||
|
||
```shell | ||
# initialize for the example-application (main branch) | ||
west init -m https://github.com/nxphovergames/doom-mcx --mr main doom-mcx-workspace | ||
# update Zephyr modules | ||
cd doom-mcx-workspace | ||
west update | ||
``` | ||
|
||
### Building | ||
|
||
To build the application, run the following command: | ||
|
||
```shell | ||
cd doom-mcx | ||
west build -p always -b frdm_mcxn947/mcxn947/cpu0 | ||
``` | ||
|
||
### Flashing | ||
|
||
> [!NOTE] | ||
> [NXP Linkserver](https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/linkserver-for-microcontrollers:LINKERSERVER) v1.5.30 or newer has to be installed. | ||
To flash the application to the FRDM-MCXN947 board. Connect a USB-C cable to the "MCU-Link" USB-C port and run the following command: | ||
|
||
```shell | ||
west flash | ||
``` | ||
|
||
### Doom-MCX Controls | ||
|
||
Doom-MCX supports 2 types of control either through touchscreen or the [Joystick shield](https://duckduckgo.com/?t=h_&q=funduino+board+joystick+shield&ia=web). | ||
|
||
#### Touchscreen controls | ||
**Open doors/start:** Tap "Use Area" | ||
**Fire:** Tap "Fire Area" | ||
**Wake & Strafe** Tap and drag in the "Virtual Joystick Area" | ||
|
||
![Doom-MXC Touch screen layout](assets/doom_mcx_touch_screen_layout.jpg) | ||
|
||
> [!CAUTION] | ||
> When using the Funduino shield make sure the switch is in 3V3 mode, otherwise you will damage the board. | ||
#### Joytick Shield controls | ||
**Fire:** D | ||
**Use:** C | ||
**Walk:** Joystick Y-axis | ||
**Strafe:** Joystick X-axis | ||
**Menu:** A | ||
|
||
# Simulation on PC | ||
|
||
Zephyr RTOS also provides a native_posix target | ||
|
||
To compile as native type: | ||
```shell | ||
west build -p always -b native_posix_64 | ||
``` | ||
|
||
To run type | ||
```shell | ||
cd doom-mcx | ||
./build/zephyr/zephyr.elf | ||
``` | ||
|
||
### native_posix controls | ||
**Fire:** CTRL | ||
**Use:** Spacebar | ||
**Walk:** Up-arrow & Down-arrow | ||
**Strafe:** Left-arrow & Right-arrow | ||
**Menu:** ESC | ||
|
||
![MCX-Doom Native](assets/mcx_doom_zephyr_native_posix.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
NXP Software Content Register | ||
|
||
Package: Doom-MCX | ||
Version: 1.0 | ||
Outgoing License: GNU General Public License v2.0 only | ||
License File: COPYING | ||
Description: A port of prBoom to NXP MCXN MCU running Zephyr RTOS. | ||
Release location: https://github.com/nxphovergames/doom-mcx | ||
Origin: NXP (GNU General Public License v2.0 only) | ||
PrBoom (GNU General Public License v2.0 only) - https://svn.prboom.org/repos/trunk/prboom2/COPYING | ||
GBADoom (GNU General Public License v2.0 only) - https://github.com/doomhack/GBADoom/blob/master/source/d_main.c |
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.