Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub_3EBA: ; CODE XREF: ROM:00003EA8p
- ori #$700,sr ; Enable interrupts.
- lea ($C00000).l,a5 ; Load the VDP data port into a5.
- lea 4(a5),a6 ; Load the VDP control port into a6.
- move.w (a6),d0 ; TODO IMPORTANT!
- lea ($FF0000).l,a0 ; Load the start of RAM into a0.
- move.w #$FFF,d0 ; Set to clear $4000 bytes.
- loc_3ED4: ; CODE XREF: sub_3EBA+1Cj
- clr.l (a0)+ ; Clear 4 bytes.
- dbf d0,loc_3ED4 ; Repeat $1000 times.
- lea loc_4278(pc),a0 ; Load the Sega screen VDP setup array address to a0 TODO - Check if it's exclusively for the SS.
- moveq #$12,d2 ; Set to write $13 registers.
- loc_3EE0: ; CODE XREF: sub_3EBA+28j
- move.w (a0)+,(a6) ; Write the first register into the VDP.
- dbf d2,loc_3EE0 ; Repeat for the others.
- move.l #$C0000000,($C00004).l ; Set the VDP to CRAM write.
- moveq #0,d0 ; Clear d0.
- moveq #$1F,d1 ; Set to clear 64 palettes.
- loc_3EF4: ; CODE XREF: sub_3EBA+3Cj
- move.l d0,(a5) ; Clear the first two palettes.
- dbf d0,loc_3EF4 ; Repeat for the rest.
- move.l #$40000010,(a6) ; Set the VDP to VSRAM write.
- moveq #0,d0 ; Clear d0.
- move.l d0,(a5) ; Clear 4 bytes of VSRAM.
- move.w #$8F01,(a6) ; Set the VDP auto increment to $01.
- move.l #$93FF94FF,(a6) ; Set the DMA data length to $FFFF.
- move.w #$9780,(a6) ; Set the VDP to DMA fill.
- move.l #$40000080,(a6) ; Set to VRAM DMA.
- move.w #0,(a5) ; Clear VRAM.
- loc_3F1C: ; CODE XREF: sub_3EBA+68j
- btst #1,1(a6) ; Is DMA still running?
- bne.s loc_3F1C ; If it is, branch.
- move.w #$8F02,(a6) ; Set the VDP auto increment back to $02.
- lea loc_42D6(pc),a0 ; Load the Nemesis-compressed art into a0. TODO IMPORTANT
- lea ($FF1000).l,a4 ; Load the RAM address to decompress the mappings to.
- bsr.w NemDectoRAM ; Decompress into a4.
- lea ($C00000).l,a5 ; Load the VDP data port into a5.
- lea 4(a5),a6 ; Load the VDP control port into a6.
- move.w #$187,d2 ; Set to clear $620 bytes of RAM.
- lea ($FF2000).l,a0 ; Load TODO.
- loc_3F4A: ; CODE XREF: sub_3EBA+92j
- clr.l (a0)+ ; Clear 4 bytes of RAM.
- dbf d2,loc_3F4A ; Repeat for the remaining bytes.
- moveq #1,d4 ; Load the first map tile for the Sega art.
- move.l #$800000,d0 ; Increment value to move down a set of tiles.
- move.l #$461C0003,d1 ; Move the VDP command to d1.
- moveq #1,d5 ; Set to repeat again for the next palette line.
- loc_3F60: ; CODE XREF: sub_3EBA+BEj
- moveq #1,d3 ; Set to draw 2 tiles down.
- loc_3F62: ; CODE XREF: sub_3EBA+B6j
- move.l d1,(a6) ; Set the VDP to VRAM write, $C61C (Plane A's mappings).
- moveq #$B,d2 ; Set to draw $C tiles across.
- loc_3F66: ; CODE XREF: sub_3EBA+B0j
- move.w d4,(a5) ; Load the first tile onto the screen.
- addq.w #1,d4 ; Load the next tile into d4.
- dbf d2,loc_3F66 ; Repeat for the entire horizontal set of tiles.
- add.l d0,d1 ; Increment down to the next set of tiles.
- dbf d3,loc_3F62 ; Repeat for the entire vertical set of tiles.
- ori.w #$2000,d4 ; Load the next (1st) palette line.
- dbf d5,loc_3F60 ; Repeat until finished.
- lea ($FFFF8400).w,a1 ; Load the palette buffer into a1.
- move.l #$EEE,d1 ; Set the first two colours to black and white.
- moveq #1,d3 ; Set to loop for the next palette line.
- loc_3F88: ; CODE XREF: sub_3EBA+D8j
- move.l d1,(a1)+ ; Write the black and white colours to the palette buffer.
- moveq #6,d2 ; Set to clear the rest of the palette line.
- loc_3F8C: ; CODE XREF: sub_3EBA+D4j
- clr.l (a1)+ ; Clear the next two colours.
- dbf d2,loc_3F8C ; Repeat until the first palette line is cleared.
- dbf d3,loc_3F88 ; Do the exact same with with the second palette line.
- move.w #1,($FF3108).l ; Set the pixel positioning routine as writing.
- lea loc_429E(pc),a0 ;
- lea ($FF3000).l,a1 ; TODO animated art buffer?
- move.l (a0)+,(a1)+ ;
- move.l (a0)+,(a1)+ ;
- moveq #-1,d1 ; Set d1 to $FFFFFFFF.
- moveq #$1E,d2 ; Set buffer size.
- loc_3FB0: ; CODE XREF: sub_3EBA+FCj
- move.w d1,(a1)
- lea 8(a1),a1 ; Load the next space.
- dbf d2,loc_3FB0 ; Repeat until finished.
- clr.l ($FFFFC420).w ; TODO
- andi #$F8FF,sr ; Disable interrupts.
- move.w #$8174,(a6) ; Enable display, VBlank and DMA.
- loc_3FC6: ; CODE XREF: sub_3EBA+15Cj
- moveq #$1F,d7 ; Set buffer size to check.
- lea ($FF3000).l,a6
- loc_3FCE: ; CODE XREF: sub_3EBA+12Ej
- tst.w (a6) ; Is it a valid entry?
- bmi.s loc_3FE4 ; If it isn't, skip
- move.w 2(a6),d0 ;
- bpl.s loc_3FE0
- ext.w d0
- move.w d0,2(a6)
- bra.s loc_3FE4
- ; ===========================================================================
- loc_3FE0: ; CODE XREF: sub_3EBA+11Cj
- bsr.w sub_4138
- ; bra.s * ; 3FE4
- loc_3FE4: ; CODE XREF: sub_3EBA+116j
- ; sub_3EBA+124j
- lea 8(a6),a6 ; Check the other entries.
- dbf d7,loc_3FCE
- ; bra.s *
- lea ($FF2000).l,a0 ; Load the plotted pixels buffer into a0.
- bsr.w sub_411E ; Dump onto the screen.
- bset #7,($FFFFC462).w ; Set to CRAM write.
- bsr.w WaitforVBlank ; Load black and white into palette line 0 and 1.
- ;bra.s *
- loc_4000: ; DATA XREF: ROM:00007E80o
- ; ROM:00007F50o
- move.b ($FFFFC421).w,d0
- or.b ($FFFFC423).w,d0
- andi.b #-$10,d0
- bne.w locret_411C
- tst.w ($FF3108).l ; Have all the pixels been dumped?
- bne.s loc_3FC6 ; If not, load the next pixel.
- lea ($FF1000).l,a0 ; Load the decompressed tiles into a0.
- bsr.w sub_411E ; Load into VRAM (Tiles are loaded over drawn pixels).
- moveq #$D,d7
- move.w #$111,d6
- moveq #0,d5
- loc_402A: ; CODE XREF: sub_3EBA+19Cj
- add.w d6,d5
- lea ($FFFF8404).w,a1
- moveq #$D,d2
- loc_4032: ; CODE XREF: sub_3EBA+17Ej
- move.w d5,$20(a1)
- move.w d5,(a1)+
- dbf d2,loc_4032
- bset #7,($FFFFC462).w
- bsr.w WaitforVBlank
- move.b ($FFFFC421).w,d0
- or.b ($FFFFC423).w,d0
- andi.b #-$10,d0
- bne.w locret_411C
- dbf d7,loc_402A
- lea ($FF310E).l,a1
- move.w #7,(a1)+
- move.w #$A,(a1)+
- move.w #$111,d4
- lea ($FFFF8404).w,a5
- moveq #$D,d7
- loc_4072: ; CODE XREF: sub_3EBA+23Ej
- cmpi.w #6,d7
- bcs.s loc_407E
- sub.w d4,(a5)
- sub.w d4,$20(a5)
- loc_407E: ; CODE XREF: sub_3EBA+1BCj
- lea Pal_SegaScreen(pc),a2
- lea ($FF310E).l,a3
- lea ($FFFF8408).w,a4
- moveq #1,d6
- loc_408E: ; CODE XREF: sub_3EBA+20Aj
- move.w (a3),d5
- subq.w #1,d5
- move.w d5,(a3)+
- movea.l a4,a1
- moveq #3,d2
- loc_4098: ; CODE XREF: sub_3EBA+1FAj
- ; sub_3EBA+202j
- addq.w #1,d5
- bmi.s loc_40BA
- cmpi.w #8,d5
- bcc.s loc_40BA
- move.w d5,d0
- add.w d0,d0
- move.w d0,d1
- add.w d0,d0
- add.w d0,d1
- movea.l a2,a0
- adda.w d1,a0
- move.l (a0)+,(a1)+
- move.w (a0)+,(a1)+
- dbf d2,loc_4098
- bra.s loc_40C0
- ; ===========================================================================
- loc_40BA: ; CODE XREF: sub_3EBA+1E0j
- ; sub_3EBA+1E6j
- addq.w #6,a1
- dbf d2,loc_4098
- loc_40C0: ; CODE XREF: sub_3EBA+1FEj
- lea $20(a4),a4
- dbf d6,loc_408E
- bset #7,($FFFFC462).w
- bsr.w WaitforVBlank
- move.b ($FFFFC421).w,d0
- or.b ($FFFFC423).w,d0
- andi.b #-$10,d0
- bne.w locret_411C
- bset #7,($FFFFC462).w
- bsr.w WaitforVBlank
- move.b ($FFFFC421).w,d0
- or.b ($FFFFC423).w,d0
- andi.b #-$10,d0
- dbf d7,loc_4072
- moveq #$3B,d7 ; ";"
- loc_40FE: ; CODE XREF: sub_3EBA+25Ej
- bset #7,($FFFFC462).w
- bsr.w WaitforVBlank
- move.b ($FFFFC421).w,d0
- or.b ($FFFFC423).w,d0
- andi.b #-$10,d0
- bne.w locret_411C
- dbf d7,loc_40FE
- locret_411C: ; CODE XREF: sub_3EBA+152j
- ; sub_3EBA+198j ...
- rts
- ; End of function sub_3EBA
- ; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
- sub_411E: ; CODE XREF: sub_3EBA+138p
- ; sub_3EBA+164p
- movea.l #$C00000,a1 ; Load the VDP control port into a1.
- move.w #$30F,d1 ; Set to dump $620 bytes into RAM.
- move.l #$40000000,4(a1) ; Set the VDP to VRAM write, $0000.
- loc_4130: ; CODE XREF: sub_411E+14j
- move.w (a0)+,(a1) ; Dump the first four pixels into VRAM.
- dbf d1,loc_4130 ; Repeat until finished.
- rts ; Return.
- ; End of function sub_411E
- ; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
- sub_4138: ; CODE XREF: sub_3EBA+126p
- clr.b ($FF3112).l
- move.w 6(a6),d5
- addq.w #4,d5
- andi.w #$E,d5
- moveq #4,d6
- bra.s loc_417C
- ; ===========================================================================
- loc_414C: ; CODE XREF: sub_4138+D2j
- dbf d6,loc_4174
- bclr #7,($FF3112).l
- beq.s loc_4168
- lea ($FF3100).l,a0
- movea.l a6,a1
- move.l (a0)+,(a1)+
- move.w (a0)+,(a1)+
- rts
- ; ===========================================================================
- loc_4168: ; CODE XREF: sub_4138+20j
- subq.w #1,($FF3108).l
- move.w #-1,(a6)
- rts
- ; ===========================================================================
- loc_4174: ; CODE XREF: sub_4138+14j
- subq.w #2,d5
- bcc.s loc_417C
- move.w #$E,d5
- loc_417C: ; CODE XREF: sub_4138+12j sub_4138+3Ej
- bsr.w sub_420E
- swap d5
- swap d6
- swap d7
- moveq #1,d0
- moveq #$F,d1
- move.w d2,d6
- lsr.w #1,d6
- bcs.s loc_4194
- moveq #$10,d0
- moveq #-$10,d1
- loc_4194: ; CODE XREF: sub_4138+56j
- move.w d0,d5
- move.w d1,d7
- move.w d3,d0
- lsl.w #2,d0
- add.w d0,d6
- add.w d4,d6
- lea ($FF1000).l,a0 ; bookmark
- move.b (a0,d6.w),d0
- and.w d7,d0
- cmp.b d5,d0
- bne.s loc_4204
- lea ($FF2000).l,a1 ; Load the plotted pixel buffer to a1.
- adda.w d6,a1 ; Get the correct offset to write to.
- move.b (a1),d0
- and.w d7,d0
- cmp.w d5,d0
- beq.s loc_4204
- or.b d5,(a1)
- bset #7,($FF3112).l
- bne.s loc_41E0
- swap d5
- move.w d5,6(a6)
- lea ($FF3100).l,a1
- move.w d2,(a1)+
- move.w d3,(a1)+
- move.w d4,(a1)+
- bra.s loc_4206
- ; ===========================================================================
- loc_41E0: ; CODE XREF: sub_4138+92j
- lea ($FF2FF8).l,a1
- addq.w #1,($FF3108).l
- loc_41EC: ; CODE XREF: sub_4138+BAj
- lea 8(a1),a1
- tst.w (a1)
- bpl.s loc_41EC
- move.w d2,(a1)+
- ori.w #-$100,d3
- move.w d3,(a1)+
- move.w d4,(a1)+
- swap d5
- move.w d5,(a1)+
- swap d5
- loc_4204: ; CODE XREF: sub_4138+76j sub_4138+86j
- swap d5
- loc_4206: ; CODE XREF: sub_4138+A6j
- swap d6
- swap d7
- bra.w loc_414C
- ; End of function sub_4138
- ; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
- sub_420E: ; CODE XREF: sub_4138+44p
- move.w 0(a6),d2
- move.w 2(a6),d3
- move.w 4(a6),d4
- jmp loc_421E(pc,d5.w)
- ; End of function sub_420E
- ; ===========================================================================
- loc_421E:
- bra.s loc_4230
- ; ===========================================================================
- bra.s loc_4232
- ; ===========================================================================
- bra.s loc_4236
- ; ===========================================================================
- bra.s loc_4238
- ; ===========================================================================
- bra.s loc_423C
- ; ===========================================================================
- bra.s loc_423E
- ; ===========================================================================
- bra.s loc_4240
- ; ===========================================================================
- bsr.s sub_424C
- bra.s loc_4240
- ; ===========================================================================
- loc_4230: ; CODE XREF: ROM:0000421Ej
- bra.s sub_424C
- ; ===========================================================================
- loc_4232: ; CODE XREF: ROM:00004220j
- bsr.s sub_424C
- bra.s loc_425C
- ; ===========================================================================
- loc_4236: ; CODE XREF: ROM:00004222j
- bra.s loc_425C
- ; ===========================================================================
- loc_4238: ; CODE XREF: ROM:00004224j
- bsr.s sub_426C
- bra.s loc_425C
- ; ===========================================================================
- loc_423C: ; CODE XREF: ROM:00004226j
- bra.s sub_426C
- ; ===========================================================================
- loc_423E: ; CODE XREF: ROM:00004228j
- bsr.s sub_426C
- loc_4240: ; CODE XREF: ROM:0000422Aj
- ; ROM:0000422Ej
- subq.w #1,d3
- bcc.s locret_424A
- moveq #7,d3
- subi.w #$180,d4
- locret_424A: ; CODE XREF: ROM:00004242j
- rts
- ; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
- sub_424C: ; CODE XREF: ROM:0000422Cp
- ; ROM:00004230j ...
- addq.w #1,d2
- cmpi.w #8,d2
- bcs.s locret_425A
- moveq #0,d2
- addi.w #$20,d4 ; " "
- locret_425A: ; CODE XREF: sub_424C+6j
- rts
- ; End of function sub_424C
- ; ===========================================================================
- loc_425C: ; CODE XREF: ROM:00004234j
- ; ROM:00004236j ...
- addq.w #1,d3
- cmpi.w #8,d3
- bcs.s locret_426A
- moveq #0,d3
- addi.w #$180,d4
- locret_426A: ; CODE XREF: ROM:00004262j
- rts
- ; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
- sub_426C: ; CODE XREF: ROM:00004238p
- ; ROM:0000423Cj ...
- subq.w #1,d2
- bcc.s locret_4276
- moveq #7,d2
- subi.w #$20,d4 ; " "
- locret_4276: ; CODE XREF: sub_426C+2j
- rts
- ; End of function sub_426C
- ; FOR REFERENCE
- ;
- loc_429E:
- dc.l $00010001
- dc.l $00200002
Advertisement
Add Comment
Please, Sign In to add comment