Skip to content

Commit

Permalink
Add palette split and z80 stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
hansbonini committed Jul 10, 2024
1 parent 12fcc3a commit 88f4ca2
Show file tree
Hide file tree
Showing 43 changed files with 2,855 additions and 3,227 deletions.
4,367 changes: 1,169 additions & 3,198 deletions Altered Beast.asm

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,27 @@ BUILD_DIR := $(WORKSPACE)/build
GFX_DIR := $(WORKSPACE)/gfx
ROM_DIR := $(WORKSPACE)/rom
TOOLS_DIR := $(WORKSPACE)/tools
Z80_DIR := $(WORKSPACE)/z80
RETROARCH_DIR := $(TOOLS_DIR)/RetroArch-Win64

# Tooling
GO := go run
ASM68K := $(TOOLS_DIR)/asm68k/asm68k.exe
ASM68K_SWITCHES ?= /m /p /k
GO := go run
SEGARD_DECOMP := $(TOOLS_DIR)/segard/decomp.go
SHA1CHECK := $(TOOLS_DIR)/checksum/sha1.go
RETROARCH := $(RETROARCH_DIR)/retroarch.exe
RETROARCH_CORE_BLASTEM := $(RETROARCH_DIR)/cores/blastem_libretro.dll
RETROARCH_CORE_GPGX := $(RETROARCH_DIR)/cores/genesis_plus_gx_libretro.dll
RETROARCH_CORE_PICODRIVE := $(RETROARCH_DIR)/cores/picodrive_libretro.dll
SJASMPLUS := $(TOOLS_DIR)/sjasmplus/sjasmplus.exe

all: extract build
build: assemble sha1
assemble:
build: z80_assemble 68k_assemble sha1
z80_assemble:
$(SJASMPLUS) --raw="$(Z80_DIR)/pcm_driver/pcm_driver1.bin" --lst="$(Z80_DIR)/pcm_driver/pcm_driver1.txt" "$(Z80_DIR)/pcm_driver/pcm_driver1.asm"
$(SJASMPLUS) --raw="$(Z80_DIR)/pcm_driver/pcm_driver2.bin" --lst="$(Z80_DIR)/pcm_driver/pcm_driver2.txt" "$(Z80_DIR)/pcm_driver/pcm_driver2.asm"
68k_assemble:
$(ASM68K) $(ASM68K_SWITCHES) "$(NAME).asm","$(BUILD_DIR)/$(NAME) ($(REGION)) ($(VERSION)) [!].bin",,"$(BUILD_DIR)/$(NAME) ($(REGION)) ($(VERSION)) [!].txt"
sha1:
$(GO) $(SHA1CHECK) "$(BUILD_DIR)/$(NAME) ($(REGION)) ($(VERSION)) [!].bin" $(SHA1)
Expand Down
4 changes: 2 additions & 2 deletions includes/helpers/load_pcm.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ load_pcm: ; CODE XREF: play_sound+6 j
move.w (a5)+,d0
movea.l (a5),a5
move.w (unk_FFFE1E).w,d7
move.w #$100,(IO_Z80BUS).l
move.w #$100,(IO_Z80BUS).l ; Send the Z80 a bus request
loc_4A12: ; CODE XREF: play_sound+80 j
btst #0,(IO_Z80BUS).l
btst #0,(IO_Z80BUS).l ; Give the Z80 the bus back
bne.s loc_4A12
lea (Z80_RAM).l,a6
loc_4A22: ; CODE XREF: play_sound+A8 j
Expand Down
6 changes: 3 additions & 3 deletions includes/helpers/write_z80ram_1d03.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ write_z80ram_1d03: ; CODE XREF: ROM:00004F52 j
; ROM:00008D12 j ...
tst.w (dword_FFFE1A).w
bne.s loc_4AEC
move.w #$100,(IO_Z80BUS).l
move.w #$100,(IO_Z80BUS).l ; Send the Z80 a bus request
loc_4AD4: ; CODE XREF: write_z80ram_1d03+16 j
btst #0,(IO_Z80BUS).l
btst #0,(IO_Z80BUS).l ; Give the Z80 the bus back
bne.s loc_4AD4
move.b d7,(byte_A01D03).l
move.w #0,(IO_Z80BUS).l
move.w #0,(IO_Z80BUS).l ; Give the Z80 the bus back
loc_4AEC: ; CODE XREF: write_z80ram_1d03+4 j
move.b d7,(unk_FFFE20).w
rts
Expand Down
6 changes: 3 additions & 3 deletions includes/helpers/write_z80ram_1d05.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ write_z80ram_1d05: ; CODE XREF: ROM:00000382 p
; ROM:0000039C p ...
tst.l (dword_FFFE1A).w
bne.s locret_4B40
move.w #$100,(IO_Z80BUS).l
move.w #$100,(IO_Z80BUS).l ; Send the Z80 a bus request
loc_4B28: ; CODE XREF: write_z80ram_1d05+16 j
btst #0,(IO_Z80BUS).l
btst #0,(IO_Z80BUS).l ; Give the Z80 the bus back
bne.s loc_4B28
move.b d7,(byte_A01D05).l
move.w #0,(IO_Z80BUS).l
move.w #0,(IO_Z80BUS).l ; Give the Z80 the bus back
locret_4B40: ; CODE XREF: write_z80ram_1d05+4 j
rts
; End of function write_z80ram_1d05
6 changes: 3 additions & 3 deletions includes/helpers/write_z80ram_1d06.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ write_z80ram_1d06: ; CODE XREF: ROM:00000F82 p
; ROM:00004D36 p ...
tst.l (dword_FFFE1A).w
bne.s locret_4B18
move.w #$100,(IO_Z80BUS).l
move.w #$100,(IO_Z80BUS).l ; Send the Z80 a bus request
loc_4B00: ; CODE XREF: write_z80ram_1d06+16 j
btst #0,(IO_Z80BUS).l
btst #0,(IO_Z80BUS).l ; Give the Z80 the bus back
bne.s loc_4B00
move.b d7,(byte_A01D06).l
move.w #0,(IO_Z80BUS).l
move.w #0,(IO_Z80BUS).l ; Give the Z80 the bus back
locret_4B18: ; CODE XREF: write_z80ram_1d06+4 j
rts
; End of function write_z80ram_1d06
4 changes: 2 additions & 2 deletions includes/interrupts.asm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ off_20: dc.l Reserv3F
dc.l Reserv3F
dc.l Reserv3F
dc.l Reserv3F
dc.l Reserv3F
off_40: dc.l Reserv3F
dc.l Reserv3F
dc.l Reserv3F
dc.l Reserv3F
Expand Down Expand Up @@ -66,7 +66,7 @@ off_AC: dc.l Trap15
dc.l Reserv3F
dc.l Reserv3F
dc.l Reserv3F
dc.l Reserv3F
off_F0: dc.l Reserv3F
dc.l Reserv3F
dc.l Reserv3F
off_FC: dc.l Reserv3F
18 changes: 9 additions & 9 deletions includes/interrupts/reset.asm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Reset: ; DATA XREF: ROM:00000004 o
move.b (IO_PCBVER+1).l,d0
andi.b #$F,d0
beq.s loc_A5EA
beq.s SkipSecurity
move.l #'SEGA',(IO_TMSS).l
loc_A5EA: ; CODE XREF: Reset+A j
SkipSecurity: ; CODE XREF: Reset+A j
bsr.w vdp_setup
movea.l #RomEnd,a0
move.l (a0),d1
Expand All @@ -15,21 +15,21 @@ loc_A5EA: ; CODE XREF: Reset+A j
subq.w #1,d2
swap d1
moveq #0,d0
loc_A60A: ; CODE XREF: Reset+38 j
ChecksumLoop: ; CODE XREF: Reset+38 j
; Reset+3C j
add.w (a0)+,d0
dbf d2,loc_A60A
dbf d1,loc_A60A
dbf d2,ChecksumLoop
dbf d1,ChecksumLoop
cmp.w (Checksum).w,d0
beq.s loc_A632
beq.s ChecksumOk
bsr.w vdp_setup
loc_A61E: ; CODE XREF: Reset+5C j
ChecksumError: ; CODE XREF: Reset+5C j
move.l #$C0000000,(VDP_CTRL).l ; DO_WRITE_TO_CRAM_AT_$0000_ADDR
; DO_OPERATION_WITHOUT_DMA
move.w #$E00,(VDP_DATA).l
bra.s loc_A61E
bra.s ChecksumError
; ---------------------------------------------------------------------------
loc_A632: ; CODE XREF: Reset+44 j
ChecksumOk: ; CODE XREF: Reset+44 j
btst #6,(IO_EXT_CTRL+1).l
bne.w loc_A668
lea (unk_FFFE00).w,a6
Expand Down
2 changes: 1 addition & 1 deletion includes/palettes/00008EBE.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pal_8EBE: dc.b $62 ; index
; DATA XREF: ROM:off_8EA2 o
; DATA XREF: ROM:pallist_8EA2 o
dc.b 6 ; size
dc.w $EE, $CE, $AE, $8E, $6E, $4E, $E; colors
2 changes: 1 addition & 1 deletion includes/palettes/00008F22.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pal_8F22: dc.b $42 ; index
; DATA XREF: ROM:off_8F06 o
; DATA XREF: ROM:pallist_8F06 o
dc.b 6 ; size
dc.w $400, $600, $800, $A00, $C00, $E20, $E40; colors
2 changes: 1 addition & 1 deletion includes/palettes/00009D7A.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pal_9D7A: dc.b $60 ; index
; DATA XREF: ROM:0000924E o
; ROM:off_9CE0 o
; ROM:pallist_9CE0 o
dc.b $F ; size
dc.w $848, $848, $848, $848, $848, $848, $848, $848, $848; colors
dc.w $848, $848, $848, $848, $848, $848, $848; colors
4 changes: 4 additions & 0 deletions includes/palettes/00009F6C.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pal_9F6C: dc.w $EC0, $EA0, $E80, $E60, $E40, $E20, $E00, $C00, $A00
; DATA XREF: draw_segalogo+DC o
dc.w $800, $600, $800, $A00, $C00, $E00, $E20, $E40, $E60
dc.w $E80, $EA0
4 changes: 4 additions & 0 deletions includes/palettes/00009F94.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pal_9F94: dc.w 0, $EEE, $EC0, $EA0, $E80, $E60, $E40, $E20, $E00
; DATA XREF: draw_segalogo+46 o
dc.w $C00, $A00, $800, $600
dcb.w 3,0
4 changes: 4 additions & 0 deletions includes/palettes/0000AD54.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pal_AD54: dc.b 8 ; index
; DATA XREF: sub_AB86+40 o
dc.b 2 ; size
dc.w 0, $EE, $E ; colors
4 changes: 4 additions & 0 deletions includes/palettes/0000AD5C.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pal_AD5C: dc.b $48 ; index
; DATA XREF: sub_AB86+4A o
dc.b 2 ; size
dc.w 0, $EE, $8E ; colors
6 changes: 6 additions & 0 deletions includes/palettes/0000B7CE.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pal_B7CE: dc.b 2 ; index
; DATA XREF: ROM:0000B5DC o
; RAM:off_FFB16C o
dc.b $D ; size
dc.w 0, $248, $46A, $68E, $8AE, $AEE, $AAA, 0, $248, $46A; colors
dc.w $68E, $8AE, $AEE, $CCC; colors
6 changes: 6 additions & 0 deletions includes/palettes/0000B7EC.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pal_B7EC: dc.b 2 ; index
; DATA XREF: ROM:0000B2BC t
; ROM:0000B2CA t ...
dc.b $D ; size
dc.w $EEE, $ACC, $688, $466, $EEC, 0, $8C6, $6A4, $482; colors
dc.w $260, $AA, $A68, $806, $EE; colors
5 changes: 5 additions & 0 deletions includes/palettes/0000B80A.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pal_B80A: dc.b 2 ; index
; DATA XREF: ROM:0000B74E o
dc.b $D ; size
dc.w $640, $840, $A60, $C80, $CA0, $EC0, $EE0, 6, 8, $C; colors
dc.w $E, $8E, $AE, $EE ; colors
5 changes: 5 additions & 0 deletions includes/palettes/0000B828.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pal_B828: dc.b 2 ; index
; DATA XREF: ROM:0000B6CC o
dc.b $D ; size
dc.w $E8E, $CEE, $ACC, $8AA, $688, $466, $244, $AEE, $8CC; colors
dc.w $6AA, $488, $266, $A0A, $C; colors
5 changes: 5 additions & 0 deletions includes/palettes/0000B846.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pal_B846: dc.b 2 ; index
; DATA XREF: ROM:0000B7C0 o
dc.b $D ; size
dc.w $EEE, $CCC, $AAA, $888, $666, $444, 0, $EE, $CE, $AE; colors
dc.w $6E, $2E, 0, $E ; colors
5 changes: 5 additions & 0 deletions includes/palettes/0000B864.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pal_B864: dc.b 0 ; index
; DATA XREF: ROM:0000B574 o
dc.b $E ; size
dc.w $E77, $EE, $8C, $48, $A48, $C6A, $E8C, $266, $488; colors
dc.w $8CC, $666, $AAA, $EEE, 0, $BE; colors
5 changes: 5 additions & 0 deletions includes/palettes/0000B884.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pal_B884: dc.b 0 ; index
; DATA XREF: ROM:0000B5F2 o
dc.b $E ; size
dc.w $22, $EE, $AA, $66, $A48, $C6A, $E8C, $266, $488; colors
dc.w $8CC, $888, $AAA, $EEE, 0, $E; colors
5 changes: 5 additions & 0 deletions includes/palettes/0000B8A4.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pal_B8A4: dc.b 0 ; index
; DATA XREF: ROM:0000B664 o
dc.b $E ; size
dc.w 4, $EE, $8C, $48, $A48, $C6A, $E8C, $266, $488, $8CC; colors
dc.w $888, $AAA, $EEE, 0, $E; colors
5 changes: 5 additions & 0 deletions includes/palettes/0000B8C4.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pal_B8C4: dc.b 0 ; index
; DATA XREF: ROM:0000B6DE o
dc.b $E ; size
dc.w 0, $EE, $8C, $66, $A48, $C6A, $E8C, $266, $488, $8CC; colors
dc.w $666, $AAA, $EEE, 0, $E; colors
5 changes: 5 additions & 0 deletions includes/palettes/0000B8E4.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pal_B8E4: dc.b 0 ; index
; DATA XREF: ROM:0000B760 o
dc.b $E ; size
dc.w $6A6, $EE, $8C, $48, $A48, $C6A, $E8C, $266, $488; colors
dc.w $8CC, $666, $AAA, $EEE, 0, $E; colors
5 changes: 5 additions & 0 deletions includes/palettes/0000B904.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pal_B904: dc.b $34 ; index
; DATA XREF: ROM:0000B578 o
; ROM:0000B5F6 o ...
dc.b 5 ; size
dc.w $ECA, $C86, $864, $642, $E, $C00; colors
5 changes: 5 additions & 0 deletions includes/palettes/0000B912.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pal_B912: dc.b $54 ; index
; DATA XREF: ROM:0000B57C o
; ROM:0000B5FA o ...
dc.b 4 ; size
dc.w $48C, $26A, $48, $26, $EE; colors
4 changes: 4 additions & 0 deletions includes/palettes/0000BCB4.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pal_BCB4: dc.b $42 ; index
; DATA XREF: ROM:0000BC72 o
dc.b 6 ; size
dc.w 0, $EE, $CE, $AE, $8E, $6E, 8; colors
7 changes: 7 additions & 0 deletions includes/palettes/0000BCC4.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pal_BCC4: dc.b 0 ; index
; DATA XREF: ROM:0000BC7A o
dc.b $1F ; size
dc.w $686, $686, $686, $686, $686, $686, $686, $686, $686; colors
dc.w $686, $686, $686, $686, $686, $686, $686, 0, $EC0; colors
dc.w $CA0, $C80, $C60, $840, $420, $400, $EC0, $CA0, $C80; colors
dc.w $C60, $840, $420, 0, 0; colors
4 changes: 4 additions & 0 deletions includes/palettes/0000BD06.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pal_BD06: dc.b $22 ; index
; DATA XREF: ROM:0000BAB8 o
dc.b 3 ; size
dc.w $E, $C, $C, $C ; colors
4 changes: 4 additions & 0 deletions includes/palettes/0000BD10.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pal_BD10: dc.b $22 ; index
; DATA XREF: ROM:0000BAC4 o
dc.b 3 ; size
dc.w $EC0, $CA0, $C80, $C60; colors
4 changes: 4 additions & 0 deletions includes/palettes/0000BD1A.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pal_BD1A: dc.b 2 ; index
; DATA XREF: sub_BA42+6 o
dc.b 6 ; size
dc.w $888, $686, $686, $686, $686, $686, $686; colors
3 changes: 3 additions & 0 deletions includes/palettes/0000BD2A.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pal_BD2A: dc.b 2 ; index
dc.b 6 ; size
dc.w $AAA, $8A8, $686, $686, $686, $686, $464; colors
3 changes: 3 additions & 0 deletions includes/palettes/0000BD3A.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pal_BD3A: dc.b 2 ; index
dc.b 6 ; size
dc.w $CCC, $ACA, $8A8, $686, $686, $464, $242; colors
3 changes: 3 additions & 0 deletions includes/palettes/0000BD4A.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pal_BD4A: dc.b 2 ; index
dc.b 6 ; size
dc.w $EEE, $CEC, $ACA, $8A8, $464, $242, $20; colors
5 changes: 5 additions & 0 deletions includes/palettes/0000BD5A.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pal_BD5A: dc.b 2 ; index
; DATA XREF: ROM:0000BA78 o
dc.b $A ; size
dc.w $EE0, $CE0, $AC0, $8A0, $460, $240, $20, $EA6, $C84; colors
dc.w $A62, $840 ; colors
2 changes: 1 addition & 1 deletion includes/vdp_setup.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vdp_setup: ; CODE XREF: Reset:loc_A5EA p
vdp_setup: ; CODE XREF: Reset:SkipSecurity p
; Reset+46 p ...
lea (vdpregs_A892).l,a0
moveq #$10,d0
Expand Down
Loading

0 comments on commit 88f4ca2

Please sign in to comment.