Super Mario Bros.: [TAS] Custom cutscenes through ACE

100th Coin January 3, 2024
Video Thumbnail

About

No channel description available.

Video Description

In this video I showcase what can be done with Arbitrary Code Execution in Super Mario Bros. This TAS is a work in progress, and will likely be much longer. I'll likely make a video breaking down how this works after the TAS is finished, but in the meantime, here's the basics... As a brief note before I explain how this works, I've been making a video game and if you would wishlist it on Steam it would really help me out! Thanks! https://store.steampowered.com/app/2119470/Fantastic_Fist/ Anyway, let's talk about how Super Mario Bros. can be transformed into a video player, playing a NES port of the Travelling Salesman Problem. In a previous video I used ACE to win the game in N-2, which sets the stage to 8-4 about a minute and 15 seconds after turning on the console. Running the arbitrary code in this TAS will have the same setup, but the payload is obviously different. For more information on how this run is set up, why and how I'm in world 'N', please refer to this video: https://www.youtube.com/watch?v=xoDakIA31jc For this TAS, the code I write lets me read the controllers and store that data at a target address in RAM. Essentially I have complete control over what the console will execute, except I'm limited to 2 kibibytes of space. I'm overwriting most bytes in the stack here, but the idea is: Read the controller twice to set up the pointer to the target address, read the controller to determine the length of the code I wish to write, then read the controller n times to write the data there. Read the controller once more to determine if the PC should redo this loop, or read the controller 2 more times to set up one more pointer and jump that that target address. Bowser is defeated with fireballs triggering the ACE. I begin by blanking the screen and drawing a box, which I later fill in with text. During this time, I'm also writing a more sophisticated loop which let's me play custom music, but for this scene I'm simply using the existing code in SMB1 to play the victory music. My custom music engine works by reading the controller over and over again to set up the data for the NES APU. For any frame playing custom music, there's an average of 12 inputs dedicated just to the audio. After the custom Title Screen for Travelling Salesman is fully colored, I expand my loop to also allow OAM modifications (again, exclusively through reading the controller multiple times), which allows me to animate Mario running across the screen. In later sections of the TAS, I have around 56 inputs per frame, so optimizing the controller reading routine was absolutely critical. I can read an upwards limit around 230 inputs per frame, which is rarely needed, but it's nice to have it as efficient as possible. One of the fun challenges was to draw a custom character. The Super Mario Bros pattern table does not include a graphic for an 8x8 pixel question mark, yet I ask "Are you familiar with the travelling salesman problem?" To add that graphic, I assembled a series of sprites using a 2x2 pixel box into the shape of a question mark. Some of the boxes are sky colored to overlap other boxes and allow for thinner sections of the question mark. The section of Mario running to all the houses was the hardest part to make, as every frame has custom music, Mario moves (positions, animation frames...) and when he reaches a Toad House I change the color. A lot of work went in long before animating that section just so I could set up the palette information. If you look closely, each house is in a 16 pixel box without any "grass". I wanted to add some neat dithering details, but due to color palettes being divvied up into 16 pixel chunks, I wanted to attempt to seamlessly put houses among the grassy field. Anyway, the noisy patterns I used for the grass is actually compressed data the game uses for setting up the title screen. Who knew it could make for some nice dithering? Animating that section of the TAS was also a fun puzzle to work out, as I needed to get a good solution for the TSP with that arrangement of points. I intentionally kept the 2nd best route I found so when Toad says "Your route was suboptimal!" that is in fact true. For the 6502 savvy, you should know that I cannot use the NMI to wait for the next frame, as SMB1's NMI routine would run for thousands of CPU cycles before I could exploit an indirect jump back to RAM (wasting most of V-Blank). In order to wait for a new frame while maximizing CPU cycles, I'm running a loop that reads from address $2002, which is a PPU Register that can yield false negatives. To work around the false negatives, I wrote a function designed to waste exactly 1 CPU cycle when needed, which can prevent the race condition. If there is anything else that needs to be explained, I will attempt to answer in the comments. Anyway, here's a link to the TAS File: https://tasvideos.org/UserFiles/Info/638398423526853571 This TAS was made for Bizhawk 2.9.1 using the Subneshawk core.

Upgrade Your Everyday

AI-recommended products based on this video

Loading...
Kasa Smart Outdoor Smart Plug by TP-Link (KP400) - Smart WiFi Outlet with 2 Sockets, IP64 Waterproof, Works with Alexa and Google Home, 2.4GHz WiFi Required, No Hub Required, Sunset & Sunrise Offset

Kasa Smart Outdoor Smart Plug by TP-Link (KP400) - Smart WiFi Outlet with 2 Sockets, IP64 Waterproof, Works with Alexa and Google Home, 2.4GHz WiFi Required, No Hub Required, Sunset & Sunrise Offset

(28,846)
$21.99$17.99
FREE delivery Wed, Aug 20 on your first order
1K+ bought in past month
Loading...
Monster Wireless Earbuds, Bluetooth 5.4 in Ear Stereo Headphones, Built-in Mic for Crystal Clear Call, 32H Playtime, Comfortable Fit, Fast Charging, Waterproof Earphones for Sports, Black

Monster Wireless Earbuds, Bluetooth 5.4 in Ear Stereo Headphones, Built-in Mic for Crystal Clear Call, 32H Playtime, Comfortable Fit, Fast Charging, Waterproof Earphones for Sports, Black

(47)
$119.59
FREE delivery Mon, Mar 9
Loading...
Wireless Earbuds, Sports Bluetooth Headphones, 80Hrs Playtime Ear Buds with LED Power Display, Noise Canceling Headset, IPX7 Waterproof Earphones for Workout/Running Z(Black)

Wireless Earbuds, Sports Bluetooth Headphones, 80Hrs Playtime Ear Buds with LED Power Display, Noise Canceling Headset, IPX7 Waterproof Earphones for Workout/Running Z(Black)

(337)
$39.99
Prime
2K+ bought in past month
Loading...
Monster N-Lite 217 Wireless Earbuds, Immersive Stereo Sound, Bluetooth 6.0 in-Ear Headphones, Built-in Smart Noise Cancelling Mic for Clear Calls, Comfortable Fit, 32H Playtime, IPX6 Waterproof, Black

Monster N-Lite 217 Wireless Earbuds, Immersive Stereo Sound, Bluetooth 6.0 in-Ear Headphones, Built-in Smart Noise Cancelling Mic for Clear Calls, Comfortable Fit, 32H Playtime, IPX6 Waterproof, Black

(8)
$39.99
FREE delivery Mon, Feb 23
Loading...
Wireless Earbuds, Bluetooth 5.4 Headphones with 50H Playback, Deep Bass Stereo Ear Buds Clear Calls with LED Power Display, Wireless Headphones with Noise Cancelling Mic for Phone/Laptop, Carbon black

Wireless Earbuds, Bluetooth 5.4 Headphones with 50H Playback, Deep Bass Stereo Ear Buds Clear Calls with LED Power Display, Wireless Headphones with Noise Cancelling Mic for Phone/Laptop, Carbon black

(3,275)
$27.99
FREE delivery Fri, Feb 27 on your first order
Loading...
Brita Stainless Steel Premium Filtering Water Bottle, BPA-Free, Reusable, Insulated, Replaces 300 Plastic Water Bottles, Filter Lasts 2 Months or 40 Gallons, Includes 1 Filter, Carbon - 20 oz.

Brita Stainless Steel Premium Filtering Water Bottle, BPA-Free, Reusable, Insulated, Replaces 300 Plastic Water Bottles, Filter Lasts 2 Months or 40 Gallons, Includes 1 Filter, Carbon - 20 oz.

(2,652)
$81.37$76.36
FREE delivery Sep 29 - Oct 2
Loading...
Simple Modern Filtered Water Bottle | Insulated Stainless-Steel Carbon Filter Travel Water Bottles | Reusable for Clean Drinking Water On The Go | 24oz, Sea Glass Sage

Simple Modern Filtered Water Bottle | Insulated Stainless-Steel Carbon Filter Travel Water Bottles | Reusable for Clean Drinking Water On The Go | 24oz, Sea Glass Sage

(26)
$30.13
FREE delivery Tue, Sep 23 on your first order
Loading...
FITVII Health & Fitness Tracker (Answer/Make Calls), Smart Watch with 24/7 Heart Rate and Blood Pressure, Sleep Tracking Monitor, 120+ Sport Mode Activity Tracker

FITVII Health & Fitness Tracker (Answer/Make Calls), Smart Watch with 24/7 Heart Rate and Blood Pressure, Sleep Tracking Monitor, 120+ Sport Mode Activity Tracker

(198)
$59.99
FREE delivery Sun, Aug 10
100+ bought in past month
Loading...
AYATAHA AYATAHA Smart Watch for Kids, Smartwatch Fitness Tracker for Boys Girls, Children's Activity Watch 37 Sports Modes SMS Notification, HD Full Touchscreen IP67 Waterproof, Blue

AYATAHA AYATAHA Smart Watch for Kids, Smartwatch Fitness Tracker for Boys Girls, Children's Activity Watch 37 Sports Modes SMS Notification, HD Full Touchscreen IP67 Waterproof, Blue

(55)
$41.99
PrimeFREE delivery Sat, Jun 14
Loading...
Iaret Iaret Smart Watch for Women, 1.83" HD Fitness Tracker with 4 Bands, Answer/Make Calls, Heart Rate/Sleep/SpO2/Step Tracking, 100+ Sport Modes, Android/iPhone Compatible Gift (Rose Gold)

Iaret Iaret Smart Watch for Women, 1.83" HD Fitness Tracker with 4 Bands, Answer/Make Calls, Heart Rate/Sleep/SpO2/Step Tracking, 100+ Sport Modes, Android/iPhone Compatible Gift (Rose Gold)

(42)
$59.99
FREE delivery Thu, Jun 19
100+ bought in past month
Loading...
Smart Watch for Men Women 1.8" Fitness Tracker, Bluetooth Call, DIY Dial, Heart Rate Sleep Blood Oxygen Monitor, 100+ Sports Modes, IP68 Waterproof Smartwatch for Android iPhone, Alexa Built-in

Smart Watch for Men Women 1.8" Fitness Tracker, Bluetooth Call, DIY Dial, Heart Rate Sleep Blood Oxygen Monitor, 100+ Sports Modes, IP68 Waterproof Smartwatch for Android iPhone, Alexa Built-in

(980)
$39.99
FREE delivery Sun, Sep 21
300+ bought in past month
Loading...
Hand Warmers 2 Pack, 14000mAh Rechargeable Hand Warmers, Electric Hand Warmer Reusable, Portable Power Bank USB Hand Warmers 4 Levels 8 Heating, Gifts for Raynauds Ski Golf Camping

Hand Warmers 2 Pack, 14000mAh Rechargeable Hand Warmers, Electric Hand Warmer Reusable, Portable Power Bank USB Hand Warmers 4 Levels 8 Heating, Gifts for Raynauds Ski Golf Camping

(683)
$74.08$59.47
FREE delivery Jun 13 - 18
Loading...
Hand Warmers Rechargeable, 10000mAh Electric Heated Gloves Power Bank Portable Graphene Handwarmers Pouch with 3 Levels & Double-Sided Heating for Hunting Camping Golf Xmas Gifts for Women Men Kids

Hand Warmers Rechargeable, 10000mAh Electric Heated Gloves Power Bank Portable Graphene Handwarmers Pouch with 3 Levels & Double-Sided Heating for Hunting Camping Golf Xmas Gifts for Women Men Kids

(651)
$44.99
PrimeFREE delivery Sun, Jun 15
Loading...
2Pack Rechargeable Hand Warmer, 8000mAh Electric Hand Warmer Power Bank, Portable USB-C Hand Warmer for Pocket, Reusable Hand Warmer Up to 8 hrs Each, Warm Gift for Men Women, for Hunting, Camping
Amazon's Choice

2Pack Rechargeable Hand Warmer, 8000mAh Electric Hand Warmer Power Bank, Portable USB-C Hand Warmer for Pocket, Reusable Hand Warmer Up to 8 hrs Each, Warm Gift for Men Women, for Hunting, Camping

(1,128)
$15.99
FREE delivery Sat, Jun 14 on your first order
Loading...
GTOCE Portable Charger,40000mAh Power Bank with 22.5W Fast Charging LED Digital Display Battery Pack with 6 Outputs 2 Inputs, Type C Powerbank Portable Charger for iPhone 16 pro Samsung AirPods,Black

GTOCE Portable Charger,40000mAh Power Bank with 22.5W Fast Charging LED Digital Display Battery Pack with 6 Outputs 2 Inputs, Type C Powerbank Portable Charger for iPhone 16 pro Samsung AirPods,Black

(334)
$42.99
FREE delivery Thu, Oct 16
1K+ bought in past month
Loading...
Monster Sleep Ear100 Ear Buds, Sleep Earbuds with Stereo Sound, Design for Side Sleeper, 32H Playtime, Bluetooth 6.0, ENC Noise Cancelling, IPX6 Waterproof Mini Headphones, White

Monster Sleep Ear100 Ear Buds, Sleep Earbuds with Stereo Sound, Design for Side Sleeper, 32H Playtime, Bluetooth 6.0, ENC Noise Cancelling, IPX6 Waterproof Mini Headphones, White

(4)
$39.99
FREE delivery Mon, Mar 2
Loading...
Monster Sleep Ear100 Ear Buds, Sleep Earbuds with Stereo Sound, Design for Side Sleeper, 32H Playtime, Bluetooth 6.0, ENC Noise Cancelling, IPX6 Waterproof Mini Headphones, Black

Monster Sleep Ear100 Ear Buds, Sleep Earbuds with Stereo Sound, Design for Side Sleeper, 32H Playtime, Bluetooth 6.0, ENC Noise Cancelling, IPX6 Waterproof Mini Headphones, Black

(15)
$39.99
FREE delivery Mon, Feb 23
Loading...
Monster Sleep Ear100 Ear Buds, Sleep Earbuds with Stereo Sound, Design for Side Sleeper, 32H Playtime, Bluetooth 6.0, ENC Noise Cancelling, IPX6 Waterproof Mini Headphones, Black

Monster Sleep Ear100 Ear Buds, Sleep Earbuds with Stereo Sound, Design for Side Sleeper, 32H Playtime, Bluetooth 6.0, ENC Noise Cancelling, IPX6 Waterproof Mini Headphones, Black

(6)
$39.99
FREE delivery Sat, Dec 27
Loading...
Hydroponics Growing System Indoor Garden - Herb Garden with Grow Light, 15 Pods Stainless Steel Indoor Garden Kit, Auto Timer, Gardening Gift for All Ages

Hydroponics Growing System Indoor Garden - Herb Garden with Grow Light, 15 Pods Stainless Steel Indoor Garden Kit, Auto Timer, Gardening Gift for All Ages

(24)
$206.57$200.61
FREE delivery Jun 13 - 17
Loading...
Umbra Triflora Hanging Planter for Window, Indoor Herb Garden, Set of 5, White/Black

Umbra Triflora Hanging Planter for Window, Indoor Herb Garden, Set of 5, White/Black

(7,808)
$71.52
PrimeFREE delivery Sat, Jun 14
Loading...
Large Hydroponics Growing System 14 Pods, Indoor Herb Garden with LED Grow Light, 5L Water Tank, Hydroponic Grow Kit with 3 Auto-Timers, Rotatable Light Panel and Child Lock for Home School Gardening

Large Hydroponics Growing System 14 Pods, Indoor Herb Garden with LED Grow Light, 5L Water Tank, Hydroponic Grow Kit with 3 Auto-Timers, Rotatable Light Panel and Child Lock for Home School Gardening

(119)
$167.81
FREE delivery Jun 16 - 20
Loading...
Hanging Planter Hanging Plant Holder, 6 Inch 4 Indoor Plant Pots, Wall/Window Plant Hanger Indoor Herb Garden

Hanging Planter Hanging Plant Holder, 6 Inch 4 Indoor Plant Pots, Wall/Window Plant Hanger Indoor Herb Garden

(269)
$35.99$28.90
PrimeFREE delivery Sat, Jun 14
Loading...
slopehill Multi Hair Stylers & Hair Straightener - 2 in 1 Wet to Dry Air Straightener and Hair Dryer Combo with High Speed Air + Rapid Heat-Up + Customizable Temperature(Pink)

slopehill Multi Hair Stylers & Hair Straightener - 2 in 1 Wet to Dry Air Straightener and Hair Dryer Combo with High Speed Air + Rapid Heat-Up + Customizable Temperature(Pink)

(177)
$139.99
Prime
Loading...
Hi.FANCY Portable Laptop Stand with Dual Cooling Fans for 14-17inch Laptops, Grey, 23.5 x 25.9 x 0.95cm

Hi.FANCY Portable Laptop Stand with Dual Cooling Fans for 14-17inch Laptops, Grey, 23.5 x 25.9 x 0.95cm

(0)
$36.99
FREE delivery Aug 18 - 28
Loading...
Laptop Stand for Desk, Adjustable Laptop Riser ABS+Silicone Foldable Portable Laptop Holder, Ventilated Cooling Notebook Stand for 10-15.6” Laptops,Tablet-Black

Laptop Stand for Desk, Adjustable Laptop Riser ABS+Silicone Foldable Portable Laptop Holder, Ventilated Cooling Notebook Stand for 10-15.6” Laptops,Tablet-Black

(11,679)
$14.99
FREE delivery Sat, Jun 14 on your first order
500+ bought in past month
Loading...
JETech 5 in 1 Case for Samsung Galaxy S25 Ultra 5G with 2-Pack Each Tempered Glass Screen Protector and Camera Lens Protector, Non-Yellowing Shockproof Bumper Phone Cover (Clear)

JETech 5 in 1 Case for Samsung Galaxy S25 Ultra 5G with 2-Pack Each Tempered Glass Screen Protector and Camera Lens Protector, Non-Yellowing Shockproof Bumper Phone Cover (Clear)

(197)
$15.99
FREE delivery Sat, Jun 14 on your first order
100+ bought in past month
Loading...
TAURI for iPhone 17 Pro Max Case 6.9" with 1-Pack Screen Protector, Camera Lens Full Protection, Military-Grade Protection, Shockproof Transparent Back Bumper Phone Cover - Clear Global Recycled Standard

TAURI for iPhone 17 Pro Max Case 6.9" with 1-Pack Screen Protector, Camera Lens Full Protection, Military-Grade Protection, Shockproof Transparent Back Bumper Phone Cover - Clear Global Recycled Standard

(0)
$10.76
FREE delivery Thu, Oct 16 on your first order
2K+ bought in past month
Loading...
TAURI for iPhone 17 Pro Case 6.3" with 1-Pack Screen Protector, Camera Lens Full Protection, Military-Grade Protection, Shockproof Transparent Back Bumper Phone Cover - Clear Global Recycled Standard
Best Seller

TAURI for iPhone 17 Pro Case 6.3" with 1-Pack Screen Protector, Camera Lens Full Protection, Military-Grade Protection, Shockproof Transparent Back Bumper Phone Cover - Clear Global Recycled Standard

(61,696)
$10.76
Prime
2K+ bought in past month
Loading...
JOINPAYA 1Set Rechargeable Hand Warmer Hand Heater for Winter Heating Levels Compact

JOINPAYA 1Set Rechargeable Hand Warmer Hand Heater for Winter Heating Levels Compact

(0)
$9.29
FREE delivery Jun 20 - Jul 4
Loading...
Shakven Rechargeable Hand Warmer | Cute Comfortable Portable Hand Warmers,Ergonomic Adjustable Energy-Efficient Small Heater for Travel, Outdoor, Winter

Shakven Rechargeable Hand Warmer | Cute Comfortable Portable Hand Warmers,Ergonomic Adjustable Energy-Efficient Small Heater for Travel, Outdoor, Winter

(0)
$26.93
FREE delivery Jun 19 - Jul 2
Loading...
OCOOPA IP45 Waterproof Hand Warmer Rechargeable, Up to 15hrs Heat,10000mAh Durable Quick Charge Electric Hand Heater, PD Compatible, 3 Levels for Outdoors, Heavy Duty, H01-PD PRO

OCOOPA IP45 Waterproof Hand Warmer Rechargeable, Up to 15hrs Heat,10000mAh Durable Quick Charge Electric Hand Heater, PD Compatible, 3 Levels for Outdoors, Heavy Duty, H01-PD PRO

(50)
$39.99
PrimeFREE delivery Sat, Jun 14
Loading...
OCOOPA IP45 Waterproof Hand Warmer Rechargeable, Up to 15hrs Heat,10000mAh Durable Quick Charge Electric Hand Heater, PD Compatible, 3 Levels for Outdoors, Heavy Duty, H01-PD PRO

OCOOPA IP45 Waterproof Hand Warmer Rechargeable, Up to 15hrs Heat,10000mAh Durable Quick Charge Electric Hand Heater, PD Compatible, 3 Levels for Outdoors, Heavy Duty, H01-PD PRO

(649)
$39.99
PrimeFREE delivery Sat, Jun 14