Home

Find the Largest Number

Trying to find the yard with the most bones :)

Problem 2: Palindrome Check — "Is Bebe's Name a Palindrome?

Time to move from arrays of numbers to **strings**. This introduces `lodsb`/pointer-walking-from-both-ends, which is the core trick you'll reuse constantly (including later for board-row logic in Tetris).

ask:** Write 8086 assembly that:

Data to use — test with both of these (one at a time, or loop over both if you're feeling ambitious):** ```asm str1 db "level",0 str2 db "bebe",0 ``` **Expected sample output:** ``` level is a palindrome bebe is NOT a palindrome ``` **Approach hint (don't have to follow exactly):** - Find the string length first (walk forward with `SI` until you hit the `0` terminator, counting as you go) - Set up two pointers: one at the start (`SI`), one at the last real character (`DI` = start + length − 1) - Loop: compare `[SI]` to `[DI]`; if they ever differ, it's not a palindrome — stop early - Otherwise `INC SI`, `DEC DI`, and keep going until the pointers meet or cross - Print the original string first (you can just point DX at it directly and use `int 21h`/`09h` since it's already null-ready... actually DOS string print wants `$`-terminated, so you may need a small tweak — that's part of the puzzle) **New concepts this exercises:** - Two-pointer technique (walking from both ends toward the middle) - Early-exit loops (`jne` out of a loop, not just falling through) - Working with null-terminated vs `$`-terminated strings — and noticing DOS wants the latter