summaryrefslogtreecommitdiff
path: root/main.s
diff options
context:
space:
mode:
authorAstrid Smith2011-10-31 00:26:51 -0700
committerAstrid Smith2011-10-31 00:26:51 -0700
commit58df7c903d62772c06ac5c8b1cc94d2f588953d1 (patch)
tree64d9b1db1157fd5f93ad5de1f4a62251f5f591f0 /main.s
parent555a832a8d8a26e81343ea059cbd39047134d864 (diff)
License clarification
Diffstat (limited to 'main.s')
-rw-r--r--main.s91
1 files changed, 1 insertions, 90 deletions
diff --git a/main.s b/main.s
index fe7ba7f..ad78bfd 100644
--- a/main.s
+++ b/main.s
@@ -83,96 +83,7 @@ emu_teardown:
rts
-|| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-|| _ __ ___ ___ _ __ ___ ___ _ __ _ _ |||||||||||||||||||||||||||
-|| | '_ ` _ \ / _ \ '_ ` _ \ / _ \| '__| | | | \\\\\\\\\\\\\\\\\\\\\\\\\\\
-|| | | | | | | __/ | | | | | (_) | | | |_| | |||||||||||||||||||||||||||
-|| |_| |_| |_|\___|_| |_| |_|\___/|_| \__, | ///////////////////////////
-|| of the virtual type |___/ |||||||||||||||||||||||||||
-|| =============================================JJJJJJJJJJJJJJJJJJJJJJJJJJJ
-
- || Take a virtual address in d1 and dereference it. Returns the
- || host address in a0. Destroys a0, d0.
-deref: | 76 cycles + 18 cycles for bsr
- | 20 bytes to inline, saves 34 cycles per call
- move.w d1,d0
- andi.w #0x3FFF,d0
- movea.w d0,a0
- move.w d1,d0
- andi.w #0xC000,d0 | Can cut this out by pre-masking the table.
- rol.w #4,d0
- adda.l deref_table(pc,d0.w),a0
- rts
-
-.even
-.data
-deref_table:
-mem_page_0: .long 0 | bank 0 / 0x0000
-mem_page_1: .long 0 | bank 1 / 0x4000
-mem_page_2: .long 0 | bank 2 / 0x8000
-mem_page_3: .long 0 | bank 3 / 0xc000
-
-.xdef mem_page_0
-.xdef mem_page_1
-.xdef mem_page_2
-.xdef mem_page_3
-
-mem_page_loc_0: .byte 0
-mem_page_loc_1: .byte 0
-mem_page_loc_2: .byte 0
-mem_page_loc_3: .byte 0
-
-.xdef mem_page_loc_0
-.xdef mem_page_loc_1
-.xdef mem_page_loc_2
-.xdef mem_page_loc_3
-
-pages: .long 0
-
-.xdef pages
-
-.text
-
- || Take a physical address in a0 and turn it into a virtual
- || address in d0
- || Destroys d0
-| XXX AFAICS, a1 is currently a scratch address register, so you can load deref_table in it, and then save some space:
-| But you may wish to use it for other purposes in the future, so you needn't integrate that immediately.
-
- || Guessing this is 300 cycles.
-underef:
- move.l d2,-(a7)
- lea deref_table(pc),a1
- move.l a0,d0
- clr.w d2
- sub.l (a1)+,d0
- bmi.s underef_not0
- cmpi.l #0x4000,d0
- bmi.s underef_thatsit
-underef_not0:
- move.l a0,d0
- move.w #0x4000,d2
- sub.l (a1)+,d0
- bmi.s underef_not1
- cmpi.l #0x4000,d0
- bmi.s underef_thatsit
-underef_not1:
- move.l a0,d0
- move.w #0x8000,d2
- sub.l (a1)+,d0
- bmi.s underef_not2
- cmpi.l #0x4000,d0
- bmi.s underef_thatsit
-underef_not2:
- move.w #0xc000,d2
- suba.l (a1)+,a0
- || if that fails too, well shit man!
- moveq #0,d0
-underef_thatsit:
- add.w d2,d0
- move.l (a7)+,d2
- rts
-
+.include "memory.s"
|| =========================================================================
|| instruction instruction instruction ================================