vice-emu-commit Mailing List for VICE (Page 4)
Versatile Commodore Emulator
Brought to you by:
blackystardust,
gpz
You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
(38) |
May
(60) |
Jun
(122) |
Jul
(148) |
Aug
(178) |
Sep
(151) |
Oct
(131) |
Nov
(208) |
Dec
(129) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(193) |
Feb
(209) |
Mar
(221) |
Apr
(243) |
May
(165) |
Jun
(168) |
Jul
(198) |
Aug
(161) |
Sep
(103) |
Oct
(98) |
Nov
(168) |
Dec
(99) |
| 2010 |
Jan
(263) |
Feb
(156) |
Mar
(57) |
Apr
(93) |
May
(85) |
Jun
(124) |
Jul
(57) |
Aug
(58) |
Sep
(113) |
Oct
(148) |
Nov
(114) |
Dec
(193) |
| 2011 |
Jan
(200) |
Feb
(207) |
Mar
(91) |
Apr
(91) |
May
(142) |
Jun
(104) |
Jul
(115) |
Aug
(137) |
Sep
(266) |
Oct
(91) |
Nov
(85) |
Dec
(186) |
| 2012 |
Jan
(98) |
Feb
(146) |
Mar
(160) |
Apr
(99) |
May
(59) |
Jun
(257) |
Jul
(84) |
Aug
(103) |
Sep
(169) |
Oct
(206) |
Nov
(90) |
Dec
(296) |
| 2013 |
Jan
(294) |
Feb
(130) |
Mar
(36) |
Apr
(14) |
May
(51) |
Jun
(74) |
Jul
(180) |
Aug
(85) |
Sep
(26) |
Oct
(45) |
Nov
(29) |
Dec
(21) |
| 2014 |
Jan
(56) |
Feb
(40) |
Mar
(57) |
Apr
(30) |
May
(31) |
Jun
(11) |
Jul
(107) |
Aug
(135) |
Sep
(142) |
Oct
(195) |
Nov
(139) |
Dec
(133) |
| 2015 |
Jan
(293) |
Feb
(161) |
Mar
(146) |
Apr
(85) |
May
(139) |
Jun
(51) |
Jul
(21) |
Aug
(24) |
Sep
(29) |
Oct
(136) |
Nov
(212) |
Dec
(118) |
| 2016 |
Jan
(119) |
Feb
(165) |
Mar
(229) |
Apr
(219) |
May
(134) |
Jun
(119) |
Jul
(134) |
Aug
(236) |
Sep
(203) |
Oct
(215) |
Nov
(300) |
Dec
(140) |
| 2017 |
Jan
(188) |
Feb
(20) |
Mar
(147) |
Apr
(198) |
May
(26) |
Jun
(21) |
Jul
(67) |
Aug
(219) |
Sep
(209) |
Oct
(194) |
Nov
(144) |
Dec
(99) |
| 2018 |
Jan
(139) |
Feb
(122) |
Mar
(116) |
Apr
(85) |
May
(232) |
Jun
(181) |
Jul
(190) |
Aug
(105) |
Sep
(92) |
Oct
(178) |
Nov
(105) |
Dec
(86) |
| 2019 |
Jan
(119) |
Feb
(79) |
Mar
(74) |
Apr
(117) |
May
(115) |
Jun
(307) |
Jul
(107) |
Aug
(131) |
Sep
(103) |
Oct
(60) |
Nov
(118) |
Dec
(70) |
| 2020 |
Jan
(114) |
Feb
(103) |
Mar
(77) |
Apr
(121) |
May
(193) |
Jun
(110) |
Jul
(214) |
Aug
(210) |
Sep
(179) |
Oct
(260) |
Nov
(237) |
Dec
(334) |
| 2021 |
Jan
(163) |
Feb
(186) |
Mar
(58) |
Apr
(81) |
May
(108) |
Jun
(175) |
Jul
(154) |
Aug
(180) |
Sep
(217) |
Oct
(204) |
Nov
(232) |
Dec
(190) |
| 2022 |
Jan
(253) |
Feb
(134) |
Mar
(229) |
Apr
(190) |
May
(125) |
Jun
(70) |
Jul
(8) |
Aug
(22) |
Sep
(19) |
Oct
(33) |
Nov
(94) |
Dec
(164) |
| 2023 |
Jan
(158) |
Feb
(366) |
Mar
(272) |
Apr
(109) |
May
(198) |
Jun
(226) |
Jul
(200) |
Aug
(94) |
Sep
(108) |
Oct
(62) |
Nov
(175) |
Dec
(116) |
| 2024 |
Jan
(35) |
Feb
(40) |
Mar
(51) |
Apr
(89) |
May
(24) |
Jun
(26) |
Jul
(53) |
Aug
(71) |
Sep
(23) |
Oct
(11) |
Nov
(22) |
Dec
(58) |
| 2025 |
Jan
(26) |
Feb
(40) |
Mar
(107) |
Apr
(39) |
May
(35) |
Jun
(20) |
Jul
(11) |
Aug
(24) |
Sep
(35) |
Oct
(20) |
Nov
|
Dec
|
|
From: <gp...@us...> - 2025-08-06 18:10:14
|
Revision: 45725
http://sourceforge.net/p/vice-emu/code/45725
Author: gpz
Date: 2025-08-06 18:10:13 +0000 (Wed, 06 Aug 2025)
Log Message:
-----------
add test prgram to show pot sample jitter/artefacts, related to bug #2159
Added Paths:
-----------
testprogs/SID/paddlescope/
testprogs/SID/paddlescope/Makefile
testprogs/SID/paddlescope/plotter.asm
testprogs/SID/paddlescope/plotter.prg
testprogs/SID/paddlescope/readme.txt
Added: testprogs/SID/paddlescope/Makefile
===================================================================
--- testprogs/SID/paddlescope/Makefile (rev 0)
+++ testprogs/SID/paddlescope/Makefile 2025-08-06 18:10:13 UTC (rev 45725)
@@ -0,0 +1,8 @@
+
+all: plotter.prg
+
+plotter.prg: plotter.asm
+ acme --cpu 6510 -f cbm -o plotter.prg plotter.asm
+
+clean:
+ $(RM) plotter.prg
Added: testprogs/SID/paddlescope/plotter.asm
===================================================================
--- testprogs/SID/paddlescope/plotter.asm (rev 0)
+++ testprogs/SID/paddlescope/plotter.asm 2025-08-06 18:10:13 UTC (rev 45725)
@@ -0,0 +1,190 @@
+bitmap = $2000
+vram = $0400
+
+xposlo = $fa
+xposhi = $fb
+
+linecount = $02
+
+
+ *= $0801
+ !byte $0c,$08,$0b,$00,$9e
+ !byte $32,$30,$36,$34
+ *= $0810
+
+ lda #0
+ sta $d020
+ sta $d021
+
+ jsr initplot
+
+ jmp doplot
+
+initplot:
+ ldy #13
+--
+ ldx #0
+ lda #$1b
+-
+ lda clearline,x
+clearaddr=*+1
+ sta vram,x
+ lda clearline2,x
+clearaddr2=*+1
+ sta vram+40,x
+ inx
+ cpx #40
+ bne -
+
+ lda clearaddr
+ clc
+ adc #40*2
+ sta clearaddr
+ bcc +
+ inc clearaddr+1
++
+ lda clearaddr2
+ clc
+ adc #40*2
+ sta clearaddr2
+ bcc +
+ inc clearaddr2+1
++
+ dey
+ bne --
+
+ lda #0
+ ldy #$20
+ ldx #0
+-
+bitmaphiaddr=*+2
+ sta bitmap,x
+ inx
+ bne -
+ inc bitmaphiaddr
+ dey
+ bne -
+
+ lda #$3b
+ sta $d011
+ lda #$18
+ sta $d018
+
+ lda #0
+ sta xposlo
+ sta xposhi
+
+ rts
+;-------------------------------------------------------------------------------
+
+
+paddlereg = $d419
+
+doplot:
+
+ ; get line address
+ ldx linecount
+ inx
+ cpx #(25*8)
+ bne +
+ ldx #0
++ stx linecount
+
+ lda bitmaphi,x
+ sta lineaddr+1
+ lda bitmaplo,x
+ sta lineaddr+0
+
+ clc
+ lda lineaddr+0
+ adc #<(20*8)
+ sta lineaddr2+0
+ lda lineaddr+1
+ adc #>(20*8)
+ sta lineaddr2+1
+
+ ; clear the line
+ ldx #0
+-
+ lda #0
+lineaddr=*+1
+ sta bitmap + (0 * 8),x
+lineaddr2=*+1
+ sta bitmap + (20 * 8),x
+; txa
+; clc
+; adc #8
+; tax
+; cpx #(20*8)
+ lda add8,x
+ tax
+ bne -
+
+ ; plot the plot
+ lda paddlereg
+ tax
+ and #%11111000
+ clc
+ adc lineaddr+0
+ sta lineaddr3+0
+
+ lda #0
+ adc lineaddr+1
+ sta lineaddr3+1
+
+ lda bitmapbits,x
+
+lineaddr3=*+1
+ sta bitmap + (0 * 8)
+
+ jmp doplot
+
+;-------------------------------------------------------------------------------
+
+clearline:
+ !byte $10,$1b,$10,$1b,$16,$1e,$16,$1e,$16,$1e
+ !byte $16,$0d,$05,$0d,$05,$0d,$05,$0d,$05,$0d
+ !byte $05,$0d,$05,$0d,$05,$0d,$05,$0d,$05,$1e
+ !byte $16,$1e,$16,$1e,$16,$1e,$10,$1b,$10,$1b
+clearline2:
+ !byte $1b,$10,$1b,$10,$1e,$16,$1e,$16,$1e,$16
+ !byte $1e,$05,$0d,$05,$0d,$05,$0d,$05,$0d,$05
+ !byte $0d,$05,$0d,$05,$0d,$05,$0d,$05,$0d,$16
+ !byte $1e,$16,$1e,$16,$1e,$16,$1b,$10,$1b,$10
+
+!align 255,0
+
+bitmapbits:
+ !for n, 0, 31 {
+ !byte %10000000
+ !byte %01000000
+ !byte %00100000
+ !byte %00010000
+ !byte %00001000
+ !byte %00000100
+ !byte %00000010
+ !byte %00000001
+ }
+
+!align 255,0
+
+bitmaphi:
+ !for n, 0, 199 {
+ !byte >(bitmap+32+(((n / 8) * 320) + (n & 7)))
+ }
+
+!align 255,0
+
+bitmaplo:
+ !for n, 0, 199 {
+ !byte <(bitmap+32+(((n / 8) * 320) + (n & 7)))
+ }
+
+!align 255,0
+add8:
+ !for n, 0, 151 {
+ !byte <(n+8)
+ }
+ !for n, 152, 255 {
+ !byte 0
+ }
Added: testprogs/SID/paddlescope/plotter.prg
===================================================================
(Binary files differ)
Index: testprogs/SID/paddlescope/plotter.prg
===================================================================
--- testprogs/SID/paddlescope/plotter.prg 2025-08-03 20:10:04 UTC (rev 45724)
+++ testprogs/SID/paddlescope/plotter.prg 2025-08-06 18:10:13 UTC (rev 45725)
Property changes on: testprogs/SID/paddlescope/plotter.prg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/x-commodore-exec
\ No newline at end of property
Added: testprogs/SID/paddlescope/readme.txt
===================================================================
--- testprogs/SID/paddlescope/readme.txt (rev 0)
+++ testprogs/SID/paddlescope/readme.txt 2025-08-06 18:10:13 UTC (rev 45725)
@@ -0,0 +1,26 @@
+
+This program continuously samples the POT value from port 1 ($d419) and shows
+a scatter plot of the values.
+
+
+- Each Square is 8 pixel wide, ie 8 values
+
+- The blue area marks the full range, ie values 0-255
+
+- The green area (approximately) marks the range used by the 1351 mouse
+
+
+Observations:
+
+- When a paddle is connected, the value jitters gradually more with higher
+ values. Very low values have almost no jitter, very high values jitter around
+ 6 values or so.
+
+- When a mouse is connected, the value is very precise over the full range,
+ only the LSB jitters.
+
+- With both regular paddles and the 1351 mouse, occasional semi-random (usually
+ much too large) values can be observed. This happens, because the program
+ does _not_ disable interrupts, and the keyboard scanner uses $dc00, which will
+ select the other joystick port for a short time, and mess up the sampling.
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-08-03 20:10:06
|
Revision: 45724
http://sourceforge.net/p/vice-emu/code/45724
Author: gpz
Date: 2025-08-03 20:10:04 +0000 (Sun, 03 Aug 2025)
Log Message:
-----------
fix access of open bus when minimon is active, partial fix for #2152
Modified Paths:
--------------
trunk/vice/src/vic20/cart/minimon.c
trunk/vice/src/vic20/cart/vic20cartmem.c
Modified: trunk/vice/src/vic20/cart/minimon.c
===================================================================
--- trunk/vice/src/vic20/cart/minimon.c 2025-08-02 14:54:31 UTC (rev 45723)
+++ trunk/vice/src/vic20/cart/minimon.c 2025-08-03 20:10:04 UTC (rev 45724)
@@ -317,27 +317,37 @@
static uint8_t minimon_io2_read(uint16_t addr)
{
+ if (minimon_bios_type == CARTRIDGE_FILETYPE_NONE) {
+ return (0x9800 + (addr & 0x3ff)) >> 8; /* open bus */
+ }
return minimon_rom[0x000 + (addr & 0x3ff)];
}
static uint8_t minimon_io3_read(uint16_t addr)
{
+ if (minimon_bios_type == CARTRIDGE_FILETYPE_NONE) {
+ return (0x9a00 + (addr & 0x3ff)) >> 8; /* open bus */
+ }
return minimon_rom[0x400 + (addr & 0x3ff)];
}
static void minimon_io2_write(uint16_t addr, uint8_t value)
{
- if (minimon_pgm_enabled) {
- minimon_rom[0x000 + (addr & 0x3ff)] = value;
- minimon_bios_changed = 1;
+ if (minimon_bios_type != CARTRIDGE_FILETYPE_NONE) {
+ if (minimon_pgm_enabled) {
+ minimon_rom[0x000 + (addr & 0x3ff)] = value;
+ minimon_bios_changed = 1;
+ }
}
}
static void minimon_io3_write(uint16_t addr, uint8_t value)
{
- if (minimon_pgm_enabled) {
- minimon_rom[0x400 + (addr & 0x3ff)] = value;
- minimon_bios_changed = 1;
+ if (minimon_bios_type != CARTRIDGE_FILETYPE_NONE) {
+ if (minimon_pgm_enabled) {
+ minimon_rom[0x400 + (addr & 0x3ff)] = value;
+ minimon_bios_changed = 1;
+ }
}
}
@@ -467,6 +477,7 @@
}
/* FIXME: load new image */
+ log_warning(LOG_DEFAULT, "FIXME: load minimon image on resource change");
return 0;
}
@@ -800,6 +811,11 @@
{
/* FIXME */
int ret = -1;
+
+ if (minimon_bios_type == CARTRIDGE_FILETYPE_NONE) {
+ log_warning(LOG_DEFAULT, "Flush: no minimon image attached");
+ return 0;
+ }
if (minimon_bios_changed && minimon_bios_write) {
if (minimon_bios_type == CARTRIDGE_FILETYPE_CRT) {
ret = minimon_crt_save(minimon_image_filename);
Modified: trunk/vice/src/vic20/cart/vic20cartmem.c
===================================================================
--- trunk/vice/src/vic20/cart/vic20cartmem.c 2025-08-02 14:54:31 UTC (rev 45723)
+++ trunk/vice/src/vic20/cart/vic20cartmem.c 2025-08-03 20:10:04 UTC (rev 45724)
@@ -392,9 +392,13 @@
/* "Slot 0" */
if (minimon_cart_enabled()) {
+
if ((res = minimon_blk5_read(addr, &value)) == CART_READ_VALID) {
return value;
}
+ /* open bus value, in case no cartridge is attached to pass through */
+ vic20_cpu_last_data = (addr >> 8);
+ printf("cartridge_read_blk5 %02x %04x\n", vic20_cpu_last_data, addr);
}
/* main slot */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-08-02 14:54:33
|
Revision: 45723
http://sourceforge.net/p/vice-emu/code/45723
Author: gpz
Date: 2025-08-02 14:54:31 +0000 (Sat, 02 Aug 2025)
Log Message:
-----------
use 16 bits for the cached sample value, should fix #2142
Modified Paths:
--------------
trunk/vice/src/plus4/ted-sound.c
Modified: trunk/vice/src/plus4/ted-sound.c
===================================================================
--- trunk/vice/src/plus4/ted-sound.c 2025-08-01 23:38:39 UTC (rev 45722)
+++ trunk/vice/src/plus4/ted-sound.c 2025-08-02 14:54:31 UTC (rev 45723)
@@ -47,6 +47,10 @@
/* #define DEBUG_TEDSOUND */
#ifdef DEBUG_TEDSOUND
+#pragma GCC diagnostic warning "-O3"
+#pragma GCC diagnostic warning "-Wall"
+#pragma GCC diagnostic warning "-Wextra"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
#define DBG(x) log_printf x
#else
#define DBG(x)
@@ -178,7 +182,7 @@
uint8_t voice0_cached_output;
uint8_t voice1_cached_output;
- uint8_t digital_cached_output;
+ uint16_t digital_cached_output;
uint32_t oscStep;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-08-01 23:38:41
|
Revision: 45722
http://sourceforge.net/p/vice-emu/code/45722
Author: gpz
Date: 2025-08-01 23:38:39 +0000 (Fri, 01 Aug 2025)
Log Message:
-----------
convert the DTV userport ps/2 mouse to a regular userport device, and make it work again. extra work is needed to make it generally work for all emulators
Modified Paths:
--------------
trunk/vice/doc/vice.texi
trunk/vice/src/Makefile.am
trunk/vice/src/c64dtv/c64dtv-resources.c
trunk/vice/src/c64dtv/c64dtv.c
trunk/vice/src/c64dtv/c64dtvcia2.c
trunk/vice/src/c64dtv/c64dtvmem.c
trunk/vice/src/joyport/mouse.c
trunk/vice/src/userport/Makefile.am
trunk/vice/src/userport/userport.c
trunk/vice/src/userport/userport.h
Added Paths:
-----------
trunk/vice/src/userport/userport_ps2mouse.c
trunk/vice/src/userport/userport_ps2mouse.h
Removed Paths:
-------------
trunk/vice/src/ps2mouse.c
trunk/vice/src/ps2mouse.h
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/doc/vice.texi 2025-08-01 23:38:39 UTC (rev 45722)
@@ -8750,6 +8750,9 @@
@item 26
@tab PET Userport diagnostic pin
@tab xpet
+@item 27
+@tab Userport PS/2 Mouse
+@tab x64dtv
@end multitable
@table @code
@@ -14010,15 +14013,13 @@
The C64DTV userport emulation currently supports three devices:
Hummer ADC, userport joystick and PS/2 mouse.
-The joystick that controls either the Hummer ADC or userport joystick
-can be selected using the same parameter or menu option. (Enable "Hummer userport
-adapter" and use the first extra joystick.)
+The Hummer ADC will be always enabled when a "Hummer" model is selected.
While using the Hummer ADC, joystick UP and DOWN are mapped to
the Hummer buttons A and B respectively. LEFT and RIGHT set the ADCs
output to 0 and 255. Centering the joystick results in the ADC value of 128.
-Currently the Hummer ADC and userport joystick are mutually exclusive.
+The Hummer ADC and userport joystick are mutually exclusive.
This means that enabling one disables the other. PS/2 mouse emulation
can be used simultaneously with either Hummer ADC or userport joystick.
@@ -14030,12 +14031,6 @@
Enable/Disable Hummer ADC
(@code{HummerADC=1}, @code{HummerADC=0}).
-@findex -ps2mouse, +ps2mouse
-@item -ps2mouse
-@itemx +ps2mouse
-Enable/disable PS/2 mouse on userport
-(@code{ps2mouse=1}, @code{ps2mouse=0}).
-
@end table
@@ -14144,10 +14139,6 @@
@item HummerADC
Boolean to enable/disable the Hummer ADC emulation.
-@vindex ps2mouse
-@item ps2mouse
-Boolean to enable/disable PS/2 Mouse emulation.
-
@vindex DtvBlitterLog
@item DtvBlitterLog
Boolean, enables Blitter logging.
Modified: trunk/vice/src/Makefile.am
===================================================================
--- trunk/vice/src/Makefile.am 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/src/Makefile.am 2025-08-01 23:38:39 UTC (rev 45722)
@@ -241,7 +241,6 @@
plus4ui.h \
profiler.h \
profiler_data.h \
- ps2mouse.h \
r65c02.h \
ram.h \
rawfile.h \
@@ -345,10 +344,6 @@
zfile.c \
zipcode.c
-
-ps2mouse_sources = \
- ps2mouse.c
-
midi_sources = \
midi.c
@@ -854,7 +849,7 @@
$(hotkeys_lib) \
$(zmbv_lib)
-x64dtv_SOURCES = $(base_sources) $(ps2mouse_sources)
+x64dtv_SOURCES = $(base_sources)
x64dtv_LDADD = $(x64dtv_libs) $(emu_extlibs) @TFE_LIBS@ @NETPLAY_LIBS@ $(X64DTV_RES)
x64dtv_DEPENDENCIES = $(x64dtv_libs)
if HAVE_DEBUG
Modified: trunk/vice/src/c64dtv/c64dtv-resources.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtv-resources.c 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/src/c64dtv/c64dtv-resources.c 2025-08-01 23:38:39 UTC (rev 45722)
@@ -34,7 +34,7 @@
#include "c64rom.h"
#include "cartridge.h"
#include "hummeradc.h"
-#include "ps2mouse.h"
+#include "userport_ps2mouse.h"
#include "kbd.h"
#include "keyboard.h"
#include "lib.h"
Modified: trunk/vice/src/c64dtv/c64dtv.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtv.c 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/src/c64dtv/c64dtv.c 2025-08-01 23:38:39 UTC (rev 45722)
@@ -88,7 +88,7 @@
#include "parallel.h"
#include "printer.h"
#include "protopad.h"
-#include "ps2mouse.h"
+#include "userport_ps2mouse.h"
#include "resources.h"
#include "rushware_keypad.h"
#include "sampler.h"
Modified: trunk/vice/src/c64dtv/c64dtvcia2.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtvcia2.c 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/src/c64dtv/c64dtvcia2.c 2025-08-01 23:38:39 UTC (rev 45722)
@@ -48,7 +48,7 @@
#include "lib.h"
#include "log.h"
#include "maincpu.h"
-#include "ps2mouse.h"
+#include "userport_ps2mouse.h"
#include "types.h"
#include "userport.h"
#include "vicii.h"
@@ -56,18 +56,11 @@
void cia2_store(uint16_t addr, uint8_t data)
{
if ((addr & 0x1f) == 1) {
- /* HACK: for now only call the userport system when ps/2 mouse is disabled */
- if (!ps2mouse_enabled) {
- store_userport_pbx(data, USERPORT_NO_PULSE);
- }
+ store_userport_pbx(data, USERPORT_NO_PULSE);
if (c64dtv_hummer_adc_enabled) {
hummeradc_store(data);
}
- /* FIXME: convert ps/2 mouse support to new userport system */
- if (ps2mouse_enabled) {
- ps2mouse_store(data);
- }
}
ciacore_store(machine_context.cia2, addr, data);
@@ -78,15 +71,8 @@
uint8_t retval = 0xff;
if ((addr & 0x1f) == 1) {
- /* HACK: for now only call the userport system when ps/2 mouse is disabled */
- if (!ps2mouse_enabled) {
- retval = read_userport_pbx(retval);
- }
+ retval = read_userport_pbx(retval);
- /* FIXME: convert ps/2 mouse support to new userport system */
- if (ps2mouse_enabled) {
- retval &= (ps2mouse_read() | 0x3f);
- }
if (c64dtv_hummer_adc_enabled) {
retval &= (hummeradc_read() | 0xf8);
}
Modified: trunk/vice/src/c64dtv/c64dtvmem.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtvmem.c 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/src/c64dtv/c64dtvmem.c 2025-08-01 23:38:39 UTC (rev 45722)
@@ -49,7 +49,7 @@
#include "interrupt.h"
#include "alarm.h"
#include "hummeradc.h"
-#include "ps2mouse.h"
+#include "userport_ps2mouse.h"
/* TODO this is a hack */
#define C64_RAM_SIZE 0x200000
Modified: trunk/vice/src/joyport/mouse.c
===================================================================
--- trunk/vice/src/joyport/mouse.c 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/src/joyport/mouse.c 2025-08-01 23:38:39 UTC (rev 45722)
@@ -51,6 +51,7 @@
#include "archdep.h"
#include "cmdline.h"
#include "joyport.h"
+#include "log.h"
#include "machine.h"
#include "maincpu.h"
#include "mouse.h"
@@ -145,6 +146,7 @@
{
*x = (int16_t)mouse_x;
*y = (int16_t)mouse_y;
+ DBG(("mouse_get_raw_int16 %d, %d", *x, *y));
}
void mouse_get_last_int16(int16_t *x, int16_t *y)
Deleted: trunk/vice/src/ps2mouse.c
===================================================================
--- trunk/vice/src/ps2mouse.c 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/src/ps2mouse.c 2025-08-01 23:38:39 UTC (rev 45722)
@@ -1,554 +0,0 @@
-/*
- * ps2mouse.c -- PS/2 mouse on userport emulation
- *
- * Written by
- * Hannu Nuotio <han...@tu...>
- * Based on code by
- * Andreas Boose <vic...@t-...>
- *
- * This file is part of VICE, the Versatile Commodore Emulator.
- * See README for copyright notice.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA.
- *
- */
-
-#include "vice.h"
-
-#include "cmdline.h"
-#include "resources.h"
-#include "log.h"
-#include "ps2mouse.h"
-#include "alarm.h"
-#include "maincpu.h"
-#include "mousedrv.h"
-
-static void mouse_button_left(int pressed);
-static void mouse_button_right(int pressed);
-static void mouse_button_middle(int pressed);
-static void mouse_button_up(int pressed);
-static void mouse_button_down(int pressed);
-
-static log_t ps2mouse_log = LOG_DEFAULT;
-
-#if 0
-#define PS2MOUSE_DEBUG(args ...) log_message(ps2mouse_log, args)
-#define PS2MOUSE_DEBUG_ENABLED
-#endif
-
-/* PS/2 mouse port bits */
-#define PS2_CLK_BIT 0x40
-#define PS2_DATA_BIT 0x80
-
-/* PS/2 mouse timing */
-#define PS2_BIT_DELAY_CLK 75
-
-/* PS/2 mouse commands & replies (TODO: support more commands) */
-#define PS2_REPLY_OK 0xfa
-#define PS2_REPLY_ERROR 0xfc
-#define PS2_CMD_SET_REMOTE_MODE 0xf0
-#define PS2_CMD_READ_DATA 0xeb
-#define PS2_CMD_GET_DEV_ID 0xf2
-#define PS2_REPLY_DEV_ID 0x00
-
-/* PS/2 mouse movement packet bits */
-#define PS2_MDATA_YO 0x80
-#define PS2_MDATA_XO 0x40
-#define PS2_MDATA_YS 0x20
-#define PS2_MDATA_XS 0x10
-#define PS2_MDATA_A1 0x08
-#define PS2_MDATA_MB 0x04
-#define PS2_MDATA_RB 0x02
-#define PS2_MDATA_LB 0x01
-
-/* PS/2 mouse variables */
-static uint8_t ps2mouse_value;
-static uint8_t ps2mouse_in;
-static uint8_t ps2mouse_out;
-static uint8_t ps2mouse_prev;
-static uint8_t ps2mouse_parity;
-static int16_t ps2mouse_lastx;
-static int16_t ps2mouse_lasty;
-static uint8_t ps2mouse_buttons;
-
-/* PS/2 transmission state */
-enum {
- PS2_FROMTO_IDLE=0,
- PS2_FROM_START, /* mouse <- cpu */
- PS2_FROM_D0,
- PS2_FROM_D1,
- PS2_FROM_D2,
- PS2_FROM_D3,
- PS2_FROM_D4,
- PS2_FROM_D5,
- PS2_FROM_D6,
- PS2_FROM_D7,
- PS2_FROM_PARITY,
- PS2_FROM_STOP,
- PS2_FROM_ACK,
- PS2_CHECK_SEND, /* mouse -> cpu */
- PS2_TO_D0,
- PS2_TO_D1,
- PS2_TO_D2,
- PS2_TO_D3,
- PS2_TO_D4,
- PS2_TO_D5,
- PS2_TO_D6,
- PS2_TO_D7,
- PS2_TO_PARITY,
- PS2_TO_STOP
-} ps2mouse_xmit_state = PS2_FROMTO_IDLE;
-
-/* Output buffer */
-#define PS2_QUEUE_SIZE 8
-uint8_t ps2mouse_queue[PS2_QUEUE_SIZE];
-uint8_t ps2mouse_queue_head;
-uint8_t ps2mouse_queue_tail;
-
-static int ps2mouse_queue_put(uint8_t value)
-{
- uint8_t new_head = (ps2mouse_queue_head + 1) & (PS2_QUEUE_SIZE - 1);
- if (new_head == ps2mouse_queue_tail) {
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("queue full!");
-#endif
- return 0;
- }
- ps2mouse_queue[ps2mouse_queue_head] = value;
- ps2mouse_queue_head = new_head;
- return 1;
-}
-
-static int ps2mouse_queue_empty(void)
-{
- return (ps2mouse_queue_head == ps2mouse_queue_tail);
-}
-
-static uint8_t ps2mouse_queue_get(void)
-{
- uint8_t retval = ps2mouse_queue[ps2mouse_queue_tail];
- ++ps2mouse_queue_tail;
- ps2mouse_queue_tail &= (PS2_QUEUE_SIZE - 1);
- return retval;
-}
-
-/* ------------------------------------------------------------------------- */
-
-
-static int ps2mouse_handle_command(uint8_t value)
-{
- int16_t diff_x, diff_y, new_x, new_y;
- uint8_t new_buttons;
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("cmd: got %02x", value);
-#endif
- ps2mouse_xmit_state = PS2_CHECK_SEND;
-
- if (ps2mouse_parity) {
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("parity error");
-#endif
- return ps2mouse_queue_put(PS2_REPLY_ERROR);
- }
-
- switch (value) {
- case PS2_CMD_GET_DEV_ID:
- return (ps2mouse_queue_put(PS2_REPLY_OK)
- && ps2mouse_queue_put(PS2_REPLY_DEV_ID));
- break;
-
- case PS2_CMD_SET_REMOTE_MODE:
-#ifdef HAVE_MOUSE
- mouse_get_raw_int16(&ps2mouse_lastx, &ps2mouse_lasty);
-#endif
- return (ps2mouse_queue_put(PS2_REPLY_OK));
- break;
-
- case PS2_CMD_READ_DATA:
- new_buttons = ps2mouse_buttons;
-#ifdef HAVE_MOUSE
- mouse_get_raw_int16(&new_x, &new_y);
- diff_x = (new_x - ps2mouse_lastx);
- if (diff_x < 0) {
- new_buttons |= PS2_MDATA_XS;
- }
- if (diff_x < -256 || diff_x > 255) {
- new_buttons |= PS2_MDATA_XO;
- }
- ps2mouse_lastx = new_x;
-
- diff_y = (int16_t)(new_y - ps2mouse_lasty);
- if (diff_y < 0) {
- new_buttons |= PS2_MDATA_YS;
- }
- if (diff_y < -256 || diff_y > 255) {
- new_buttons |= PS2_MDATA_YO;
- }
- ps2mouse_lasty = new_y;
-#else
- diff_x = 0;
- diff_y = 0;
-#endif
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("x/y/b: %02x, %02x, %02x", diff_x, diff_y, new_buttons);
-#endif
- return (ps2mouse_queue_put(PS2_REPLY_OK)
- && ps2mouse_queue_put(new_buttons)
- && ps2mouse_queue_put((uint8_t)diff_x)
- && ps2mouse_queue_put((uint8_t)diff_y));
- break;
-
- default:
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("unsupported command %02x", value);
-#endif
- return (ps2mouse_queue_put(PS2_REPLY_ERROR) & 0);
- break;
- }
- return 0;
-}
-
-
-struct alarm_s *c64dtv_ps2mouse_alarm;
-
-static void c64dtv_ps2mouse_alarm_handler(CLOCK offset, void *data)
-{
- int another_alarm = 1;
-
- alarm_unset(c64dtv_ps2mouse_alarm);
-
- ps2mouse_out ^= PS2_CLK_BIT;
- ps2mouse_out &= ~PS2_DATA_BIT;
-
- switch (ps2mouse_xmit_state) {
- case PS2_FROM_START:
- ps2mouse_value = 0;
- ps2mouse_parity = 0;
- ps2mouse_out |= (ps2mouse_in & PS2_DATA_BIT);
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("start: clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
- ++ps2mouse_xmit_state;
- }
- break;
-
- case PS2_FROM_D0:
- case PS2_FROM_D1:
- case PS2_FROM_D2:
- case PS2_FROM_D3:
- case PS2_FROM_D4:
- case PS2_FROM_D5:
- case PS2_FROM_D6:
- case PS2_FROM_D7:
- if (ps2mouse_out & PS2_CLK_BIT) {
- ps2mouse_value >>= 1;
- if (ps2mouse_in & PS2_DATA_BIT) {
- ps2mouse_value |= 0x80;
- ps2mouse_parity ^= PS2_DATA_BIT;
- }
- }
- ps2mouse_out |= (ps2mouse_in & PS2_DATA_BIT);
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("d%i: clk/data = %i/%i", ps2mouse_xmit_state - PS2_FROM_D0, (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
- ++ps2mouse_xmit_state;
- }
- break;
-
- case PS2_FROM_PARITY:
- if (ps2mouse_out & PS2_CLK_BIT) {
- if (ps2mouse_in & PS2_DATA_BIT) {
- ps2mouse_parity ^= PS2_DATA_BIT;
- }
- }
- ps2mouse_out |= PS2_DATA_BIT;
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("parity: clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
- ++ps2mouse_xmit_state;
- }
- break;
-
- case PS2_FROM_STOP:
- if (ps2mouse_out & PS2_CLK_BIT) {
- if (ps2mouse_in & PS2_DATA_BIT) {
- ps2mouse_parity ^= PS2_DATA_BIT;
- }
- ps2mouse_out |= PS2_DATA_BIT;
- } else {
- ps2mouse_out |= ps2mouse_parity;
- }
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("stop: clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
- ++ps2mouse_xmit_state;
- }
- break;
-
- case PS2_FROM_ACK:
- ps2mouse_out |= PS2_DATA_BIT; /* ps2mouse_parity; */
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("got %02x, parity: %02x, clk/data = %i/%i", ps2mouse_value, ps2mouse_parity, (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- another_alarm = ps2mouse_handle_command(ps2mouse_value);
- break;
-
- case PS2_CHECK_SEND:
- if (ps2mouse_queue_empty()) {
- ps2mouse_out |= (PS2_DATA_BIT | PS2_CLK_BIT);
- another_alarm = 0;
- ps2mouse_xmit_state = PS2_FROMTO_IDLE;
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("all sent. clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- break;
- }
- if ((ps2mouse_in & PS2_CLK_BIT) == 0) {
- ps2mouse_out &= ~PS2_CLK_BIT;
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("hold! clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- break;
- }
-
- if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
- ps2mouse_parity = PS2_DATA_BIT;
- ps2mouse_value = ps2mouse_queue_get();
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("sending %02x, clk/data = %i/%i", ps2mouse_value, (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- ps2mouse_xmit_state = PS2_TO_D0;
- }
- break;
-
- case PS2_TO_D0:
- case PS2_TO_D1:
- case PS2_TO_D2:
- case PS2_TO_D3:
- case PS2_TO_D4:
- case PS2_TO_D5:
- case PS2_TO_D6:
- case PS2_TO_D7:
- if (ps2mouse_out & PS2_CLK_BIT) {
- ps2mouse_out |= (ps2mouse_value & 1) ? PS2_DATA_BIT : 0;
- ps2mouse_prev = ps2mouse_out;
- ps2mouse_parity ^= (ps2mouse_value & 1) ? PS2_DATA_BIT : 0;
- ps2mouse_value >>= 1;
- } else {
- ps2mouse_out |= (ps2mouse_prev & PS2_DATA_BIT);
- }
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("to_d%i: clk/data = %i/%i", ps2mouse_xmit_state - PS2_TO_D0, (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
- ++ps2mouse_xmit_state;
- }
- break;
-
- case PS2_TO_PARITY:
- if (ps2mouse_out & PS2_CLK_BIT) {
- ps2mouse_out |= ps2mouse_parity;
- ps2mouse_prev = ps2mouse_out;
- } else {
- ps2mouse_out |= (ps2mouse_prev & PS2_DATA_BIT);
- }
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("to_parity: clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
- ++ps2mouse_xmit_state;
- }
- break;
-
- case PS2_TO_STOP:
- ps2mouse_out |= PS2_DATA_BIT;
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("stop: clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
- ps2mouse_xmit_state = PS2_CHECK_SEND;
- }
- break;
-
- default:
- ps2mouse_out |= (PS2_DATA_BIT | PS2_CLK_BIT);
- another_alarm = 0;
- ps2mouse_xmit_state = PS2_FROMTO_IDLE;
-#ifdef PS2MOUSE_DEBUG_ENABLED
- PS2MOUSE_DEBUG("bug! state %i. clk/data = %i/%i", ps2mouse_xmit_state, (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
-#endif
- break;
- }
-
- if (another_alarm) {
- alarm_set(c64dtv_ps2mouse_alarm, maincpu_clk + PS2_BIT_DELAY_CLK);
- }
-}
-
-
-void ps2mouse_store(uint8_t value)
-{
- ps2mouse_in = value;
- if (((ps2mouse_prev & PS2_CLK_BIT) == 0) && (value & PS2_CLK_BIT)
- && (ps2mouse_xmit_state == PS2_FROMTO_IDLE) && ((value & PS2_DATA_BIT) == 0)) {
- ps2mouse_xmit_state = PS2_FROM_START;
- ps2mouse_out = value;
- alarm_set(c64dtv_ps2mouse_alarm, maincpu_clk + PS2_BIT_DELAY_CLK);
- }
- ps2mouse_prev = value;
- return;
-}
-
-uint8_t ps2mouse_read(void)
-{
- return ps2mouse_out;
-}
-
-/* ------------------------------------------------------------------------- */
-
-
-static void c64dtv_ps2mouse_alarm_init(void)
-{
- c64dtv_ps2mouse_alarm = alarm_new(maincpu_alarm_context, "PS2MOUSEAlarm",
- c64dtv_ps2mouse_alarm_handler, NULL);
-}
-
-void ps2mouse_reset(void)
-{
- ps2mouse_in = 0xff;
- ps2mouse_out = 0xff;
- ps2mouse_prev = 0xff;
- ps2mouse_xmit_state = PS2_FROMTO_IDLE;
- ps2mouse_parity = 0;
- ps2mouse_lastx = 0;
- ps2mouse_lasty = 0;
- ps2mouse_buttons = PS2_MDATA_A1;
- ps2mouse_queue_head = 0;
- ps2mouse_queue_tail = 0;
- return;
-}
-
-/* ------------------------------------------------------------------------- */
-
-int ps2mouse_enabled = 0;
-
-static int set_ps2mouse_enable(int val, void *param)
-{
- ps2mouse_enabled = (unsigned int)(val ? 1 : 0);
-
- return 0;
-}
-
-static const resource_int_t resources_int[] = {
- { "ps2mouse", 0, RES_EVENT_SAME, NULL,
- &ps2mouse_enabled, set_ps2mouse_enable, NULL },
- RESOURCE_INT_LIST_END
-};
-
-static const cmdline_option_t cmdline_options[] =
-{
- { "-ps2mouse", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
- NULL, NULL, "PS2Mouse", (void *)1,
- NULL, "Enable PS/2 mouse on userport" },
- { "+ps2mouse", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
- NULL, NULL, "PS2Mouse", (void *)0,
- NULL, "Disable PS/2 mouse on userport" },
- CMDLINE_LIST_END
-};
-
-/* ------------------------------------------------------------------------- */
-
-static const mouse_func_t mouse_funcs =
-{
- mouse_button_left,
- mouse_button_right,
- mouse_button_middle,
- mouse_button_up,
- mouse_button_down
-};
-
-int mouse_ps2_resources_init(void)
-{
- if (resources_register_int(resources_int) < 0) {
- return -1;
- }
-
- return mousedrv_resources_init(&mouse_funcs);
-}
-
-int mouse_ps2_cmdline_options_init(void)
-{
- if (cmdline_register_options(cmdline_options) < 0) {
- return -1;
- }
-
- return mousedrv_cmdline_options_init();
-}
-
-void mouse_ps2_init(void)
-{
- if (ps2mouse_log == LOG_DEFAULT) {
- ps2mouse_log = log_open("ps2mouse");
- }
-
- c64dtv_ps2mouse_alarm_init();
-
- ps2mouse_reset();
- mousedrv_init();
-}
-
-void mouse_ps2_shutdown(void)
-{
-}
-
-static void mouse_button_left(int pressed)
-{
- if (pressed) {
- ps2mouse_buttons |= PS2_MDATA_LB;
- } else {
- ps2mouse_buttons &= ~PS2_MDATA_LB;
- }
-}
-
-static void mouse_button_middle(int pressed)
-{
- if (pressed) {
- ps2mouse_buttons |= PS2_MDATA_MB;
- } else {
- ps2mouse_buttons &= ~PS2_MDATA_MB;
- }
-}
-
-static void mouse_button_right(int pressed)
-{
- if (pressed) {
- ps2mouse_buttons |= PS2_MDATA_RB;
- } else {
- ps2mouse_buttons &= ~PS2_MDATA_RB;
- }
-}
-
-static void mouse_button_up(int pressed)
-{
-}
-
-static void mouse_button_down(int pressed)
-{
-}
Deleted: trunk/vice/src/ps2mouse.h
===================================================================
--- trunk/vice/src/ps2mouse.h 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/src/ps2mouse.h 2025-08-01 23:38:39 UTC (rev 45722)
@@ -1,51 +0,0 @@
-/*
- * ps2mouse.h - PS/2 mouse on userport emulation
- *
- * Written by
- * Hannu Nuotio <han...@tu...>
- * Based on code by
- * Andreas Boose <vic...@t-...>
- *
- * This file is part of VICE, the Versatile Commodore Emulator.
- * See README for copyright notice.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA.
- *
- */
-
-#ifndef VICE_PS2MOUSE_H
-#define VICE_PS2MOUSE_H
-
-#include "types.h"
-
-void ps2mouse_reset(void);
-
-uint8_t ps2mouse_read(void);
-void ps2mouse_store(uint8_t value);
-
-int ps2mouse_resources_init(void);
-int ps2mouse_cmdline_options_init(void);
-
-extern int ps2mouse_enabled;
-
-int mouse_ps2_resources_init(void);
-int mouse_ps2_cmdline_options_init(void);
-void mouse_ps2_init(void);
-void mouse_ps2_shutdown(void);
-
-extern int _mouse_enabled;
-
-#endif
Modified: trunk/vice/src/userport/Makefile.am
===================================================================
--- trunk/vice/src/userport/Makefile.am 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/src/userport/Makefile.am 2025-08-01 23:38:39 UTC (rev 45722)
@@ -49,6 +49,8 @@
userport_joystick.h \
userport_petscii_snespad.c \
userport_petscii_snespad.h \
+ userport_ps2mouse.c \
+ userport_ps2mouse.h \
userport_rtc_58321a.c \
userport_rtc_58321a.h \
userport_rtc_ds1307.c \
Modified: trunk/vice/src/userport/userport.c
===================================================================
--- trunk/vice/src/userport/userport.c 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/src/userport/userport.c 2025-08-01 23:38:39 UTC (rev 45722)
@@ -145,6 +145,7 @@
#include "userport_hummer_joystick.h"
#include "userport_io_sim.h"
#include "userport_petscii_snespad.h"
+#include "userport_ps2mouse.h"
#include "userport_rtc_58321a.h"
#include "userport_rtc_ds1307.h"
#include "userport_spt_joystick.h"
@@ -184,6 +185,7 @@
#ifdef USERPORT_EXPERIMENTAL_DEVICES
{ USERPORT_DEVICE_TYPE_HARNESS, "Diagnostic harness" },
#endif
+ { USERPORT_DEVICE_TYPE_MOUSE_ADAPTER, "Mouse adapter" },
{ -1, NULL }
};
@@ -778,6 +780,13 @@
userport_diag_pin_cmdline_options_init /* cmdline options init function */
},
+ { USERPORT_DEVICE_MOUSE_PS2, /* device id */
+ UP_DTV, /* emulators this device works on */
+ userport_ps2mouse_resources_init, /* resources init function */
+ NULL, /* resources shutdown function */
+ NULL /* cmdline options init function */
+ },
+
{ USERPORT_DEVICE_NONE, VICE_MACHINE_NONE, NULL, NULL, NULL }, /* end of the devices list */
};
Modified: trunk/vice/src/userport/userport.h
===================================================================
--- trunk/vice/src/userport/userport.h 2025-07-31 20:59:11 UTC (rev 45721)
+++ trunk/vice/src/userport/userport.h 2025-08-01 23:38:39 UTC (rev 45722)
@@ -70,6 +70,7 @@
USERPORT_DEVICE_SPACEBALLS, /* CAUTION: also connects to the controller port(s) */
USERPORT_DEVICE_SPT_JOYSTICK,
USERPORT_DEVICE_DIAGNOSTIC_PIN,
+ USERPORT_DEVICE_MOUSE_PS2,
/* This item always needs to be at the end */
USERPORT_MAX_DEVICES
@@ -91,7 +92,8 @@
USERPORT_DEVICE_TYPE_WIFI,
#endif
USERPORT_DEVICE_TYPE_IO_SIMULATION,
- USERPORT_DEVICE_TYPE_DIAGNOSTIC
+ USERPORT_DEVICE_TYPE_DIAGNOSTIC,
+ USERPORT_DEVICE_TYPE_MOUSE_ADAPTER,
};
/* 24 pin userport pin defines */
Copied: trunk/vice/src/userport/userport_ps2mouse.c (from rev 45721, trunk/vice/src/ps2mouse.c)
===================================================================
--- trunk/vice/src/userport/userport_ps2mouse.c (rev 0)
+++ trunk/vice/src/userport/userport_ps2mouse.c 2025-08-01 23:38:39 UTC (rev 45722)
@@ -0,0 +1,588 @@
+/*
+ * ps2mouse.c -- PS/2 mouse on userport emulation
+ *
+ * Written by
+ * Hannu Nuotio <han...@tu...>
+ * Based on code by
+ * Andreas Boose <vic...@t-...>
+ *
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ *
+ */
+
+#include "vice.h"
+
+#include "cmdline.h"
+#include "resources.h"
+#include "log.h"
+#include "joyport.h"
+#include "userport.h"
+#include "userport_ps2mouse.h"
+#include "alarm.h"
+#include "maincpu.h"
+#include "mousedrv.h"
+
+static void mouse_button_left(int pressed);
+static void mouse_button_right(int pressed);
+static void mouse_button_middle(int pressed);
+static void mouse_button_up(int pressed);
+static void mouse_button_down(int pressed);
+
+static log_t ps2mouse_log = LOG_DEFAULT;
+
+#if 0
+#define PS2MOUSE_DEBUG(args ...) log_message(ps2mouse_log, args)
+#define PS2MOUSE_DEBUG_ENABLED
+#endif
+
+/* PS/2 mouse port bits */
+#define PS2_CLK_BIT 0x40
+#define PS2_DATA_BIT 0x80
+
+/* PS/2 mouse timing */
+#define PS2_BIT_DELAY_CLK 75
+
+/* PS/2 mouse commands & replies (TODO: support more commands) */
+#define PS2_REPLY_OK 0xfa
+#define PS2_REPLY_ERROR 0xfc
+#define PS2_CMD_SET_REMOTE_MODE 0xf0
+#define PS2_CMD_READ_DATA 0xeb
+#define PS2_CMD_GET_DEV_ID 0xf2
+#define PS2_REPLY_DEV_ID 0x00
+
+/* PS/2 mouse movement packet bits */
+#define PS2_MDATA_YO 0x80
+#define PS2_MDATA_XO 0x40
+#define PS2_MDATA_YS 0x20
+#define PS2_MDATA_XS 0x10
+#define PS2_MDATA_A1 0x08
+#define PS2_MDATA_MB 0x04
+#define PS2_MDATA_RB 0x02
+#define PS2_MDATA_LB 0x01
+
+/* PS/2 mouse variables */
+static uint8_t ps2mouse_value;
+static uint8_t ps2mouse_in;
+static uint8_t ps2mouse_out;
+static uint8_t ps2mouse_prev;
+static uint8_t ps2mouse_parity;
+static int16_t ps2mouse_lastx;
+static int16_t ps2mouse_lasty;
+static uint8_t ps2mouse_buttons;
+
+/* PS/2 transmission state */
+enum {
+ PS2_FROMTO_IDLE=0,
+ PS2_FROM_START, /* mouse <- cpu */
+ PS2_FROM_D0,
+ PS2_FROM_D1,
+ PS2_FROM_D2,
+ PS2_FROM_D3,
+ PS2_FROM_D4,
+ PS2_FROM_D5,
+ PS2_FROM_D6,
+ PS2_FROM_D7,
+ PS2_FROM_PARITY,
+ PS2_FROM_STOP,
+ PS2_FROM_ACK,
+ PS2_CHECK_SEND, /* mouse -> cpu */
+ PS2_TO_D0,
+ PS2_TO_D1,
+ PS2_TO_D2,
+ PS2_TO_D3,
+ PS2_TO_D4,
+ PS2_TO_D5,
+ PS2_TO_D6,
+ PS2_TO_D7,
+ PS2_TO_PARITY,
+ PS2_TO_STOP
+} ps2mouse_xmit_state = PS2_FROMTO_IDLE;
+
+/* Output buffer */
+#define PS2_QUEUE_SIZE 8
+static uint8_t ps2mouse_queue[PS2_QUEUE_SIZE];
+static uint8_t ps2mouse_queue_head;
+static uint8_t ps2mouse_queue_tail;
+
+/* ------------------------------------------------------------------------- */
+
+static uint8_t userport_ps2mouse_read_pbx(uint8_t orig);
+static void userport_ps2mouse_store_pbx(uint8_t value, int pulse);
+static int userport_ps2mouse_enable(int val);
+static int userport_ps2mouse_write_snapshot_module(snapshot_t *s);
+static int userport_ps2mouse_read_snapshot_module(snapshot_t *s);
+
+static userport_device_t ps2mouse_device = {
+ "PS/2 Mouse", /* device name */
+ JOYSTICK_ADAPTER_ID_NONE, /* this is NOT a joystick adapter */
+ USERPORT_DEVICE_TYPE_MOUSE_ADAPTER, /* device is a mouse adapter */
+ userport_ps2mouse_enable, /* enable function */
+ userport_ps2mouse_read_pbx, /* read pb0-pb7 function */
+ userport_ps2mouse_store_pbx, /* store pb0-pb7 function */
+ NULL, /* NO read pa2 pin function */
+ NULL, /* NO store pa2 pin function */
+ NULL, /* NO read pa3 pin function */
+ NULL, /* NO store pa3 pin function */
+ 0, /* pc pin is NOT needed */
+ NULL, /* NO store sp1 pin function */
+ NULL, /* NO read sp1 pin function */
+ NULL, /* NO store sp2 pin function */
+ NULL, /* NO read sp2 pin function */
+ NULL, /* NO reset function */
+ NULL, /* NO powerup function */
+ userport_ps2mouse_write_snapshot_module, /* snapshot write function */
+ userport_ps2mouse_read_snapshot_module /* snapshot read function */
+};
+
+static int ps2mouse_enabled = 0;
+
+static int userport_ps2mouse_enable(int val)
+{
+ ps2mouse_enabled = (unsigned int)(val ? 1 : 0);
+
+ return 0;
+}
+
+int userport_ps2mouse_resources_init(void)
+{
+ return userport_device_register(USERPORT_DEVICE_MOUSE_PS2, &ps2mouse_device);
+}
+
+/* ---------------------------------------------------------------------*/
+
+static int userport_ps2mouse_write_snapshot_module(snapshot_t *s)
+{
+ /* FIXME */
+ return 0;
+}
+
+static int userport_ps2mouse_read_snapshot_module(snapshot_t *s)
+{
+ /* FIXME */
+ return 0;
+}
+
+/* ------------------------------------------------------------------------- */
+
+
+static int ps2mouse_queue_put(uint8_t value)
+{
+ uint8_t new_head = (ps2mouse_queue_head + 1) & (PS2_QUEUE_SIZE - 1);
+ if (new_head == ps2mouse_queue_tail) {
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("queue full!");
+#endif
+ return 0;
+ }
+ ps2mouse_queue[ps2mouse_queue_head] = value;
+ ps2mouse_queue_head = new_head;
+ return 1;
+}
+
+static int ps2mouse_queue_empty(void)
+{
+ return (ps2mouse_queue_head == ps2mouse_queue_tail);
+}
+
+static uint8_t ps2mouse_queue_get(void)
+{
+ uint8_t retval = ps2mouse_queue[ps2mouse_queue_tail];
+ ++ps2mouse_queue_tail;
+ ps2mouse_queue_tail &= (PS2_QUEUE_SIZE - 1);
+ return retval;
+}
+
+/* ------------------------------------------------------------------------- */
+
+
+static int ps2mouse_handle_command(uint8_t value)
+{
+ int16_t diff_x, diff_y, new_x, new_y;
+ uint8_t new_buttons;
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("cmd: got %02x", value);
+#endif
+ ps2mouse_xmit_state = PS2_CHECK_SEND;
+
+ if (ps2mouse_parity) {
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("parity error");
+#endif
+ return ps2mouse_queue_put(PS2_REPLY_ERROR);
+ }
+
+ switch (value) {
+ case PS2_CMD_GET_DEV_ID:
+ return (ps2mouse_queue_put(PS2_REPLY_OK)
+ && ps2mouse_queue_put(PS2_REPLY_DEV_ID));
+ break;
+
+ case PS2_CMD_SET_REMOTE_MODE:
+#ifdef HAVE_MOUSE
+ mouse_poll(); /* HACK: should probably happen elsewhere */
+ mouse_get_raw_int16(&ps2mouse_lastx, &ps2mouse_lasty);
+#endif
+ return (ps2mouse_queue_put(PS2_REPLY_OK));
+ break;
+
+ case PS2_CMD_READ_DATA:
+ new_buttons = ps2mouse_buttons;
+#ifdef HAVE_MOUSE
+ mouse_poll(); /* HACK: should probably happen elsewhere */
+ mouse_get_raw_int16(&new_x, &new_y);
+
+ diff_x = (new_x - ps2mouse_lastx);
+ if (diff_x < 0) {
+ new_buttons |= PS2_MDATA_XS;
+ }
+ if (diff_x < -256 || diff_x > 255) {
+ new_buttons |= PS2_MDATA_XO;
+ }
+ ps2mouse_lastx = new_x;
+
+ diff_y = (int16_t)(new_y - ps2mouse_lasty);
+ if (diff_y < 0) {
+ new_buttons |= PS2_MDATA_YS;
+ }
+ if (diff_y < -256 || diff_y > 255) {
+ new_buttons |= PS2_MDATA_YO;
+ }
+ ps2mouse_lasty = new_y;
+#else
+ diff_x = 0;
+ diff_y = 0;
+#endif
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("x/y/b: %02x, %02x, %02x", diff_x, diff_y, new_buttons);
+#endif
+ return (ps2mouse_queue_put(PS2_REPLY_OK)
+ && ps2mouse_queue_put(new_buttons)
+ && ps2mouse_queue_put((uint8_t)diff_x)
+ && ps2mouse_queue_put((uint8_t)diff_y));
+ break;
+
+ default:
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("unsupported command %02x", value);
+#endif
+ return (ps2mouse_queue_put(PS2_REPLY_ERROR) & 0);
+ break;
+ }
+ return 0;
+}
+
+
+struct alarm_s *c64dtv_ps2mouse_alarm;
+
+static void c64dtv_ps2mouse_alarm_handler(CLOCK offset, void *data)
+{
+ int another_alarm = 1;
+
+ alarm_unset(c64dtv_ps2mouse_alarm);
+
+ ps2mouse_out ^= PS2_CLK_BIT;
+ ps2mouse_out &= ~PS2_DATA_BIT;
+
+ switch (ps2mouse_xmit_state) {
+ case PS2_FROM_START:
+ ps2mouse_value = 0;
+ ps2mouse_parity = 0;
+ ps2mouse_out |= (ps2mouse_in & PS2_DATA_BIT);
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("start: clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
+ ++ps2mouse_xmit_state;
+ }
+ break;
+
+ case PS2_FROM_D0:
+ case PS2_FROM_D1:
+ case PS2_FROM_D2:
+ case PS2_FROM_D3:
+ case PS2_FROM_D4:
+ case PS2_FROM_D5:
+ case PS2_FROM_D6:
+ case PS2_FROM_D7:
+ if (ps2mouse_out & PS2_CLK_BIT) {
+ ps2mouse_value >>= 1;
+ if (ps2mouse_in & PS2_DATA_BIT) {
+ ps2mouse_value |= 0x80;
+ ps2mouse_parity ^= PS2_DATA_BIT;
+ }
+ }
+ ps2mouse_out |= (ps2mouse_in & PS2_DATA_BIT);
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("d%i: clk/data = %i/%i", ps2mouse_xmit_state - PS2_FROM_D0, (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
+ ++ps2mouse_xmit_state;
+ }
+ break;
+
+ case PS2_FROM_PARITY:
+ if (ps2mouse_out & PS2_CLK_BIT) {
+ if (ps2mouse_in & PS2_DATA_BIT) {
+ ps2mouse_parity ^= PS2_DATA_BIT;
+ }
+ }
+ ps2mouse_out |= PS2_DATA_BIT;
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("parity: clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
+ ++ps2mouse_xmit_state;
+ }
+ break;
+
+ case PS2_FROM_STOP:
+ if (ps2mouse_out & PS2_CLK_BIT) {
+ if (ps2mouse_in & PS2_DATA_BIT) {
+ ps2mouse_parity ^= PS2_DATA_BIT;
+ }
+ ps2mouse_out |= PS2_DATA_BIT;
+ } else {
+ ps2mouse_out |= ps2mouse_parity;
+ }
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("stop: clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
+ ++ps2mouse_xmit_state;
+ }
+ break;
+
+ case PS2_FROM_ACK:
+ ps2mouse_out |= PS2_DATA_BIT; /* ps2mouse_parity; */
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("got %02x, parity: %02x, clk/data = %i/%i", ps2mouse_value, ps2mouse_parity, (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ another_alarm = ps2mouse_handle_command(ps2mouse_value);
+ break;
+
+ case PS2_CHECK_SEND:
+ if (ps2mouse_queue_empty()) {
+ ps2mouse_out |= (PS2_DATA_BIT | PS2_CLK_BIT);
+ another_alarm = 0;
+ ps2mouse_xmit_state = PS2_FROMTO_IDLE;
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("all sent. clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ break;
+ }
+ if ((ps2mouse_in & PS2_CLK_BIT) == 0) {
+ ps2mouse_out &= ~PS2_CLK_BIT;
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("hold! clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ break;
+ }
+
+ if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
+ ps2mouse_parity = PS2_DATA_BIT;
+ ps2mouse_value = ps2mouse_queue_get();
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("sending %02x, clk/data = %i/%i", ps2mouse_value, (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ ps2mouse_xmit_state = PS2_TO_D0;
+ }
+ break;
+
+ case PS2_TO_D0:
+ case PS2_TO_D1:
+ case PS2_TO_D2:
+ case PS2_TO_D3:
+ case PS2_TO_D4:
+ case PS2_TO_D5:
+ case PS2_TO_D6:
+ case PS2_TO_D7:
+ if (ps2mouse_out & PS2_CLK_BIT) {
+ ps2mouse_out |= (ps2mouse_value & 1) ? PS2_DATA_BIT : 0;
+ ps2mouse_prev = ps2mouse_out;
+ ps2mouse_parity ^= (ps2mouse_value & 1) ? PS2_DATA_BIT : 0;
+ ps2mouse_value >>= 1;
+ } else {
+ ps2mouse_out |= (ps2mouse_prev & PS2_DATA_BIT);
+ }
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("to_d%i: clk/data = %i/%i", ps2mouse_xmit_state - PS2_TO_D0, (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
+ ++ps2mouse_xmit_state;
+ }
+ break;
+
+ case PS2_TO_PARITY:
+ if (ps2mouse_out & PS2_CLK_BIT) {
+ ps2mouse_out |= ps2mouse_parity;
+ ps2mouse_prev = ps2mouse_out;
+ } else {
+ ps2mouse_out |= (ps2mouse_prev & PS2_DATA_BIT);
+ }
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("to_parity: clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
+ ++ps2mouse_xmit_state;
+ }
+ break;
+
+ case PS2_TO_STOP:
+ ps2mouse_out |= PS2_DATA_BIT;
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("stop: clk/data = %i/%i", (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ if ((ps2mouse_out & PS2_CLK_BIT) == 0) {
+ ps2mouse_xmit_state = PS2_CHECK_SEND;
+ }
+ break;
+
+ default:
+ ps2mouse_out |= (PS2_DATA_BIT | PS2_CLK_BIT);
+ another_alarm = 0;
+ ps2mouse_xmit_state = PS2_FROMTO_IDLE;
+#ifdef PS2MOUSE_DEBUG_ENABLED
+ PS2MOUSE_DEBUG("bug! state %i. clk/data = %i/%i", ps2mouse_xmit_state, (ps2mouse_out >> 6) & 1, (ps2mouse_out >> 7) & 1);
+#endif
+ break;
+ }
+
+ if (another_alarm) {
+ alarm_set(c64dtv_ps2mouse_alarm, maincpu_clk + PS2_BIT_DELAY_CLK);
+ }
+}
+
+
+void userport_ps2mouse_store_pbx(uint8_t value, int pulse)
+{
+ ps2mouse_in = value;
+ if (((ps2mouse_prev & PS2_CLK_BIT) == 0) && (value & PS2_CLK_BIT)
+ && (ps2mouse_xmit_state == PS2_FROMTO_IDLE) && ((value & PS2_DATA_BIT) == 0)) {
+ ps2mouse_xmit_state = PS2_FROM_START;
+ ps2mouse_out = value;
+ alarm_set(c64dtv_ps2mouse_alarm, maincpu_clk + PS2_BIT_DELAY_CLK);
+ }
+ ps2mouse_prev = value;
+ return;
+}
+
+uint8_t userport_ps2mouse_read_pbx(uint8_t orig)
+{
+ return ps2mouse_out;
+}
+
+/* ------------------------------------------------------------------------- */
+
+static void userport_ps2mouse_alarm_init(void)
+{
+ c64dtv_ps2mouse_alarm = alarm_new(maincpu_alarm_context, "PS2MOUSEAlarm",
+ c64dtv_ps2mouse_alarm_handler, NULL);
+}
+
+/* called from src/c64dtv/c64dtvmem.c:979 */
+void ps2mouse_reset(void)
+{
+ ps2mouse_in = 0xff;
+ ps2mouse_out = 0xff;
+ ps2mouse_prev = 0xff;
+ ps2mouse_xmit_state = PS2_FROMTO_IDLE;
+ ps2mouse_parity = 0;
+ ps2mouse_lastx = 0;
+ ps2mouse_lasty = 0;
+ ps2mouse_buttons = PS2_MDATA_A1;
+ ps2mouse_queue_head = 0;
+ ps2mouse_queue_tail = 0;
+ return;
+}
+
+/* ------------------------------------------------------------------------- */
+
+static const mouse_func_t mouse_funcs =
+{
+ mouse_button_left,
+ mouse_button_right,
+ mouse_button_middle,
+ mouse_button_up,
+ mouse_button_down
+};
+
+/* called from src/c64dtv/c64dtv.c:507 */
+int mouse_ps2_resources_init(void)
+{
+ return mousedrv_resources_init(&mouse_funcs);
+}
+
+/* called from src/c64dtv/c64dtv.c:637 */
+int mouse_ps2_cmdline_options_init(void)
+{
+ return mousedrv_cmdline_options_init();
+}
+
+/* called from src/c64dtv/c64dtv.c:776 */
+void mouse_ps2_init(void)
+{
+ if (ps2mouse_log == LOG_DEFAULT) {
+ ps2mouse_log = log_open("ps2mouse");
+ }
+
+ userport_ps2mouse_alarm_init();
+
+ ps2mouse_reset();
+ mousedrv_init();
+}
+
+/* called from src/c64dtv/c64dtv.c:823 */
+void mouse_ps2_shutdown(void)
+{
+}
+
+static void mouse_button_left(int pressed)
+{
+ if (pressed) {
+ ps2mouse_buttons |= PS2_MDATA_LB;
+ } else {
+ ps2mouse_buttons &= ~PS2_MDATA_LB;
+ }
+}
+
+static void mouse_button_middle(int pressed)
+{
+ if (pressed) {
+ ps2mouse_buttons |= PS2_MDATA_MB;
+ } else {
+ ps2mouse_buttons &= ~PS2_MDATA_MB;
+ }
+}
+
+static void mouse_button_right(int pressed)
+{
+ if (pressed) {
+ ps2mouse_buttons |= PS2_MDATA_RB;
+ } else {
+ ps2mouse_buttons &= ~PS2_MDATA_RB;
+ }
+}
+
+static void mouse_button_up(int pressed)
+{
+}
+
+static void mouse_button_down(int pressed)
+{
+}
Copied: trunk/vice/src/userport/userport_ps2mouse.h (from rev 45721, trunk/vice/src/ps2mouse.h)
===================================================================
--- trunk/vice/src/userport/userport_ps2mouse.h (rev 0)
+++ trunk/vice/src/userport/userport_ps2mouse.h 2025-08-01 23:38:39 UTC (rev 45722)
@@ -0,0 +1,43 @@
+/*
+ * ps2mouse.h - PS/2 mouse on userport emulation
+ *
+ * Written by
+ * Hannu Nuotio <han...@tu...>
+ * Based on code by
+ * Andreas Boose <vic...@t-...>
+ *
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ *
+ */
+
+#ifndef VICE_PS2MOUSE_H
+#define VICE_PS2MOUSE_H
+
+#include "types.h"
+
+int userport_ps2mouse_resources_init(void);
+
+void ps2mouse_reset(void);
+
+int mouse_ps2_resources_init(void);
+int mouse_ps2_cmdline_options_init(void);
+void mouse_ps2_init(void);
+void mouse_ps2_shutdown(void);
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-07-31 20:59:14
|
Revision: 45721
http://sourceforge.net/p/vice-emu/code/45721
Author: gpz
Date: 2025-07-31 20:59:11 +0000 (Thu, 31 Jul 2025)
Log Message:
-----------
some refactoring, move all hummer-adc related code into hummeradc.c, and handle it like any other joystick adapter
Modified Paths:
--------------
trunk/vice/src/c64dtv/c64dtv-cmdline-options.c
trunk/vice/src/c64dtv/c64dtv-resources.c
trunk/vice/src/c64dtv/c64dtv-resources.h
trunk/vice/src/c64dtv/c64dtv-snapshot.c
trunk/vice/src/c64dtv/c64dtv.c
trunk/vice/src/c64dtv/c64dtvcia2.c
trunk/vice/src/c64dtv/c64dtvmemsnapshot.c
trunk/vice/src/c64dtv/c64dtvmemsnapshot.h
trunk/vice/src/c64dtv/hummeradc.c
trunk/vice/src/c64dtv/hummeradc.h
Modified: trunk/vice/src/c64dtv/c64dtv-cmdline-options.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtv-cmdline-options.c 2025-07-31 00:06:54 UTC (rev 45720)
+++ trunk/vice/src/c64dtv/c64dtv-cmdline-options.c 2025-07-31 20:59:11 UTC (rev 45721)
@@ -97,13 +97,7 @@
"<Name>", "Specify name of character generator ROM image" },
{ "-model", CALL_FUNCTION, CMDLINE_ATTRIB_NEED_ARGS,
set_dtv_model, NULL, NULL, NULL,
- "<Model>", "Set DTV model (v2/v2pal/v2ntsc, v3/v3pal/v3ntsc, hummer)" },
- { "-hummeradc", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
- NULL, NULL, "HummerADC", (void *)1,
- NULL, "Enable Hummer ADC" },
- { "+hummeradc", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
- NULL, NULL, "HummerADC", (void *)0,
- NULL, "Disable Hummer ADC" },
+ "<Model>", "Set DTV model (v2/v2pal/v2ntsc, v3/v3pal/v3ntsc, hummer/hummerpal/hummerntsc)" },
CMDLINE_LIST_END
};
Modified: trunk/vice/src/c64dtv/c64dtv-resources.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtv-resources.c 2025-07-31 00:06:54 UTC (rev 45720)
+++ trunk/vice/src/c64dtv/c64dtv-resources.c 2025-07-31 20:59:11 UTC (rev 45721)
@@ -147,14 +147,6 @@
}
#endif
-int c64dtv_hummer_adc_enabled = 0;
-
-static int c64dtv_hummer_adc_set(int val, void *param)
-{
- c64dtv_hummer_adc_enabled = val ? 1 : 0;
- return 0;
-}
-
static const resource_string_t resources_string[] = {
{ "ChargenName", C64_CHARGEN_NAME, RES_EVENT_NO, NULL,
/* FIXME: should be same but names may differ */
@@ -171,8 +163,6 @@
static const resource_int_t resources_int[] = {
{ "MachineVideoStandard", MACHINE_SYNC_PAL, RES_EVENT_SAME, NULL,
&sync_factor, set_sync_factor, NULL },
- { "HummerADC", 0, RES_EVENT_SAME, NULL,
- (int *)&c64dtv_hummer_adc_enabled, c64dtv_hummer_adc_set, NULL },
RESOURCE_INT_LIST_END
};
Modified: trunk/vice/src/c64dtv/c64dtv-resources.h
===================================================================
--- trunk/vice/src/c64dtv/c64dtv-resources.h 2025-07-31 00:06:54 UTC (rev 45720)
+++ trunk/vice/src/c64dtv/c64dtv-resources.h 2025-07-31 20:59:11 UTC (rev 45721)
@@ -30,6 +30,4 @@
int c64dtv_resources_init(void);
void c64dtv_resources_shutdown(void);
-extern int c64dtv_hummer_adc_enabled;
-
#endif
Modified: trunk/vice/src/c64dtv/c64dtv-snapshot.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtv-snapshot.c 2025-07-31 00:06:54 UTC (rev 45720)
+++ trunk/vice/src/c64dtv/c64dtv-snapshot.c 2025-07-31 20:59:11 UTC (rev 45721)
@@ -41,6 +41,7 @@
#include "cia.h"
#include "drive-snapshot.h"
#include "drive.h"
+#include "hummeradc.h"
#include "joyport.h"
#include "joystick.h"
#include "keyboard.h"
@@ -82,7 +83,7 @@
|| c64dtv_snapshot_write_module(s, save_roms) < 0
|| c64dtvdma_snapshot_write_module(s) < 0
|| c64dtvblitter_snapshot_write_module(s) < 0
- || c64dtvmisc_snapshot_write_module(s) < 0
+ || hummeradc_snapshot_write_module(s) < 0
|| ciacore_snapshot_write_module(machine_context.cia1, s) < 0
|| ciacore_snapshot_write_module(machine_context.cia2, s) < 0
|| sid_snapshot_write_module(s) < 0
@@ -127,7 +128,7 @@
|| c64dtv_snapshot_read_module(s) < 0
|| c64dtvdma_snapshot_read_module(s) < 0
|| c64dtvblitter_snapshot_read_module(s) < 0
- || c64dtvmisc_snapshot_read_module(s) < 0
+ || hummeradc_snapshot_read_module(s) < 0
|| ciacore_snapshot_read_module(machine_context.cia1, s) < 0
|| ciacore_snapshot_read_module(machine_context.cia2, s) < 0
|| sid_snapshot_read_module(s) < 0
Modified: trunk/vice/src/c64dtv/c64dtv.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtv.c 2025-07-31 00:06:54 UTC (rev 45720)
+++ trunk/vice/src/c64dtv/c64dtv.c 2025-07-31 20:59:11 UTC (rev 45721)
@@ -61,6 +61,7 @@
#include "fliplist.h"
#include "fsdevice.h"
#include "gfxoutput.h"
+#include "hummeradc.h"
#include "imagecontents.h"
#include "inception.h"
#include "init.h"
@@ -409,6 +410,10 @@
init_resource_fail("c64dtv");
return -1;
}
+ if (hummeradc_resources_init() < 0) {
+ init_resource_fail("hummer adc");
+ return -1;
+ }
if (c64dtvmem_resources_init() < 0) {
init_resource_fail("c64dtvmem");
return -1;
@@ -544,6 +549,10 @@
init_cmdline_options_fail("c64dtv");
return -1;
}
+ if (hummeradc_cmdline_options_init() < 0) {
+ init_cmdline_options_fail("hummer adc");
+ return -1;
+ }
if (c64dtvmem_cmdline_options_init() < 0) {
init_cmdline_options_fail("c64dtvmem");
return -1;
Modified: trunk/vice/src/c64dtv/c64dtvcia2.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtvcia2.c 2025-07-31 00:06:54 UTC (rev 45720)
+++ trunk/vice/src/c64dtv/c64dtvcia2.c 2025-07-31 20:59:11 UTC (rev 45721)
@@ -56,16 +56,15 @@
void cia2_store(uint16_t addr, uint8_t data)
{
if ((addr & 0x1f) == 1) {
- /* HACK: for now only call the userport system when neither ps/2 mouse
- nor hummer adc is enabled */
- if (!c64dtv_hummer_adc_enabled && !ps2mouse_enabled) {
+ /* HACK: for now only call the userport system when ps/2 mouse is disabled */
+ if (!ps2mouse_enabled) {
store_userport_pbx(data, USERPORT_NO_PULSE);
}
- /* FIXME: convert hummer adc and ps/2 mouse support to new userport system */
if (c64dtv_hummer_adc_enabled) {
hummeradc_store(data);
}
+ /* FIXME: convert ps/2 mouse support to new userport system */
if (ps2mouse_enabled) {
ps2mouse_store(data);
}
@@ -79,13 +78,12 @@
uint8_t retval = 0xff;
if ((addr & 0x1f) == 1) {
- /* HACK: for now only call the userport system when neither ps/2 mouse
- nor hummer adc is enabled */
- if (!c64dtv_hummer_adc_enabled && !ps2mouse_enabled) {
+ /* HACK: for now only call the userport system when ps/2 mouse is disabled */
+ if (!ps2mouse_enabled) {
retval = read_userport_pbx(retval);
}
- /* FIXME: convert hummer adc and ps/2 mouse support to new userport system */
+ /* FIXME: convert ps/2 mouse support to new userport system */
if (ps2mouse_enabled) {
retval &= (ps2mouse_read() | 0x3f);
}
Modified: trunk/vice/src/c64dtv/c64dtvmemsnapshot.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtvmemsnapshot.c 2025-07-31 00:06:54 UTC (rev 45720)
+++ trunk/vice/src/c64dtv/c64dtvmemsnapshot.c 2025-07-31 20:59:11 UTC (rev 45721)
@@ -276,82 +276,3 @@
return -1;
}
-#define SNAP_MAJOR 0
-#define SNAP_MINOR 0
-static const char snap_misc_module_name[] = "C64DTVMISC";
-
-int c64dtvmisc_snapshot_write_module(snapshot_t *s)
-{
- snapshot_module_t *m;
-
- /* Misc. module. */
- m = snapshot_module_create(s, snap_misc_module_name, SNAP_MAJOR, SNAP_MINOR);
- if (m == NULL) {
- return -1;
- }
-
- if (SMW_B(m, hummeradc_value) < 0
- || SMW_B(m, hummeradc_channel) < 0
- || SMW_B(m, hummeradc_control) < 0
- || SMW_B(m, hummeradc_chanattr) < 0
- || SMW_B(m, hummeradc_chanwakeup) < 0
- || SMW_B(m, hummeradc_prev) < 0) {
- goto fail;
- }
-
- if (snapshot_module_close(m) < 0) {
- goto fail;
- }
- m = NULL;
-
- return 0;
-
-fail:
- if (m != NULL) {
- snapshot_module_close(m);
- }
- return -1;
-}
-
-int c64dtvmisc_snapshot_read_module(snapshot_t *s)
-{
- uint8_t major_version, minor_version;
- snapshot_module_t *m;
-
- /* Misc. module. */
- m = snapshot_module_open(s, snap_misc_module_name,
- &major_version, &minor_version);
- if (m == NULL) {
- return -1;
- }
-
- if (snapshot_version_is_bigger(major_version, minor_version, SNAP_MAJOR, SNAP_MINOR)) {
- log_error(c64_snapshot_log,
- "Snapshot module version (%d.%d) newer than %d.%d.",
- major_version, minor_version,
- SNAP_MAJOR, SNAP_MINOR);
- goto fail;
- }
-
- if (SMR_B(m, &hummeradc_value) < 0
- || SMR_B(m, &hummeradc_channel) < 0
- || SMR_B(m, &hummeradc_control) < 0
- || SMR_B(m, &hummeradc_chanattr) < 0
- || SMR_B(m, &hummeradc_chanwakeup) < 0
- || SMR_B(m, &hummeradc_prev) < 0) {
- goto fail;
- }
-
- if (snapshot_module_close(m) < 0) {
- goto fail;
- }
- m = NULL;
-
- return 0;
-
-fail:
- if (m != NULL) {
- snapshot_module_close(m);
- }
- return -1;
-}
Modified: trunk/vice/src/c64dtv/c64dtvmemsnapshot.h
===================================================================
--- trunk/vice/src/c64dtv/c64dtvmemsnapshot.h 2025-07-31 00:06:54 UTC (rev 45720)
+++ trunk/vice/src/c64dtv/c64dtvmemsnapshot.h 2025-07-31 20:59:11 UTC (rev 45721)
@@ -31,7 +31,5 @@
int c64dtv_snapshot_write_module(struct snapshot_s *s, int save_roms);
int c64dtv_snapshot_read_module(struct snapshot_s *s);
-int c64dtvmisc_snapshot_write_module(struct snapshot_s *s);
-int c64dtvmisc_snapshot_read_module(struct snapshot_s *s);
#endif
Modified: trunk/vice/src/c64dtv/hummeradc.c
===================================================================
--- trunk/vice/src/c64dtv/hummeradc.c 2025-07-31 00:06:54 UTC (rev 45720)
+++ trunk/vice/src/c64dtv/hummeradc.c 2025-07-31 20:59:11 UTC (rev 45721)
@@ -27,10 +27,12 @@
#include "vice.h"
#include "c64dtv-resources.h"
+#include "cmdline.h"
#include "hummeradc.h"
#include "joystick.h"
#include "log.h"
#include "resources.h"
+#include "uiapi.h"
static log_t hummeradc_log = LOG_DEFAULT;
@@ -45,13 +47,12 @@
#define ADC_DIO_BIT 0x01
/* Hummer ADC variables */
-/* FIXME: move code from c64dtvmemsnapshot.c here, make static */
-uint8_t hummeradc_value;
-uint8_t hummeradc_channel;
-uint8_t hummeradc_control;
-uint8_t hummeradc_chanattr;
-uint8_t hummeradc_chanwakeup;
-uint8_t hummeradc_prev;
+static uint8_t hummeradc_value;
+static uint8_t hummeradc_channel;
+static uint8_t hummeradc_control;
+static uint8_t hummeradc_chanattr;
+static uint8_t hummeradc_chanwakeup;
+static uint8_t hummeradc_prev;
/* Hummer ADC state */
enum {
@@ -311,6 +312,12 @@
/* ------------------------------------------------------------------------- */
+
+int hummeradc_enable(int value)
+{
+ return 0;
+}
+
void hummeradc_init(void)
{
if (hummeradc_log == LOG_DEFAULT) {
@@ -337,3 +344,139 @@
hummeradc_chanwakeup = 0;
return;
}
+
+int c64dtv_hummer_adc_enabled = 0;
+
+static int c64dtv_hummer_adc_set(int value, void *param)
+{
+ int val = value ? 1 : 0;
+
+ if (c64dtv_hummer_adc_enabled == val) {
+ return 0;
+ }
+
+ if (val) {
+ /* check if a different joystick adapter is already active */
+ if (joystick_adapter_get_id()) {
+ ui_error("Joystick adapter %s is already active", joystick_adapter_get_name());
+ return -1;
+ }
+ joystick_adapter_activate(JOYSTICK_ADAPTER_ID_GENERIC_USERPORT, "Hummer ADC");
+
+ /* Enable 1 extra joystick port, without +5VDC support */
+ joystick_adapter_set_ports(1, 0);
+ } else {
+ joystick_adapter_deactivate();
+ }
+
+ c64dtv_hummer_adc_enabled = val;
+
+ return 0;
+}
+
+static const resource_int_t resources_int[] = {
+ { "HummerADC", 0, RES_EVENT_SAME, NULL,
+ (int *)&c64dtv_hummer_adc_enabled, c64dtv_hummer_adc_set, NULL },
+ RESOURCE_INT_LIST_END
+};
+
+int hummeradc_resources_init(void)
+{
+ return resources_register_int(resources_int);
+}
+
+static const cmdline_option_t cmdline_options[] =
+{
+ { "-hummeradc", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "HummerADC", (void *)1,
+ NULL, "Enable Hummer ADC" },
+ { "+hummeradc", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
+ NULL, NULL, "HummerADC", (void *)0,
+ NULL, "Disable Hummer ADC" },
+ CMDLINE_LIST_END
+};
+
+int hummeradc_cmdline_options_init(void)
+{
+ return cmdline_register_options(cmdline_options);
+}
+
+#define SNAP_MAJOR 0
+#define SNAP_MINOR 0
+static const char snap_misc_module_name[] = "HUMMERADC";
+
+int hummeradc_snapshot_write_module(snapshot_t *s)
+{
+ snapshot_module_t *m;
+
+ /* Misc. module. */
+ m = snapshot_module_create(s, snap_misc_module_name, SNAP_MAJOR, SNAP_MINOR);
+ if (m == NULL) {
+ return -1;
+ }
+
+ if (SMW_B(m, hummeradc_value) < 0
+ || SMW_B(m, hummeradc_channel) < 0
+ || SMW_B(m, hummeradc_control) < 0
+ || SMW_B(m, hummeradc_chanattr) < 0
+ || SMW_B(m, hummeradc_chanwakeup) < 0
+ || SMW_B(m, hummeradc_prev) < 0) {
+ goto fail;
+ }
+
+ if (snapshot_module_close(m) < 0) {
+ goto fail;
+ }
+ m = NULL;
+
+ return 0;
+
+fail:
+ if (m != NULL) {
+ snapshot_module_close(m);
+ }
+ return -1;
+}
+
+int hummeradc_snapshot_read_module(snapshot_t *s)
+{
+ uint8_t major_version, minor_version;
+ snapshot_module_t *m;
+
+ /* Misc. module. */
+ m = snapshot_module_open(s, snap_misc_module_name,
+ &major_version, &minor_version);
+ if (m == NULL) {
+ return -1;
+ }
+
+ if (snapshot_version_is_bigger(major_version, minor_version, SNAP_MAJOR, SNAP_MINOR)) {
+ log_error(hummeradc_log,
+ "Snapshot module version (%d.%d) newer than %d.%d.",
+ major_version, minor_version,
+ SNAP_MAJOR, SNAP_MINOR);
+ goto fail;
+ }
+
+ if (SMR_B(m, &hummeradc_value) < 0
+ || SMR_B(m, &hummeradc_channel) < 0
+ || SMR_B(m, &hummeradc_control) < 0
+ || SMR_B(m, &hummeradc_chanattr) < 0
+ || SMR_B(m, &hummeradc_chanwakeup) < 0
+ || SMR_B(m, &hummeradc_prev) < 0) {
+ goto fail;
+ }
+
+ if (snapshot_module_close(m) < 0) {
+ goto fail;
+ }
+ m = NULL;
+
+ return 0;
+
+fail:
+ if (m != NULL) {
+ snapshot_module_close(m);
+ }
+ return -1;
+}
Modified: trunk/vice/src/c64dtv/hummeradc.h
===================================================================
--- trunk/vice/src/c64dtv/hummeradc.h 2025-07-31 00:06:54 UTC (rev 45720)
+++ trunk/vice/src/c64dtv/hummeradc.h 2025-07-31 20:59:11 UTC (rev 45721)
@@ -28,6 +28,7 @@
#define VICE_HUMMERADC_H
#include "types.h"
+#include "snapshot.h"
void hummeradc_init(void);
void hummeradc_reset(void);
@@ -36,11 +37,14 @@
uint8_t hummeradc_read(void);
void hummeradc_store(uint8_t value);
-extern uint8_t hummeradc_value;
-extern uint8_t hummeradc_channel;
-extern uint8_t hummeradc_control;
-extern uint8_t hummeradc_chanattr;
-extern uint8_t hummeradc_chanwakeup;
-extern uint8_t hummeradc_prev;
+int hummeradc_enable(int value);
+extern int c64dtv_hummer_adc_enabled;
+
+int hummeradc_cmdline_options_init(void);
+int hummeradc_resources_init(void);
+
+int hummeradc_snapshot_write_module(snapshot_t *s);
+int hummeradc_snapshot_read_module(snapshot_t *s);
+
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-07-31 00:06:55
|
Revision: 45720
http://sourceforge.net/p/vice-emu/code/45720
Author: gpz
Date: 2025-07-31 00:06:54 +0000 (Thu, 31 Jul 2025)
Log Message:
-----------
add simple test program for the hummer adc
Added Paths:
-----------
testprogs/DTV/hummeradc/
testprogs/DTV/hummeradc/Makefile
testprogs/DTV/hummeradc/hummeradc.asm
testprogs/DTV/hummeradc/hummeradc.prg
Added: testprogs/DTV/hummeradc/Makefile
===================================================================
--- testprogs/DTV/hummeradc/Makefile (rev 0)
+++ testprogs/DTV/hummeradc/Makefile 2025-07-31 00:06:54 UTC (rev 45720)
@@ -0,0 +1,6 @@
+
+
+all: hummeradc.prg
+
+hummeradc.prg: hummeradc.asm
+ acme -f cbm -o hummeradc.prg hummeradc.asm
Added: testprogs/DTV/hummeradc/hummeradc.asm
===================================================================
--- testprogs/DTV/hummeradc/hummeradc.asm (rev 0)
+++ testprogs/DTV/hummeradc/hummeradc.asm 2025-07-31 00:06:54 UTC (rev 45720)
@@ -0,0 +1,245 @@
+; adcrdxx.asm
+; (c) 2006 by doug garmon
+; released under gpl licence
+
+; delay loops removed for this version
+
+portb = $dd01
+ddr = $dd03
+zstore = $fb
+
+; cia2 portb data direction register settings
+startddr = %00000110
+writeddr = %00000111
+readddr = %00000110
+
+start = %00000100
+clock = %00000010
+writemask = %00000001
+
+; the commands and data in the following section
+; are stored in reverse-bit order (backwards)
+adccmd = %00000001 ; adc read cmd (100)
+ctrlrg = %00000110 ; control reg setting cmd (011)
+chnatt = %00000100 ; channel attribute setting cmd (001)
+wakeup = %00000010 ; channel wakeup cmd (010)
+
+*=$0801
+ !byte $0b,$08,$0a,$00,$9e,$32,$30,$36,$31,0,0,0
+
+; jump table
+; jmp read ; read the adc
+; jmp init ; perform all the init subroutines
+ jmp dmdisp ; demo/display pot values
+
+; data section
+; bits are stored backwards
+; %00000000 channel #0 (000) 3 bits
+; %00001000 4-bit control reg setting (0001) 4 bits
+; the next two setting could just as easily be reset to effect only chan #0
+; %11111111 set all channels for wakeup - 8 bits
+; %11111111 set all channels to analog, not just channel 0 - 8 bits
+channel !byte $00 ; channel #
+chancrset !byte %00001000 ; channel control reg setting data
+chanwake !byte %11111111 ; channel wakeup function -- all
+chananalog !byte %11111111 ; set channels to analog -- all
+
+; read the adc
+read sei ; disable interrupts
+
+ jsr startsig ; the start signal
+
+ lda #adccmd ; send adc command
+ sta zstore ; bits to write in zstore
+ ldx #$03
+
+sendcmd jsr sendbits ; send it
+
+ lda channel ; send channel #
+ sta zstore ; bits to write in zstore
+ ldx #$03
+
+sendchan jsr sendbits ; send it
+
+ lda #readddr ; setup port for read
+ sta ddr
+
+ ldx #$04 ; two empty clock cycles = 4 clock toggles
+cycle jsr toggleclock
+ dex
+ bne cycle
+
+ lda #$00
+ sta zstore ; blank the data store
+
+ ldx #$08 ; get the 8 bits adc
+
+; fetch and store the adc bits
+; read each data bit in the middle of the clock cycle
+
+readadc jsr toggleclock
+ lda portb ; get adc bit
+
+ ror
+ rol zstore
+
+ jsr toggleclock
+ dex
+ bne readadc ; go back & get next bit
+
+ jsr toggleclock ; get the last bit (skip the roll)
+
+ jsr toggleclock ; complete last clock tic...
+ jsr toggleclock
+
+ cli ; enable interrupts
+ rts
+
+; init
+; call all the init routines
+
+init
+
+; init the control register settings
+; set the voltage reference to use 'ref' pin
+
+initcrs
+ sei
+ jsr startsig
+
+ lda #ctrlrg ; control reg setting command
+ sta zstore ; bits to write in zstore
+ ldx #$03 ; 3 bits
+
+ jsr sendbits ; send the cmd
+
+ lda chancrset ; cntl reg setting
+ sta zstore
+ ldx #$04 ; 4 bits in a cr setting
+
+ jsr sendbits ; send the setting
+
+; init channels for analog input
+initchn
+ jsr startsig
+
+ lda #chnatt ; channel attribute command
+ sta zstore ; bits to write in zstore
+ ldx #$03 ; 3 bits
+
+ jsr sendbits ; send the cmd
+
+ lda chananalog ; set channels to analog
+ sta zstore
+ ldx #$08 ; 8 bits
+
+ jsr sendbits ; send the setting
+
+; init channels for wakeup function
+initwake
+ jsr startsig
+
+ lda #wakeup ; wakeup command
+ sta zstore ; bits to write in zstore
+ ldx #$03 ; 3 bits
+
+ jsr sendbits ; send the cmd
+
+ lda chanwake ; set channels to wake
+ sta zstore
+ ldx #$08 ; 8 bits
+
+ jsr sendbits ; send the setting
+ cli
+
+ rts
+
+; send bits to adc
+; zstore holds bits (one byte, up to 8 bits)
+; x reg holds number of bits
+
+sendbits
+ jsr writebit
+ jsr toggleclock
+
+ lsr zstore ; shift the cmd/data bits
+ dex
+ bne sendbits ; loop back until all bits sent
+
+ rts
+
+
+; start signal, initiate any transfer
+; startsig also initializes the ddr for whatever cmd follows
+
+startsig
+ lda #startddr ; initialize for start
+ sta ddr
+ lda #start
+ sta portb ; begin start signal
+
+ lda #$00
+ sta portb ; drop start
+
+ lda #writeddr ; initialize for write
+ sta ddr
+ rts
+
+; toggles clock
+
+toggleclock
+ lda portb
+ eor #clock ; eor the current state of clock
+ sta portb
+
+ rts
+
+; sets clock, writes to dio
+; writing only involves two bits (clock and data), so don't set clock and data
+; separately--just set the two bits as required and write to the port once.
+
+writebit
+ lda zstore
+ and #writemask ; and the data bit
+ ora #clock ; set the clock bit
+ sta portb
+
+ rts
+
+; david murray's demo/display routine:
+; display adc values in loop, exit on keypress
+
+dmdisp jsr init
+
+ lda #$93 ; petscii for clearscreen
+ jsr $ffd2 ; kernal char-out
+disp
+ lda #$13 ; print home
+ jsr $ffd2
+
+ jsr read ; read the ADC
+ lda zstore
+ and #$f0 ; get only high 4-bits
+ ror
+ ror
+ ror
+ ror
+ jsr convert
+ jsr $ffd2
+ lda zstore
+ and #$0f ; get only low 4 bits
+ jsr convert
+ jsr $ffd2
+ jsr $ffe4 ; get char from keyboard
+; cmp #$00
+; bne convert2 ; if not equal to zero, end.
+ sta $0400+80
+
+ jmp disp
+convert
+ adc #$30 ; routine converts a digit 0-15 to
+ cmp #$3a ; a petscii character for hex display
+ bcc convert2
+ adc #$06
+convert2
+ rts
Added: testprogs/DTV/hummeradc/hummeradc.prg
===================================================================
(Binary files differ)
Index: testprogs/DTV/hummeradc/hummeradc.prg
===================================================================
--- testprogs/DTV/hummeradc/hummeradc.prg 2025-07-30 23:50:48 UTC (rev 45719)
+++ testprogs/DTV/hummeradc/hummeradc.prg 2025-07-31 00:06:54 UTC (rev 45720)
Property changes on: testprogs/DTV/hummeradc/hummeradc.prg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/x-commodore-exec
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-07-30 23:50:50
|
Revision: 45719
http://sourceforge.net/p/vice-emu/code/45719
Author: gpz
Date: 2025-07-30 23:50:48 +0000 (Wed, 30 Jul 2025)
Log Message:
-----------
hotfix for #2155 - the proper fix will be to convert ps/2 mouse and hummer-adc to the new userport system
Modified Paths:
--------------
trunk/vice/src/c64dtv/c64dtvcia2.c
trunk/vice/src/c64dtv/hummeradc.c
Modified: trunk/vice/src/c64dtv/c64dtvcia2.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtvcia2.c 2025-07-29 23:17:47 UTC (rev 45718)
+++ trunk/vice/src/c64dtv/c64dtvcia2.c 2025-07-30 23:50:48 UTC (rev 45719)
@@ -56,9 +56,13 @@
void cia2_store(uint16_t addr, uint8_t data)
{
if ((addr & 0x1f) == 1) {
- store_userport_pbx(data, USERPORT_NO_PULSE);
+ /* HACK: for now only call the userport system when neither ps/2 mouse
+ nor hummer adc is enabled */
+ if (!c64dtv_hummer_adc_enabled && !ps2mouse_enabled) {
+ store_userport_pbx(data, USERPORT_NO_PULSE);
+ }
- /* The functions below will gradually be removed as the functionality is added to the new userport system. */
+ /* FIXME: convert hummer adc and ps/2 mouse support to new userport system */
if (c64dtv_hummer_adc_enabled) {
hummeradc_store(data);
}
@@ -75,9 +79,13 @@
uint8_t retval = 0xff;
if ((addr & 0x1f) == 1) {
- retval = read_userport_pbx(retval);
+ /* HACK: for now only call the userport system when neither ps/2 mouse
+ nor hummer adc is enabled */
+ if (!c64dtv_hummer_adc_enabled && !ps2mouse_enabled) {
+ retval = read_userport_pbx(retval);
+ }
- /* The functions below will gradually be removed as the functionality is added to the new userport system. */
+ /* FIXME: convert hummer adc and ps/2 mouse support to new userport system */
if (ps2mouse_enabled) {
retval &= (ps2mouse_read() | 0x3f);
}
Modified: trunk/vice/src/c64dtv/hummeradc.c
===================================================================
--- trunk/vice/src/c64dtv/hummeradc.c 2025-07-29 23:17:47 UTC (rev 45718)
+++ trunk/vice/src/c64dtv/hummeradc.c 2025-07-30 23:50:48 UTC (rev 45719)
@@ -45,6 +45,7 @@
#define ADC_DIO_BIT 0x01
/* Hummer ADC variables */
+/* FIXME: move code from c64dtvmemsnapshot.c here, make static */
uint8_t hummeradc_value;
uint8_t hummeradc_channel;
uint8_t hummeradc_control;
@@ -112,7 +113,7 @@
{
uint16_t joyport_3_joystick_value;
#ifdef HUMMERADC_DEBUG_ENABLED
- HUMMERADC_DEBUG("write: value %02x, state %i", value, hummeradc_state);
+ HUMMERADC_DEBUG("write: value %02x, state %i, ADC:%2x", value, hummeradc_state, hummeradc_value);
#endif
if (value & ADC_START_BIT) {
hummeradc_state = ADC_START;
@@ -232,13 +233,13 @@
- "inertia" (hold down left/right for value++/--), handled elsewhere */
joyport_3_joystick_value = get_joystick_value(JOYPORT_3);
switch (joyport_3_joystick_value & 0x0c) {
- case 4:
+ case 4: /* left */
hummeradc_value = 0x00;
break;
- case 8:
+ case 8: /* right */
hummeradc_value = 0xff;
break;
- default:
+ default: /* neutral */
hummeradc_value = 0x80;
break;
}
@@ -303,7 +304,7 @@
break;
}
#ifdef HUMMERADC_DEBUG_ENABLED
- HUMMERADC_DEBUG(" read: value %02x, state %i", retval, hummeradc_state);
+ HUMMERADC_DEBUG(" read: value %02x, state %i, ADC:%2x", retval, hummeradc_state, hummeradc_value);
#endif
return retval;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-07-29 23:17:49
|
Revision: 45718
http://sourceforge.net/p/vice-emu/code/45718
Author: gpz
Date: 2025-07-29 23:17:47 +0000 (Tue, 29 Jul 2025)
Log Message:
-----------
add hint on how to setup the Hummer ADC joystick
Modified Paths:
--------------
trunk/vice/doc/vice.texi
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2025-07-29 22:02:24 UTC (rev 45717)
+++ trunk/vice/doc/vice.texi 2025-07-29 23:17:47 UTC (rev 45718)
@@ -14011,7 +14011,8 @@
Hummer ADC, userport joystick and PS/2 mouse.
The joystick that controls either the Hummer ADC or userport joystick
-can be selected using the same parameter or menu option.
+can be selected using the same parameter or menu option. (Enable "Hummer userport
+adapter" and use the first extra joystick.)
While using the Hummer ADC, joystick UP and DOWN are mapped to
the Hummer buttons A and B respectively. LEFT and RIGHT set the ADCs
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-07-29 22:02:27
|
Revision: 45717
http://sourceforge.net/p/vice-emu/code/45717
Author: gpz
Date: 2025-07-29 22:02:24 +0000 (Tue, 29 Jul 2025)
Log Message:
-----------
add support for the PAL DTV Hummer
Modified Paths:
--------------
trunk/vice/doc/vice.texi
trunk/vice/src/arch/gtk3/c64dtvui.c
trunk/vice/src/arch/gtk3/widgets/settings_c64dtvflash.c
trunk/vice/src/arch/gtk3/widgets/settings_model.c
trunk/vice/src/arch/sdl/menu_c64dtvhw.c
trunk/vice/src/c64dtv/c64dtv-cmdline-options.c
trunk/vice/src/c64dtv/c64dtvflash.c
trunk/vice/src/c64dtv/c64dtvmodel.c
trunk/vice/src/c64dtv/c64dtvmodel.h
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2025-07-29 15:23:08 UTC (rev 45716)
+++ trunk/vice/doc/vice.texi 2025-07-29 22:02:24 UTC (rev 45717)
@@ -13935,11 +13935,16 @@
Specify filename of the C64DTV PAL v3 ROM image
(@code{DTVPALV3FlashName}).
-@findex -hummerromimage
-@item -hummerromimage <name>
-Specify filename of the C64DTV Hummer ROM image
-(@code{DTVHummerFlashName}).
+@findex -hummerntscromimage
+@item -hummerntscromimage <name>
+Specify filename of the C64DTV NTSC Hummer ROM image
+(@code{DTVNTSCHummerFlashName}).
+@findex -hummerpalromimage
+@item -hummerpalromimage <name>
+Specify filename of the C64DTV PAL Hummer ROM image
+(@code{DTVPALHummerFlashName}).
+
@findex -c64dtvromrw, +c64dtvromrw
@item -c64dtvromrw
@itemx +c64dtvromrw
@@ -14110,10 +14115,14 @@
@item DTVPALV3FlashName
String specifying the filename of the DTV PAL v3 Flash ROM image.
-@vindex DTVHummerFlashName
-@item DTVHummerFlashName
-String specifying the filename of the DTV Hummer Flash ROM image.
+@vindex DTVNTSCHummerFlashName
+@item DTVNTSCHummerFlashName
+String specifying the filename of the DTV NTSC Hummer Flash ROM image.
+@vindex DTVPALHummerFlashName
+@item DTVPALHummerFlashName
+String specifying the filename of the DTV PAL Hummer Flash ROM image.
+
@vindex DTVFlashRevision
@item DTVFlashRevision
Integer specifying which of the above Flash ROM images will be used.
Modified: trunk/vice/src/arch/gtk3/c64dtvui.c
===================================================================
--- trunk/vice/src/arch/gtk3/c64dtvui.c 2025-07-29 15:23:08 UTC (rev 45716)
+++ trunk/vice/src/arch/gtk3/c64dtvui.c 2025-07-29 22:02:24 UTC (rev 45717)
@@ -53,6 +53,7 @@
"V2 NTSC",
"V3 PAL",
"V3 NTSC",
+ "Hummer (PAL)",
"Hummer (NTSC)",
NULL
};
Modified: trunk/vice/src/arch/gtk3/widgets/settings_c64dtvflash.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_c64dtvflash.c 2025-07-29 15:23:08 UTC (rev 45716)
+++ trunk/vice/src/arch/gtk3/widgets/settings_c64dtvflash.c 2025-07-29 22:02:24 UTC (rev 45717)
@@ -5,14 +5,15 @@
*/
/*
- * $VICERES DTVPALV2FlashName x64dtv
- * $VICERES DTVNTSCV2FlashName x64dtv
- * $VICERES DTVPALV3FlashName x64dtv
- * $VICERES DTVNTSCV3FlashName x64dtv
- * $VICERES DTVHummerFlashName x64dtv
- * $VICERES c64dtvromrw x64dtv
- * $VICERES FSFlashDir x64dtv
- * $VICERES FlashTrueFS x64dtv
+ * $VICERES DTVPALV2FlashName x64dtv
+ * $VICERES DTVNTSCV2FlashName x64dtv
+ * $VICERES DTVPALV3FlashName x64dtv
+ * $VICERES DTVNTSCV3FlashName x64dtv
+ * $VICERES DTVPALHummerFlashName x64dtv
+ * $VICERES DTVNTSCHummerFlashName x64dtv
+ * $VICERES c64dtvromrw x64dtv
+ * $VICERES FSFlashDir x64dtv
+ * $VICERES FlashTrueFS x64dtv
*/
/*
@@ -59,7 +60,8 @@
"DTVNTSCV2FlashName",
"DTVPALV3FlashName",
"DTVNTSCV3FlashName",
- "DTVHummerFlashName"
+ "DTVPALHummerFlashName",
+ "DTVNTSCHummerFlashName"
};
chooser = vice_gtk3_resource_filechooser_new(resnames[idx],
@@ -144,15 +146,20 @@
gtk_grid_attach(GTK_GRID(grid), label, 0, 3, 1, 1);
gtk_grid_attach(GTK_GRID(grid), rom_file, 1, 3, 1, 1);
- label = label_helper("Hummer ROM file");
- rom_file = create_rom_widget(DTVMODEL_HUMMER_NTSC);
+ label = label_helper("PAL Hummer ROM file");
+ rom_file = create_rom_widget(DTVMODEL_HUMMER_PAL);
gtk_grid_attach(GTK_GRID(grid), label, 0, 4, 1, 1);
gtk_grid_attach(GTK_GRID(grid), rom_file, 1, 4, 1, 1);
+ label = label_helper("NTSC Hummer ROM file");
+ rom_file = create_rom_widget(DTVMODEL_HUMMER_NTSC);
+ gtk_grid_attach(GTK_GRID(grid), label, 0, 5, 1, 1);
+ gtk_grid_attach(GTK_GRID(grid), rom_file, 1, 5, 1, 1);
+
rom_write = vice_gtk3_resource_check_button_new(
"c64dtvromrw",
"Enable writes to C64DTV ROM image");
- gtk_grid_attach(GTK_GRID(grid), rom_write, 1, 5, 1, 1);
+ gtk_grid_attach(GTK_GRID(grid), rom_write, 1, 6, 1, 1);
/* Flash dir and true HW flash check button */
label = label_helper("Flash FS directory");
@@ -162,9 +169,9 @@
"Enable true hardware flash file system");
gtk_widget_set_margin_top(label, 16);
gtk_widget_set_margin_top(flash_dir, 16);
- gtk_grid_attach(GTK_GRID(grid), label, 0, 6, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), flash_dir, 1, 6, 1, 1);
- gtk_grid_attach(GTK_GRID(grid), flash_hw, 1, 7, 1, 1);
+ gtk_grid_attach(GTK_GRID(grid), label, 0, 7, 1, 1);
+ gtk_grid_attach(GTK_GRID(grid), flash_dir, 1, 7, 1, 1);
+ gtk_grid_attach(GTK_GRID(grid), flash_hw, 1, 8, 1, 1);
gtk_widget_show_all(grid);
return grid;
Modified: trunk/vice/src/arch/gtk3/widgets/settings_model.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_model.c 2025-07-29 15:23:08 UTC (rev 45716)
+++ trunk/vice/src/arch/gtk3/widgets/settings_model.c 2025-07-29 22:02:24 UTC (rev 45717)
@@ -770,6 +770,7 @@
break;
case DTVMODEL_V3_PAL: /* fall through */
case DTVMODEL_V3_NTSC: /* fall through */
+ case DTVMODEL_HUMMER_PAL:
case DTVMODEL_HUMMER_NTSC:
rev = DTVREV_3;
break;
Modified: trunk/vice/src/arch/sdl/menu_c64dtvhw.c
===================================================================
--- trunk/vice/src/arch/sdl/menu_c64dtvhw.c 2025-07-29 15:23:08 UTC (rev 45716)
+++ trunk/vice/src/arch/sdl/menu_c64dtvhw.c 2025-07-29 22:02:24 UTC (rev 45717)
@@ -86,6 +86,11 @@
.callback = custom_DTVModel_callback,
.data = (ui_callback_data_t)DTVMODEL_V3_NTSC
},
+ { .string = "Hummer PAL",
+ .type = MENU_ENTRY_RESOURCE_RADIO,
+ .callback = custom_DTVModel_callback,
+ .data = (ui_callback_data_t)DTVMODEL_HUMMER_PAL
+ },
{ .string = "Hummer NTSC",
.type = MENU_ENTRY_RESOURCE_RADIO,
.callback = custom_DTVModel_callback,
@@ -100,7 +105,8 @@
UI_MENU_DEFINE_FILE_STRING(DTVPALV2FlashName)
UI_MENU_DEFINE_FILE_STRING(DTVNTSCV3FlashName)
UI_MENU_DEFINE_FILE_STRING(DTVPALV3FlashName)
-UI_MENU_DEFINE_FILE_STRING(DTVHummerFlashName)
+UI_MENU_DEFINE_FILE_STRING(DTVPALHummerFlashName)
+UI_MENU_DEFINE_FILE_STRING(DTVNTSCHummerFlashName)
UI_MENU_DEFINE_TOGGLE(c64dtvromrw)
UI_MENU_DEFINE_TOGGLE(FlashTrueFS)
@@ -162,11 +168,16 @@
.callback = file_string_DTVPALV3FlashName_callback,
.data = (ui_callback_data_t)"Select C64DTV PAL v3 ROM image file"
},
- { .string = "Hummer",
+ { .string = "PAL Hummer",
.type = MENU_ENTRY_DIALOG,
- .callback = file_string_DTVHummerFlashName_callback,
- .data = (ui_callback_data_t)"Select C64DTV Hummer ROM image file"
+ .callback = file_string_DTVPALHummerFlashName_callback,
+ .data = (ui_callback_data_t)"Select C64DTV PAL Hummer ROM image file"
},
+ { .string = "NTSC Hummer",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = file_string_DTVNTSCHummerFlashName_callback,
+ .data = (ui_callback_data_t)"Select C64DTV NTSC Hummer ROM image file"
+ },
SDL_MENU_ITEM_SEPARATOR,
{ .string = "Enable writes",
Modified: trunk/vice/src/c64dtv/c64dtv-cmdline-options.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtv-cmdline-options.c 2025-07-29 15:23:08 UTC (rev 45716)
+++ trunk/vice/src/c64dtv/c64dtv-cmdline-options.c 2025-07-29 22:02:24 UTC (rev 45717)
@@ -48,6 +48,8 @@
{ "v3pal", DTVMODEL_V3_PAL },
{ "v3ntsc", DTVMODEL_V3_NTSC },
{ "hummer", DTVMODEL_HUMMER_NTSC },
+ { "hummerpal", DTVMODEL_HUMMER_PAL },
+ { "hummerntsc", DTVMODEL_HUMMER_NTSC },
{ NULL, DTVMODEL_UNKNOWN }
};
Modified: trunk/vice/src/c64dtv/c64dtvflash.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtvflash.c 2025-07-29 15:23:08 UTC (rev 45716)
+++ trunk/vice/src/c64dtv/c64dtvflash.c 2025-07-29 22:02:24 UTC (rev 45717)
@@ -49,11 +49,12 @@
/* #define DEBUG */
-#define DTVROM_PALV2_NAME_DEFAULT "dtvrom.bin" /* FIXME: rename (who made this?) */
-#define DTVROM_PALV3_NAME_DEFAULT "dtvrom.bin" /* FIXME: rename (who made this?) */
-#define DTVROM_NTSCV2_NAME_DEFAULT "dtvrom.bin" /* FIXME: rename (who made this?) */
-#define DTVROM_NTSCV3_NAME_DEFAULT "dtvrom.bin" /* FIXME: rename (who made this?) */
-#define DTVROM_HUMMER_NAME_DEFAULT "dtvrom.bin" /* FIXME: rename (who made this?) */
+#define DTVROM_PALV2_NAME_DEFAULT "dtvrom.bin" /* FIXME: rename (who made this?) */
+#define DTVROM_PALV3_NAME_DEFAULT "dtvrom.bin" /* FIXME: rename (who made this?) */
+#define DTVROM_NTSCV2_NAME_DEFAULT "dtvrom.bin" /* FIXME: rename (who made this?) */
+#define DTVROM_NTSCV3_NAME_DEFAULT "dtvrom.bin" /* FIXME: rename (who made this?) */
+#define DTVROM_HUMMER_NAME_DEFAULT "dtvrom.bin" /* FIXME: rename (who made this?) */
+#define DTVROM_HUMMER_PAL_NAME_DEFAULT "dtvrom.bin" /* FIXME: rename (who made this?) */
static log_t c64dtvflash_log = LOG_DEFAULT;
#ifdef DEBUG
@@ -634,8 +635,10 @@
&c64dtvflash_filename[DTVMODEL_V3_NTSC], set_c64dtvflash_filename, (void*)DTVMODEL_V3_NTSC },
{ "DTVPALV3FlashName", DTVROM_PALV3_NAME_DEFAULT, RES_EVENT_NO, NULL,
&c64dtvflash_filename[DTVMODEL_V3_PAL], set_c64dtvflash_filename, (void*)DTVMODEL_V3_PAL },
- { "DTVHummerFlashName", DTVROM_HUMMER_NAME_DEFAULT, RES_EVENT_NO, NULL,
+ { "DTVNTSCHummerFlashName", DTVROM_HUMMER_NAME_DEFAULT, RES_EVENT_NO, NULL,
&c64dtvflash_filename[DTVMODEL_HUMMER_NTSC], set_c64dtvflash_filename, (void*)DTVMODEL_HUMMER_NTSC },
+ { "DTVPALHummerFlashName", DTVROM_HUMMER_PAL_NAME_DEFAULT, RES_EVENT_NO, NULL,
+ &c64dtvflash_filename[DTVMODEL_HUMMER_PAL], set_c64dtvflash_filename, (void*)DTVMODEL_HUMMER_PAL },
RESOURCE_STRING_LIST_END
};
@@ -682,9 +685,12 @@
{ "-palv3romimage", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
NULL, NULL, "DTVPALV3FlashName", NULL,
"<Name>", "Specify name of C64DTV PAL v3 ROM image" },
- { "-hummerromimage", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
- NULL, NULL, "DTVHummerFlashName", NULL,
- "<Name>", "Specify name of C64DTV Hummer ROM image" },
+ { "-hummerntscromimage", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
+ NULL, NULL, "DTVNTSCHummerFlashName", NULL,
+ "<Name>", "Specify name of C64DTV NTSC Hummer ROM image" },
+ { "-hummerpalromimage", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
+ NULL, NULL, "DTVPALHummerFlashName", NULL,
+ "<Name>", "Specify name of C64DTV PAL Hummer ROM image" },
{ "-c64dtvromrw", SET_RESOURCE, CMDLINE_ATTRIB_NONE,
NULL, NULL, "c64dtvromrw", (void *)1,
NULL, "Enable writes to C64DTV ROM image" },
Modified: trunk/vice/src/c64dtv/c64dtvmodel.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtvmodel.c 2025-07-29 15:23:08 UTC (rev 45716)
+++ trunk/vice/src/c64dtv/c64dtvmodel.c 2025-07-29 22:02:24 UTC (rev 45717)
@@ -83,6 +83,7 @@
{ MACHINE_SYNC_NTSC, DTVREV_2, IS_DTV, DTVMODEL_V2_NTSC }, /* DTV v2 (ntsc) */
{ MACHINE_SYNC_PAL, DTVREV_3, IS_DTV, DTVMODEL_V3_PAL }, /* DTV v3 (pal) */
{ MACHINE_SYNC_NTSC, DTVREV_3, IS_DTV, DTVMODEL_V3_NTSC }, /* DTV v3 (ntsc) */
+ { MACHINE_SYNC_PAL, DTVREV_3, IS_HUMMER, DTVMODEL_HUMMER_PAL }, /* Hummer (pal) */
{ MACHINE_SYNC_NTSC, DTVREV_3, IS_HUMMER, DTVMODEL_HUMMER_NTSC }, /* Hummer (ntsc) */
};
Modified: trunk/vice/src/c64dtv/c64dtvmodel.h
===================================================================
--- trunk/vice/src/c64dtv/c64dtvmodel.h 2025-07-29 15:23:08 UTC (rev 45716)
+++ trunk/vice/src/c64dtv/c64dtvmodel.h 2025-07-29 22:02:24 UTC (rev 45717)
@@ -35,6 +35,7 @@
DTVMODEL_V2_NTSC, /* DTV v2 (ntsc) */
DTVMODEL_V3_PAL, /* DTV v3 (pal) */
DTVMODEL_V3_NTSC, /* DTV v3 (ntsc) */
+ DTVMODEL_HUMMER_PAL, /* Hummer (pal) */
DTVMODEL_HUMMER_NTSC, /* Hummer (ntsc) */
/* This entry always needs to be at the end */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-07-29 15:23:10
|
Revision: 45716
http://sourceforge.net/p/vice-emu/code/45716
Author: gpz
Date: 2025-07-29 15:23:08 +0000 (Tue, 29 Jul 2025)
Log Message:
-----------
in C65/Mega65 mode preserve leading spaces in txt->prg conversion, patch by Dan Sanderson
Modified Paths:
--------------
trunk/vice/src/tools/petcat/petcat.c
Modified: trunk/vice/src/tools/petcat/petcat.c
===================================================================
--- trunk/vice/src/tools/petcat/petcat.c 2025-07-29 13:35:42 UTC (rev 45715)
+++ trunk/vice/src/tools/petcat/petcat.c 2025-07-29 15:23:08 UTC (rev 45716)
@@ -1882,6 +1882,23 @@
#define MAX_INLINE_LEN (256 * 8)
#define MAX_OUTLINE_LEN 256
+static unsigned char* check_leading_space(int version, unsigned char* p)
+{
+ if (version == B_10 || version == B_65) {
+ /* for modes that preserve leading spaces, only delete a single space */
+ if (isspace(*p)) {
+ p++;
+ }
+ } else {
+ /* otherwise, delete all leading spaces */
+ while (isspace((unsigned char)*p)) {
+ p++;
+ }
+ }
+
+ return p;
+}
+
static void p_tokenize(int version, unsigned int addr, int ctrls)
{
static char line[MAX_INLINE_LEN + 1];
@@ -1920,10 +1937,9 @@
quote = 0;
rem_data_mode = 0;
- while (isspace((unsigned char)*p2)) {
- p2++;
- }
+ p2 = check_leading_space(version, p2);
+
while (*p2) {
if (*p2 == 0x22) {
quote ^= *p2;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-07-29 13:35:43
|
Revision: 45715
http://sourceforge.net/p/vice-emu/code/45715
Author: gpz
Date: 2025-07-29 13:35:42 +0000 (Tue, 29 Jul 2025)
Log Message:
-----------
added testprogram related to bug #2124
Modified Paths:
--------------
testprogs/testbench/kernal64scpu64-testlist.txt
testprogs/testbench/scpu-testlist.in
testprogs/testbench/xscpu64-testlist.txt
Added Paths:
-----------
testprogs/SCPU/reu/
testprogs/SCPU/reu/Makefile
testprogs/SCPU/reu/dmatest.prg
testprogs/SCPU/reu/dmatest.s
testprogs/SCPU/reu/readme.txt
Added: testprogs/SCPU/reu/Makefile
===================================================================
--- testprogs/SCPU/reu/Makefile (rev 0)
+++ testprogs/SCPU/reu/Makefile 2025-07-29 13:35:42 UTC (rev 45715)
@@ -0,0 +1,10 @@
+
+XSCPU = /Applications/vice-arm64-gtk3-3.9/bin/xscpu64
+X64SC = /Applications/vice-arm64-gtk3-3.9/bin/x64sc
+
+dmatest.prg: dmatest.s
+ cl65 -t none --start-addr 2047 $^ -o $@
+
+run: dmatest.prg
+ #$(XSCPU) dmatest.prg
+ $(X64SC) dmatest.prg
Added: testprogs/SCPU/reu/dmatest.prg
===================================================================
(Binary files differ)
Index: testprogs/SCPU/reu/dmatest.prg
===================================================================
--- testprogs/SCPU/reu/dmatest.prg 2025-07-23 12:58:46 UTC (rev 45714)
+++ testprogs/SCPU/reu/dmatest.prg 2025-07-29 13:35:42 UTC (rev 45715)
Property changes on: testprogs/SCPU/reu/dmatest.prg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/x-commodore-exec
\ No newline at end of property
Added: testprogs/SCPU/reu/dmatest.s
===================================================================
--- testprogs/SCPU/reu/dmatest.s (rev 0)
+++ testprogs/SCPU/reu/dmatest.s 2025-07-29 13:35:42 UTC (rev 45715)
@@ -0,0 +1,83 @@
+
+ .MACPACK cbm
+ .word basicstub ; load address
+
+da=$0400+52
+
+basicstub:
+ .byte $0b,$08,$0a,$00,$9e,$32,$30,$36,$31,0,0,0
+
+ sei
+ ldx#119
+:
+ lda#32
+ sta $0400,x
+ lda#7
+ sta $d800,x
+ dex
+ bne :-
+
+ jsr tx
+ jsr rx
+
+ ldx#15
+: lda da,x
+ cmp sd,x
+ bne fail
+ dex
+ bpl :-
+
+ lda #5 ; green
+ ldy #0 ; pass
+ jmp store
+fail:
+ lda #2 ; red
+ ldy #$ff ; fail
+store:
+ sta $d020
+ sty $d7ff
+ cli
+ rts
+
+tx:
+ lda #<sd ; C64 addr
+ sta $df02
+ lda #>sd
+ sta $df03
+ lda #$01 ; REU addr $006001
+ sta $df04
+ lda #$60
+ sta $df05
+ lda #$00
+ sta $df06
+ nop
+ lda #$10 ; len $0010
+ sta $df07
+ nop
+ lda #$00
+ sta $df08
+ lda #$90 ; execute C64->REU
+ sta $df01
+ rts
+rx:
+ lda #<da ; C64 addr
+ sta $df02
+ lda #>da
+ sta $df03
+ lda #$01 ; REU addr $006001
+ sta $df04
+ lda #$60
+ sta $df05
+ lda #$00
+ sta $df06
+ nop
+ lda #$10 ; len $0010
+ sta $df07
+ nop
+ lda #$00
+ sta $df08
+ lda #$91 ; execute REU->C64
+ sta $df01
+ rts
+sd:
+ scrcode "ANIMALS IN A ZOO"
Added: testprogs/SCPU/reu/readme.txt
===================================================================
--- testprogs/SCPU/reu/readme.txt (rev 0)
+++ testprogs/SCPU/reu/readme.txt 2025-07-29 13:35:42 UTC (rev 45715)
@@ -0,0 +1,2 @@
+related to bug #2124
+
Modified: testprogs/testbench/kernal64scpu64-testlist.txt
===================================================================
--- testprogs/testbench/kernal64scpu64-testlist.txt 2025-07-23 12:58:46 UTC (rev 45714)
+++ testprogs/testbench/kernal64scpu64-testlist.txt 2025-07-29 13:35:42 UTC (rev 45715)
@@ -25,6 +25,10 @@
../SCPU/scputest/,scputest-0.prg,exitcode,30000000
../SCPU/scputest/,scputest-1.prg,exitcode,30000000
################################################################################
+# REU
+################################################################################
+../SCPU/reu/,dmatest.prg,exitcode,6000000
+################################################################################
# Joystick/Mouse
################################################################################
################################################################################
Modified: testprogs/testbench/scpu-testlist.in
===================================================================
--- testprogs/testbench/scpu-testlist.in 2025-07-23 12:58:46 UTC (rev 45714)
+++ testprogs/testbench/scpu-testlist.in 2025-07-29 13:35:42 UTC (rev 45715)
@@ -24,6 +24,10 @@
../SCPU/scputest/,scputest-0.prg,exitcode,30000000
../SCPU/scputest/,scputest-1.prg,exitcode,30000000
################################################################################
+# REU
+################################################################################
+../SCPU/reu/,dmatest.prg,exitcode,6000000
+################################################################################
# Joystick/Mouse
################################################################################
################################################################################
Modified: testprogs/testbench/xscpu64-testlist.txt
===================================================================
--- testprogs/testbench/xscpu64-testlist.txt 2025-07-23 12:58:46 UTC (rev 45714)
+++ testprogs/testbench/xscpu64-testlist.txt 2025-07-29 13:35:42 UTC (rev 45715)
@@ -25,6 +25,10 @@
../SCPU/scputest/,scputest-0.prg,exitcode,30000000
../SCPU/scputest/,scputest-1.prg,exitcode,30000000
################################################################################
+# REU
+################################################################################
+../SCPU/reu/,dmatest.prg,exitcode,6000000
+################################################################################
# Joystick/Mouse
################################################################################
################################################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-07-23 12:58:48
|
Revision: 45714
http://sourceforge.net/p/vice-emu/code/45714
Author: empathicqubit
Date: 2025-07-23 12:58:46 +0000 (Wed, 23 Jul 2025)
Log Message:
-----------
docs: Fix CPU history diagram
Modified Paths:
--------------
trunk/vice/doc/vice.texi
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2025-07-17 22:08:46 UTC (rev 45713)
+++ trunk/vice/doc/vice.texi 2025-07-23 12:58:46 UTC (rev 45714)
@@ -22742,11 +22742,11 @@
...
RS[0][RC-1] @{ ... @}
]
+ CL[0] CL[0] CL[0] CL[0] CL[0] CL[0] CL[0] CL[0] | IL[0] | IB[0][0] IB[0][1] ... IB[0][IL-1]
@}
...
IS[HC-1] @{ ... @}
]
-CL CL CL CL CL CL CL CL | IL | IB[0] IB[1] ... IB[IL-1]
@end example
@*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-07-17 22:08:49
|
Revision: 45713
http://sourceforge.net/p/vice-emu/code/45713
Author: gpz
Date: 2025-07-17 22:08:46 +0000 (Thu, 17 Jul 2025)
Log Message:
-----------
add some details on check points
Modified Paths:
--------------
trunk/vice/doc/vice.texi
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2025-07-14 19:25:58 UTC (rev 45712)
+++ trunk/vice/doc/vice.texi 2025-07-17 22:08:46 UTC (rev 45713)
@@ -20879,7 +20879,10 @@
@item goto <address>
@itemx g <address>
-Change the PC to address and continue execution.
+Change the PC to address and continue execution. If no address is given, execution
+will continue from where it stopped. Also, if @code{KeepMonitorOpen} is 1, the monitor
+window will stay open in the background. This can be useful to watch eg trace points
+or log output in real time.
@item io [<address>]
Display i/o registers. Invoking without an address shows a dump of
@@ -21060,6 +21063,20 @@
A conditional expression can also be specified for the breakpoint.
For more information on conditions, see the CONDITION command.
+When a breakpoint hits, the following info will be printed: The first line shows
+the type of checkpoint, the address, current raster line and -cycle. The second
+line shows a dump and disassemble, followed by the CPU registers and flags. The
+number at the end of the line is the stopwatch cycle counter.
+@end table
+
+@example
+#1 (Stop on exec ea31) 41/$029, 35/$23
+.C:ea31 20 EA FF JSR $FFEA - A:00 X:ED Y:0A SP:ed ..-..IZ. 27481706
+@end example
+
+
+@table @code
+
@item enable <checknum>
@item disable <checknum>
Each checkpoint can be enabled or disabled. This command allows
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rh...@us...> - 2025-07-14 19:25:59
|
Revision: 45712
http://sourceforge.net/p/vice-emu/code/45712
Author: rhialto
Date: 2025-07-14 19:25:58 +0000 (Mon, 14 Jul 2025)
Log Message:
-----------
Clean up some video address mask nonsense.
Modified Paths:
--------------
trunk/vice/src/pet/pet.c
Modified: trunk/vice/src/pet/pet.c
===================================================================
--- trunk/vice/src/pet/pet.c 2025-07-14 19:12:34 UTC (rev 45711)
+++ trunk/vice/src/pet/pet.c 2025-07-14 19:25:58 UTC (rev 45712)
@@ -931,17 +931,15 @@
/* mem_initialize_memory(); */
if (!cols) {
+ /* FIXME this guesswork should never be needed!
+ * petmem_check_info() already does something like this. */
cols = petres.rom_video;
if (!cols) {
cols = PET_COLS;
}
- vmask = (cols == 40) ? 0x3ff : 0x7ff;
+ vmask = (petres.map == PET_MAP_8296) ? 0x0fff : 0x3ff;
}
- /* when switching 8296 to 40 columns, CRTC ends up at $9000 otherwise...*/
- if (cols == 40) {
- vmask = 0x3ff;
- }
/*
log_message(pet_mem_log, "set_screen(vmask=%04x, cols=%d, crtc=%d)",
vmask, cols, petres.model.crtc);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rh...@us...> - 2025-07-14 19:12:35
|
Revision: 45711
http://sourceforge.net/p/vice-emu/code/45711
Author: rhialto
Date: 2025-07-14 19:12:34 +0000 (Mon, 14 Jul 2025)
Log Message:
-----------
PET, HRE: small fix: we need a vertical screen size of 256 pixels, otherwise the bottom few scan lines get cut off in HRE mode.
Modified Paths:
--------------
trunk/vice/src/crtc/crtc.c
trunk/vice/src/pet/pet.c
trunk/vice/src/pet/pethre.c
Modified: trunk/vice/src/crtc/crtc.c
===================================================================
--- trunk/vice/src/crtc/crtc.c 2025-06-30 22:43:43 UTC (rev 45710)
+++ trunk/vice/src/crtc/crtc.c 2025-07-14 19:12:34 UTC (rev 45711)
@@ -401,7 +401,7 @@
crtc.screen_width = (num_cols + CRTC_EXTRA_COLS) * 8 + 2 * CRTC_SCREEN_BORDERWIDTH;
crtc.screen_height = rasterlines + CRTC_EXTRA_RASTERLINES + 2 * CRTC_SCREEN_BORDERHEIGHT;
- DBG(("crtc_set_screen_options: cols=%d, rl=%d -> w=%d, h=%d",
+ DBG(("crtc_set_screen_options: cols=%d, rl=%d -> w=%u, h=%u",
num_cols, rasterlines, crtc.screen_width, crtc.screen_height));
crtc_update_window();
@@ -869,19 +869,19 @@
}
#ifdef DEBUG_CRTC
if (crtc.venable && !new_venable)
- printf("disable ven, cl=%d, yc=%d, rl=%d\n",
+ printf("disable ven, cl=%d, yc=%u, rl=%u\n",
crtc.current_charline, crtc.raster.ycounter,
crtc.raster.current_line);
if (new_venable && !crtc.venable)
- printf("enable ven, cl=%d, yc=%d, rl=%d\n",
+ printf("enable ven, cl=%d, yc=%u, rl=%u\n",
crtc.current_charline, crtc.raster.ycounter,
crtc.raster.current_line);
if (crtc.vsync && !new_vsync)
- printf("disable vsync, cl=%d, yc=%d, rl=%d\n",
+ printf("disable vsync, cl=%d, yc=%u, rl=%u\n",
crtc.current_charline, crtc.raster.ycounter,
crtc.raster.current_line);
if (new_vsync && !crtc.vsync)
- printf("enable vsync, cl=%d, yc=%d, rl=%d\n",
+ printf("enable vsync, cl=%d, yc=%u, rl=%u\n",
crtc.current_charline, crtc.raster.ycounter,
crtc.raster.current_line);
#endif /* DEBUG_CRTC */
Modified: trunk/vice/src/pet/pet.c
===================================================================
--- trunk/vice/src/pet/pet.c 2025-06-30 22:43:43 UTC (rev 45710)
+++ trunk/vice/src/pet/pet.c 2025-07-14 19:12:34 UTC (rev 45711)
@@ -957,7 +957,11 @@
/* On the 8296 we do not (invert the screen by clearing MA12). */
vrevmask = petres.map == PET_MAP_8296 ? vmask : 0x1000;
- crtc_set_screen_options(cols, 25 * 10);
+ /*
+ * Vertical nr of pixels: max(25*10, 256), for 25 text lines of 10 px,
+ * or 256 for the HRE.
+ */
+ crtc_set_screen_options(cols, 256);
crtc_set_screen_addr(mem_ram + 0x8000);
crtc_set_hw_options(hwflag,
vmask,
Modified: trunk/vice/src/pet/pethre.c
===================================================================
--- trunk/vice/src/pet/pethre.c 2025-06-30 22:43:43 UTC (rev 45710)
+++ trunk/vice/src/pet/pethre.c 2025-07-14 19:12:34 UTC (rev 45711)
@@ -332,9 +332,9 @@
* memory.
*/
if (ymod8 < 8 && xstart < xend) {
- int ma_hi = scr_rel & MA_HI; /* MA<9...6> MA is already multi- */
- int ma_lo = scr_rel & MA_LO; /* MA<5...0> ...plied by two. */
- /* Form <MA 9-6><RA 2-0><MA 5-0> */
+ int ma_hi = scr_rel & MA_HI; /* MA<11...6> MA is already multi- */
+ int ma_lo = scr_rel & MA_LO; /* MA< 5...0> ...plied by two. */
+ /* Form <MA 11-6><RA 2-0><MA 5-0> */
uint8_t *screen_rel = mem_ram + 0x8000 + /* == crtc.screen_base */
(ma_hi << 3) + (ymod8 << 6) + ma_lo;
int width = xend - xstart;
@@ -357,7 +357,7 @@
int i;
#if HRE_DEBUG_GFX
- log_message(pethre_log, "pethre_DRAW: xstart=%d, xend=%d, ymod8=%d, scr_rel=%04x screen_rel=%04x", xstart, xend, ymod8, scr_rel, screen_rel - mem_ram);
+ log_message(pethre_log, "pethre_DRAW: xstart=%d, xend=%d, ymod8=%d, scr_rel=%04x screen_rel=%04x", xstart, xend, ymod8, (unsigned int)scr_rel, (unsigned int)(screen_rel - mem_ram));
#endif
for (i = xstart; i < xend; i++) {
int d = *screen_rel++;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-06-30 22:43:46
|
Revision: 45710
http://sourceforge.net/p/vice-emu/code/45710
Author: gpz
Date: 2025-06-30 22:43:43 +0000 (Mon, 30 Jun 2025)
Log Message:
-----------
test related to #2148
Modified Paths:
--------------
testprogs/testbench/dtv-testlist.in
testprogs/testbench/x64dtv-testlist.txt
Added Paths:
-----------
testprogs/DTV/dummy/
testprogs/DTV/dummy/Makefile
testprogs/DTV/dummy/incbank.asm
testprogs/DTV/dummy/incbank.prg
Added: testprogs/DTV/dummy/Makefile
===================================================================
--- testprogs/DTV/dummy/Makefile (rev 0)
+++ testprogs/DTV/dummy/Makefile 2025-06-30 22:43:43 UTC (rev 45710)
@@ -0,0 +1,8 @@
+
+all: incbank.prg
+
+incbank.prg: incbank.asm
+ acme -f cbm -o incbank.prg incbank.asm
+
+clean:
+ $(RM) incbank.prg
Added: testprogs/DTV/dummy/incbank.asm
===================================================================
--- testprogs/DTV/dummy/incbank.asm (rev 0)
+++ testprogs/DTV/dummy/incbank.asm 2025-06-30 22:43:43 UTC (rev 45710)
@@ -0,0 +1,80 @@
+
+; #2148 Wrong Bank for RMW Instructions in C64DTV
+
+ !to "bug.prg",cbm
+ !cpu c64dtv2
+ * = $0801
+
+ !by $0b,$08,$00,$00,$9e,$32,$30,$36,$31,$00,$00,$00
+
+ sei
+ ;copy "code4000" to bank 1
+ ldx #$00
+- lda code4000,x
+ sta $4000,x
+ inx
+ bne -
+ jmp $4000
+
+testcode:
+ ldy #$ff
+ sty $0800
+
+ ;here is the bug:
+ ;inc first write (Value $ff) goes into wrong bank (bank 0)!!!
+
+ inc $0800
+ rts
+
+code4000:
+!pseudopc $4000 {
+ ;copy code to bank 1
+
+ ldx #$00
+- lda $0800,x
+ sta $4100,x
+ inx
+ bne -
+
+ ;switch bank 0 to segment $7f
+ sac #$cc
+ lda #$7f
+ sac #$00
+
+ ;copy back the code, but now in the segment at $7f
+- lda $4100,x
+ sta $0800,x
+ inx
+ bne -
+
+ ;call the test code in bank $7f
+ jsr testcode
+
+ ;set segment 0 to bank 0
+ sac #$cc
+ lda #$00
+ sac #$00
+
+ ;check if bank 0 was modified -> error
+ ldx #5
+ ldy #$00 ;success
+
+ lda $0800
+ beq no_error
+ ldx #10
+ ldy #$ff ; failure
+no_error:
+ stx $d020
+ sty $d7ff
+ rts
+}
+
+
+
+
+
+
+
+
+
+
Added: testprogs/DTV/dummy/incbank.prg
===================================================================
(Binary files differ)
Index: testprogs/DTV/dummy/incbank.prg
===================================================================
--- testprogs/DTV/dummy/incbank.prg 2025-06-30 22:07:34 UTC (rev 45709)
+++ testprogs/DTV/dummy/incbank.prg 2025-06-30 22:43:43 UTC (rev 45710)
Property changes on: testprogs/DTV/dummy/incbank.prg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/x-commodore-exec
\ No newline at end of property
Modified: testprogs/testbench/dtv-testlist.in
===================================================================
--- testprogs/testbench/dtv-testlist.in 2025-06-30 22:07:34 UTC (rev 45709)
+++ testprogs/testbench/dtv-testlist.in 2025-06-30 22:43:43 UTC (rev 45710)
@@ -17,6 +17,7 @@
../DTV/dmablit/,dmatest.prg,interactive,0
#TODO:
#../DTV/dmatime,dmatime.prg,exitcode
+../DTV/dummy/,incbank.prg,exitcode,30000000
../DTV/fulltime/,fulltime.prg,interactive,0
../DTV/fulltime/,fulltime_dtv.prg,interactive,0
#TODO:
Modified: testprogs/testbench/x64dtv-testlist.txt
===================================================================
--- testprogs/testbench/x64dtv-testlist.txt 2025-06-30 22:07:34 UTC (rev 45709)
+++ testprogs/testbench/x64dtv-testlist.txt 2025-06-30 22:43:43 UTC (rev 45710)
@@ -18,6 +18,7 @@
../DTV/dmablit/,dmatest.prg,interactive,0
#TODO:
#../DTV/dmatime,dmatime.prg,exitcode
+../DTV/dummy/,incbank.prg,exitcode,30000000
../DTV/fulltime/,fulltime.prg,interactive,0
../DTV/fulltime/,fulltime_dtv.prg,interactive,0
#TODO:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-06-30 22:07:35
|
Revision: 45709
http://sourceforge.net/p/vice-emu/code/45709
Author: gpz
Date: 2025-06-30 22:07:34 +0000 (Mon, 30 Jun 2025)
Log Message:
-----------
do dummy accesses only if 'skip bytes' is not set
Modified Paths:
--------------
trunk/vice/src/c64dtv/c64dtvcpu.c
Modified: trunk/vice/src/c64dtv/c64dtvcpu.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtvcpu.c 2025-06-30 21:31:53 UTC (rev 45708)
+++ trunk/vice/src/c64dtv/c64dtvcpu.c 2025-06-30 22:07:34 UTC (rev 45709)
@@ -275,10 +275,10 @@
#define LOAD_ZERO(addr) \
mem_read((uint16_t)((((uint16_t) dtv_registers[10]) << 8) + ((uint16_t)((addr) & 0xff))))
-#define STORE_DUMMY(addr, value) STORE(addr, value)
-#define LOAD_DUMMY(addr) LOAD(addr)
-#define STORE_ZERO_DUMMY(addr, value) STORE_ZERO(addr, value)
-#define LOAD_ZERO_DUMMY(addr) LOAD_ZERO(addr)
+#define LOAD_DUMMY(addr) ((dtv_registers[9] & 1) ? 0 : LOAD(addr))
+#define LOAD_ZERO_DUMMY(addr) ((dtv_registers[9] & 1) ? 0 : LOAD_ZERO(addr))
+#define STORE_DUMMY(addr, value) if (!(dtv_registers[9] & 1)) { STORE(addr, value); }
+#define STORE_ZERO_DUMMY(addr, value) if (!(dtv_registers[9] & 1)) { STORE_ZERO(addr, value); }
/* Route stack operations through register 11 (stack mapper) */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-06-30 21:31:54
|
Revision: 45708
http://sourceforge.net/p/vice-emu/code/45708
Author: gpz
Date: 2025-06-30 21:31:53 +0000 (Mon, 30 Jun 2025)
Log Message:
-----------
use DTV specific mem access functions also for the dummy accesses - should fix #2148
Modified Paths:
--------------
trunk/vice/src/c64dtv/c64dtvcpu.c
Modified: trunk/vice/src/c64dtv/c64dtvcpu.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtvcpu.c 2025-06-28 03:01:18 UTC (rev 45707)
+++ trunk/vice/src/c64dtv/c64dtvcpu.c 2025-06-30 21:31:53 UTC (rev 45708)
@@ -275,6 +275,11 @@
#define LOAD_ZERO(addr) \
mem_read((uint16_t)((((uint16_t) dtv_registers[10]) << 8) + ((uint16_t)((addr) & 0xff))))
+#define STORE_DUMMY(addr, value) STORE(addr, value)
+#define LOAD_DUMMY(addr) LOAD(addr)
+#define STORE_ZERO_DUMMY(addr, value) STORE_ZERO(addr, value)
+#define LOAD_ZERO_DUMMY(addr) LOAD_ZERO(addr)
+
/* Route stack operations through register 11 (stack mapper) */
#define PUSH(val) (STORE((((uint16_t) dtv_registers[11]) << 8) + ((reg_sp--) & 0xff), val))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dq...@us...> - 2025-06-28 03:01:19
|
Revision: 45707
http://sourceforge.net/p/vice-emu/code/45707
Author: dqh
Date: 2025-06-28 03:01:18 +0000 (Sat, 28 Jun 2025)
Log Message:
-----------
Add link to GitHub actions run to all build failure notifications
Modified Paths:
--------------
trunk/.github/workflows/build-main-on-push.yml
trunk/.github/workflows/check-make-dist.yml
trunk/.github/workflows/run-doxygen.yml
Modified: trunk/.github/workflows/build-main-on-push.yml
===================================================================
--- trunk/.github/workflows/build-main-on-push.yml 2025-06-23 10:33:38 UTC (rev 45706)
+++ trunk/.github/workflows/build-main-on-push.yml 2025-06-28 03:01:18 UTC (rev 45707)
@@ -550,4 +550,4 @@
IRC_PASS: ${{ secrets.IRC_PASS }}
shell: bash
run: |
- ./vice/build/github-actions/irc-message.sh "tried to build $(echo "${{ github.ref }}" | sed 's,.*/,,') but it failed :( $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
+ ./vice/build/github-actions/irc-message.sh "tried to build $(echo "${{ github.ref }}" | sed 's,.*/,,') but it failed :( See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
Modified: trunk/.github/workflows/check-make-dist.yml
===================================================================
--- trunk/.github/workflows/check-make-dist.yml 2025-06-23 10:33:38 UTC (rev 45706)
+++ trunk/.github/workflows/check-make-dist.yml 2025-06-28 03:01:18 UTC (rev 45707)
@@ -126,9 +126,8 @@
if: ${{ failure() }}
shell: bash
run: |
- ./vice/build/github-actions/irc-message.sh "make dist => make failed for ${{ matrix.source.name }} => ${{ matrix.target.name }}"
+ ./vice/build/github-actions/irc-message.sh "make dist => make failed for ${{ matrix.source.name }} => ${{ matrix.target.name }}. See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
-
diff_dists:
name: Check dist tarballs for content differences
runs-on: ubuntu-latest
@@ -155,4 +154,4 @@
if: ${{ failure() }}
shell: bash
run: |
- ./vice/build/github-actions/irc-message.sh "Dist tarballs do not match. See log of 'Weekly Check Dist' github action."
+ ./vice/build/github-actions/irc-message.sh "Dist tarballs do not match. See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
Modified: trunk/.github/workflows/run-doxygen.yml
===================================================================
--- trunk/.github/workflows/run-doxygen.yml 2025-06-23 10:33:38 UTC (rev 45706)
+++ trunk/.github/workflows/run-doxygen.yml 2025-06-28 03:01:18 UTC (rev 45707)
@@ -37,4 +37,4 @@
if: ${{ failure() }}
shell: bash
run: |
- ./vice/build/github-actions/irc-message.sh "Running Doxygen failed."
+ ./vice/build/github-actions/irc-message.sh "Running Doxygen failed. See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-06-23 10:33:40
|
Revision: 45706
http://sourceforge.net/p/vice-emu/code/45706
Author: gpz
Date: 2025-06-23 10:33:38 +0000 (Mon, 23 Jun 2025)
Log Message:
-----------
add header to makefile, tweak docs
Modified Paths:
--------------
trunk/vice/doc/vice.texi
trunk/vice/src/c64/cart/Makefile.am
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2025-06-20 07:04:42 UTC (rev 45705)
+++ trunk/vice/doc/vice.texi 2025-06-23 10:33:38 UTC (rev 45706)
@@ -31402,7 +31402,7 @@
ROM memory is organized in 8KiB ($2000) banks located at $8000-$9FFF.
Bank switching is done by accessing address $DE00+X, where X is the
bank number (STA $DE00,X). For instance, to read from bank 3, address
- $DE03 is read or written to.
+ $DE03 is read from, or written to.
The CRT file contains a string of CHIP blocks, each block with a start
address of $8000, length $2000 and the bank number in the bank field.
Modified: trunk/vice/src/c64/cart/Makefile.am
===================================================================
--- trunk/vice/src/c64/cart/Makefile.am 2025-06-20 07:04:42 UTC (rev 45705)
+++ trunk/vice/src/c64/cart/Makefile.am 2025-06-23 10:33:38 UTC (rev 45706)
@@ -141,8 +141,9 @@
mach5.c \
mach5.h \
magicdesk.c \
+ magicdesk.h \
magicdesk16.c \
- magicdesk.h \
+ magicdesk16.h \
magicformel.c \
magicformel.h \
magicvoice.c \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <st...@us...> - 2025-06-20 07:04:45
|
Revision: 45705
http://sourceforge.net/p/vice-emu/code/45705
Author: strobey
Date: 2025-06-20 07:04:42 +0000 (Fri, 20 Jun 2025)
Log Message:
-----------
Make the C128's MMU IO dump in the monitor ("io d500") significantly more readable.
Modified Paths:
--------------
trunk/vice/src/c128/c128mmu.c
Modified: trunk/vice/src/c128/c128mmu.c
===================================================================
--- trunk/vice/src/c128/c128mmu.c 2025-06-17 16:21:24 UTC (rev 45704)
+++ trunk/vice/src/c128/c128mmu.c 2025-06-20 07:04:42 UTC (rev 45705)
@@ -605,47 +605,48 @@
int mmu_dump(void *context, uint16_t addr)
{
- mon_out("CR: bank: %d, $4000-$7FFF: %s, $8000-$BFFF: %s, $C000-$CFFF: %s, $D000-$DFFF: %s, $E000-$FFFF: %s\n",
+ mon_out(" Bank $4000-$7FFF $8000-$BFFF $C000-$CFFF $D000-$DFFF $E000-$FFFF\n");
+ mon_out("CR: %d %12s %12s %12s %12s %12s\n",
(mmu[0] & 0xc0) >> 6,
- (mmu[0] & 2) ? "RAM" : "BASIC ROM low",
- (mmu[0] & 8) ? ((mmu[0] & 4) ? "RAM" : "External Function ROM") : ((mmu[0] & 4) ? "Internal Function ROM" : "BASIC ROM high"),
- (mmu[0] & 0x20) ? ((mmu[0] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[0] & 0x10) ? "Internal Function ROM" : "Kernal ROM"),
- (mmu[0] & 1) ? ((mmu[0] & 0x20) ? ((mmu[0] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[0] & 0x10) ? "Internal Function ROM" : "Kernal ROM")) : "I/O",
- (mmu[0] & 0x20) ? ((mmu[0] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[0] & 0x10) ? "Internal Function ROM" : "Kernal ROM"));
+ (mmu[0] & 2) ? "RAM" : "BASIC ROM",
+ (mmu[0] & 8) ? ((mmu[0] & 4) ? "RAM" : "Ext.Func.ROM") : ((mmu[0] & 4) ? "Int.Func.ROM" : "BASIC ROM"),
+ (mmu[0] & 0x20) ? ((mmu[0] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[0] & 0x10) ? "Int.Func.ROM" : "Kernal ROM"),
+ (mmu[0] & 1) ? ((mmu[0] & 0x20) ? ((mmu[0] & 0x10) ? "RAM" : "Ext. Func. ROM") : ((mmu[0] & 0x10) ? "Int. Func. ROM" : "Kernal ROM")) : "I/O",
+ (mmu[0] & 0x20) ? ((mmu[0] & 0x10) ? "RAM" : "Ext Func.ROM") : ((mmu[0] & 0x10) ? "Int.Func.ROM" : "Kernal ROM"));
- mon_out("PCRA: bank: %d, $4000-$7FFF: %s, $8000-$BFFF: %s, $C000-$CFFF: %s, $D000-$DFFF: %s, $E000-$FFFF: %s\n",
+ mon_out("PCRA: %d %12s %12s %12s %12s %12s\n",
(mmu[1] & 0xc0) >> 6,
- (mmu[1] & 2) ? "RAM" : "BASIC ROM low",
- (mmu[1] & 8) ? ((mmu[1] & 4) ? "RAM" : "External Function ROM") : ((mmu[1] & 4) ? "Internal Function ROM" : "BASIC ROM high"),
- (mmu[1] & 0x20) ? ((mmu[1] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[1] & 0x10) ? "Internal Function ROM" : "Kernal ROM"),
- (mmu[1] & 1) ? ((mmu[1] & 0x20) ? ((mmu[1] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[1] & 0x10) ? "Internal Function ROM" : "Kernal ROM")) : "I/O",
- (mmu[1] & 0x20) ? ((mmu[1] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[1] & 0x10) ? "Internal Function ROM" : "Kernal ROM"));
+ (mmu[1] & 2) ? "RAM" : "BASIC ROM",
+ (mmu[1] & 8) ? ((mmu[1] & 4) ? "RAM" : "Ext.Func.ROM") : ((mmu[1] & 4) ? "Int.Func.ROM" : "BASIC ROM"),
+ (mmu[1] & 0x20) ? ((mmu[1] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[1] & 0x10) ? "Int.Func.ROM" : "Kernal ROM"),
+ (mmu[1] & 1) ? ((mmu[1] & 0x20) ? ((mmu[1] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[1] & 0x10) ? "Int.Func.ROM" : "Kernal ROM")) : "I/O",
+ (mmu[1] & 0x20) ? ((mmu[1] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[1] & 0x10) ? "Int.Func.ROM" : "Kernal ROM"));
- mon_out("PCRB: bank: %d, $4000-$7FFF: %s, $8000-$BFFF: %s, $C000-$CFFF: %s, $D000-$DFFF: %s, $E000-$FFFF: %s\n",
+ mon_out("PCRB: %d %12s %12s %12s %12s %12s\n",
(mmu[2] & 0xc0) >> 6,
- (mmu[2] & 2) ? "RAM" : "BASIC ROM low",
- (mmu[2] & 8) ? ((mmu[2] & 4) ? "RAM" : "External Function ROM") : ((mmu[2] & 4) ? "Internal Function ROM" : "BASIC ROM high"),
- (mmu[2] & 0x20) ? ((mmu[2] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[2] & 0x10) ? "Internal Function ROM" : "Kernal ROM"),
- (mmu[2] & 1) ? ((mmu[2] & 0x20) ? ((mmu[2] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[2] & 0x10) ? "Internal Function ROM" : "Kernal ROM")) : "I/O",
- (mmu[2] & 0x20) ? ((mmu[2] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[2] & 0x10) ? "Internal Function ROM" : "Kernal ROM"));
+ (mmu[2] & 2) ? "RAM" : "BASIC ROM",
+ (mmu[2] & 8) ? ((mmu[2] & 4) ? "RAM" : "Ext.Func.ROM") : ((mmu[2] & 4) ? "Int.Func.ROM" : "BASIC ROM"),
+ (mmu[2] & 0x20) ? ((mmu[2] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[2] & 0x10) ? "Int.Func.ROM" : "Kernal ROM"),
+ (mmu[2] & 1) ? ((mmu[2] & 0x20) ? ((mmu[2] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[2] & 0x10) ? "Int.Func.ROM" : "Kernal ROM")) : "I/O",
+ (mmu[2] & 0x20) ? ((mmu[2] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[2] & 0x10) ? "Int.Func.ROM" : "Kernal ROM"));
- mon_out("PCRC: bank: %d, $4000-$7FFF: %s, $8000-$BFFF: %s, $C000-$CFFF: %s, $D000-$DFFF: %s, $E000-$FFFF: %s\n",
+ mon_out("PCRC: %d %12s %12s %12s %12s %12s\n",
(mmu[3] & 0xc0) >> 6,
- (mmu[3] & 2) ? "RAM" : "BASIC ROM low",
- (mmu[3] & 8) ? ((mmu[3] & 4) ? "RAM" : "External Function ROM") : ((mmu[3] & 4) ? "Internal Function ROM" : "BASIC ROM high"),
- (mmu[3] & 0x20) ? ((mmu[3] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[3] & 0x10) ? "Internal Function ROM" : "Kernal ROM"),
- (mmu[3] & 1) ? ((mmu[3] & 0x20) ? ((mmu[3] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[3] & 0x10) ? "Internal Function ROM" : "Kernal ROM")) : "I/O",
- (mmu[3] & 0x20) ? ((mmu[3] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[3] & 0x10) ? "Internal Function ROM" : "Kernal ROM"));
+ (mmu[3] & 2) ? "RAM" : "BASIC ROM",
+ (mmu[3] & 8) ? ((mmu[3] & 4) ? "RAM" : "Ext.Func.ROM") : ((mmu[3] & 4) ? "Int.Func.ROM" : "BASIC ROM"),
+ (mmu[3] & 0x20) ? ((mmu[3] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[3] & 0x10) ? "Int.Func.ROM" : "Kernal ROM"),
+ (mmu[3] & 1) ? ((mmu[3] & 0x20) ? ((mmu[3] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[3] & 0x10) ? "Int.Func.ROM" : "Kernal ROM")) : "I/O",
+ (mmu[3] & 0x20) ? ((mmu[3] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[3] & 0x10) ? "Int.Func.ROM" : "Kernal ROM"));
- mon_out("PCRD: bank: %d, $4000-$7FFF: %s, $8000-$BFFF: %s, $C000-$CFFF: %s, $D000-$DFFF: %s, $E000-$FFFF: %s\n",
+ mon_out("PCRD: %d %12s %12s %12s %12s %12s\n",
(mmu[4] & 0xc0) >> 6,
- (mmu[4] & 2) ? "RAM" : "BASIC ROM low",
- (mmu[4] & 8) ? ((mmu[4] & 4) ? "RAM" : "External Function ROM") : ((mmu[4] & 4) ? "Internal Function ROM" : "BASIC ROM high"),
- (mmu[4] & 0x20) ? ((mmu[1] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[4] & 0x10) ? "Internal Function ROM" : "Kernal ROM"),
- (mmu[4] & 1) ? ((mmu[4] & 0x20) ? ((mmu[4] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[4] & 0x10) ? "Internal Function ROM" : "Kernal ROM")) : "I/O",
- (mmu[4] & 0x20) ? ((mmu[4] & 0x10) ? "RAM" : "External Function ROM") : ((mmu[4] & 0x10) ? "Internal Function ROM" : "Kernal ROM"));
+ (mmu[4] & 2) ? "RAM" : "BASIC ROM",
+ (mmu[4] & 8) ? ((mmu[4] & 4) ? "RAM" : "Ext.Func.ROM") : ((mmu[4] & 4) ? "Int.Func.ROM" : "BASIC ROM"),
+ (mmu[4] & 0x20) ? ((mmu[1] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[4] & 0x10) ? "Int.Func.ROM" : "Kernal ROM"),
+ (mmu[4] & 1) ? ((mmu[4] & 0x20) ? ((mmu[4] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[4] & 0x10) ? "Int.Func.ROM" : "Kernal ROM")) : "I/O",
+ (mmu[4] & 0x20) ? ((mmu[4] & 0x10) ? "RAM" : "Ext.Func.ROM") : ((mmu[4] & 0x10) ? "Int.Func.ROM" : "Kernal ROM"));
- mon_out("MCR: 40/80 key: %s, Operating mode: %s, EXROM line: %d, GAME line: %d, fast serial: %s, current CPU: %s\n",
+ mon_out("MCR: 40/80 key: %s, Operating mode: %s, EXROM line: %d, GAME line: %d\n Fast serial: %s, Current CPU: %s\n",
(mmu[5] & 0x80) ? "up" : "down",
(mmu[5] & 0x40) ? "C64 mode" : "C128 mode",
(mmu[5] & 0x20) >> 5,
@@ -653,7 +654,7 @@
(mmu[5] & 8) ? "serial out" : "serial in",
(mmu[5] & 1) ? "8502" : "Z80");
- mon_out("RCR: VIC-II RAM bank: %d, Shared RAM location: %s, Shared RAM size: %s\n",
+ mon_out("RCR: VIC-II RAM bank: %d, Shared RAM location & size: %s, %s\n",
(mmu[6] & 0xc0) >> 6,
(mmu[6] & 8) ? ((mmu[6] & 4) ? "bottom and top" : "top") : ((mmu[6] & 4) ? "bottom" : "none"),
(mmu[6] & 2) ? ((mmu[6] & 1) ? "16KiB" : "8KiB") : ((mmu[6] & 1) ? "4KiB" : "1KiB"));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <old...@us...> - 2025-06-17 16:21:26
|
Revision: 45704
http://sourceforge.net/p/vice-emu/code/45704
Author: oldwoman37
Date: 2025-06-17 16:21:24 +0000 (Tue, 17 Jun 2025)
Log Message:
-----------
RAMLINK: Fixed bug #2144; SEGV issue when using less than 16MB ramcard sizes
Modified Paths:
--------------
trunk/vice/src/c64/cart/ramlink.c
Modified: trunk/vice/src/c64/cart/ramlink.c
===================================================================
--- trunk/vice/src/c64/cart/ramlink.c 2025-06-15 17:07:33 UTC (rev 45703)
+++ trunk/vice/src/c64/cart/ramlink.c 2025-06-17 16:21:24 UTC (rev 45704)
@@ -63,8 +63,6 @@
/* #define RLLOG1 */
/* #define RLLOG2 */
-/* #define RLLOG1 */
-/* #define RLLOG2 */
/* #define RLDEBUGIO */
/* #define RLDEBUGMEM */
@@ -114,6 +112,8 @@
extern unsigned int reg_pc;
+/* #define RAMLINKXL */
+
/* resources */
static int rl_enabled = 0;
static int rl_write_image = 0;
@@ -149,7 +149,7 @@
static uint8_t *rl_rom = NULL;
static int rl_extexrom = 0;
static int rl_extgame = 0;
-static char rl_memmap[256];
+static int8_t rl_memmap[256];
/* some prototypes are needed */
static uint8_t ramlink_io1_read(uint16_t addr);
@@ -942,9 +942,13 @@
}
if (size != 1 && size != 2 && size != 3 && size != 4 &&
size != 5 && size != 8 && size != 9 && size != 12 &&
- size != 13 && size != 16 && size != 20 && size != 32 &&
+ size != 13 && size != 16 &&
+#ifdef RAMLINKXL
+ size != 20 && size != 32 &&
size != 36 && size != 48 && size != 52 && size != 64 &&
- size != 17 && size != 33 && size != 49 && size != 0) {
+ size != 17 && size != 33 && size != 49 &&
+#endif
+ size != 0) {
return -1;
}
@@ -1009,7 +1013,7 @@
#if 0
printf("* RL_MEMMAP:\n");
for(i=0;i<64;i++) {
- printf("%02x ",rl_memmap[i]);
+ printf("%02x ",(unsigned int)rl_memmap[i]);
if (!((i+1)%16)) printf("\n");
}
#endif
@@ -1260,7 +1264,6 @@
ramlink_sync_cpus();
cmdbus.cpu_data = byte;
cmdbus_update();
-/*if (reg==0) printf("RAMLINK: Send %02x\n",byte);*/
}
static uint8_t get_pa(struct _i8255a_state *ctx, int8_t reg)
@@ -1283,7 +1286,6 @@
data = 0xff;
}
-/*if (reg==0) printf("RAMLINK: Got %02x\n",data);*/
return data;
}
@@ -1318,7 +1320,6 @@
cmdbus_patn_changed(new, old);
cmdbus_update();
-/*if (reg==1) printf("RAMLINK: R=%d C=%d A=%d\n",(byte & 0x80 ? 0 : 1),(byte & 0x40 ? 0 : 1),(byte & 0x20 ? 0 : 1));*/
}
static uint8_t get_pb(struct _i8255a_state *ctx, int8_t reg)
@@ -1547,7 +1548,7 @@
}
i = rl_memmap[(rl_cardaddr >> 20) & 63];
/* if the memory re-mapping is set to -1, then the bus is open */
- if (i>64) {
+ if (i<0) {
rl_cardbase = -1;
} else {
rl_cardbase = (i << 20) | (rl_cardaddr & 0x0fffff);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rh...@us...> - 2025-06-15 17:07:35
|
Revision: 45703
http://sourceforge.net/p/vice-emu/code/45703
Author: rhialto
Date: 2025-06-15 17:07:33 +0000 (Sun, 15 Jun 2025)
Log Message:
-----------
Add {} so that the declaration is not directly following a case label.
Modified Paths:
--------------
trunk/vice/src/cbmdos.c
Modified: trunk/vice/src/cbmdos.c
===================================================================
--- trunk/vice/src/cbmdos.c 2025-06-15 15:51:56 UTC (rev 45702)
+++ trunk/vice/src/cbmdos.c 2025-06-15 17:07:33 UTC (rev 45703)
@@ -501,28 +501,30 @@
break;
case 'L'|0x80:
case 'L': /* L,(#record length) max 254 */
- /*
- * Allow extra text between L and the comma,
- * like with other file types.
- */
- uint8_t *comma = memchr(p + 1, ',', limit - (p + 1));
- if (comma && comma + 1 < limit) {
- cmd_parse->recordlength = comma[1]; /* Changing RL causes error */
+ {
+ /*
+ * Allow extra text between L and the comma,
+ * like with other file types.
+ */
+ uint8_t *comma = memchr(p + 1, ',', limit - (p + 1));
+ if (comma && comma + 1 < limit) {
+ cmd_parse->recordlength = comma[1]; /* Changing RL causes error */
#ifdef DEBUG_CBMDOS
- log_debug(LOG_DEFAULT, "L recordlength=%u", cmd_parse->recordlength);
+ log_debug(LOG_DEFAULT, "L recordlength=%u", cmd_parse->recordlength);
#endif
- /* Don't allow REL file record lengths less than 2 or
- greater than 254. The 1541/71/81 lets you create a
- REL file of record length 0, but it locks up the CPU
- on the drive - nice. */
- if (cmd_parse->recordlength < 2 || cmd_parse->recordlength > 254) {
- return CBMDOS_IPE_OVERFLOW;
+ /* Don't allow REL file record lengths less than 2 or
+ greater than 254. The 1541/71/81 lets you create a
+ REL file of record length 0, but it locks up the CPU
+ on the drive - nice. */
+ if (cmd_parse->recordlength < 2 || cmd_parse->recordlength > 254) {
+ return CBMDOS_IPE_OVERFLOW;
+ }
+ /* skip the REL length */
+ p = comma + 1;
+ } else {
+ /* No record length: we can only read this file, not write it */
+ cmd_parse->readmode = CBMDOS_FAM_READ;
}
- /* skip the REL length */
- p = comma + 1;
- } else {
- /* No record length: we can only read this file, not write it */
- cmd_parse->readmode = CBMDOS_FAM_READ;
}
cmd_parse->filetype = CBMDOS_FT_REL;
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rh...@us...> - 2025-06-15 15:51:59
|
Revision: 45702
http://sourceforge.net/p/vice-emu/code/45702
Author: rhialto
Date: 2025-06-15 15:51:56 +0000 (Sun, 15 Jun 2025)
Log Message:
-----------
Fix bug 2146: c1541 can't read REL files
The command "read relfile,l outfile" does not work.
Cause: file name parsing is now mostly done with cbmdos_command_parse_plus(). However this function worked slightly different when parsing ",L" in a file spec.
Fix: copy the logic from cbmdos_command_parse() to handle this.
Modified Paths:
--------------
trunk/vice/src/c1541.c
trunk/vice/src/cbmdos.c
trunk/vice/src/vdrive/vdrive-iec.c
Modified: trunk/vice/src/c1541.c
===================================================================
--- trunk/vice/src/c1541.c 2025-06-14 19:03:50 UTC (rev 45701)
+++ trunk/vice/src/c1541.c 2025-06-15 15:51:56 UTC (rev 45702)
@@ -3700,6 +3700,7 @@
int status = 0;
uint8_t *slot;
uint8_t file_type;
+ const int secadr = 0; /* use 0 to force read mode */
unit = extract_unit_from_file_name(args[1], &p);
if (unit <= 0) {
@@ -3734,7 +3735,7 @@
charset_petconvstring((uint8_t *)src_name_petscii, CONVERT_TO_PETSCII);
if (vdrive_iec_open(drives[dnr], (uint8_t *)src_name_petscii,
- (unsigned int)strlen(src_name_petscii), 0, NULL)) {
+ (unsigned int)strlen(src_name_petscii), secadr, NULL)) {
fprintf(stderr,
"cannot read `%s' on unit %d\n", src_name_ascii, dnr + 8);
lib_free(src_name_ascii);
@@ -3744,7 +3745,7 @@
/* Get real filename from the disk file. Slot must be defined by
vdrive_iec_open(). */
- bufferinfo_t *bufferinfo = &drives[dnr]->buffers[0]; /* 0 = secadr */
+ bufferinfo_t *bufferinfo = &drives[dnr]->buffers[secadr];
slot = bufferinfo->slot;
actual_name = lib_malloc(IMAGE_CONTENTS_FILE_NAME_LEN + 1);
memcpy(actual_name, slot + SLOT_NAME_OFFSET, IMAGE_CONTENTS_FILE_NAME_LEN);
Modified: trunk/vice/src/cbmdos.c
===================================================================
--- trunk/vice/src/cbmdos.c 2025-06-14 19:03:50 UTC (rev 45701)
+++ trunk/vice/src/cbmdos.c 2025-06-15 15:51:56 UTC (rev 45702)
@@ -304,6 +304,9 @@
}
/* skip the rest */
cmdlen = 0;
+ } else {
+ /* No record length: we can only read this file, not write it */
+ cmd_parse->readmode = CBMDOS_FAM_READ;
}
}
cmd_parse->filetype = CBMDOS_FT_REL;
@@ -498,8 +501,16 @@
break;
case 'L'|0x80:
case 'L': /* L,(#record length) max 254 */
- if (p+2 < limit && p[1] == ',') {
- cmd_parse->recordlength = p[2]; /* Changing RL causes error */
+ /*
+ * Allow extra text between L and the comma,
+ * like with other file types.
+ */
+ uint8_t *comma = memchr(p + 1, ',', limit - (p + 1));
+ if (comma && comma + 1 < limit) {
+ cmd_parse->recordlength = comma[1]; /* Changing RL causes error */
+#ifdef DEBUG_CBMDOS
+ log_debug(LOG_DEFAULT, "L recordlength=%u", cmd_parse->recordlength);
+#endif
/* Don't allow REL file record lengths less than 2 or
greater than 254. The 1541/71/81 lets you create a
REL file of record length 0, but it locks up the CPU
@@ -508,11 +519,12 @@
return CBMDOS_IPE_OVERFLOW;
}
/* skip the REL length */
- p += 2;
- cmd_parse->filetype = CBMDOS_FT_REL;
+ p = comma + 1;
} else {
- return CBMDOS_IPE_OVERFLOW;
+ /* No record length: we can only read this file, not write it */
+ cmd_parse->readmode = CBMDOS_FAM_READ;
}
+ cmd_parse->filetype = CBMDOS_FT_REL;
break;
case 'R':
cmd_parse->readmode = CBMDOS_FAM_READ;
Modified: trunk/vice/src/vdrive/vdrive-iec.c
===================================================================
--- trunk/vice/src/vdrive/vdrive-iec.c 2025-06-14 19:03:50 UTC (rev 45701)
+++ trunk/vice/src/vdrive/vdrive-iec.c 2025-06-15 15:51:56 UTC (rev 45702)
@@ -498,6 +498,9 @@
if (rc != CBMDOS_IPE_OK) {
status = SERIAL_ERROR;
+#ifdef DEBUG_DRIVE
+ log_debug(LOG_DEFAULT, "File name parsing failed, rc = %d, status = SERIAL_ERROR", rc);
+#endif
goto out;
}
#ifdef DEBUG_DRIVE
@@ -504,6 +507,7 @@
log_debug(LOG_DEFAULT, "Raw file name: `%s', length: %u.", name, length);
log_debug(LOG_DEFAULT, "Parsed file name: `%s', reallength: %u. drive: %i",
cmd_parse->file, cmd_parse->filelength, cmd_parse->drive);
+ log_debug(LOG_DEFAULT, "File type: %u, Record length: %u.", cmd_parse->filetype, cmd_parse->recordlength);
#endif
} else {
cmd_parse->full = (uint8_t*)cmd_parse_ext->parsecmd;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pot...@us...> - 2025-06-14 19:03:51
|
Revision: 45701
http://sourceforge.net/p/vice-emu/code/45701
Author: pottendo
Date: 2025-06-14 19:03:50 +0000 (Sat, 14 Jun 2025)
Log Message:
-----------
remove wrong workaround for https://sourceforge.net/p/vice-emu/bugs/2102/
Modified Paths:
--------------
trunk/vice/src/userport/userport_wic64.c
Modified: trunk/vice/src/userport/userport_wic64.c
===================================================================
--- trunk/vice/src/userport/userport_wic64.c 2025-06-14 05:14:56 UTC (rev 45700)
+++ trunk/vice/src/userport/userport_wic64.c 2025-06-14 19:03:50 UTC (rev 45701)
@@ -179,7 +179,6 @@
static int wic64_remote_timeout; /* used for resource */
static int remote_to = WIC64_DEFAULT_REMOTE_TIMEOUT;
static uint8_t wic64_remote_timeout_triggered = 0;
-static int force_timeout = 0;
static char *wic64_sec_token = NULL;
static int current_tz = 2; /* WIC64Timezone */
static int current_dhcp = 1; /* WIC64DHCP */
@@ -2101,7 +2100,7 @@
static void cmd_force_timeout_alarm_handler(CLOCK offset, void *data)
{
wic64_log(LOG_COL_LRED, "force timeout expired");
- replyptr = reply_length = force_timeout = 0;
+ replyptr = reply_length = 0;
input_state = INPUT_EXP_PROT;
commandptr = 0;
alarm_unset(cmd_force_timeout_alarm);
@@ -2115,7 +2114,6 @@
}
int timeout = (commandptr > 0) ? commandbuffer[0] : 1;
wic64_log(CONS_COL_NO, "forcing timeout after %ds", timeout);
- force_timeout = 1;
/* set_userport_flag(FLAG2_ACTIVE); */
@@ -2448,11 +2446,6 @@
/* PC2 irq (pulse) triggers when C64 reads/writes to userport */
static void userport_wic64_store_pbx(uint8_t value, int pulse)
{
- if (force_timeout) {
- debug_log(LOG_COL_OFF, 3, "%s: force timeout running %d/%d", __FUNCTION__, value, pulse);
- set_userport_flag(FLAG2_INACTIVE);
- return;
- }
if (pulse == 1) {
if (wic64_inputmode) {
debug_log(LOG_COL_LBLUE, 3, "receiving '%c'/0x%02x, input_state = %d",
@@ -2567,10 +2560,6 @@
/* PA2 interrupt toggles input/output mode */
static void userport_wic64_store_pa2(uint8_t value)
{
- if (force_timeout == 1) {
- debug_log(LOG_COL_OFF, 3, "%s: force timeout pending...%d", __FUNCTION__, value);
- return;
- }
debug_log(CONS_COL_NO, 2, "userport mode %s...(len = %d)",
value ? "sending" : "receiving",
reply_length);
@@ -2651,7 +2640,7 @@
int tmp_dhcp;
wic64_log(CONS_COL_NO, "%s", __FUNCTION__);
- commandptr = input_state = input_length = force_timeout = 0;
+ commandptr = input_state = input_length = 0;
input_command = WIC64_CMD_NONE;
wic64_inputmode = 1;
memset(sec_token, 0, 32);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|