Main Menu

Glitches

References/Resources

Affiliates

Technical

Search Wiki

Toolbox

TheZZAZZGlitch's memory editor
 Page | Discussion | View source | History

From Glitch City Laboratories

Revision as of 11:06, 1 September 2018 by Torchickens (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
The memory editor in action

TheZZAZZGlitch's memory editor is an arbitrary code execution loaded memory editor for Pokémon Red and Blue, designed for use at memory address $DB01. It is similar to the older offgao's memory editor.

It was created by TheZZAZZGlitch, hence the name.

Differences from offgao's memory editor

  • The memory editor appears on the left side of the screen, rather than the right side of the screen.
  • Editing a memory address is done by holding A, and then pushing buttons while the cursor is highlighted. Offgao's requires holding Start instead.
  • Edits are buffered until the A-Button is released, allowing safe editing of sensitive regions such as when setting up OAM DMA hijacking.
  • Includes a 'subroutine execution' feature. Holding A down and pressing Select and Start will execute the given address as code.

Bytes (EN Red/Blue)

54 5d d5 21 f8 ff 19 54 5d f0 f8 a7 20 fb 21 a0 c3 36 7c 23 7a cd a9 db 7b cd a9 db 36 e3 23 1a cd a9 db 36 7c 01 0c 00 09 13 7d fe 08 20 e2 21 45 c4 36 ed d1 76 f0 f8 47 cb 58 28 04 7a c6 10 57 cb 50 28 01 14 cb 48 c0 cb 40 20 24 cb 70 28 01 1b cb 78 28 01 13 cb 68 28 06 21 f0 ff 19 54 5d cb 60 28 06 21 10 00 19 54 5d 18 95 79 12 18 fa 36 ec 1a 4f 76 f0 f8 a7 28 f2 47 cb 70 28 04 79 c6 10 4f cb 78 28 04 79 d6 10 4f cb 68 28 01 0d cb 60 28 01 0c 2e 46 79 cd a9 db f0 f8 fe 0d 28 19 e6 fe 20 f6 18 cd 47 cb 37 e6 0f cd b2 db 78 e6 0f c6 f6 30 02 c6 60 22 c9 21 c9 db 73 23 72 cd 94 3e fa 4e cc c3

Code (EN Red/Blue, for learning)

_start:

   ld d,h
   ld e,l

writeagain:

   push de
   ld hl,$fff8
   add hl,de
   ld d,h
   ld e,l

.testkeys

   ldh a,[$fff8]
   and a
   jr nz,.testkeys
   ld hl,$c3a0

write:

   ld [hl],$7c
   inc hl
   ld a,d
   call writehex
   ld a,e
   call writehex
   ld [hl],$e3
   inc hl
   ld a,[de]
   call writehex
   ld [hl],$7c
   ld bc,12
   add hl,bc
   inc de
   ld a,l
   cp 8
   jr nz,write

waiting:

   ld hl,$c445
   ld [hl],$ed
   pop de

.testbuttons

   db $76 ; halt
   ldh a,[$fff8]
   ld b,a
   bit 3,b
   jr z,.nostartbtn
   ld a,d
   add $10
   ld d,a

.nostartbtn

   bit 2,b
   jr z,.noselectbtn
   inc d

.noselectbtn

   bit 1,b
   ret nz
   bit 0,b
   jr nz,bytechangeloop
   bit 6,b
   jr z,.noupbtn
   dec de

.noupbtn

   bit 7,b
   jr z,.nodownbtn
   inc de

.nodownbtn

   bit 5,b
   jr z,.noleftbtn
   ld hl,$fff0
   add hl,de
   ld d,h
   ld e,l

.noleftbtn

   bit 4,b
   jr z,.norightbtn
   ld hl,$0010
   add hl,de
   ld d,h
   ld e,l

.norightbtn writeagainbounce:

   jr writeagain
  

storeandwriteagain:

   ld a,c
   ld [de],a
   jr writeagainbounce
  

bytechangeloop:

   ld [hl],$ec
   ld a,[de]
   ld c,a

bytechangeloopentry:

   db $76 ; halt
   ldh a,[$fff8]
   and a
   jr z,storeandwriteagain
   ld b,a
   bit 6,b
   jr z,.noupbtn
   ld a,c
   add $10
   ld c,a

.noupbtn

   bit 7,b
   jr z,.nodownbtn
   ld a,c
   sub $10
   ld c,a

.nodownbtn

   bit 5,b
   jr z,.noleftbtn
   dec c

.noleftbtn

   bit 4,b
   jr z,.norightbtn
   inc c

.norightbtn

   ld l,$46
   ld a,c
   call writehex

.waitbuttonsc

   ldh a,[$fff8]
   cp $0d
   jr z,specialexec
   and $fe
   jr nz,.waitbuttonsc
   jr bytechangeloopentry

writehex:

   ld b,a
   swap a
   and $0f
   call writehexdigit
   ld a,b
   ; fall through to writehexdigit

writehexdigit:

   and $0f
   add $f6
   jr nc,.noadd
   add $60

.noadd

   ld [hli],a

.retinstr

   ret

specialexec:

   ld hl,.executive
   ld [hl],e
   inc hl
   ld [hl],d
   call $3e94 ; GetPredefRegisters
   ld a,[$cc4e]
   db $c3 ; jp

.executive

   ; subroutine address goes here

YouTube video

YouTube video by TheZZAZZGlitch