From 4cca5277a118b6e1d2da40ee678849530ed4baf4 Mon Sep 17 00:00:00 2001 From: jeffman Date: Sun, 29 Sep 2019 12:43:08 -0400 Subject: [PATCH] Clamp text X values --- src/m2-hack.asm | 3 +++ src/m2-title.asm | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/m2-hack.asm b/src/m2-hack.asm index e78924f..8231bb4 100644 --- a/src/m2-hack.asm +++ b/src/m2-hack.asm @@ -1595,6 +1595,9 @@ nop .org 0x80117D4 :: dw title_sequence_0D .org 0x80117D8 :: dw title_sequence_0D + // Clamp initial X values for text + .org 0x80116F0 :: bl title_setup_clamp + // Commit hacks: // Commit all things on every sequence diff --git a/src/m2-title.asm b/src/m2-title.asm index 91c5811..9393c68 100644 --- a/src/m2-title.asm +++ b/src/m2-title.asm @@ -11,6 +11,24 @@ pop {r1} ldr r0,=0x80113F4 mov pc,r0 // Run the existing routine +//--------------------------------------------------------- +title_setup_clamp: +mov r1,250 +cmp r0,r1 +bgt @@clamp +neg r1,r1 +cmp r0,r1 +blt @@clamp +b @@clamp_end + +@@clamp: +mov r0,r1 + +@@clamp_end: +str r0,[r5,4] +mov r1,r8 // clobbered code +bx lr + //--------------------------------------------------------- // r3 has 2028008 // [r3+14] has 2028028