Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
Bringing labels  in line with https://github.com/8bitbubsy/pt2-clone before chasing down the bugs.
  • Loading branch information
stefandrissen committed May 25, 2024
1 parent dcb2b66 commit e82b272
Show file tree
Hide file tree
Showing 36 changed files with 149 additions and 130 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/obj/
/res/mods
/res/*
!/res/dos
10 changes: 5 additions & 5 deletions src/demo/demo.s
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ demo:
; print speed and tempo

ld hl,screen + screen.24.rows * 1 + 18
ld a,(speed)
ld a,(song.speed)
ld c,a
call print.hi.nibble
ld a,c
call print.lo.nibble

ld hl,(tempo)
ld hl,(song.bpm)
ld b,h
ld c,l ; bc = tempo
srl h
Expand Down Expand Up @@ -326,16 +326,16 @@ demo:
@wait.left:

ei ;just in case we're pausing
ld a,(tick)
ld a,(song.tick)
or a
jr nz,@wait.left

@not.left:

bit 4,c
jr nz,@not.right
ld a,(speed)
ld hl,tick
ld a,(song.speed)
ld hl,song.tick
ld (hl),a

@wait.right:
Expand Down
2 changes: 1 addition & 1 deletion src/demo/show.burst.s
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ show.burst:
;-------------------------------------------------------------------------------
@burst.interrupt:

ld a,(tick)
ld a,(song.tick)
or a
ret nz

Expand Down
10 changes: 5 additions & 5 deletions src/demo/show.pattern.s
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ print.percent:
; PATTERN TRACKER for MOD player

; runs off tracker frame interrupt
; only run when frame counter (tick) <> 0
; only run when frame counter (song.tick) <> 0

pattern.interrupt:

ld hl,(tick.fraction)
ld de,(tempo)
ld hl,(song.tick.fraction)
ld de,(song.bpm)
add hl,de
ld a,(speed)
ld a,(song.speed)
dec a
cp h

Expand All @@ -206,7 +206,7 @@ pattern.interrupt:
or a
jp z,@print.channel.4_3

ld a,(tick)
ld a,(song.tick)
or a
ret nz

Expand Down
2 changes: 1 addition & 1 deletion src/demo/show.samples.s
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ sample.cursors.interrupt:

; display cursors on sample name screen

ld a,(tick)
ld a,(song.tick)
or a
ret nz

Expand Down
8 changes: 4 additions & 4 deletions src/memory.i
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ vol.update: equ var + 40 ; when set do extra burst volume update
; burstplayer acts on changed value of c?.on.

countint: equ var + 41 ; user frame counter
tick.fraction: equ var + 42 ; 1/256 frame counter for tracker
tick: equ var + 43 ; frame counter for tracker
speed: equ var + 44 ; song speed in frames
tempo: equ var + 45 ; bpm speed (relative to 125)
song.tick.fraction: equ var + 42 ; 1/256 frame counter for tracker
song.tick: equ var + 43 ; frame counter for tracker
song.speed: equ var + 44 ; song speed in frames
song.bpm: equ var + 45 ; bpm speed (relative to 125)
song.position: equ var + 47 ; position in songtable (0-127)
pattern.num: equ var + 48 ; pattern being played (0-255)
pattern.row: equ var + 49 ; row being played (0-63)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
;---------------------------------------------------------------
; Extended Effect 1 - Fine Porta Up

ld a,(tick)
ld a,(song.tick)
or a
ret nz

ld a,0x0f
r1.119:
ld (porta_up.mask),a
r1.120:
jp effect.portamento_up
jp effect.portaUp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
;---------------------------------------------------------------
; Extended Effect 2 - Fine Porta Down

ld a,(tick)
ld a,(song.tick)
or a
ret nz

ld a,0x0f
r1.121:
ld (porta_down.mask),a
r1.122:
jp effect.portamento_down
jp effect.portaDown

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;---------------------------------------------------------------
; Extended Effect 6 - Jump Loop

ld a,(tick)
ld a,(song.tick)
or a
ret nz

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
ld l,a
jr nc,$+3
inc h
ld a,(tick)
ld a,(song.tick)
add a,l
ld l,a ;can't overflow
ld a,(hl)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;---------------------------------------------------------------
; Extended Effect A - Volume Fine Up

ld a,(tick)
ld a,(song.tick)
or a
ret nz

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;---------------------------------------------------------------
; Extended Effect B - Volume Fine Down

ld a,(tick)
ld a,(song.tick)
or a
ret nz

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ld a,(parameter)
and 0x0f
ld b,a
ld a,(tick)
ld a,(song.tick)
cp b
ret nz

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ld a,(parameter)
and 0x0f
ld b,a
ld a,(tick)
ld a,(song.tick)
cp b
ret nz

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;---------------------------------------------------------------
; Extended Effect E - Pattern Delay

ld a,(tick)
ld a,(song.tick)
or a
ret nz

Expand Down
2 changes: 1 addition & 1 deletion src/tracker/effect/0.arpeggio.s
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;---------------------------------------------------------------
; Effect 0 - Arpeggio
;---------------------------------------------------------------
ld a,(tick) ; [1-31]
ld a,(song.tick) ; [1-31]
ld h,table.arpeggio / 0x100 ; table on 256 boundary
ld l,a
ld a,(hl) ; -> a = tick mod 3
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

tonenochng:
@use.last.parameter:
wanted.per: equ $+1
wanted.period: equ $+1
ld de,0
ld a,d
or e
Expand Down Expand Up @@ -48,7 +48,7 @@
@reset.tone.portamento:
ld hl,0
r1.062:
ld (wanted.per),hl
ld (wanted.period),hl

@tone.set.period:
add hl,de
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
ld e,(hl)
inc l
ld d,(hl)
ld (tempo),de
ld (song.bpm),de

ret

@speed:
ld (speed),a
ld (song.speed),a

ret

8 changes: 4 additions & 4 deletions src/tracker/init.s
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
ld (rs.bp.page),a

;---------------------------------------------------------------------------
;set up the finetune tables
;set up the note period lookup table

ld hl,table.finetune
ld de,table.finetune + 1
ld hl,table.periods
ld de,table.periods + 1
ld bc,0x400 - 1
ld (hl),0xff
ldir
Expand All @@ -54,7 +54,7 @@

@loop:

ld h,table.finetune / 0x100
ld h,table.periods / 0x100
ld a,(de)
inc de
ld l,a
Expand Down
12 changes: 6 additions & 6 deletions src/tracker/install.mod.s
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
ld a,0
jr z,$+3 ; !!! length 1 word should also be no sample
dec a
ld (iy + st.sample),a ; -1 = no sample
ld (iy + st.sample),a ; 0 = no sample / -1 = sample

push hl

Expand Down Expand Up @@ -1188,7 +1188,7 @@ reset.song:
ld (hl),a ;update volume?

ld hl,0x500
ld (tick.fraction),hl
ld (song.tick.fraction),hl
call reset.speed

; ld (disable.pos),a ;no position jumping (temp)
Expand Down Expand Up @@ -1250,9 +1250,9 @@ reset.song:
reset.speed:

ld a,6
ld (speed),a
ld (song.speed),a
ld hl,0x100
ld (tempo),hl
ld (song.bpm),hl

ret

Expand All @@ -1267,9 +1267,9 @@ reset.list:
defb 0
defw c1 + period + 1
defb 0
defw c1 + wanted.per + 0
defw c1 + wanted.period + 0
defb 0
defw c1 + wanted.per + 1
defw c1 + wanted.period + 1
defb 0
defw c1 + porta_up.mask
defb 0xff
Expand Down
5 changes: 5 additions & 0 deletions src/tracker/tables/finetune.i
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

; C-1 C#1 D-1 D#1 E-1 F-1 F#1 G-1 G#1 A-1 A#1 B-1 Amiga
; C-2 C#2 D-2 D#2 E-2 F-2 F#2 G-2 G#2 A-2 A#2 B-2 Amiga
; C-3 C#3 D-3 D#3 E-3 F-3 F#3 G-3 G#3 A-3 A#3 B-3 Amiga
; C-4 C#4 D-4 D#4 E-4 F-4 F#4 G-4 G#4 A-4 A#4 B-4 PC

defw 856,808,762,720,678,640,604,570,538,508,480,453
defw 428,404,381,360,339,320,302,285,269,254,240,226
defw 214,202,190,180,170,160,151,143,135,127,120,113 ;tuning 0
Expand Down
Loading

0 comments on commit e82b272

Please sign in to comment.