Wednesday, March 2, 2016

Interrupt Vectors on ap2000

The ap2000 has its code in rom, so it uses a jump to redirect to a location in ram where it's put another JMP.

00000000: 54 E0 00           JMP     $00E0
00000003: 00                 NOP     

NMI interrupt is at 0004

00000004: 54 2A 0C           JMP     $0C2A
00000007: 00                 NOP     

INTT0 and INTT1 interrupts are at 0008

00000008: 11                 EXX           
00000009: 10                 EXA     
0000000A: 54 17 98           JMP     $9817
0000000D: 00                 NOP     
0000000E: 00                 NOP     
0000000F: 00                 NOP     

INT1 AND INT2 are at 0010

00000010: 00                 NOP     
00000011: 00                 NOP     
00000012: 00                 NOP     
00000013: 00                 NOP     
00000014: 00                 NOP     
00000015: 00                 NOP     
00000016: 00                 NOP     
00000017: 00                 NOP     

INTE0 and INTE1 are at 0018

00000018: 11                 EXX     
00000019: 10                 EXA     
0000001A: 54 1A 98           JMP     $981A
0000001D: 00                 NOP     
0000001E: 00                 NOP     
0000001F: 00                 NOP     

INTEIN and INTAD are at 0020

00000020: 00                 NOP     
00000021: 00                 NOP     
00000022: 00                 NOP     
00000023: 00                 NOP     
00000024: 00                 NOP     
00000025: 00                 NOP     
00000026: 00                 NOP     
00000027: 00                 NOP     

INTSR and INTST are at 0028

00000028: 54 CE 20           JMP     $20CE

The most interesting ones for me to study right now are the JMP to $9817 and $981A.


at $016A we put 54 in 9817 with MOV ($9817),A to put the JMP opcode in place

0000016A: 69 54              MVI     A,$54
0000016C: 70 79 17 98        MOV     ($9817),A
00000170: 70 79 1A 98        MOV     ($981A),A
00000174: 40 F7 0B           CALL    $0BF7

and the code at 0BF7 puts 0C0F into the address at $9818 to fix the address to make it JMP $0C0F.

00000BF7: 64 9D E0           ORI     TMM,$E0
00000BFA: 48 42              SKIT    FT1
00000BFC: 00                 NOP     
00000BFD: 69 26              MVI     A,$26
00000BFF: 4D DB              MOV     TM1,A
00000C01: 34 0F 0C           LXI     HL,$0C0F
00000C04: 70 3E 18 98        SHLD    $9818
00000C08: 64 8D 3F           ANI     TMM,$3F
00000C0B: 64 0F FB           ANI     MKL,$FB
00000C0E: B8                 RET     
00000C0F: 40 16 0C           CALL    $0C16
00000C12: 11                 EXX     
00000C13: 10                 EXA     
00000C14: AA                 EI      
00000C15: 62                 RETI    


There seem to be only a few routines for these two interrupt vectors.

Using my good friend grep with -A (after) and -B (before) gives us

~/Downloads/mame$ grep -A 2 -B 2 '9818' ap2k_disasm
00000BFF: 4D DB              MOV     TM1,A
00000C01: 34 0F 0C           LXI     HL,$0C0F
00000C04: 70 3E 18 98        SHLD    $9818
00000C08: 64 8D 3F           ANI     TMM,$3F
00000C0B: 64 0F FB           ANI     MKL,$FB
--
00001E52: 70 3E 1B 98        SHLD    $981B
00001E56: 34 04 7A           LXI     HL,$7A04
00001E59: 70 3E 18 98        SHLD    $9818
00001E5D: B8                 RET     
00001E5E: 55 10 02           OFFIW   VV:10,$02
--
00001EA7: 70 3E 1B 98        SHLD    $981B
00001EAB: 34 5A 7A           LXI     HL,$7A5A
00001EAE: 70 3E 18 98        SHLD    $9818
00001EB2: CE                 JR      $1EC1
00001EB3: 34 E3 1D           LXI     HL,$1DE3
00001EB6: 70 3E 1B 98        SHLD    $981B
00001EBA: 34 5A 7A           LXI     HL,$7A5A
00001EBD: 70 3E 18 98        SHLD    $9818
00001EC1: 69 0C              MVI     A,$0C
00001EC3: 4D CC              MOV     ETMM,A
--
000079E9: 64 9D E0           ORI     TMM,$E0
000079EC: 34 04 7A           LXI     HL,$7A04
000079EF: 70 3E 18 98        SHLD    $9818
000079F3: 15 0F 01           ORIW    VV:0F,$01
000079F6: 69 E6              MVI     A,$E6
--
00007A84: 99                 CALT    ($00B2)
00007A85: 34 04 7A           LXI     HL,$7A04
00007A88: 70 3E 18 98        SHLD    $9818
00007A8C: 55 00 80           OFFIW   VV:00,$80
00007A8F: 5E 00              BIT     6,VV:00

~/Downloads/mame$ grep -A 2 -B 2 '981B' ap2k_disasm
00001E4C: 64 0F DF           ANI     MKL,$DF
00001E4F: 34 78 1E           LXI     HL,$1E78
00001E52: 70 3E 1B 98        SHLD    $981B
00001E56: 34 04 7A           LXI     HL,$7A04
00001E59: 70 3E 18 98        SHLD    $9818
--
00001EA3: CF                 JR      $1EB3
00001EA4: 34 85 1D           LXI     HL,$1D85
00001EA7: 70 3E 1B 98        SHLD    $981B
00001EAB: 34 5A 7A           LXI     HL,$7A5A
00001EAE: 70 3E 18 98        SHLD    $9818
00001EB2: CE                 JR      $1EC1
00001EB3: 34 E3 1D           LXI     HL,$1DE3
00001EB6: 70 3E 1B 98        SHLD    $981B
00001EBA: 34 5A 7A           LXI     HL,$7A5A
00001EBD: 70 3E 18 98        SHLD    $9818
--
0000319F: 48 D2              DMOV    ETM0,EA
000031A1: 34 F5 31           LXI     HL,$31F5
000031A4: 70 3E 1B 98        SHLD    $981B
000031A8: 48 45              SKIT    FE0
000031AA: 00                 NOP     


Now to figure out what these interrupts do 8-)

No comments:

Post a Comment