Jump to content
  • CPU Find Open Receiver


    jstout

    View attachment: Original_CPU_Passing.nes

    View attachment: Original_CPU_Passing_Juiced.nes

    .define X_DISTANCE $DD.define Y_DISTANCE $DE .define RECEIVER_LO $40.define RECEIVER_HI $41 .define DEFENDER_LO $42.define DEFENDER_HI $43 .define X_LO_APART $44.define X_HI_APART $45 START:LDY #$00	  ; SET TO FIRST COMMAND BYTETYAPHA@NEXT_RECEIVER:PLATAY; CHECK FOR NO MORE RECEIVERSCPY $DCBCC @CONTINUEBEQ @CONTINUE; NO OPEN RECEIVERS SO RANDOM THROWLDA $3BAND $DCTAYRTS@CONTINUE:INY  ; SET TO NEXT RECEIVER ; FIND X DISTANCELDA ($3E),YAND #$F0LSRSTA X_DISTANCE ; DISTANCE * 8 PIXELSBNE @Y_GETJMP @EXIT @Y_GET:; FIND Y DISTANCELDA ($3E),YAND #$F0LSRLSRLSRLSRSTA Y_DISTANCEASLASLCLCADC Y_DISTANCESTA Y_DISTANCE ; DISTANCE * 5 PIXELS ; GET RECEIVER LOCATIONLDA ($3E),YAND #$0FASLTAXTYAPHA;LDY #$08LDA ($AE),YBMI @2PLDA $DEEB,XSTA RECEIVER_LOLDA $DEEC,XSTA RECEIVER_HIJMP @DEFENDER@2P:LDA $DF01,XSTA RECEIVER_LOLDA $DF02,XSTA RECEIVER_HI @DEFENDER:; GET DEFENDER LOCATIONLDX #$14@NEXT_DEFENDER:LDY #$08LDA ($AE),YBMI @1PLDA $DF01,XSTA DEFENDER_LOLDA $DF02,XSTA DEFENDER_HIJMP @CALC@1P:LDA $DEEB,XSTA DEFENDER_LOLDA $DEEC,XSTA DEFENDER_HI @CALC:; FIND X SIDELDY #$15LDA (RECEIVER_LO),YCMP (DEFENDER_LO),YBCC @RIGHT		 ; RECEIVER < DEFENDERBNE @LEFT		  ; RECEIVER > DEFENDERDEYLDA (RECEIVER_LO),YCMP (DEFENDER_LO),YBCC @RIGHT		 ; RECEIVER < DEFENDER				   ; RECEIVER > DEFENDER ; X DISTANCE CHECK@LEFT:LDY #$14LDA (RECEIVER_LO),YSECSBC (DEFENDER_LO),YSTA X_LO_APARTINYLDA (RECEIVER_LO),YSBC (DEFENDER_LO),YSTA X_HI_APARTJMP @XAPART @RIGHT:LDY #$14LDA (DEFENDER_LO),YSECSBC (RECEIVER_LO),YSTA X_LO_APARTINYLDA (DEFENDER_LO),YSBC (RECEIVER_LO),YSTA X_HI_APART @XAPART:LDA X_HI_APARTBNE @GOOD		  ; VERY LARGE DISTANCELDA X_LO_APARTCMP X_DISTANCEBCS @GOOD		  ; OUT OF X DISTANCE				   ; IN X DISTANCE = CHECK Y DISTANCE ; Y DISTANCE CHECK@TOP_BOTTOM:LDY #$17LDA (RECEIVER_LO),YCMP (DEFENDER_LO),YBCC @BOTTOM	    ; RECEIVER < DEFENDER				   ; RECEIVER > DEFENDER @TOP:LDA (RECEIVER_LO),YSECSBC (DEFENDER_LO),YCMP Y_DISTANCEJMP @YAPART @BOTTOM:LDA (DEFENDER_LO),YSECSBC (RECEIVER_LO),YCMP Y_DISTANCE @YAPART:BCC @NEXT		  ; IN Y DISTANCE = BAD THROW@GOOD:DEXDEXBMI @THROW		 ; OPENJMP @NEXT_DEFENDER@NEXT:JMP @NEXT_RECEIVER @THROW:PLATAY@EXIT:RTS

    Set Default Values:

    PRO T WAGGLE L = 93 54 22

    R AND S FLARE C = 94 83 75 52 21

    PRO T WAGGLE R = 63 54 21

    ROLL OUT R = 94 63 45 31

    ROLL OUT L = 93 74 45 22

    T PLAY ACTION D = 93 73 42 21

    PRO T SCREEN L = 93 54 45 21

    PLAY ACTION = 93 54 42

    PWR FAKE Z POST = 94 53 31

    WTE F-FLICKER = 93 84

    SHOTGUN X CURL = 63 64 45 42 21

    R AND S Z FLY = 94 92 53 55

    PRO T FLARE D = 94 73 45 22 21

    OFFSET FLARE E = 94 63 41 32

    ONEBACK Z CROSS = 93 92 44 31

    ONEBACK FLARE A = 94 53 42

    T FLEA FLICKER = 93 54 22

    PWR FAKE X FLY = 93 94 55 31

    SHOTGUN X DRIVE = 93 54 AND 93 95 54 61 22

    R AND S 3-WING = 93 94 72 55

    PLAYACTION Z IN = 93 51 54 42

    FLEA FLICKER = 94 53 32

    PRO T FLARE C = 93 75 64 42

    SHOTGUN 3-WING = 93 74 52 45 31

    SHOTGUN XY BOMB = 93 94 81 75 62

    R AND S Y UP = 93 95 84 42 21

    X OUT AND FLY = 94 83 55 32 31

    REV-FAKE Z POST = 94 51

    SLOT L Z DRIVE = 83 54 AND 83 71 54 45 22

    NO BACK X DEEP = 94 72 53 21

    SHOTGUN Z S-IN = 73 44 AND 95 73 62 44 21

    REDGUN Z SLANT = 94 95 52 43 31

    ;---------------

    x90 COMMAND:

    FIRST NIBBLE (BOX DISTANCE) SECOND NIBBLE (RECEIVER): (8 Pixels = 1 Yard)

    0 = 0 PIXELS LEFT AND RIGHT + 0 PIXELS UP AND DOWN (Forces Throw)

    1 = 8 PIXELS LEFT AND RIGHT + 5 PIXELS UP AND DOWN

    2 = 16 PIXELS LEFT AND RIGHT + 10 PIXELS UP AND DOWN

    3 = 24 PIXELS LEFT AND RIGHT + 15 PIXELS UP AND DOWN

    4 = 32 PIXELS LEFT AND RIGHT + 20 PIXELS UP AND DOWN

    5 = 40 PIXELS LEFT AND RIGHT + 25 PIXELS UP AND DOWN

    6 = 48 PIXELS LEFT AND RIGHT + 30 PIXELS UP AND DOWN

    7 = 56 PIXELS LEFT AND RIGHT + 35 PIXELS UP AND DOWN

    8 = 64 PIXELS LEFT AND RIGHT + 40 PIXELS UP AND DOWN

    9 = 72 PIXELS LEFT AND RIGHT + 45 PIXELS UP AND DOWN

    A = 80 PIXELS LEFT AND RIGHT + 50 PIXELS UP AND DOWN

    B = 88 PIXELS LEFT AND RIGHT + 55 PIXELS UP AND DOWN

    C = 96 PIXELS LEFT AND RIGHT + 60 PIXELS UP AND DOWN

    D = 104 PIXELS LEFT AND RIGHT + 65 PIXELS UP AND DOWN

    E = 112 PIXELS LEFT AND RIGHT + 70 PIXELS UP AND DOWN

    F = 120 PIXELS LEFT AND RIGHT + 75 PIXELS UP AND DOWN


    User Feedback

    Recommended Comments



    besides the obvious badassness of this development, I am having fun "baiting" COM QBs...I never thought I'd see the day.  

    excellent.

    I do love that it provides a legitimate alternative to blitzing your linebacker now. 

    Link to comment
    Share on other sites

    Why blitz your linebacker ever, save the specific run plays?

    against the computer?  Because I think it's the most efficient defensive tactic vs. the pass.  Otherwise, you end up dropping back and covering some guy who only has a 20-25% chance of being targeted anyway . . . and wasting him.  And, even if he does throw to the man you covered, a linebacker vs. a juiced computer WR usually results in a completion anyway.

    Link to comment
    Share on other sites

     

    This is the same code as above but changing the rectangular check to a circle (requires more space for better accuracy).

    .define DISTANCE $DD

    .define TEMP_HI      $DE

     

    .define RECEIVER_LO $40

    .define RECEIVER_HI $41

     

    .define DEFENDER_LO $42

    .define DEFENDER_HI $43

     

    .define X_LO_APART $44

    .define X_HI_APART $45

     

    .define X_APART $44

    .define Y_APART $45

     

    .define APART_LO $44

    .define APART_HI $45

     

    START:

                    LDY #$00                              ; SET TO FIRST COMMAND BYTE

                    TYA

                    PHA

    @NEXT_RECEIVER:

                    PLA

                    TAY

    ; CHECK FOR NO MORE RECEIVERS

                    CPY $DC

                    BCC @CONTINUE

                    BEQ @CONTINUE

    ; NO OPEN RECEIVERS SO RANDOM THROW

                    LDA $3B

                    AND $DC

                    TAY

                    RTS

    @CONTINUE:

                    INY                         ; SET TO NEXT RECEIVER

     

    ; FIND DISTANCE

                    LDA ($3E),Y

                    AND #$F0

                    LSR

                    LSR

                    LSR

                    LSR

                    STA DISTANCE

                    BNE @LOCATIONS

                    JMP @EXIT

     

    @LOCATIONS:

    ; GET RECEIVER LOCATION

                    LDA ($3E),Y

                    AND #$0F                            ; RECEIVER

                    ASL

                    TAX                                        ; PLAYER INDEX

                    TYA

                    PHA                                       ; STORE Y

    ; WHICH PLAYER?

                    LDY #$08

                    LDA ($AE),Y

                    BMI @2P

                    LDA $DEEB,X

                    STA RECEIVER_LO

                    LDA $DEEC,X

                    STA RECEIVER_HI

                    JMP @DEFENDER

    @2P:

                    LDA $DF01,X

                    STA RECEIVER_LO

                    LDA $DF02,X

                    STA RECEIVER_HI

     

    @DEFENDER:

    ; GET DEFENDER LOCATION

                    LDX #$14                              ; SET TO LAST DEFENDER INDEX

    @NEXT_DEFENDER:

    ; WHICH PLAYER?

                    LDY #$08

                    LDA ($AE),Y

                    BMI @1P

                    LDA $DF01,X

                    STA DEFENDER_LO

                    LDA $DF02,X

                    STA DEFENDER_HI

                    JMP @CALC

    @1P:

                    LDA $DEEB,X

                    STA DEFENDER_LO

                    LDA $DEEC,X

                    STA DEFENDER_HI

     

    @CALC:

     

    ; FIND X SIDE

                    LDY #$15

                    LDA (RECEIVER_LO),Y

                    CMP (DEFENDER_LO),Y

                    BCC @RIGHT                      ; RECEIVER < DEFENDER

                    BNE @LEFT                         ; RECEIVER > DEFENDER

                    DEY

                    LDA (RECEIVER_LO),Y

                    CMP (DEFENDER_LO),Y

                    BCC @RIGHT                      ; RECEIVER < DEFENDER

                                                                    ; RECEIVER > DEFENDER

    ; X DISTANCE CHECK

    @LEFT:

                    LDY #$14

                    LDA (RECEIVER_LO),Y

                    SEC

                    SBC (DEFENDER_LO),Y

                    STA X_LO_APART

                    INY

                    LDA (RECEIVER_LO),Y

                    SBC (DEFENDER_LO),Y

                    STA X_HI_APART

                    JMP @XAPART

    @RIGHT:

                    LDY #$14

                    LDA (DEFENDER_LO),Y

                    SEC

                    SBC (RECEIVER_LO),Y

                    STA X_LO_APART

                    INY

                    LDA (DEFENDER_LO),Y

                    SBC (RECEIVER_LO),Y

                    STA X_HI_APART

    @XAPART:

                    LDA X_HI_APART

                    BEQ @X_LO

                    JMP @GOOD                     ; VERY LARGE DISTANCE

    @X_LO:

                    LDA X_LO_APART

                    LSR

                    LSR

                    LSR

                    CMP DISTANCE

                    BCS @GOOD                      ; OUT OF X DISTANCE

                    STA X_APART                    ; IN X DISTANCE = CHECK Y DISTANCE

     

    ; FIND Y SIDE

                    LDY #$17

                    LDA (RECEIVER_LO),Y

                    CMP (DEFENDER_LO),Y

                    BCC @BOTTOM                                ; RECEIVER < DEFENDER

                                                                    ; RECEIVER > DEFENDER

    ; Y DISTANCE CHECK

    @TOP:

                    LDA (RECEIVER_LO),Y

                    SEC

                    SBC (DEFENDER_LO),Y

                    JMP @YAPART

    @BOTTOM:

                    LDA (DEFENDER_LO),Y

                    SEC

                    SBC (RECEIVER_LO),Y

    @YAPART:

                    LSR

                    LSR

                    LSR

                    CMP DISTANCE

                    BCS @GOOD                      ; OUT OF Y DISTANCE

                    STA Y_APART                     ; IN Y DISTANCE = CHECK RADIUS

     

    ; CHECK RADIUS DISTANCE

    ; A^2

                    LDY X_APART

                    BEQ @NO_X

                    LDA #$00

    @LOOP_X:

                    CLC

                    ADC X_APART

                    DEY

                    BNE @LOOP_X

                    STA X_APART

    ; B^2

    @NO_X:

                    LDY Y_APART

                    BEQ @NO_Y

                    LDA #$00

    @LOOP_Y:

                    CLC

                    ADC Y_APART

                    DEY

                    BNE @LOOP_Y

                    STA Y_APART

    @NO_Y:

    ; A^2 + B^2

                    LDA X_APART

                    CLC

                    ADC Y_APART

                    STA APART_LO

                    LDA #$00

                    ADC #$00

                    STA APART_HI

    ; SQRT(A^2 + B^2)

                    TXA

                    PHA

                    LDY #$00

                    LDX #$07

    @loop:

                    TYA

                    ORA @stab-1,X

                    STA TEMP_HI

                    LDA APART_HI

                    CMP TEMP_HI

                    BCC @skip1

                    SBC TEMP_HI

                    STA APART_HI

                    TYA

                    ORA @stab,x

                    TAY

    @skip1:

                    ASL APART_LO

                    ROL APART_HI

                    DEX

                    BNE @loop

    ; last iteration

                    STY TEMP_HI

                    LDA APART_LO

                    CMP #$80

                    LDA APART_HI

                    SBC TEMP_HI

                    BCC @skip2

                    INY

    @skip2:

                    PLA

                    TAX

            CPY DISTANCE

                    BCC @NEXT                        ; IN RADIUS DISTANCE = BAD THROW

     

    ; MORE DEFENDERS?

    @GOOD:

                    DEX

                    DEX

                    BMI @THROW                   ; OPEN

                    JMP @NEXT_DEFENDER

    @NEXT:

                    JMP @NEXT_RECEIVER

    @THROW:

                    PLA

                    TAY

    @EXIT:

                    RTS

    @stab:  .BYTE $01,$02,$04,$08,$10,$20,$40,$80

     

    do you have a ROM with this "radial" distancing hack applied?  thx

    Link to comment
    Share on other sites

    jstout, would it be feasible to port this beautiful hack to SNES TSB 1?

     

    Yes, the code would look nearly the same with just RAM locations changed and ability to use 16-bit numbers.  I'll see about writing it up when I get the chance.

     

    BTW, I do have a ROM with the Radial code but need to find it on my hard drive (or recompile) and then I'll post it.

    Link to comment
    Share on other sites

    Yes, the code would look nearly the same with just RAM locations changed and ability to use 16-bit numbers.  I'll see about writing it up when I get the chance.

     

    BTW, I do have a ROM with the Radial code but need to find it on my hard drive (or recompile) and then I'll post it.

    Any update on this good sir?

    Link to comment
    Share on other sites

    I've found two plays where the CPU throw to "non-eligible" players, in MAN vs COM.

     

    attachicon.gifpro t waggle r & pwr fake z post.jpg

     

    Good find.  There are also some other plays where it does not seem to be optimized (R&S Pass 2, for example), and some plays where the QB partially scrambles and then throws to someone that's covered.

     

    I will make some SET patches for these fixes, eventually.

    Link to comment
    Share on other sites

    so, what does the QB do when all receivers are covered?  it seems like he throws to RB2 or TE


    .  


    which brings up the question:  how can I set this "dump off" receiver for each (or all) play?  I would rather QB dump to WR1 or WR2 if all else fails.


    Edited by buck
    Link to comment
    Share on other sites

    Lmao...cmon guys Its right in the source for the hack about 10 lines down

    "NO OPEN RECEIVERS SO RANDOM THROW"

    I see that, but how can the code be changed to make the QB throw to WR1 instead of random?  I can't follow that formatting.

    Link to comment
    Share on other sites

    I guess I can spoon feed you the answer....I'm feeling generous...but you must change your name to TecmoLeechMonster.  :razz:

     

    On the first rom post you would do the following

     

    SET (0x1DA2C, 0xA08060EAEAEA)

     

    LDY #$80                                        ; use as our indicator to throw to a designated WR

    RTS                                                 ; return

    NOP

    NOP

    NOP

     

     

    SET(0x288C7, 0xC080D005A9034CCB884CC788)

     

    CPY #$80                                                    ; check to throw to designated WR
    BNE NORM                                                  ; NO-> do normal COM pass throw
    LDA #$03                                                    ; LOAD WR 1 player ID
    JMP $88CB                                                  ; jump to different point in COM pass that skips target # to actual player conversion

    NORM                                                          ;
    JMP $88C7                                                  ; jump to normal point in COM PASS

    Link to comment
    Share on other sites

    but you must change your name to TecmoLeechMonster.  :razz:

    Ha, sheesh, come ON, dude!  Not only (1) was it buck that first asked, but (2) I give back to this community, including what I think is the 2nd most downloaded rom outside this site's "official" rom, (3) I've donated to you personally, and (4) in last season's rom release thread, I asked downloaders to donate to you using your donate button within the same thread.  I don't know how much money that raised for you -- I'm sure not very much -- but whatever it was, was infinitely more than I personally collected from it (which, if you're counting at home, is zero dollars to date). 

     

    So, in other words, I've decided not to change my name, but I do thank you for the info.  I'm anxious to try this out.

    Link to comment
    Share on other sites

    Mostly just giving you a hard time...but I spent a lot of time learning assembly language so I eventually didn't have to keep asking. Jstout even provided links to very good tutorials. If you spent some time learning the basics of what's going on you could do some small assembly language hacks or at least better understand how the existing ones work. 


     


    The fact that I can whip out an answer in like 30 minutes is built on XXXXXX hours learning assembly and commenting the rom code/locations.


     


    I do appreciate the donations from you and others. In terms of dollars donated/ time spent I've likely been working for much less than a $1 per hour...


     


    Anyways hopefully you enjoy it. 


    Link to comment
    Share on other sites

    it sure as heck doesn't seem random to me, but that is beside the point.  

     

    so, how do these codes this make it "random"?

     

    load accumulator $3B? ; is this an address or actual value?

    logical AND $DC? ; is this an address or actual value?

    Transfer Accumulator to Y register;  store the number?

    Return from Subroutine

     

    ; NO OPEN RECEIVERS SO RANDOM THROW
    LDA $3B
    AND $DC
    TAY
    RTS

    Edited by buck
    Link to comment
    Share on other sites

    Anything that only has a $ is a memory location.

    #$ indicates a constant

    $3B,$3C,$3D are the memory locations of random numbers. The random numbers are created by adding prime numbers to the current number. They are updated at least once a frame. Sometimes othe functions re-update them mid frame if "better" randomness is needed. You can watch them update in fceux by slowing the speed way down

    $DC is memory location that is used as a temporary variable. At this point in the code its holding the total number of pass targets for the play.

    ANDing the number of targets with a random number means the the value will be restricted to between 0 and the number of targets.

    However i realized this won't give a truly random result due to how bit wise anding works

    Link to comment
    Share on other sites

    However i realized this won't give a truly random result due to how bit wise anding works

     

    I realized it wasn't random before I even looked at the code.  Mostly because I have never seen it "randomly" throw to either WR1 or WR2.  It mostly dumps it to RB2.

     

    is there an easy fix (that will fit in existing space) to make it actually random?

    Link to comment
    Share on other sites

    Buck..your observation isn't correct either. I made it so it would be random every play the way its currently written every time to test it. For shotgun pass 3 for example it will throw to WR 1 often.


     


    For 5 WR patterns it will either throw to TARGET 1 or TARGET 5. 


    For 4 WR patterns it will throw to ANY OF THE 4 possible targets


    For 3 WR patterns it will throw to TARGET 1 or TARGET 3.  


     


    The order of the targets is not the same for each play so sometimes target 1 is WR1 sometimes it is RB1 etc. 


     


    For example in  one short test of BUF vs MIA the com threw to WR1, WR2, WR2, RB2, RB1. It depends on what plays are used. 


     


     


     


     


    Yes there should be a way to make it completely random...


    Link to comment
    Share on other sites

    Buck..your observation isn't correct either. I made it so it would be random every play the way its currently written every time to test it. For shotgun pass 3 for example it will throw to WR 1 often.

     

    For 5 WR patterns it will either throw to TARGET 1 or TARGET 5. 

    For 4 WR patterns it will throw to ANY OF THE 4 possible targets

    For 3 WR patterns it will throw to TARGET 1 or TARGET 3.  

     

    The order of the targets is not the same for each play so sometimes target 1 is WR1 sometimes it is RB1 etc. 

     

    For example in  one short test of BUF vs MIA the com threw to WR1, WR2, WR2, RB2, RB1. It depends on what plays are used. 

     

     

    Yes there should be a way to make it completely random...

     

    cool.  

    Link to comment
    Share on other sites

    So I've noticed that the COM QB seems to be more likely to make a bad target decision on the Shotgun Z S-In play, and also seems to have a quicker trigger than normal.


     


    Could this be because the QB has two different WR progression strings in his instruction line that inhibits proper application of the hack?  It's one of three plays that has two different progression strings.


    Link to comment
    Share on other sites




    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Member Statistics

    13,356
    Total Members
    1,845
    Most Online
    SoulidifiedX
    Newest Member
    SoulidifiedX
    Joined
  • Forum Statistics

    69.4k
    Total Topics
    473.3k
    Total Posts
×
×
  • Create New...