Skip to content

Commit 78f02fc

Browse files
Benchmark: Don't overflow meter if over 16MHz
The Benchmark accessory uses VBL to gauge the processor speed. The Virtual ][ emulator version 13.0 decouples VBL from emulation speed, which is neat; at "high" speed, you can see the CPU runs faster than 1MHz (I see it vary between 0.8MHz and 2MHz). At "maximum" speed it is way faster than 16MHz, which was overflowing the progress meter! Add a clamp so that the meter never mis-paints, even at this ludicrious speed.
1 parent 7fd19b0 commit 78f02fc

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Project Page: https://github.com/a2stuff/a2d
8080
* Refresh windows if 12/24-hour setting changes. ([#835](https://github.com/a2stuff/a2d/issues/835))
8181
* Refresh windows if date changes. ([#843](https://github.com/a2stuff/a2d/issues/843))
8282
* International: Add "first day of week" setting.
83+
* Benchmark: Don't overflow meter if over 16MHz.
8384
* New DA (in Extras): "Screenshot" - saves screenshot file to application directory.
8485
* New DA (in Extras): "DOS33.Import" - allows importing files from DOS 3.3 disks.
8586
* New DA (in Control Panels): "Views" - allows setting the default view style.

src/desk.acc/benchmark.s

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ pattern_right:
155155
.byte %11111111
156156
.byte %10111011
157157
.byte %11111111
158+
pattern_plaid:
159+
.byte %01011010
160+
.byte %11111111
161+
.byte %01011010
162+
.byte %01011010
163+
.byte %01011010
164+
.byte %11111111
165+
.byte %01011010
166+
.byte %01011010
158167

159168
DEFINE_POINT pt_tick, 0, kMeterTop + kMeterHeight + 2
160169
DEFINE_POINT pt_tickdelta, 0, 2
@@ -349,6 +358,8 @@ done: jmp InputLoop
349358
;;; ============================================================
350359

351360
.proc UpdateMeter
361+
MGTK_CALL MGTK::SetPattern, pattern_left
362+
352363
jsr ProbeSpeed
353364

354365
copy16 counter, progress_muldiv_params::numerator
@@ -360,11 +371,18 @@ done: jmp InputLoop
360371
END_IF
361372

362373
MGTK_CALL MGTK::MulDiv, progress_muldiv_params
374+
375+
;; Max out the meter
376+
cmp16 progress_muldiv_params::result, #kMeterWidth
377+
IF_GE
378+
copy16 #kMeterWidth, progress_muldiv_params::result
379+
MGTK_CALL MGTK::SetPattern, pattern_plaid
380+
END_IF
381+
363382
add16 meter_left::x1, progress_muldiv_params::result, meter_left::x2
364383
add16 meter_left::x2, #1, meter_right::x1
365384

366385
MGTK_CALL MGTK::SetPenMode, pencopy
367-
MGTK_CALL MGTK::SetPattern, pattern_left
368386
MGTK_CALL MGTK::PaintRect, meter_left
369387
MGTK_CALL MGTK::SetPattern, pattern_right
370388
MGTK_CALL MGTK::PaintRect, meter_right

0 commit comments

Comments
 (0)