commit 439a7c2

d_m  ·  2026-03-21 19:38:31 +0000 UTC
parent c73dc05
Add scroll wheel display

Currently only supports scrolly; adding scrollx would not be hard.

Since Mouse/scrolly is a "transient" value displaying the port
always shows 0000. So this patch chooses to display the counter.
This is arguably misleading but makes it easier to show the rate
at which the scroll wheel receives 0001 and ffff events.

I left the overall alignment alone; please feel to adjust the
spacing and positioning to fit the ROM.
1 files changed,  +34, -0
+34, -0
 1@@ -10,6 +10,7 @@
 2 |000
 3 
 4 	@center/x $2 &y $2
 5+	@wheelposy $1 &lo $1
 6 
 7 |100
 8 
 9@@ -145,8 +146,32 @@
10 		.center/x LDZ2 #0018 SUB2 .Screen/x DEO2
11 		.center/y LDZ2 #0022 ADD2 .Screen/y DEO2
12 		#05ff ;small/icn #16 <draw-times> }
13+	( | wheel counter )
14+	.center/x LDZ2 #0047 ADD2 .Screen/x DEO2
15+	.center/y LDZ2 #0010 ADD2 .Screen/y DEO2
16+	.wheelposy/lo LDZ hex/<draw-byte>
17+	( | wheel )
18+	.center/x LDZ2 #0048 ADD2 .Screen/x DEO2
19+	.center/y LDZ2 #0020 ADD2 .Screen/y DEO2
20+	#05ff ;wheel/icns #16 <draw-times>
21+	#05ff ;wheel/icns #0010 ADD2 #16 <draw-times>
22+	#00 draw-wheel-points
23+	.wheelposy LDZ2k .Mouse/scrolly DEI2 ADD2 ROT STZ2
24+	#01 draw-wheel-points
25+	( | return )
26 	POP JMP2r
27 
28+@draw-wheel-points ( color -- )
29+	,&px STR .wheelposy LDZ2
30+	DUP2 #0010 ADD2
31+	/offset ( >> )
32+&offset ( wheelpos* -- )
33+	DUP2       #001f AND2 .center/x LDZ2 #0048 ADD2 /load .Screen/x DEO2
34+	#0018 ADD2 #001f AND2 .center/y LDZ2 #0020 ADD2 /load .Screen/y DEO2
35+	LIT [ &px $1 ] .Screen/pixel DEO JMP2r
36+&load ( offset* base* -- coord* )
37+	SWP2 ;wheel/offsets ADD2 LDA #00 SWP ADD2 JMP2r
38+
39 (
40 @|Generics )
41 
42@@ -291,3 +316,12 @@
43 	0018 2420 2020 2418 0038 2424 2424 2438
44 	001c 2020 3820 201c 001c 2020 3820 2020 ]
45 
46+( 16x16 base wheel image )
47+@wheel/icns [
48+	0718 2040 4080 8081 c030 0804 0402 0202
49+	8080 4040 2018 0700 0202 0404 0830 c000 ]
50+
51+( pt1=+0,+24, pt2=+16,+8 )
52+@wheel/offsets [
53+	07 08 09 0a 0b 0b 0c 0c 0c 0c 0c 0b 0b 0a 09 08
54+	07 06 05 04 03 03 02 02 02 02 02 03 03 04 05 06 ]