Editroid 3.5

Update: Version 3.6 is available, which fixes bugs found in version 3.5.

Time to release a new version of my Metroid editor. This version allows you to add ASM to each screen that will run when the screen loads. It includes a built-in assembler so you can do everything right in Editroid. This makes it easy to do things like bankswap graphics for different areas of a level or change music for different areas, or to load additional objects into the screen based on a condition, or change the lava height in different screens so it doesn’t have to be right at the bottom in every screen. So yeah… all sorts of stuff.
Editroid Screenshot
This is an alpha version, meaning everything is implemented and works, but hasn’t been tested and debugged too thoroughly, but I’ve been using it without any problems.

Before you start adding ASM, the ROM needs to be expanded (under the file menu), and then you can click “Create Project” in the project menu. Then, everything ASM-related can be found in the project menu.

http://snarfblam.com/files/Editroid%203.5a.zip
Check out the RHDN Editroid page for the most recent version.

 

Code Samples

Here are some examples of code you can add to a screen to do nifty things.

; Background graphics bank swap

lda #$09 ; Bank 9
sta $7801 ; (First bank in animation)
sta $7802 ; (Last bank in animation)
sta $7803 ; (Current bank)
rts
;Play Tourian theme (simple :)
jmp TourianMusic
;(You can insert a different song in its place to allow two songs in an area)
; Draw an object on the screen if the player has at least 1 full e-tank
; (Requires that the code below be added to the general code file!)

; Exit if player doesn't have any full tanks
lda HealthHi
and #$F0
bne +
    rts    
*

; Load ptr to data and draw it
ldx #<ObjectData
ldy #>ObjectData
jmp ExtraRoomData

ObjectData:
;    xy  type pal  end
.db $88, $08, $01, $FF
; This is required by the above example.
; This would be placed in the general code file.

; ----------------------------
;  ExtraRoomData
; ----------------------------
;  Draws additional objects to a screen. Call in screen-load
;  routine. This is a modified version of a similar routine in
;  the original game.
;     Parameters:
;     x - low byte of object data
;     y - high byte of object data

    ExtraRoomData:
                stx RoomPtr                             ; Store data address
                sty RoomPtr + 1
                ldy #$00                                ; Point to first byte
                lda (RoomPtr),Y                         ; Read it

    DrawExtraObject:
                sta $0E                         ;Store object position byte(%yyyyxxxx).
                lda CartRAMPtr                  ;
                sta CartRAMWorkPtr              ;Set the working pointer equal to the room pointer-->
                lda CartRAMPtr+1                ;(start at beginning of the room).
                sta CartRAMWorkPtr+1            ;
                lda $0E                         ;Reload object position byte.
                jsr Adiv16                      ;($C2BF)/16. Lower nibble contains object y position.-->
                tax                             ;Transfer it to X, prepare for loop.
                beq +++                         ;Skip y position calculation loop as y position=0 and-->
                                                ;does not need to be calculated.
         *      lda CartRAMWorkPtr              ;LoW byte of pointer working in room RAM.
                clc                             ;
                adc #$40                        ;Advance two rows in room RAM(one y unit).
                sta CartRAMWorkPtr              ;
                bcc +                           ;If carry occurred, increment high byte of pointer-->
                inc CartRAMWorkPtr+1            ;in room RAM.
         *      dex                             ;
                bne --                          ;Repeat until at desired y position(X=0).

         *      lda $0E                         ;Reload object position byte.
                and #$0F                        ;Remove y position upper nibble.
                asl                             ;Each x unit is 2 tiles.
                adc CartRAMWorkPtr              ;
                sta CartRAMWorkPtr              ;Add x position to room RAM work pointer.
                bcc +                           ;If carry occurred, increment high byte of room RAM work-->
                inc CartRAMWorkPtr+1            ;pointer, else branch to draw object.

    ;CartRAMWorkPtr now points to the object's starting location (upper left corner)
    ;on the room RAM which will eventually be loaded into a name table.

          *     iny                             ;Move to the next byte of room data which is-->
                lda (RoomPtr),y                 ;the index into the structure pointer table.
                tax                             ;Transfer structure pointer index into X.
                iny                             ;Move to the next byte of room data which is-->
                lda (RoomPtr),y                 ;the attrib table info for the structure.
                sta ObjectPal                   ;Save attribute table info.
                txa                             ;Restore structure pointer to A.
                asl                             ;*2. Structure pointers are two bytes in size.
                tay                             ;
                lda (StructPtrTable),y          ;Low byte of 16-bit structure ptr.
                sta StructPtr                   ;
                iny                             ;
                lda (StructPtrTable),y          ;High byte of 16-bit structure ptr.
                sta StructPtr+1                 ;
                jsr DrawStruct                  ;($EF8C)Draw one structure.

    ; Next Object
                lda #$03                        ;Move to next set of structure data.
                jsr AddToRoomPtr                ;($EAC0)Add A to room data pointer.
                ldy #$00                        ;Zero index.
                lda (RoomPtr),y                 ;Load byte of room data.-->
                cmp #$FF                        ;Is it #$FF(end-of-room)?-->
                beq +                           ;If so, branch to exit.
                jmp DrawExtraObject
              * rts
Leave a comment

1 Comments.

  1. Wow, you have done an amazing work with Editroid, I absolutely love it! Expanding the rom completely puts hacking NEStroid into a new realm.
    I checked out the rom data in TLP and noticed that the graphics was dublicated several times. Does this mean that it’s possible to draw additional graphics to these new graphic offsets?

Leave a Reply

Your email address will not be published. Required fields are marked *