X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hexed%2Fhexed.s;h=99d1c084e39c9e66d3e453546c15246a453d3198;hb=ee7bd6b03730c9caeee249adf71c868b9a6d96c3;hp=b999de1d8f509d06c7c79cf3e2a9c1814e7ebf4b;hpb=8689c962a08dd52e25725851316aa51a7e22d432;p=megadrive.git diff --git a/hexed/hexed.s b/hexed/hexed.s index b999de1..99d1c08 100644 --- a/hexed/hexed.s +++ b/hexed/hexed.s @@ -1,6 +1,6 @@ ############################################################################### # -# Copyright (c) 2009, Gražvydas Ignotas +# Copyright (c) 2009,2011 Gražvydas Ignotas # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -14,10 +14,10 @@ # names of its contributors may be used to endorse or promote products # derived from this software without specific prior written permission. # -# THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY +# THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +# DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND @@ -215,6 +215,9 @@ safe_addrs: dc.l 0xa13000, 0xa130ff safe_addrs_end: +sizeof_bin: + dc.l _edata + txt_edit: .ascii "- edit -\0" txt_a_confirm: @@ -259,8 +262,45 @@ txt_exc: main: /* make sure io port 2 is doing inputs */ move.b #0,(0xa1000b).l - /* mask irqs during init */ + /* make sure irqs are masked */ move.w #0x2700,sr + /* take care of TMSS */ + move.b (0xa10000).l,d0 + andi.b #0x0f,d0 + beq no_tmss + move.l #0x53454741,(0xa14000).l + /* want cart, not OS rom if cart pops in */ + move.w #1,(0xa14100).l + /* touch VDP after TMSS setup? */ + tst.w (0xc00004).l +no_tmss: + + /* want to do early PC transfer (with RAM/VRAM intact and such)? + * also give time PC to see start condition */ + move.l #0x2000,d0 +0: dbra d0,0b + + move.l #0xa10005,a0 + btst.b #5,(a0) + bne no_early_transfer +move.b #1,(0) + move.b #0x40,(0xa1000b).l /* port 2 ctrl */ + move.b #0x00,(a0) /* port 2 data - start with TH low */ + move.l #0x2000,d0 +0: + btst.b #4,(a0) + beq do_early_transfer + dbra d0,0b + +move.b #2,(0) + move.b #0,(0xa1000b).l + bra no_early_transfer /* timeout */ + +do_early_transfer: +move.b #9,(0) + bsr do_transfer + +no_early_transfer: .if COPY_TO_EXP /* copy to expansion device if magic number is set */ @@ -269,7 +309,8 @@ main: bne 0f move.l #0,a0 - move.w #0x2000/8-1,d0 + move.l (sizeof_bin,pc),d0 + lsr.l #3,d0 1: move.l (a0)+,(a1)+ move.l (a0)+,(a1)+ @@ -286,7 +327,8 @@ main: /* copy, assume 8K size */ move.l #0xFF0100,a1 - move.w #0x2000/8-1,d0 + move.l (sizeof_bin,pc),d0 + lsr.l #3,d0 1: move.l (a0)+,(a1)+ move.l (a0)+,(a1)+ @@ -443,6 +485,7 @@ no_auto_transfer: lea (jumptab,pc,d0),a0 jmp (a0) jumptab: + /* branch insns here because we want to be position independent */ bra mode_main bra mode_val_input bra mode_edit_val /* edit val in editor */ @@ -1311,7 +1354,8 @@ wait_tl_low0: bne wait_tl_low0 menu_text txt_working, 13, 13, 0 - bra do_transfer + bsr do_transfer + bra return_to_main # go back to main mode return_to_main: