News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Problem with irq  (Read 1414 times)

yugisokubodai

  • Full Member
  • ***
  • Posts: 144
    • View Profile
    • Assembly
Problem with irq
« on: August 07, 2018, 11:20:19 am »
I set irq to occur at vertical count 00.
Yes, it does occur when the beam hit line 00.
The problem is, if the copy routine keeps so long (for example, copy $1000 bytes from Rom to Ram during force blank), the irq keeps occuring forever. It occurs at VC 00, return with RTI and then occurs again right after that.

Code: [Select]
*** IRQ
$00/8026 48          PHA                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF8 P:envMxdIzc HC:0098 VC:000 FC:39 I:02
$00/8027 DA          PHX                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF7 P:envMxdIzc HC:0128 VC:000 FC:39 I:02
$00/8028 5A          PHY                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF5 P:envMxdIzc HC:0166 VC:000 FC:39 I:02
$00/8029 08          PHP                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF3 P:envMxdIzc HC:0204 VC:000 FC:39 I:02
$00/802A 0B          PHD                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF2 P:envMxdIzc HC:0234 VC:000 FC:39 I:02
$00/802B 8B          PHB                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF0 P:envMxdIzc HC:0272 VC:000 FC:39 I:02
$00/802C 5C 30 80 80 JMP $808030[$80:8030]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0302 VC:000 FC:39 I:02
$80/8030 E2 20       SEP #$20                A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0340 VC:000 FC:39 I:02
$80/8032 C2 10       REP #$10                A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0364 VC:000 FC:39 I:02
$80/8034 AD 11 42    LDA $4211  [$7F:4211]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0388 VC:000 FC:39 I:02
$80/8037 A5 09       LDA $09    [$00:0009]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:0420 VC:000 FC:39 I:02
$80/8039 8D 00 21    STA $2100  [$7F:2100]   A:0080 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:eNvMxdIzc HC:0446 VC:000 FC:39 I:02
$80/803C A5 0A       LDA $0A    [$00:000A]   A:0080 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:eNvMxdIzc HC:0478 VC:000 FC:39 I:02
$80/803E 8D 05 21    STA $2105  [$7F:2105]   A:0001 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0504 VC:000 FC:39 I:02
$80/8041 A5 0C       LDA $0C    [$00:000C]   A:0001 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0536 VC:000 FC:39 I:02
$80/8043 8D 07 21    STA $2107  [$7F:2107]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:0602 VC:000 FC:39 I:02
$80/8046 A5 0D       LDA $0D    [$00:000D]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:0634 VC:000 FC:39 I:02
$80/8048 8D 08 21    STA $2108  [$7F:2108]   A:0011 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0660 VC:000 FC:39 I:02
$80/804B A5 0E       LDA $0E    [$00:000E]   A:0011 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0692 VC:000 FC:39 I:02
$80/804D 8D 09 21    STA $2109  [$7F:2109]   A:0020 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0718 VC:000 FC:39 I:02
$80/8050 A5 10       LDA $10    [$00:0010]   A:0020 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0750 VC:000 FC:39 I:02
$80/8052 8D 0B 21    STA $210B  [$7F:210B]   A:0043 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0776 VC:000 FC:39 I:02
$80/8055 A5 11       LDA $11    [$00:0011]   A:0043 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0808 VC:000 FC:39 I:02
$80/8057 8D 0C 21    STA $210C  [$7F:210C]   A:0005 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0834 VC:000 FC:39 I:02
$80/805A A5 12       LDA $12    [$00:0012]   A:0005 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0866 VC:000 FC:39 I:02
$80/805C 8D 0D 21    STA $210D  [$7F:210D]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:0892 VC:000 FC:39 I:02
$80/805F A5 13       LDA $13    [$00:0013]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:0924 VC:000 FC:39 I:02
$80/8061 8D 0E 21    STA $210E  [$7F:210E]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:0950 VC:000 FC:39 I:02
$80/8064 A5 14       LDA $14    [$00:0014]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:0982 VC:000 FC:39 I:02
$80/8066 8D 0F 21    STA $210F  [$7F:210F]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:1008 VC:000 FC:39 I:02
$80/8069 A5 15       LDA $15    [$00:0015]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:1040 VC:000 FC:39 I:02
$80/806B 8D 10 21    STA $2110  [$7F:2110]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:1066 VC:000 FC:39 I:02
$80/806E A5 16       LDA $16    [$00:0016]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:1098 VC:000 FC:39 I:02
$80/8070 8D 11 21    STA $2111  [$7F:2111]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:1124 VC:000 FC:39 I:02
$80/8073 A5 17       LDA $17    [$00:0017]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:1156 VC:000 FC:39 I:02
$80/8075 8D 12 21    STA $2112  [$7F:2112]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:1182 VC:000 FC:39 I:02
$80/8078 22 97 82 80 JSL $808297[$80:8297]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:1214 VC:000 FC:39 I:02


$80/8297 48          PHA                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEC P:envMxdIZc HC:1268 VC:000 FC:39 I:02
$80/8298 DA          PHX                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEB P:envMxdIZc HC:1294 VC:000 FC:39 I:02
$80/8299 5A          PHY                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE9 P:envMxdIZc HC:1328 VC:000 FC:39 I:02
$80/829A 08          PHP                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE7 P:envMxdIZc HC:1362 VC:000 FC:39 I:02
$80/829B E2 20       SEP #$20                A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envMxdIZc HC:0024 VC:001 FC:40 I:02
$80/829D AD 12 42    LDA $4212  [$7F:4212]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envMxdIZc HC:0048 VC:001 FC:40 I:02
$80/82A0 29 01       AND #$01                A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envMxdIZc HC:0080 VC:001 FC:40 I:02
$80/82A2 D0 F9       BNE $F9    [$829D]      A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envMxdIZc HC:0098 VC:001 FC:40 I:02
$80/82A4 C2 20       REP #$20                A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envMxdIZc HC:0116 VC:001 FC:40 I:02
$80/82A6 AD 18 42    LDA $4218  [$7F:4218]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0140 VC:001 FC:40 I:02
$80/82A9 85 26       STA $26    [$00:0026]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0180 VC:001 FC:40 I:02
$80/82AB 29 0F 00    AND #$000F              A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0214 VC:001 FC:40 I:02
$80/82AE F0 04       BEQ $04    [$82B4]      A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0238 VC:001 FC:40 I:02
$80/82B4 A5 26       LDA $26    [$00:0026]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0262 VC:001 FC:40 I:02
$80/82B6 45 2C       EOR $2C    [$00:002C]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0296 VC:001 FC:40 I:02
$80/82B8 25 26       AND $26    [$00:0026]   A:0080 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIzc HC:0330 VC:001 FC:40 I:02
$80/82BA 85 28       STA $28    [$00:0028]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0364 VC:001 FC:40 I:02
$80/82BC 85 2A       STA $2A    [$00:002A]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0398 VC:001 FC:40 I:02
$80/82BE A5 26       LDA $26    [$00:0026]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0432 VC:001 FC:40 I:02
$80/82C0 F0 12       BEQ $12    [$82D4]      A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0466 VC:001 FC:40 I:02
$80/82D4 A5 22       LDA $22    [$00:0022]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0490 VC:001 FC:40 I:02
$80/82D6 85 2E       STA $2E    [$00:002E]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0524 VC:001 FC:40 I:02
$80/82D8 A5 26       LDA $26    [$00:0026]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0598 VC:001 FC:40 I:02
$80/82DA 85 2C       STA $2C    [$00:002C]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0632 VC:001 FC:40 I:02
$80/82DC 20 E4 82    JSR $82E4  [$80:82E4]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envmxdIZc HC:0666 VC:001 FC:40 I:02


$80/82E4 E2 20       SEP #$20                A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE4 P:envmxdIZc HC:0712 VC:001 FC:40 I:02
$80/82E6 A5 1E       LDA $1E    [$00:001E]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE4 P:envMxdIZc HC:0736 VC:001 FC:40 I:02
$80/82E8 D0 20       BNE $20    [$830A]      A:0001 X:38C9 Y:0738 D:0000 DB:7F S:1FE4 P:envMxdIzc HC:0762 VC:001 FC:40 I:02
$80/830A A5 27       LDA $27    [$00:0027]   A:0001 X:38C9 Y:0738 D:0000 DB:7F S:1FE4 P:envMxdIzc HC:0786 VC:001 FC:40 I:02
$80/830C 29 80       AND #$80                A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE4 P:envMxdIZc HC:0812 VC:001 FC:40 I:02
$80/830E F0 18       BEQ $18    [$8328]      A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE4 P:envMxdIZc HC:0830 VC:001 FC:40 I:02
$80/8328 60          RTS                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE4 P:envMxdIZc HC:0854 VC:001 FC:40 I:02


$80/82DF 28          PLP                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE6 P:envMxdIZc HC:0900 VC:001 FC:40 I:02
$80/82E0 7A          PLY                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE7 P:envMxdIZc HC:0932 VC:001 FC:40 I:02
$80/82E1 FA          PLX                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FE9 P:envMxdIzc HC:0972 VC:001 FC:40 I:02
$80/82E2 68          PLA                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEB P:envMxdIzc HC:1012 VC:001 FC:40 I:02
$80/82E3 6B          RTL                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEC P:envMxdIZc HC:1044 VC:001 FC:40 I:02


$80/807C AD 11 42    LDA $4211  [$7F:4211]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:1092 VC:001 FC:40 I:02
$80/807F AB          PLB                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIZc HC:1124 VC:001 FC:40 I:02
$80/8080 2B          PLD                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF0 P:envMxdIzc HC:1156 VC:001 FC:40 I:02
$80/8081 28          PLP                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF2 P:envMxdIZc HC:1196 VC:001 FC:40 I:02
$80/8082 7A          PLY                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF3 P:envMxdIzc HC:1228 VC:001 FC:40 I:02
$80/8083 FA          PLX                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF5 P:envMxdIzc HC:1268 VC:001 FC:40 I:02
$80/8084 68          PLA                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF7 P:envMxdIzc HC:1308 VC:001 FC:40 I:02
$80/8085 40          RTI                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF8 P:envMxdIZc HC:1340 VC:001 FC:40 I:02
*** IRQ
$00/8026 48          PHA                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF8 P:envMxdIzc HC:0094 VC:002 FC:40 I:02
$00/8027 DA          PHX                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF7 P:envMxdIzc HC:0124 VC:002 FC:40 I:02
$00/8028 5A          PHY                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF5 P:envMxdIzc HC:0162 VC:002 FC:40 I:02
$00/8029 08          PHP                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF3 P:envMxdIzc HC:0200 VC:002 FC:40 I:02
$00/802A 0B          PHD                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF2 P:envMxdIzc HC:0230 VC:002 FC:40 I:02
$00/802B 8B          PHB                     A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FF0 P:envMxdIzc HC:0268 VC:002 FC:40 I:02

Can anyone explain to me why this happens? And how to remedy? (Not to mention the turn off methods like SEI)

Disch

  • Hero Member
  • *****
  • Posts: 2727
  • NES Junkie
    • View Profile
Re: Problem with irq
« Reply #1 on: August 09, 2018, 10:03:41 pm »
You're never acknowledging the IRQ.

You need to read from $4211 in order to acknowledge it.  You are TRYING this but you are reading from the wrong bank:

Code: [Select]
$80/8034 AD 11 42    LDA $4211  [$7F:4211]   A:0000 X:38C9 Y:0738 D:0000 DB:7F S:1FEF P:envMxdIzc HC:0388 VC:000 FC:39 I:02
                                ^^^^^^^^^^

Note you're reading from bank 7F, not from bank 00.

yugisokubodai

  • Full Member
  • ***
  • Posts: 144
    • View Profile
    • Assembly
Re: Problem with irq
« Reply #2 on: August 11, 2018, 12:24:23 am »
Thank you Disch.
Solved.
I forgot to force to bank 00 during Irq, that's why this happened only when I copied some data to bank 7F.