|
|
1.1 ! root 1: ; ! 2: ; nono ! 3: ; Copyright (C) 2023 nono project ! 4: ; ! 5: ; Redistribution and use in source and binary forms, with or without ! 6: ; modification, are permitted provided that the following conditions ! 7: ; are met: ! 8: ; 1. Redistributions of source code must retain the above copyright ! 9: ; notice, this list of conditions and the following disclaimer. ! 10: ; 2. Redistributions in binary form must reproduce the above copyright ! 11: ; notice, this list of conditions and the following disclaimer in the ! 12: ; documentation and/or other materials provided with the distribution. ! 13: ; ! 14: ; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ! 15: ; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ! 16: ; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ! 17: ; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ! 18: ; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ! 19: ; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ! 20: ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED ! 21: ; AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ! 22: ; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ! 23: ; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! 24: ; SUCH DAMAGE. ! 25: ! 26: ; エリアセット、拡張エリアセットで設定した領域を DMAC からアクセスしてみる ! 27: ; テスト。だけのはずだったがついでに各 FC でアクセスしてみる。 ! 28: ; ! 29: ; % has area.has ! 30: ; % hlk area.o si_util.o ! 31: ; ! 32: ; usage: ! 33: ; area <address> ! 34: ! 35: .include doscall.mac ! 36: .include iocscall.mac ! 37: .xref hexstr_long ! 38: ! 39: DMAC_ch2: .equ $e84080 ! 40: DMAC_CSR: .equ $00 ! 41: DMAC_DCR: .equ $04 ! 42: DMAC_OCR: .equ $05 ! 43: DMAC_SCR: .equ $06 ! 44: DMAC_CCR: .equ $07 ! 45: DMAC_MTC: .equ $0a ! 46: DMAC_MAR: .equ $0c ! 47: DMAC_DAR: .equ $14 ! 48: DMAC_NIV: .equ $25 ! 49: DMAC_EIV: .equ $27 ! 50: DMAC_MFC: .equ $29 ! 51: DMAC_DFC: .equ $31 ! 52: ! 53: PRINT .macro str ! 54: pea str ! 55: DOS _PRINT ! 56: addq.l #4,sp ! 57: .endm ! 58: ! 59: PUTCHAR .macro chr ! 60: move.w #chr,-(sp) ! 61: DOS _PUTCHAR ! 62: addq.l #2,sp ! 63: .endm ! 64: ! 65: .cpu 68000 ! 66: .list ! 67: .text ! 68: .even ! 69: start: ! 70: clr.l -(sp) ! 71: DOS _SUPER ! 72: addq.l #4,sp ! 73: ! 74: exg.l sp,sp ; ブレークポイント ! 75: bsr check_arg ! 76: bsr init ! 77: ! 78: move.l addr(pc),d0 ; アドレス表示 ! 79: lea.l addrbuf(pc),a0 ! 80: bsr hexstr_long ! 81: move.b #' ',(a0)+ ! 82: move.b #0,(a0) ! 83: PRINT addrbuf(pc) ! 84: ! 85: move.l addr(pc),a0 ! 86: ! 87: moveq.l #$1,d1 ! 88: bsr print_rw ! 89: PUTCHAR ' ' ! 90: moveq.l #$2,d1 ! 91: bsr print_rw ! 92: PUTCHAR ' ' ! 93: moveq.l #$5,d1 ! 94: bsr print_rw ! 95: PUTCHAR ' ' ! 96: moveq.l #$6,d1 ! 97: bsr print_rw ! 98: PRINT msg_crlf(pc) ! 99: ! 100: ; 後始末 ! 101: moveq.l #$68,d1 ! 102: move.l niv_backup(pc),a1 ! 103: IOCS _B_INTVCS ! 104: moveq.l #$69,d1 ! 105: move.l eiv_backup(pc),a1 ! 106: IOCS _B_INTVCS ! 107: ! 108: DOS _EXIT ! 109: ! 110: ; a0 (d1.B がFC) について読み書きした結果を表示する。 ! 111: ; 破壊 d2 ! 112: print_rw: ! 113: moveq.l #$80,d2 ! 114: bsr checkmem ! 115: bne @f ! 116: PUTCHAR 'R' ! 117: bra @@f ! 118: @@: ! 119: PUTCHAR '-' ! 120: @@: ! 121: ! 122: moveq.l #$00,d2 ! 123: bsr checkmem ! 124: bne @f ! 125: PUTCHAR 'W' ! 126: bra @@f ! 127: @@: ! 128: PUTCHAR '-' ! 129: @@: ! 130: rts ! 131: ! 132: ! 133: ; DMA でアクセス出来るかチェックする。 ! 134: ; d1.B はチェックする FC。 ! 135: ; d2.B は 0 なら書き込み、0x80 なら読み込み。 ! 136: ; a1.L はチェックするアドレス。 ! 137: ; a4 は DMA#2 のベースアドレス (グローバル変数) ! 138: ; アクセスできれば d0.L に 0 を返す。出来なければ非0 を返す。 ! 139: checkmem: ! 140: movem.l a0,-(sp) ! 141: ! 142: clr.b niv_occur ! 143: clr.b eiv_occur ! 144: ! 145: moveq.l #$11,d0 ; Word, ReqMax ! 146: or.b d2,d0 ; bit7 = DtoM/MtoD ! 147: move.b d0,DMAC_OCR(a4) ! 148: ! 149: move.w #$0001,DMAC_MTC(a4) ! 150: move.l a0,DMAC_DAR(a4) ! 151: lea.l buf(pc),a0 ! 152: move.l a0,DMAC_MAR(a4) ! 153: move.b d1,DMAC_DFC(a4) ! 154: move.b #$05,DMAC_MFC(a4) ! 155: move.b #$00,DMAC_CSR(a4) ; Clear status ! 156: move.b #$88,DMAC_CCR(a4) ; Start! ! 157: @@: ! 158: move.w niv_occur(pc),d0 ! 159: beq @b ; Wait until either niv/eiv occur ! 160: ! 161: movem.l (sp)+,a0 ! 162: moveq.l #0,d0 ! 163: move.b eiv_occur,d0 ! 164: rts ! 165: ! 166: ; 初期化 ! 167: init: ! 168: movem.l a0,-(sp) ! 169: movea.l #DMAC_ch2,a4 ! 170: ! 171: moveq.l #$68,d1 ; NIV 設定 ! 172: move.b d1,DMAC_NIV(a4) ! 173: lea.l niv_handler(pc),a1 ! 174: IOCS _B_INTVCS ! 175: move.l d0,niv_backup ! 176: ! 177: moveq.l #$69,d1 ; EIV 設定 ! 178: move.b d1,DMAC_EIV(a4) ! 179: lea.l eiv_handler(pc),a1 ! 180: IOCS _B_INTVCS ! 181: move.l d0,eiv_backup ! 182: ! 183: move.b #$08,DMAC_DCR(a4) ; DCR=16bit ! 184: move.b #$05,DMAC_SCR(a4) ; S++,D++ ! 185: movem.l (sp)+,a0 ! 186: rts ! 187: ! 188: niv_handler: ! 189: move.b #$10,DMAC_CCR(a4) ; Stop ! 190: move.b #$ff,DMAC_CSR(a4) ! 191: st niv_occur ! 192: rte ! 193: ! 194: eiv_handler: ! 195: move.b #$10,DMAC_CCR(a4) ; Stop ! 196: move.b #$ff,DMAC_CSR(a4) ! 197: st eiv_occur ! 198: rte ! 199: ! 200: ! 201: ; 引数のアドレスを addr に返す。 ! 202: ; a2 は引数の先頭 (先頭1バイトが長さ)。先頭の余分な空白はない。 ! 203: check_arg: ! 204: move.b (a2)+,d1 ; arglen ! 205: beq usage ! 206: movea.l a2,a0 ! 207: .dc.w $fe12 ; __STOH ! 208: bcs usage ! 209: move.l d0,addr ! 210: rts ! 211: ! 212: usage: ! 213: PRINT msg_usage(pc) ! 214: DOS _EXIT ! 215: ! 216: ! 217: msg_usage: ! 218: .dc.b "usage: <address>",$d,$a ! 219: .dc.b " Access an <address> with FC=1,2,5,6." ! 220: msg_crlf: ! 221: .dc.b $d,$a,0 ! 222: ! 223: .even ! 224: buf: ! 225: .ds.l 2 ! 226: addr: ! 227: .ds.l 1 ! 228: niv_backup: ! 229: .ds.l 1 ! 230: eiv_backup: ! 231: .ds.l 1 ! 232: .even ! 233: niv_occur: ! 234: .ds.b 1 ! 235: eiv_occur: ! 236: .ds.b 1 ! 237: addrbuf: ! 238: .ds.b 10 ! 239: ! 240: .end ! 241: ; vi:set ts=8:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.