Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASM68K branch improvements #65

Merged
merged 16 commits into from
May 13, 2023
Merged
34 changes: 17 additions & 17 deletions Macros.asm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ locVRAM: macro loc,controlport
if (narg=1)
move.l #($40000000+((loc&$3FFF)<<16)+((loc&$C000)>>14)),(vdp_control_port).l
else
move.l #($40000000+((loc&$3FFF)<<16)+((loc&$C000)>>14)),controlport
move.l #($40000000+((loc&$3FFF)<<16)+((loc&$C000)>>14)),\controlport
endc
endm

Expand All @@ -29,13 +29,13 @@ locVRAM: macro loc,controlport
; input: source, length, destination
; ---------------------------------------------------------------------------

writeVRAM: macro
writeVRAM: macro source,length,destination
lea (vdp_control_port).l,a5
move.l #$94000000+(((\2>>1)&$FF00)<<8)+$9300+((\2>>1)&$FF),(a5)
move.l #$96000000+(((\1>>1)&$FF00)<<8)+$9500+((\1>>1)&$FF),(a5)
move.w #$9700+((((\1>>1)&$FF0000)>>16)&$7F),(a5)
move.w #$4000+(\3&$3FFF),(a5)
move.w #$80+((\3&$C000)>>14),(v_vdp_buffer2).w
move.l #$94000000+(((length>>1)&$FF00)<<8)+$9300+((length>>1)&$FF),(a5)
move.l #$96000000+(((source>>1)&$FF00)<<8)+$9500+((source>>1)&$FF),(a5)
move.w #$9700+((((source>>1)&$FF0000)>>16)&$7F),(a5)
move.w #$4000+(destination&$3FFF),(a5)
move.w #$80+((destination&$C000)>>14),(v_vdp_buffer2).w
move.w (v_vdp_buffer2).w,(a5)
endm

Expand All @@ -44,13 +44,13 @@ writeVRAM: macro
; input: source, length, destination
; ---------------------------------------------------------------------------

writeCRAM: macro
writeCRAM: macro source,length,destination
lea (vdp_control_port).l,a5
move.l #$94000000+(((\2>>1)&$FF00)<<8)+$9300+((\2>>1)&$FF),(a5)
move.l #$96000000+(((\1>>1)&$FF00)<<8)+$9500+((\1>>1)&$FF),(a5)
move.w #$9700+((((\1>>1)&$FF0000)>>16)&$7F),(a5)
move.w #$C000+(\3&$3FFF),(a5)
move.w #$80+((\3&$C000)>>14),(v_vdp_buffer2).w
move.l #$94000000+(((length>>1)&$FF00)<<8)+$9300+((length>>1)&$FF),(a5)
move.l #$96000000+(((source>>1)&$FF00)<<8)+$9500+((source>>1)&$FF),(a5)
move.w #$9700+((((source>>1)&$FF0000)>>16)&$7F),(a5)
move.w #$C000+(destination&$3FFF),(a5)
move.w #$80+((destination&$C000)>>14),(v_vdp_buffer2).w
move.w (v_vdp_buffer2).w,(a5)
endm

Expand All @@ -73,9 +73,9 @@ fillVRAM: macro value,length,loc
; input: source, destination, width [cells], height [cells]
; ---------------------------------------------------------------------------

copyTilemap: macro source,loc,width,height
copyTilemap: macro source,destination,width,height
lea (source).l,a1
move.l #$40000000+((loc&$3FFF)<<16)+((loc&$C000)>>14),d0
locVRAM \destination,d0
moveq #width,d1
moveq #height,d2
bsr.w TilemapToVRAM
Expand Down Expand Up @@ -244,11 +244,11 @@ out_of_range: macro exit,pos
; ---------------------------------------------------------------------------

gotoSRAM: macro
move.b #1,($A130F1).l
move.b #1,($A130F1).l
endm

gotoROM: macro
move.b #0,($A130F1).l
move.b #0,($A130F1).l
endm

; ---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion _inc/HUD (part 2).asm
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Hud_ClrBonusLoop:


Hud_Lives:
hudVRAM $FBA0 ; set VRAM address
locVRAM $FBA0,d0 ; set VRAM address
moveq #0,d1
move.b (v_lives).w,d1 ; load number of lives
lea (Hud_10).l,a2
Expand Down
17 changes: 6 additions & 11 deletions _inc/HUD_Update.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

hudVRAM: macro loc
move.l #($40000000+((loc&$3FFF)<<16)+((loc&$C000)>>14)),d0
endm


HUD_Update:
tst.w (f_debugmode).w ; is debug mode on?
bne.w HudDebug ; if yes, branch
tst.b (f_scorecount).w ; does the score need updating?
beq.s @chkrings ; if not, branch

clr.b (f_scorecount).w
hudVRAM $DC80 ; set VRAM address
locVRAM $DC80,d0 ; set VRAM address
move.l (v_score).w,d1 ; load score
bsr.w Hud_Score

Expand All @@ -28,7 +23,7 @@ HUD_Update:

@notzero:
clr.b (f_ringcount).w
hudVRAM $DF40 ; set VRAM address
locVRAM $DF40,d0 ; set VRAM address
moveq #0,d1
move.w (v_rings).w,d1 ; load number of rings
bsr.w Hud_Rings
Expand Down Expand Up @@ -56,11 +51,11 @@ HUD_Update:
move.b #9,(a1) ; keep as 9

@updatetime:
hudVRAM $DE40
locVRAM $DE40,d0
moveq #0,d1
move.b (v_timemin).w,d1 ; load minutes
bsr.w Hud_Mins
hudVRAM $DEC0
locVRAM $DEC0,d0
moveq #0,d1
move.b (v_timesec).w,d1 ; load seconds
bsr.w Hud_Secs
Expand Down Expand Up @@ -105,13 +100,13 @@ HudDebug:

@notzero:
clr.b (f_ringcount).w
hudVRAM $DF40 ; set VRAM address
locVRAM $DF40,d0 ; set VRAM address
moveq #0,d1
move.w (v_rings).w,d1 ; load number of rings
bsr.w Hud_Rings

@objcounter:
hudVRAM $DEC0 ; set VRAM address
locVRAM $DEC0,d0 ; set VRAM address
moveq #0,d1
move.b (v_spritecount).w,d1 ; load "number of objects" counter
bsr.w Hud_Secs
Expand Down
6 changes: 3 additions & 3 deletions _inc/Pattern Load Cues.asm
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ PLC_GHZAnimals: dc.w ((PLC_GHZAnimalsend-PLC_GHZAnimals-2)/6)-1
; Pattern load cues - LZ animals
; ---------------------------------------------------------------------------
PLC_LZAnimals: dc.w ((PLC_LZAnimalsend-PLC_LZAnimals-2)/6)-1
plcm Nem_BlackBird, $B000 ; blackbird
plcm Nem_Penguin, $B000 ; penguin
plcm Nem_Seal, $B240 ; seal
PLC_LZAnimalsend:
; ---------------------------------------------------------------------------
Expand Down Expand Up @@ -330,7 +330,7 @@ PLC_SYZAnimals: dc.w ((PLC_SYZAnimalsend-PLC_SYZAnimals-2)/6)-1
; Pattern load cues - SBZ animals
; ---------------------------------------------------------------------------
PLC_SBZAnimals: dc.w ((PLC_SBZAnimalsend-PLC_SBZAnimals-2)/6)-1
plcm Nem_Rabbit, $B000 ; rabbit
plcm Nem_Rabbit, $B000 ; rabbit
plcm Nem_Chicken, $B240 ; chicken
PLC_SBZAnimalsend:
; ---------------------------------------------------------------------------
Expand All @@ -356,7 +356,7 @@ PLC_Ending: dc.w ((PLC_Endingend-PLC_Ending-2)/6)-1
endc
plcm Nem_Rabbit, $AA60 ; rabbit
plcm Nem_Chicken, $ACA0 ; chicken
plcm Nem_BlackBird, $AE60 ; blackbird
plcm Nem_Penguin, $AE60 ; penguin
plcm Nem_Seal, $B0A0 ; seal
plcm Nem_Pig, $B260 ; pig
plcm Nem_Flicky, $B4A0 ; flicky
Expand Down
2 changes: 1 addition & 1 deletion _incObj/26 Monitor (SolidSides subroutine).asm
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ loc_A4EA:
bcc.s loc_A4E2
moveq #-1,d1
rts
; End of function Obj26_SolidSides
; End of function Mon_SolidSides
4 changes: 2 additions & 2 deletions _incObj/89 Ending Sequence STH.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

EndSTH:
moveq #0,d0
move.b $24(a0),d0
move.b obRoutine(a0),d0
move.w ESth_Index(pc,d0.w),d1
if Revision=0
jmp ESth_Index(pc,d1.w)
Expand Down Expand Up @@ -58,4 +58,4 @@ ESth_GotoCredits:
bra.w DisplaySprite
else
rts
endc
endc
File renamed without changes.
14 changes: 7 additions & 7 deletions s1.sounddriver.asm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ UpdateMusic:
; loc_71BB2:
@skipfadein:
; DANGER! The following line only checks v_soundqueue0 and v_soundqueue1, breaking v_soundqueue2.
tst.w v_soundqueue0(a6) ; is a music or sound queued for played?
tst.w v_soundqueue0(a6) ; is a music or sound queued for playing?
beq.s @nosndinput ; if not, branch
jsr CycleSoundQueue(pc)
; loc_71BBC:
Expand Down Expand Up @@ -202,7 +202,7 @@ UpdateMusic:
@sfxpsgloop:
adda.w #TrackSz,a5
tst.b (a5) ; Is track playing? (TrackPlaybackControl)
bpl.s @sfxpsgnext ; Branch of not
bpl.s @sfxpsgnext ; Branch if not
jsr PSGUpdateTrack(pc)
; loc_71C22:
@sfxpsgnext:
Expand Down Expand Up @@ -420,7 +420,7 @@ NoteTimeoutUpdate:
subq.b #1,TrackNoteTimeout(a5) ; Update note fill timeout
bne.s @locret ; Return if it hasn't expired
bset #1,(a5) ; Put track at rest (TrackPlaybackControl)
tst.b TrackVoiceControl(a5) ; Is this a psg track?
tst.b TrackVoiceControl(a5) ; Is this a PSG track?
bmi.w @psgnoteoff ; If yes, branch
jsr FMNoteOff(pc)
addq.w #4,sp ; Do not return to caller
Expand Down Expand Up @@ -620,7 +620,7 @@ CycleSoundQueue:
cmp.b d3,d2 ; Is it a lower priority sound?
blo.s @nextinput ; Branch if yes
move.b d2,d3 ; Store new priority
move.b d1,v_sound_id(a6) ; Queue sound for play
move.b d1,v_sound_id(a6) ; Queue sound for playing
; loc_71F3E:
@nextinput:
dbf d4,@inputloop
Expand Down Expand Up @@ -781,7 +781,7 @@ Sound_PlayBGM:
lea v_music_fmdac_tracks(a6),a1
lea FMDACInitBytes(pc),a2
; loc_72098:
@bmg_fmloadloop:
@bgm_fmloadloop:
bset #7,(a1) ; Initial playback control: set 'track playing' bit (TrackPlaybackControl)
move.b (a2)+,TrackVoiceControl(a1) ; Voice control bits
move.b d4,TrackTempoDivider(a1)
Expand All @@ -791,10 +791,10 @@ Sound_PlayBGM:
moveq #0,d0
move.w (a4)+,d0 ; load DAC/FM pointer
add.l a3,d0 ; Relative pointer
move.l d0,TrackDataPointer(a1) ; Store track pointer
move.l d0,TrackDataPointer(a1) ; Store track pointer
move.w (a4)+,TrackTranspose(a1) ; load FM channel modifier
adda.w d6,a1
dbf d7,@bmg_fmloadloop
dbf d7,@bgm_fmloadloop

cmpi.b #7,2(a3) ; Are 7 FM tracks defined?
bne.s @silencefm6
Expand Down
18 changes: 5 additions & 13 deletions sonic.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3457,7 +3457,7 @@ SS_BGLoad:
lea (Eni_SSBg1).l,a0 ; load mappings for the birds and fish
move.w #$4051,d0
bsr.w EniDec
move.l #$50000001,d3
locVRAM $5000,d3
lea ($FF0080).l,a2
moveq #6,d7

Expand Down Expand Up @@ -3506,16 +3506,8 @@ loc_491C:
lea (Eni_SSBg2).l,a0 ; load mappings for the clouds
move.w #$4000,d0
bsr.w EniDec
lea ($FF0000).l,a1
move.l #$40000003,d0
moveq #$3F,d1
moveq #$1F,d2
bsr.w TilemapToVRAM
lea ($FF0000).l,a1
move.l #$50000003,d0
moveq #$3F,d1
moveq #$3F,d2
bsr.w TilemapToVRAM
copyTilemap $FF0000,$C000,$3F,$1F
copyTilemap $FF0000,$D000,$3F,$3F
rts
; End of function SS_BGLoad

Expand Down Expand Up @@ -8277,7 +8269,7 @@ SS_AniEmeraldSparks:
bne.s locret_1B60C
clr.l (a0)
clr.l 4(a0)
move.b #4,($FFFFD024).w
move.b #4,(v_player+obRoutine).w
move.w #sfx_SSGoal,d0
jsr (PlaySound_Special).l ; play special stage GOAL sound

Expand Down Expand Up @@ -8878,7 +8870,7 @@ Nem_Rabbit: incbin "artnem\Animal Rabbit.bin"
even
Nem_Chicken: incbin "artnem\Animal Chicken.bin"
even
Nem_BlackBird: incbin "artnem\Animal Blackbird.bin"
Nem_Penguin: incbin "artnem\Animal Penguin.bin"
even
Nem_Seal: incbin "artnem\Animal Seal.bin"
even
Expand Down