News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

[SM] Tourian Gate System Assistance

Started by Mentlegen, January 15, 2018, 05:46:05 PM

Previous topic - Next topic

Mentlegen

i am willing to barter/ trade original music or remixed music That I write for assistance constructing a tourian gate system

I already have the bulk of the code:


Below given by Vener

C836 = 02:46E0 | 02:3CAF (Switches)(Vanilla)

[High] = 00
[Low] Type of gate.   
     00 = blue left
     02 = blue right
     04 = pink left
     06 = pink right
     08 = green left
     0A = green right
     0C = yellow left
     0E = yellow right


Main (Vanilla) 02:46E0 :

  BE C7 1D   LDX,y    PLM Room argument (value in 'Low' is used to skip bytes# in the next pointers line)
  BD 0A C7 > LDA,x    AF BC B5 BC BB BC C1 BC C7 BC CD BC D3 BC D9 BC ***
  99 27 1D   STA,y    Next PLM instruction
  BE C7 1D   LDX,y    PLM Room argument
  BD 1A C7 > LDA,x    46 C0 00 00 48 C0 00 00 4A C0 00 00 4C C0 00 00  Set BTS# for the 2 PLM blocks
  F0 08      BEQ *
  BE 87 1C   LDX,y    PLM's location in the room (nth block * 2)
  CA CA      DEX x2
  20 B4 82   JSR      82B4 : X must contain a block location in ram, and A has new status for it. High byte becomes the new block-prop (second nybble should be 0), and low byte becomes the new bts value.)
* BE C7 1D   LDX,y    PLM Room argument
  BD 2A C7 > LDA,x    00 00 47 C0 00 00 49 C0 00 00 4B C0 00 00 4D C0  Set BTS# for the 2 PLM blocks
  F0 08      BEQ **
  BE 87 1C   LDX,y    PLM's location in the room (nth block * 2)
  E8 E8      INX x2
  20 B4 82   JSR      82B4 : X must contain a block location in ram, and A has new status for it. High byte becomes the new block-prop (second nybble should be 0), and low byte becomes the new bts value.)
**60         RTS

then a load of shits until 02:4739 ...


Main (Redesign) 02:46E0 :

  B9 C7 1D   LDA,y   PLM Room argument
  29 0E 00   AND#    [Low] Type of gate from #00 to #0E , i guess it is
  AA         TAX
  BD 0A C7   LDA,x   Draw PLM blocks
  99 27 1D   STA,y   Next PLM instruction
  BD 1A C7   LDA,x   Set BTS# for the 2 PLM blocks
  F0 07      BEQ *
  BE 87 1C   LDX,y   PLM's location in the room (nth block * 2)
  CA CA      DEX x2
  80 08      BRA **
* BD 2A C7   LDA,x   Set BTS# for the 2 PLM blocks
  BE 87 1C   LDX,y   PLM's location in the room (nth block * 2)
  E8 E8      INX x2
**20 B4 82   JSR     >same as vanilla
  4C 70 F4   JMP     $F470
  B4 82      -ReWrited instructions-
  60         -ReWrited instructions-



02:7470 :

  B9 C7 1D     LDA,y  PLM Room argument
  29 00 7F     AND#   Probably the [High] byte in smile (used for the opened door bit array) 
  F0 23        BEQ *
  EB           XBA
  09 00 01     ORA#
  22 8E 81 80  JSL    Change nth bit to address offset and mask
  BF B0 D8 7E  LDA,x  Opened door bit array. D0-EF are never used
  2D E7 05     AND$   Often used to check bits for completed tasks/picked up items
  F0 12        BEQ *
  B9 C7 1D     LDA,y  PLM Room argument
  29 01 00     AND#
  D0 05        BNE **
  A9 26 C8     LDA#  <OPENING SHUTTER
  80 15        BRA @

**A9 2E C8     LDA#  <UPSIDE DOWN OPENING SHUTTER(unused)
  80 10        BRA @
* B9 C7 1D     LDA,y  PLM Room argument
  29 01 00     AND#
  D0 05        BNE @@
  A9 2A C8     LDA#  <CLOSING SHUTTER
  80 03        BRA @

@@A9 32 C8     LDA#  <UPSIDE DOWN CLOSING SHUTTER(unused) < This could be removed at all
@ 48           PHA
  B9 C7 1D     LDA,y  PLM Room argument
  30 13        BMI +
  B9 87 1C     LDA,y  PLM's location in the room (nth block * 2)
--4A           LSR a
  8D C4 0D     STA    Current block index (nth block of the room)
  68           PLA
  22 E7 84 84  JSL  >like vanilla
  AD 27 1C     LDA
  99 17 1E     STA,y
  60           RTS

+ 29 F0 00     AND#
  A2 50 00     LDX#
- 48           PHA
  A9 E0 F4     LDA#  <REMOTE INTERRUPTOR
++CA           DEX
  CA           DEX
  DD 37 1C     CMP,x
  D0 F9        BNE ++
  68           PLA
  DD C7 1D     CMP,x  PLM Room argument
  D0 EF        BNE -
  BD 87 1C     LDA,x
  80 D4        BRA --

code end at 02:74DF

Pre (Vanilla) 02:3CAF :

***

Blue switch left    01 00 D7 A5 BC 86 > Draw: 01 00 D6 80 FF 00 01 00 DB C0 00 00
Blue switch right   01 00 E3 A5 BC 86 > Draw: 02 00 D6 80 DB C4 00 00
Pink switch left    01 00 EB A5 BC 86 > Draw: 01 00 D6 80 FF 00 01 00 DA C0 00 00
Pink switch right   01 00 F7 A5 BC 86 > Draw: 02 00 D6 80 DA C4 00 00
Green switch left   01 00 FF A5 BC 86 > Draw: 01 00 D6 80 FF 00 01 00 D9 C0 00 00
Green switch right  01 00 0B A6 BC 86 > Draw: 02 00 D6 80 D9 C4 00 00
Yellow switch left  01 00 13 A6 BC 86 > Draw: 01 00 D6 80 FF 00 01 00 D8 C0 00 00 > This last is sensed to be the yellow ones but they used the grey switch tile instead '-' (i should fix this...)
Yellow switch right 01 00 1F A6 BC 86 > Draw: 02 00 D6 80 D8 C4 00 00


Pre (Redesign) 02:3CAF :
             
                     //    //   B4 86 > 88 88 98 9D 27 1D 68 60
                     //    //   B4 86
                     //    //   B4 86
                     //    //   B4 86
                     //    //   B4 86
                     //    //   B4 86
                     //    //   B4 86
                     //    //   B4 86



No returning gates (old F4E0):E4 F4|E3 AA (SHUTTERS)

Main 02:74E4 :

  BB           TYX
  A9 02 00     LDA #$0002
  9F 1C DE 7E  STA $7E:DE1C   (PLM frame delay)
  60           RTS

  BD 17 1E     LDA,X $1E I7   (Variable use PLM value)
  DA           PHX
  AA          TAX                                                       
  BD 77 1D     LDA,X $1D 77   (Variable use PLM value)     
  F0 02 *      BEQ                      
  FA           PLX                                                             
  60           RTS                                                             

* FE 77 1D     INC,X $1D 77   (Variable use PLM value)
  FA           PLX
  BD C7 1D     LDA,X $1D C7   (PLM Room argument)
  29 00 7F     AND
  F0 13        BEQ **
  EB           XBA
  09 00 01     ORA #0100 
  22 8E 81 80  JSL Change nth bit to address offset and mask  
  BF B0 D8 7E  LDA,X $7E:D8B0 (opened door bit array)
  4D E7 05     EOR $05 E7     (Often used to check bits for completed tasks/picked up items)
  9F B0 D8 7E  STA,X $7E:D8B0 (opened door bit array)
**60           RTS



Pre PLM:                                                                                     (space available from 1847 to 1876)

BC 86          Deletes the PLM header, then exits the instruction loop (PLA, RTS). Used to delete PLMs
that's all ?


4E 87 06       Set 7E:1D77,X to the argument (only 1 byte).
04 00 A3 92 > 04 00 53 00 53 00 53 00 53 00 00 00
04 00 AF 92 > 04 00 54 00 54 00 54 00 54 00 00 00
04 00 BB 92 > 04 00 55 00 55 00 55 00 55 00 00 00
04 00 97 92 > 04 00 FF 00 FF 00 FF 00 FF 00 00 00
00 AB          < identic to vanilla
3F 87          Decrement 7E:1D77,X. If not 0, use the address given by the argument as the next instruction.
E8 AA          < identic to vanilla




actual Gate part ( generously given to me by SMILEuser96 )
lorom

org $84EFE0

GatePLM:
DW Init : DW Main

Init:
  LDA $0DC4 : PHA
  LDA $1C87,y : LSR : STA $0DC4
  LDA $1DC7,y  ;Room argument
  JSL $80818E  ;$05E7 = A % 8, x = A / 8
  LDA $7ED8B0,x : AND $05E7 : BNE SpawnOpenGate  ;Branches if the bit was set

SpawnClosedGate:
  LDA #$C82A : JSL $8484E7  ;Spawns a closed gate over this PLM
  BRA End


SpawnOpenGate:
  LDA #$C826 : JSL $8484E7  ;Spawns an open gate over this PLM

End:
  PLA : STA $0DC4
  RTS


Main:
  DW $86BC  ;Delete


Dissasembly given by PHOSPHOTiDYL
;==============================================================================================================================;
;------------------------------------------------------------------------------------------------------------------------------;
;//PLM $C826 [$C6D8/$BC13](normal opened gate)
;//[$C6D8 = JSR $C66A : RTS][$C66A gets plm location in room & does something involving room bts tilemap (maybe animates it?)]
;//[$BC13]
dw $0001 ;//
dw $A517 ;//draw [05 80 D6 C0 FF 00 FF 00 FF 00 FF 00 00 00]
dw $BBDD ;//clear check inst
dw $86C1 ;//set pre inst code
dw $BB52 ;//activate when shot
dw $86B4 ;//wait inst
dw $0010 ;//might be how long to wait
dw $A517 ;//draw inst
dw $BBE1 ;//spawn as room object inst
dw $E64B ;//???
dw $8C19 ;//play sound library 03
dw $100E ;//sound to play
dw $A525 ;//draw [05 80 D7 C0 FF C0 FF 00 FF 00 FF 00 00 00]
dw $0010 ;//
dw $A533 ;//draw [05 80 D7 C0 FF C0 FF C0 FF 00 FF 00 00 00]
dw $0010 ;//
dw $A541 ;//draw [05 80 D7 C0 FF C0 FF C0 FF C0 FF 00 00 00]
dw $0018 ;//
dw $A54F ;//draw [05 80 D7 C0 FF C0 FF C0 FF C0 FF C0 00 00]
;//PLM $C82A [$C6BE/$BC3A](normal closed gate)
;//[$C6BE = PHY : LDY #$E659 : JSL $868097 : PLY : JSR $C66A : RTS][spawn enemy/room projectile then animate it??]
;//[$BC3A]
dw $0001 ;//
dw $A55D ;//draw [05 80 D6 C0 FF C0 FF C0 FF C0 FF C0 00 00]
dw $BBDD ;//clear check inst
dw $86C1 ;//set pre inst code
dw $BB6B ;//activate if below plm or shot
dw $86B4 ;//wait inst
dw $BBF0 ;//find room objuct that has plm position & activate, else crash
dw $E566 ;//???
dw $8C19 ;//play sound library 03
dw $100E ;//sound to play
db $00 ;//???
dw $A54F ;//draw [05 80 D7 C0 FF C0 FF C0 FF C0 FF C0 00 00]
dw $0010 ;//
dw $A541 ;//draw [05 80 D7 C0 FF C0 FF C0 FF C0 FF 00 00 00]
dw $0010 ;//
dw $A533 ;//draw [05 80 D7 C0 FF C0 FF C0 FF 00 FF 00 00 00]
dw $0018 ;//
dw $A525 ;//draw [05 80 D7 C0 FF C0 FF 00 FF 00 FF 00 00 00]
dw $8724 ;//goto inst
dw $BC13 ;//see above
;//PLM $C82E [$C6DC/$BC61](upwards opened gate) ;//[NOT USED]
;//PLM $C832 [$C6CB/$BC88](upwards closed gate) ;//[NOT USED]
;//PLM $C836 [$C6E0/$BCAF](normal gate shotblock)
;//[$C6E0 = see below]
;//[$BCAF]
dw $0001 ;//
dw $A5D7 ;//draw [01 00 D6 80 FF 00 01 00 DB C0 00 00]
dw $86BC ;//delete plm inst
dw $0001 ;//
dw $A5E3 ;//draw [02 00 D6 80 DB C4 00 00]
dw $86BC ;//delete plm inst
dw $0001 ;//
dw $A5EB ;//draw [01 00 D6 80 FF 00 01 00 DA C0 00 00]
dw $86BC ;//delete plm inst
dw $0001 ;//
dw $A5F7 ;//draw [02 00 D6 80 DA C4 00 00]
dw $86BC ;//delete plm inst
dw $0001 ;//
dw $A5FF ;//draw [01 00 D6 80 FF 00 01 00 D9 C0 00 00]
dw $86BC ;//delete plm inst
dw $0001 ;//
dw $A60B ;//draw [02 00 D6 80 D9 C4 00 00]
dw $86BC ;//delete plm inst
dw $0001 ;//
dw $A613 ;//draw [01 00 D6 80 FF 00 01 00 D8 C0 00 00
dw $86BC ;//delete plm inst
dw $0001 ;//
dw $A61F ;//draw [02 00 D6 80 D8 C4 00 00]
dw $86BC ;//delete plm inst
;//PLM $C83A [$C73A/$BCDF](upside down gate shotblock) ;//[NOT USED]
;------------------------------------------------------------------------------------------------------------------------------;
ORG $84C6E0 ;//[get init inst for gate plm]
LDX $1DC7,y : LDA Gate_Init_Inst,x : STA $1D27,y ;//get plm inst for value of high byte, store to next plm inst
LDA $1DC7,y : LDA $C71A,x : BEQ $08 ;//get some value for value of high byte, branch if zero
LDX $1C87,y : DEX : DEX : JSR $82B4 ;//else get plm location in room & write block type
LDX $1DC7,y : LDA $C72A,x : BEQ $08 ;//get some value for value of high byte, branch if zero
LDX $1C87,y : INX : INX : JSR $82B4 ;//else get plm location in room & write block type
RTS

ORG $84C70A ;//[get inst based on high byte]
Gate_Init_Inst:
dw Blu_L,Blu_R,Red_L,Red_R,Grn_L,Grn_R,Ylw_L,Ylw_R
;//-----dw $BCAF,$BCB5,$BCBB,$BCC1,$BCC7,$BCCD,$BCD3,$BCD9
;//$C01A
dw $C046,$0000,$C048,$0000,$C04A,$0000,$C04C,$0000
;//$C02A
dw $0000,$C047,$0000,$C049,$0000,$C04B,$0000,$C04D
;------------------------------------------------------------------------------------------------------------------------------;
;==============================================================================================================================;



more by SMILEuser96
LDA !DoorIndex
  JSL $80818E  ;$05E7 = A % 8, x = A / 8
  LDA $7ED8B0,x : ORA $05E7 : STA $7ED8B0,x  ;Sets the door index defined by the LDA as opened


I am NOT in the slightest ASM knowledgeble, but i am willing to work out a deal with whomever would like to aid me.

Helpers/ contributers will get a mention in the credits of Super Metroid Radon

PHOSPHOTiDYL

023C13 to 00 stops the gates from closing until leaving the room.

PHOSPHOTiDYL

So you can just do this to get the same effect.
I mean, if anyone is aiming for an assist, I don't know what I'm doing either.

Hence the term "hacking."

ORG $84BC13
   dw $0001,$A517,$86BC   ;//[draw, delete]



PHOSPHOTiDYL

Hard @ work, here's a checkpoint b4 I f*** things up again.
I had it working w/door indexes earlier, just not in the same room, & it's gone.

This will open the gate, keep it open & lit, just not if you leave the room.
No asm code, custom plm, very important I learn this bank.

Also includes some left green door code for your hack notes...
Replacement for the C82A gate part, not the shot part, $F000 by default.

LoROM

;==============================================================================================================================;
;------------------------------------------------------------------------------------------------------------------------------;
;//[PLM $C872 (GREEN DOOR LEFT)][$C7B1,$C19C,$C185]

;//[$C7B1]
ORG $84C7B1 : LDX $1C87,y : LDA #$C044 : JSR $82B4 : RTS ;//[get plm location & write block type]

;//[$C19C]
ORG $84C19C
dw $8A72 ;//[goto argument if room argument's door bit is set]
dw $C4B1
dw $8A24 ;//[set goto/return pointer]
dw $C1AE
dw $86C1 ;//[set pre-inst]
dw $BD88 ;//[wake when shot w/s-missile]
dw $0001,$A827
dw $86B4 ;//[wait inst]
dw $8A91 ;//[inc counter DF0C]
db $01 ;//must be counter
dw $C1CF ;//[19 8C 07 06 00 33 A8 06 00 3F A8 06 00 4B A8 01 00 77 A6 BC 86 02 00 83 A6 02 00 7B A8]
dw $0003,$A9B3
dw $0004,$A827
dw $0003,$A9B3
dw $0004,$A827
dw $0003,$A9B3
dw $0004,$A827
dw $8724 ;//[goto command for inst]
dw $C1AC
dw $8C19 ;//[sound library 3]
db $07 ;//must be sound
dw $0006,$A833
dw $0006,$A83F
dw $0006,$A84B
dw $0001,$A677
dw $86BC ;//[delete plm]

;//[$C185]
ORG $84C185
dw $0002,$A677
dw $0002,$A84B
dw $8C19 ;//[sound library 3]
dw $08 ;//
dw $0002,$A83F
dw $0002,$A833
dw $0001,$A827
;------------------------------------------------------------------------------------------------------------------------------;
ORG $84F000 ;//[PLM freespace]
dw $C6BE,Main ;// $C6D8,$BC13
Main:
dw $0001,$A55D ;//[closed gate]
dw $BBDD,$86C1 ;//[set pre inst, continue]
dw $BB6B,$86B4 ;//[pre inst, wait inst]
dw $BBF0,$E64B ;//[activate plm]
dw $8C19 : db $0E ;//[sound library 3, sfx]
MainII:
dw $0010,$A54F ;//draw [05 80 D7 C0 FF C0 FF C0 FF C0 FF C0 00 00]
dw $0010,$A541 ;//draw [05 80 D7 C0 FF C0 FF C0 FF C0 FF 00 00 00]
dw $0010,$A533 ;//draw [05 80 D7 C0 FF C0 FF C0 FF 00 FF 00 00 00]
dw $0018,$A525 ;//draw [05 80 D7 C0 FF C0 FF 00 FF 00 FF 00 00 00]
dw $BBDD ;//clear check inst
dw $86C1 ;//set pre inst code
dw $BB6B ;//activate if below plm or shot
dw $86B4 ;//wait inst
dw $BBF0 ;//find room objuct that has plm position & activate, else crash
dw $E566 ;//[this magic keeps it closed & lit up]
dw $86BC ;//[delete plm (keeps invisible gate from spawning)]
;------------------------------------------------------------------------------------------------------------------------------;
;==============================================================================================================================;

Mentlegen

Quote from: PHOSPHOTiDYL on January 16, 2018, 11:45:02 AM
Hard @ work, here's a checkpoint b4 I f*** things up again.
I had it working w/door indexes earlier, just not in the same room, & it's gone.

This will open the gate, keep it open & lit, just not if you leave the room.
No asm code, custom plm, very important I learn this bank.

Also includes some left green door code for your hack notes...
Replacement for the C82A gate part, not the shot part, $F000 by default.

LoROM

;==============================================================================================================================;
;------------------------------------------------------------------------------------------------------------------------------;
;//[PLM $C872 (GREEN DOOR LEFT)][$C7B1,$C19C,$C185]

;//[$C7B1]
ORG $84C7B1 : LDX $1C87,y : LDA #$C044 : JSR $82B4 : RTS ;//[get plm location & write block type]

;//[$C19C]
ORG $84C19C
dw $8A72 ;//[goto argument if room argument's door bit is set]
dw $C4B1
dw $8A24 ;//[set goto/return pointer]
dw $C1AE
dw $86C1 ;//[set pre-inst]
dw $BD88 ;//[wake when shot w/s-missile]
dw $0001,$A827
dw $86B4 ;//[wait inst]
dw $8A91 ;//[inc counter DF0C]
db $01 ;//must be counter
dw $C1CF ;//[19 8C 07 06 00 33 A8 06 00 3F A8 06 00 4B A8 01 00 77 A6 BC 86 02 00 83 A6 02 00 7B A8]
dw $0003,$A9B3
dw $0004,$A827
dw $0003,$A9B3
dw $0004,$A827
dw $0003,$A9B3
dw $0004,$A827
dw $8724 ;//[goto command for inst]
dw $C1AC
dw $8C19 ;//[sound library 3]
db $07 ;//must be sound
dw $0006,$A833
dw $0006,$A83F
dw $0006,$A84B
dw $0001,$A677
dw $86BC ;//[delete plm]

;//[$C185]
ORG $84C185
dw $0002,$A677
dw $0002,$A84B
dw $8C19 ;//[sound library 3]
dw $08 ;//
dw $0002,$A83F
dw $0002,$A833
dw $0001,$A827
;------------------------------------------------------------------------------------------------------------------------------;
ORG $84F000 ;//[PLM freespace]
dw $C6BE,Main ;// $C6D8,$BC13
Main:
dw $0001,$A55D ;//[closed gate]
dw $BBDD,$86C1 ;//[set pre inst, continue]
dw $BB6B,$86B4 ;//[pre inst, wait inst]
dw $BBF0,$E64B ;//[activate plm]
dw $8C19 : db $0E ;//[sound library 3, sfx]
MainII:
dw $0010,$A54F ;//draw [05 80 D7 C0 FF C0 FF C0 FF C0 FF C0 00 00]
dw $0010,$A541 ;//draw [05 80 D7 C0 FF C0 FF C0 FF C0 FF 00 00 00]
dw $0010,$A533 ;//draw [05 80 D7 C0 FF C0 FF C0 FF 00 FF 00 00 00]
dw $0018,$A525 ;//draw [05 80 D7 C0 FF C0 FF 00 FF 00 FF 00 00 00]
dw $BBDD ;//clear check inst
dw $86C1 ;//set pre inst code
dw $BB6B ;//activate if below plm or shot
dw $86B4 ;//wait inst
dw $BBF0 ;//find room objuct that has plm position & activate, else crash
dw $E566 ;//[this magic keeps it closed & lit up]
dw $86BC ;//[delete plm (keeps invisible gate from spawning)]
;------------------------------------------------------------------------------------------------------------------------------;
;==============================================================================================================================;


Thanks for your contribution! i can't wait to see what further progress you make. I am very grateful for your aid.

PHOSPHOTiDYL

I'm very close to acquiring the gates of hell.
Something about my pre-instruction isn't clicking.

Aiming for 16 gates per two-byte ram address...
That's a lot of message boxes though.

If all else fails, door indexes.

https://www.youtube.com/watch?v=fe-8QyaVYUI

Mentlegen