megadrive_test2

annotate src/intr.s @ 6:df2c6b3c6f2e

added NTSC/PAL detection
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 21 Jun 2017 06:32:10 +0300
parents 72ab63f262bf
children
rev   line source
nuclear@4 1 | vi:filetype=gas68k:
nuclear@0 2 | the following will go into the .vect section which will be placed at the very
nuclear@0 3 | begining of the binary at address 0 by the linker (see lnkscript).
nuclear@0 4 .section .vect,"a"
nuclear@0 5 .extern start
nuclear@0 6 | exception vectors
nuclear@0 7 .long _stacktop | 00 reset - initial SSP
nuclear@0 8 .long start | 01 reset - initial PC
nuclear@0 9 .long intr_fatal | 02 bus error
nuclear@0 10 .long intr_fatal | 03 address error
nuclear@0 11 .long intr_fatal | 04 illegal instruction
nuclear@0 12 .long intr_fatal | 05 zero divide
nuclear@0 13 .long intr_fatal | 06 chk instruction
nuclear@0 14 .long intr_fatal | 07 trapv instruction
nuclear@0 15 .long intr_fatal | 08 privilege violation
nuclear@0 16 .long intr_fatal | 09 trace
nuclear@0 17 .long intr_fatal | 0a line 1010 emulator
nuclear@0 18 .long intr_fatal | 0b line 1111 emulator
nuclear@0 19 .long intr_fatal | 0c reserved
nuclear@0 20 .long intr_fatal | 0d reserved
nuclear@0 21 .long intr_fatal | 0e format error (mc68010 only)
nuclear@0 22 .long intr_fatal | 0f uninitialized interrupt vector
nuclear@0 23 .long intr_fatal | 10 \
nuclear@0 24 .long intr_fatal | 11 |
nuclear@0 25 .long intr_fatal | 12 |
nuclear@0 26 .long intr_fatal | 13 > reserved
nuclear@0 27 .long intr_fatal | 14 |
nuclear@0 28 .long intr_fatal | 15 |
nuclear@0 29 .long intr_fatal | 16 |
nuclear@0 30 .long intr_fatal | 17 /
nuclear@0 31 .long intr_fatal | 18 spurious interrupt
nuclear@0 32 .long intr_fatal | 19 level 1 interrupt
nuclear@0 33 .long intr_fatal | 1a level 2 interrupt
nuclear@0 34 .long intr_fatal | 1b level 3 interrupt
nuclear@0 35 .long intr_hblank | 1c level 4 interrupt (hblank in the mega drive)
nuclear@0 36 .long intr_fatal | 1d level 5 interrupt
nuclear@0 37 .long intr_vblank | 1e level 6 interrupt (vblank in the mega drive)
nuclear@0 38 .long intr_fatal | 1f level 7 interrupt
nuclear@0 39 .long intr_fatal | 20 trap 0
nuclear@0 40 .long intr_fatal | 21 trap 1
nuclear@0 41 .long intr_fatal | 22 trap 2
nuclear@0 42 .long intr_fatal | 23 trap 3
nuclear@0 43 .long intr_fatal | 24 trap 4
nuclear@0 44 .long intr_fatal | 25 trap 5
nuclear@0 45 .long intr_fatal | 26 trap 6
nuclear@0 46 .long intr_fatal | 27 trap 7
nuclear@0 47 .long intr_fatal | 28 trap 8
nuclear@0 48 .long intr_fatal | 29 trap 9
nuclear@0 49 .long intr_fatal | 2a trap a
nuclear@0 50 .long intr_fatal | 2b trap b
nuclear@0 51 .long intr_fatal | 2c trap c
nuclear@0 52 .long intr_fatal | 2d trap d
nuclear@0 53 .long intr_fatal | 2e trap e
nuclear@0 54 .long intr_fatal | 2f trap f
nuclear@0 55 .long intr_fatal | 30 \
nuclear@0 56 .long intr_fatal | 31 |
nuclear@0 57 .long intr_fatal | 32 |
nuclear@0 58 .long intr_fatal | 33 |
nuclear@0 59 .long intr_fatal | 34 |
nuclear@0 60 .long intr_fatal | 35 |
nuclear@0 61 .long intr_fatal | 36 |
nuclear@0 62 .long intr_fatal | 37 |
nuclear@0 63 .long intr_fatal | 38 > reserved
nuclear@0 64 .long intr_fatal | 39 |
nuclear@0 65 .long intr_fatal | 3a |
nuclear@0 66 .long intr_fatal | 3b |
nuclear@0 67 .long intr_fatal | 3c |
nuclear@0 68 .long intr_fatal | 3d |
nuclear@0 69 .long intr_fatal | 3e |
nuclear@0 70 .long intr_fatal | 3f /
nuclear@0 71
nuclear@0 72 | from here on we continue in the regular .text section since we don't care
nuclear@0 73 | where this code ends up.
nuclear@0 74 .text
nuclear@1 75
nuclear@1 76 .global enable_intr
nuclear@1 77 enable_intr:
nuclear@1 78 andi.w #0xf8ff, %sr
nuclear@1 79 rts
nuclear@1 80
nuclear@1 81 .global disable_intr
nuclear@1 82 disable_intr:
nuclear@1 83 ori.w #0x0300, %sr
nuclear@1 84 rts
nuclear@1 85
nuclear@0 86 | interrupt handlers
nuclear@0 87 intr_fatal:
nuclear@0 88 stop #0x2700
nuclear@0 89
nuclear@1 90 .include "vdpdefs.inc"
nuclear@1 91 .extern vblank_handler
nuclear@1 92 .extern palval
nuclear@1 93
nuclear@0 94 intr_hblank:
nuclear@4 95 | move.l #0xc0020000, VDP_PORT_CTL
nuclear@4 96 |
nuclear@4 97 | move.w testcol, %d0
nuclear@4 98 | move.w %d0, VDP_PORT_DATA
nuclear@4 99 | rol.b #4, %d0
nuclear@4 100 | move.w %d0, testcol
nuclear@4 101 |
nuclear@0 102 rte
nuclear@1 103
nuclear@0 104 intr_vblank:
nuclear@5 105 jsr vblank_handler
nuclear@0 106 rte