Skip to content

Commit

Permalink
Round displayed percentages
Browse files Browse the repository at this point in the history
fixes Tempo can be shown incorrectly #24
  • Loading branch information
stefandrissen committed Oct 15, 2023
1 parent 6febc45 commit 2ddef55
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/demo.s
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,12 @@ demo:

ld hl,(tempo)
ld b,h
ld c,l
ld c,l ; bc = tempo
srl h
rr l
rr l ; hl = tempo / 2
srl h
rr l
adc hl,bc
rr l ; hl = tempo / 4
adc hl,bc ; hl = tempo + tempo / 4 (-> * 1.25)
ld b,h
ld c,l
ld hl,screen + screen.24.rows * 1 + 29
Expand Down
5 changes: 4 additions & 1 deletion src/demo/show.pattern.s
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ print.percent:
add hl,bc
add hl,hl ; * 10

ld a,h
ld a,h ; h = next digit, but unrounded
bit 7,l
jr z,$+3
inc a ; round up

ex de,hl
jr @print ; fraction (1%)
Expand Down
26 changes: 15 additions & 11 deletions src/tracker.s
Original file line number Diff line number Diff line change
Expand Up @@ -1508,11 +1508,7 @@ reset.song:

ld hl,0x500
ld (counter.fract),hl
ld a,h
inc a
ld (speed),a
ld hl,0x100
ld (tempo),hl
call reset.speed

; ld (disable.pos),a ;no position jumping (temp)

Expand Down Expand Up @@ -1565,6 +1561,16 @@ im.lmpr:
; ei
ret

;---------------------------------------------------------------
reset.speed:

ld a,6
ld (speed),a
ld hl,0x100
ld (tempo),hl

ret

reset.list:
defw c1+repeat+1
defb 0
Expand Down Expand Up @@ -1802,7 +1808,9 @@ vibrato.table:
defw 197,199,201,203,205,207,209,211 ; 96
defw 213,216,218,220,222,224,226,228 ;104
defw 230,232,234,236,238,240,242,244 ;112
defw 246,248,250,252,254,256,259,261 ;120
defw 246,248,250,252,254 ;120
defw 256 ;125 0x0100
defw 259,261 ;126
defw 263,265,267,269,271,273,275,277 ;128
defw 279,281,283,285,287,289,291,293 ;136
defw 295,297,300,302,304,306,308,310 ;144
Expand Down Expand Up @@ -2059,11 +2067,7 @@ tracker:

loop.time:

ld (hl),0
ld a,6 ;reset speed (new in 2.03)
ld (speed),a
ld hl,0x0100 ;and tempo
ld (tempo),hl
call reset.speed

play.status:
ld a,(disable.pos) ;0=keep repeating
Expand Down

0 comments on commit 2ddef55

Please sign in to comment.