vice-emu-commit Mailing List for VICE (Page 10)
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
(26) |
Nov
|
Dec
|
|
From: <co...@us...> - 2025-03-25 14:14:57
|
Revision: 45581
http://sourceforge.net/p/vice-emu/code/45581
Author: compyx
Date: 2025-03-25 14:14:52 +0000 (Tue, 25 Mar 2025)
Log Message:
-----------
Merge trunk (r45560:HEAD) into branch
Modified Paths:
--------------
branches/compyx/joymap-001/vice/doc/vice.texi
branches/compyx/joymap-001/vice/src/arch/gtk3/uicart.c
branches/compyx/joymap-001/vice/src/arch/sdl/menu_vic20cart.c
branches/compyx/joymap-001/vice/src/c128/cart/magicdesk128.c
branches/compyx/joymap-001/vice/src/c128/cart/partner128.c
branches/compyx/joymap-001/vice/src/c64/cart/c64cart.c
branches/compyx/joymap-001/vice/src/c64/vsid-stubs.c
branches/compyx/joymap-001/vice/src/c64dtv/c64dtv-stubs.c
branches/compyx/joymap-001/vice/src/cartridge.h
branches/compyx/joymap-001/vice/src/cbm2/cart/cbm2cart.c
branches/compyx/joymap-001/vice/src/monitor/mon_memmap.c
branches/compyx/joymap-001/vice/src/monitor/mon_memmap.h
branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c
branches/compyx/joymap-001/vice/src/pet/pet-stubs.c
branches/compyx/joymap-001/vice/src/plus4/cart/plus4cart.c
branches/compyx/joymap-001/vice/src/vic20/cart/vic20cart.c
Modified: branches/compyx/joymap-001/vice/doc/vice.texi
===================================================================
--- branches/compyx/joymap-001/vice/doc/vice.texi 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/doc/vice.texi 2025-03-25 14:14:52 UTC (rev 45581)
@@ -21472,6 +21472,7 @@
* MON_CMD_REGISTERS_AVAILABLE::
* MON_CMD_DISPLAY_GET::
* MON_CMD_VICE_INFO::
+* MON_CMD_CPUHISTORY_GET::
* MON_CMD_PALETTE_GET::
* MON_CMD_JOYPORT_SET::
* MON_CMD_USERPORT_SET::
@@ -21490,15 +21491,20 @@
Command body:
+@example
+FX | SA SA | EA EA | MS | BI BI
+@end example
+@*
+
@table @strong
-@item byte 0: side effects?
+@item FX: 1 byte: side effects?
Should the read cause side effects?
-@item byte 1-2: start address
+@item SA: 2 bytes: start address
-@item byte 3-4: end address
+@item EA: 2 bytes: end address
-@item byte 5: memspace
+@item MS: 1 byte: memspace
Describes which part of the computer you want to read:
@itemize
@@ -21509,7 +21515,7 @@
@item 0x04: drive 11
@end itemize
-@item byte 6-7: bank ID
+@item BI: 2 bytes: bank ID
Describes which bank you want. This is dependent on your
machine. @xref{MON_CMD_BANKS_AVAILABLE}. If the memspace selected
doesn't support banks, this value is ignored.
@@ -21522,10 +21528,16 @@
Response body:
+@example
+ML ML | MM[0] MM[1] ... MM[ML-1]
+@end example
+@*
+
@table @strong
-@item byte 0-1: The length of the memory segment. Will be zero for start 0x0000, end 0xffff.
+@item ML: 2 bytes: Memory segment length.
+ Will be zero for start 0x0000, end 0xffff.
-@item byte 2+: The memory at the address.
+@item MM: ML bytes: The memory at the address.
@end table
@@ -21538,15 +21550,20 @@
Command body:
+@example
+FX | SA SA | EA EA | MS | BI BI | MM[0] MM[1] ... MM[EA-SA]
+@end example
+@*
+
@table @strong
-@item byte 0: side effects?
+@item FX: 1 byte: side effects?
Should the write cause side effects?
-@item byte 1-2: start address
+@item SA: 2 bytes: start address
-@item byte 3-4: end address
+@item EA: 2 bytes: end address
-@item byte 5: memspace
+@item MS: 1 byte: memspace
Describes which part of the computer you want to write:
@itemize
@@ -21557,12 +21574,12 @@
@item 0x04: drive 11
@end itemize
-@item byte 6-7: bank ID
+@item BI: 2 bytes: bank ID
Describes which bank you want. This is dependent on your machine.
@xref{MON_CMD_BANKS_AVAILABLE}.
If the memspace selected doesn't support banks, this byte is ignored.
-@item byte 8+: Memory contents to write
+@item MM: 1+EA-SA bytes: Memory contents to write
@end table
@@ -21572,7 +21589,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_CHECKPOINT_GET
@subsection Checkpoint get (0x11)
@@ -21583,8 +21603,13 @@
Command body:
+@example
+CN CN CN CN
+@end example
+@*
+
@table @strong
-@item byte 0-3: checkpoint number
+@item CN: 4 bytes: checkpoint number
@end table
@@ -21600,25 +21625,30 @@
Command body:
+@example
+SA SA | EA EA | ST | EN | OP | TM | MS?
+@end example
+@*
+
@table @strong
-@item byte 0-1: start address
+@item SA: 2 bytes: start address
-@item byte 2-3: end address
+@item EA: 2 bytes: end address
-@item byte 4: stop when hit
+@item ST: 1 byte: stop when hit
>=0x01: true, 0x00: false
-@item byte 5: enabled
+@item EN: 1 byte: enabled
>=0x01: true, 0x00: false
-@item byte 6: CPU operation
+@item OP: 1 byte: CPU operation
>=0x01: load, 0x02: store, 0x04: exec
-@item byte 7: temporary
+@item TM: 1 byte: temporary
Deletes the checkpoint after it has been hit once. This is similar to
"until" command, but it will not resume the emulator.
-@item byte 8 (optional): memspace
+@item MS: 1 byte (optional): memspace
Describes which part of the computer to checkpoint:
@itemize
@@ -21642,8 +21672,13 @@
Command body:
+@example
+CN CN CN CN
+@end example
+@*
+
@table @strong
-@item byte 0-3: checkpoint number
+@item CN: 4 bytes: checkpoint number
@end table
@@ -21653,7 +21688,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_CHECKPOINT_LIST
@subsection Checkpoint list (0x14)
@@ -21662,7 +21700,10 @@
Command body:
+@example
Currently empty.
+@end example
+@*
Response type:
@@ -21673,8 +21714,13 @@
Response body:
+@example
+CC CC CC CC
+@end example
+@*
+
@table @strong
-@item byte 0-3: The total number of checkpoints
+@item CC: 4 bytes: The total count of checkpoints
@end table
@@ -21685,10 +21731,15 @@
Command body:
+@example
+CN CN CN CN | EN
+@end example
+@*
+
@table @strong
-@item byte 0-3: Checkpoint number
+@item CN: 4 bytes: Checkpoint number
-@item byte 4: Enabled?
+@item EN: 1 byte: Enabled?
0x00: disabled, 0x01: enabled
@end table
@@ -21699,7 +21750,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_CONDITION_SET
@subsection Condition set (0x22)
@@ -21711,13 +21765,18 @@
Command body:
+@example
+CN CN CN CN | EL | ES[0] ES[1] ... ES[EL-1]
+@end example
+@*
+
@table @strong
-@item byte 0-3: checkpoint number
+@item CN: 4 bytes: checkpoint number
-@item byte 4: condition expression length
+@item EL: 1 byte: condition expression length
-@item byte 5+: condition expression string
-This is the same format used on the command line. Not null terminated.
+@item ES: EL bytes: condition expression string
+This is the same format used in the text monitor. Not null terminated.
@end table
@@ -21727,7 +21786,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_REGISTERS_GET
@subsection Registers get (0x31)
@@ -21738,8 +21800,13 @@
Command body:
+@example
+MS
+@end example
+@*
+
@table @strong
-@item byte 0: memspace
+@item MS: 1 byte: memspace
Describes which part of the computer you want to read:
@itemize
@@ -21763,8 +21830,17 @@
Command body:
+@example
+MS | RC RC [
+ IS[0] @{ RI[0] | RV[0] RV[0] @}
+ ...
+ IS[RC-1] @{ RI[RC-1] | RV[RC-1] RV[RC-1] @}
+]
+@end example
+@*
+
@table @strong
-@item byte 0: memspace
+@item MS: 1 byte: memspace
Describes which part of the computer you want to write:
@itemize
@@ -21775,14 +21851,24 @@
@item 0x04: drive 11
@end itemize
-@item byte 1-2: The count of the array items
+@item RC: 2 bytes: Register count
-@item byte 3+: An array with items of structure:
+@item Array: RC*(IS+1) bytes: An array with items of structure:
@table @strong
-@item byte 0: Size of the item, excluding this byte
-@item byte 1: ID of the register
-@item byte 2-3: register value
+
+@item
+
+[
+
+@item IS: 1 byte: Item size, excluding this byte
+@item RI: 1 byte: Register ID
+@item RV: 2 bytes: Register value
+
+@item
+
+]
+
@end table
@end table
@@ -21798,16 +21884,21 @@
Command body:
+@example
+SR | SD | FL | FN[0] FN[1] ... FN[FL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Save ROMs to snapshot file?
+@item SR: 1 byte: Save ROMs to snapshot file?
>=0x01: true, 0x00: false
-@item byte 1: Save disks to snapshot file?
+@item SD: 1 byte: Save disks to snapshot file?
>=0x01: true, 0x00: false
-@item byte 2: Length of filename
+@item FL: 1 byte: Length of filename
-@item byte 3+: Filename
+@item FN: FL bytes: Filename
The filename to save the snapshot to.
@end table
@@ -21818,7 +21909,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_UNDUMP
@subsection Undump (0x42)
@@ -21829,10 +21923,15 @@
Command body:
+@example
+FL | FN[0] FN[1] ... FN[FL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Length of filename
+@item FL: 1 byte: Length of filename
-@item byte 1+: Filename
+@item FN: FL bytes: Filename
The filename to load the snapshot from.
@end table
@@ -21843,8 +21942,13 @@
Response body:
+@example
+PC PC
+@end example
+@*
+
@table @strong
-@item byte 0-1: The current program counter position
+@item PC: 2 bytes: The current program counter position
@end table
@@ -21857,10 +21961,15 @@
Command body:
+@example
+NL | RN[0] RN[1] ... RN[NL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Length of resource name
+@item NL: 1 byte: Resource name length
-@item byte 1+: Resource name
+@item RN: NL bytes: Resource name
@end table
@@ -21870,13 +21979,18 @@
Response body:
+@example
+RT | VL | RV[0] RV[1] ... RV[VL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Type of the resource
+@item RT: 1 byte: Resource type
0x00: String, 0x01: Integer
-@item byte 1: Length of the value
+@item VL: 1 byte: Resource value length
-@item byte 2+: The value
+@item RV: VL bytes: The resource value
@end table
@@ -21889,18 +22003,23 @@
Command body:
+@example
+RT | NL | RN[0] RN[1] ... RN[NL-1] | VL | RV[0] RV[1] ... RV[VL-1]
+@end example
+@*
+
@table @strong
-@item 1 byte: Type of the resource value
+@item RT: 1 byte: Type of the resource value
0x00: String, 0x01: Integer@*
Strings will be interpreted if the destination is an Integer.
-@item 1 byte: Resource name length = (&name)
+@item NL: 1 byte: Resource name length
-@item (*name) bytes: The resource name
+@item RN: NL bytes: The resource name
-@item 1 byte: Resource value length = (&value)
+@item VL: 1 byte: Resource value length
-@item (*value) bytes: The resource value
+@item RV: VL bytes: The resource value
@end table
@@ -21910,7 +22029,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_ADVANCE_INSTRUCTIONS
@subsection Advance Instructions (0x71)
@@ -21921,11 +22043,16 @@
Command body:
+@example
+SO | IC IC
+@end example
+@*
+
@table @strong
-@item byte 0: Step over subroutines?
+@item SO: 1 byte: Step over subroutines?
Should subroutines count as a single instruction?
-@item byte 1-2: How many instructions to step over.
+@item IC: 2 bytes: How many instructions to step over.
@end table
@@ -21935,7 +22062,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_KEYBOARD_FEED
@subsection Keyboard feed (0x72)
@@ -21948,10 +22078,15 @@
Command body:
+@example
+TL | TC[0] TC[1] ... TC[TL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Length of text
+@item TL: 1 byte: Text Length
-@item byte 1+: The text, in PETSCII
+@item TC: TL bytes: The text content, in PETSCII
@end table
@@ -21961,7 +22096,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_EXECUTE_UNTIL_RETURN
@subsection Execute until return (0x73)
@@ -21974,7 +22112,10 @@
Command body:
+@example
Currently empty.
+@end example
+@*
Response type:
@@ -21982,7 +22123,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_PING
@subsection Ping (0x81)
@@ -21993,7 +22137,10 @@
Command body:
+@example
Always empty
+@end example
+@*
Response type:
@@ -22001,7 +22148,10 @@
Response body:
+@example
Always empty
+@end example
+@*
@node MON_CMD_BANKS_AVAILABLE
@subsection Banks available (0x82)
@@ -22012,7 +22162,10 @@
Command body:
+@example
Currently empty.
+@end example
+@*
Response type:
@@ -22020,19 +22173,37 @@
Response body:
+@example
+BC BC [
+ IS[0] @{ BI[0] BI[0] | NL[0] | BN[0][0] BN[0][1] ... BN[0][NL[0]-1] @}
+ ...
+ IS[BC-1] @{ ... @}
+]
+@end example
+@*
+
@table @strong
-@item byte 0-1: The count of the array items
-@item byte 2+: An array with items of structure:
+@item BC: 2 bytes: Bank item count
+@item Array 1+BC*IS bytes: An array with items of structure:
@table @strong
-@item byte 0: Size of the item, excluding this byte
-@item byte 1-2: bank ID
+@item
-@item byte 3: Name length
+[
-@item byte 4+: Name
+@item IS: 1 byte: Item size, excluding this byte
+@item BI: 2 bytes: Bank ID
+
+@item NL: 1 byte: Name Length
+
+@item BN: NL bytes: Name
+
+@item
+
+]
+
@end table
@end table
@@ -22046,9 +22217,14 @@
Command body:
+@example
+MS
+@end example
+@*
+
@table @strong
-@item byte 0: memspace
+@item MS: 1 byte: memspace
Describes which part of the computer you want to read:
@itemize
@@ -22063,25 +22239,30 @@
Response type:
-0x82: MON_RESPONSE_REGISTERS_AVAILABLE
+0x83: MON_RESPONSE_REGISTERS_AVAILABLE
Response body:
+@example
+RC RC [ IS[0] @{ RI[0] | RS[0] | NL[0] | RN[0][0] RN[0][1] ... RN[0][NL[0]-1] @} ... IS[RC-1] @{ ... @} ]
+@end example
+@*
+
@table @strong
-@item byte 0-1: The count of the array items
-@item byte 2+: An array with items of structure:
+@item RC: 2 bytes: Register item count
+@item Array: RC*(IS+1) bytes: An array with items of structure:
@table @strong
-@item byte 0: Size of the item, excluding this byte
+@item IS: 1 byte: Item Size, excluding this byte
-@item byte 1: ID of the register
+@item RI: 1 byte: Register ID
-@item byte 2: Size of the register in bits
+@item RS: 1 byte: Register Size in bits
-@item byte 3: Length of name
+@item NL: 1 byte: Length of name
-@item byte 4+: Name
+@item RN: NL bytes : Register name
@end table
@@ -22098,12 +22279,17 @@
Command body:
+@example
+VC | FM
+@end example
+@*
+
@table @strong
-@item byte 0: USE VIC-II?
+@item VC: 1 byte: USE VIC-II?
Must be included, but ignored for all but the C128. If true, (>=0x01) the screen
returned will be from the VIC-II. If false (0x00), it will be from the VDC.
-@item byte 1: Format
+@item FM: 1 byte: Format
0x00: Indexed, 8 bit@*
@end table
@@ -22114,32 +22300,37 @@
Response body:
+@example
+FL FL FL FL | DW DW | DH DH | XO XO | YO YO | IW IW | IH IH | BP |
+ BL BL BL BL | BD[0] BD[1] ... BD[BL-1]
+@end example
+@*
+
@table @strong
-@item 4 bytes: Length of the fields before the display buffer
+@item FL: 4 bytes: Length of the fields before the display buffer
-@item 2 bytes: Debug width of display buffer (uncropped)
+@item DW: 2 bytes: Debug width of display buffer (uncropped)
The largest width the screen gets.
-@item 2 bytes: Debug height of display buffer (uncropped)
+@item DH: 2 bytes: Debug height of display buffer (uncropped)
The largest height the screen gets.
-@item 2 bytes: X offset
+@item XO: 2 bytes: X offset
X offset to the inner part of the screen.
-@item 2 bytes: Y offset
+@item YO: 2 bytes: Y offset
Y offset to the inner part of the screen.
-@item 2 bytes: Width of the inner part of the screen.
+@item IW: 2 bytes: Width of the inner part of the screen.
-@item 2 bytes: Height of the inner part of the screen.
+@item IH: 2 bytes: Height of the inner part of the screen.
-@item 1 byte: Bits per pixel of display buffer, 8
+@item BP: 1 byte: Bits per pixel of display buffer, 8
+@item BL: 4 bytes: Length of display buffer
-@item 4 bytes: Length of display buffer = (&buffer)
+@item BD: BL bytes: Display buffer data
-@item (*buffer) bytes: Display buffer data
-
@end table
@node MON_CMD_VICE_INFO
@@ -22151,7 +22342,10 @@
Command body:
+@example
Always empty
+@end example
+@*
Response type:
@@ -22159,19 +22353,122 @@
Response body:
+@example
+ML | MV[0] MV[1] ... MV[ML-1] | SL | SV[0] SV[1] ... SV[SL-1]
+@end example
+@*
+
@table @strong
-@item 1 byte: Length of main version = (&main)
+@item ML: 1 byte: Length of main version
-@item (*main) bytes: Main version
+@item MV: ML bytes: Main version
In linear format. For example 0x03, 0x05, 0x00, 0x00 for 3.5.0.0
-@item 1 byte: Length of SVN revision = (&rev)
+@item SL: 1 byte: Length of SVN revision
-@item (*rev) bytes: SVN revision
+@item SV: SL bytes: SVN revision
In little endian format. Returns zero if it's not an SVN build.
@end table
+@node MON_CMD_CPUHISTORY_GET
+@subsection CPU History (0x86)
+
+Gets records of every instruction executed by an emulated CPU.
+
+Minimum VICE version: 3.10
+
+Command body:
+
+@example
+MS | HC HC HC HC
+@end example
+@*
+
+@table @strong
+@item MS: 1 byte: memspace
+
+@itemize
+@item 0x00: main memory
+@item 0x01: drive 8
+@item 0x02: drive 9
+@item 0x03: drive 10
+@item 0x04: drive 11
+@end itemize
+
+@item HC: 4 bytes: count of items to retrieve
+
+@end table
+
+Response type:
+
+0x86: MON_RESPONSE_CPUHISTORY_GET
+
+Response body:
+
+@example
+HC HC HC HC [
+ IS[0] @{
+ RC[0] RC[0] [
+ RS[0][0] @{ ... @}
+ ...
+ RS[0][RC-1] @{ ... @}
+ ]
+ @}
+ ...
+ IS[HC-1] @{ ... @}
+]
+CL CL CL CL CL CL CL CL | IL | IB[0] IB[1] ... IB[IL-1]
+@end example
+@*
+
+@table @strong
+@item HC: 4 bytes: CPU history item count
+
+@item Array: HC*(IS+1) bytes:
+An array with items of structure:
+
+@table @strong
+@item
+
+[
+
+@item IS: 1 bytes: Item size, excluding this byte
+
+@item RC: 2 bytes: Register item count
+
+@item Array: RC*(RS+1) bytes: Array items of structure:
+
+@table @strong
+@item
+
+[
+
+@item RS: 1 byte: Item size, excluding this byte
+
+@item @{...@}: RS bytes: The array item body from @ref{MON_RESPONSE_REGISTER_INFO}
+
+@item
+
+]
+
+@end table
+
+@item CL: 8 bytes: The CPU clock
+
+@item IL: 1 bytes: instruction bytes length
+
+@item IB: IL bytes: Instruction byte string.
+This is a fixed length and must be interpreted by the client.
+
+@end table
+
+@item
+
+]
+
+@end table
+
@node MON_CMD_PALETTE_GET
@subsection Palette get (0x91)
@@ -22181,8 +22478,13 @@
Command body:
+@example
+VC
+@end example
+@*
+
@table @strong
-@item byte 0: USE VIC-II?
+@item VC: 1 byte: USE VIC-II?
Must be included, but ignored for all but the C128. If true, (>=0x01) the screen
returned will be from the VIC-II. If false (0x00), it will be from the VDC.
@@ -22194,20 +22496,37 @@
Response body:
+@example
+PC PC [
+ IS[0] { RR[0] | GG[0] | BB[0] }
+ ...
+ IS[PC-1] { RR[PC-1] | GG[PC-1] | BB[PC-1] }
+]
+@end example
+@*
+
@table @strong
-@item byte 0-1: The number of palette items.
+@item PC: 2 bytes: The palette item count
-@item byte 2+: An array with items of structure:
+@item Array : PC*(IS+1): An array with items of structure:
@table @strong
-@item byte 0: Size of the item, excluding this byte
+@item
-@item byte 1: Red
+[
-@item byte 2: Green
+@item IS: 1 byte: Item size, excluding this byte
-@item byte 3: Blue
+@item RR: 1 byte: Red
+@item GG: 1 byte: Green
+
+@item BB: 1 byte: Blue
+
+@item
+
+]
+
@end table
@end table
@@ -22221,9 +22540,14 @@
Command body:
+@example
+PN PN | PV PV
+@end example
+@*
+
@table @strong
-@item byte 0-1: The port to set the value on
-@item byte 2-3: The value to set
+@item PN: 2 bytes: The port to set the value on
+@item PV: 2 bytes: The value to set
@end table
@@ -22233,9 +22557,11 @@
Response body:
+@example
Currently empty.
+@end example
+@*
-
@node MON_CMD_USERPORT_SET
@subsection Userport set (0xb2)
@@ -22245,8 +22571,13 @@
Command body:
+@example
+UV UV
+@end example
+@*
+
@table @strong
-@item byte 0-1: The value to set
+@item UV: 2 bytes: The value to set
@end table
@@ -22256,7 +22587,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_EXIT
@subsection Exit (0xaa)
@@ -22267,7 +22601,10 @@
Command body:
+@example
Currently empty.
+@end example
+@*
Response type:
@@ -22275,7 +22612,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_QUIT
@subsection Quit (0xbb)
@@ -22286,7 +22626,10 @@
Command body:
+@example
Currently empty.
+@end example
+@*
Response type:
@@ -22294,7 +22637,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_RESET
@subsection Reset (0xcc)
@@ -22305,8 +22651,13 @@
Command body:
+@example
+RS
+@end example
+@*
+
@table @strong
-@item byte 0: What to reset
+@item RS: 1 byte: What to reset
@itemize
@item 0x00: Reset system
@@ -22322,7 +22673,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_AUTOSTART
@subsection Autostart / autoload (0xdd)
@@ -22333,16 +22687,21 @@
Command body:
+@example
+RL | FI FI | FL | FN[0] FN[1] ... FN[FL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Run after loading?
+@item RL: 1 byte: Run after loading?
>=0x01: true, 0x00: false
-@item byte 1-2: File index
+@item FI: 2 bytes: File index
The index of the file to execute, if a disk image. 0x00 is the default value.
-@item byte 3: Length of filename
+@item FL: byte 3: Length of filename
-@item byte 4+: Filename
+@item FN: FL bytes: Filename
The filename to autoload.
@end table
@@ -22353,7 +22712,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node Binary Responses
@section Responses
@@ -22382,7 +22744,10 @@
Response body:
+@example
Usually empty
+@end example
+@*
@node MON_RESPONSE_CHECKPOINT_INFO
@subsection Checkpoint Response (0x11)
@@ -22402,37 +22767,44 @@
Response body:
+@example
+CN CN CN CN | CH | SA SA | EA EA | ST | EN | OP | TM |
+ HC HC HC HC | IC IC IC IC | CE | MS
+@end example
+@*
+
@table @strong
-@item byte 0-3: Checkpoint number
+@item CN: 4 bytes: Checkpoint number
-@item byte 4: Currently hit?
+@item CH: 1 byte: Currently hit?
>=0x01: true, 0x00: false
-@item byte 5-6: start address
+@item SA: 2 bytes: start address
-@item byte 7-8: end address
+@item EA: 2 bytes: end address
-@item byte 9: stop when hit
+@item ST: 1 byte: stop when hit
>=0x01: true, 0x00: false
-@item byte 10: enabled
+@item EN: 1 byte: enabled
>=0x01: true, 0x00: false
-@item byte 11: CPU operation
+@item OP: 1 byte: CPU operation
0x01: load, 0x02: store, 0x04: exec
-@item byte 12: temporary
-Deletes the checkpoint after it has been hit once. This is similar to
-"until" command, but it will not resume the emulator.
+@item TM: 1 byte: temporary
+ Deletes the checkpoint after it has been hit once. This is similar to
+ "until" command, but it will not resume the emulator.
-@item byte 13-16: hit count
+@item HC: 4 bytes: hit count
-@item byte 17-20: ignore count
+@item IC: 4 bytes: ignore count
-@item byte 21: Has condition?
+@item CE: 1 byte: Has condition?
>=0x01: true, 0x00: false
-@item byte 22: memspace
+@item MS: 1 byte: memspace
+Describes which part of the computer to checkpoint:
@itemize
@item 0x00: main memory
@@ -22453,18 +22825,35 @@
Response body:
+@example
+RC RC [
+ IS[0] @{ RI[0] | RV[0] RV[0] @}
+ ...
+ IS[RC-1] @{ RI[RC-1] | RV[RC-1] RV[RC-1] @}
+]
+@end example
+@*
+
@table @strong
-@item byte 0-1: The count of the array items
+@item RC: 2 bytes: The count of the array items
-@item byte 2+: An array with items of structure:
+@item Array: RC*(IS+1): An array with items of structure:
@table @strong
-@item byte 0: Size of the item, excluding this byte
+@item
-@item byte 1: ID of the register
+[
-@item byte 2-3: register value
+@item IS: 1 byte: Item size, excluding this byte
+@item RI: 1 byte: ID of the register
+
+@item RV: 2 bytes: register value
+
+@item
+
+]
+
@end table
@end table
@@ -22481,8 +22870,13 @@
Response body:
+@example
+PC PC
+@end example
+@*
+
@table @strong
-@item byte 0-1: The current program counter position
+@item PC: 2 bytes: The current program counter position
@end table
@@ -22498,8 +22892,13 @@
Response body:
+@example
+PC PC
+@end example
+@*
+
@table @strong
-@item byte 0-1: The current program counter position
+@item PC: 2 bytes: The current program counter position
@end table
@@ -22514,8 +22913,13 @@
Response body:
+@example
+PC PC
+@end example
+@*
+
@table @strong
-@item byte 0-1: The current program counter position
+@item PC: 2 bytes: The current program counter position
@end table
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/uicart.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/uicart.c 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/uicart.c 2025-03-25 14:14:52 UTC (rev 45581)
@@ -140,13 +140,10 @@
/** \brief List of VIC-20 'main' cart types
- *
- * The generic type will use the generic carts list in #vic20_cart_types_generic
*/
static const cart_type_list_t vic20_cart_types[] = {
{ "Smart-attach", UICART_VIC20_SMART },
{ "Generic", UICART_VIC20_GENERIC },
-/* { "Add to generic cartridge", UICART_VIC20_ADD_GENERIC }, */
{ "Freezer", UICART_VIC20_FREEZER },
{ "Games", UICART_VIC20_GAME },
{ "Utilities", UICART_VIC20_UTIL },
@@ -177,20 +174,6 @@
{ NULL, -1 }
};
-#if 0
-/** \brief List of VIC-20 cart types of the 'generic' variety
- */
-static const cart_type_list_t vic20_cart_types_generic[] = {
- { "Smart-attach cartridge image", CARTRIDGE_VIC20_DETECT },
- { "32KiB cartridge at $2000", CARTRIDGE_VIC20_32KB_2000 },
- { "4/8/16KiB cartridge at $2000", CARTRIDGE_VIC20_16KB_2000 },
- { "4/8/16KiB cartridge at $4000", CARTRIDGE_VIC20_16KB_4000 },
- { "4/8/16KiB cartridge at $6000", CARTRIDGE_VIC20_16KB_6000 },
- { "4/8KiB cartridge at $A000", CARTRIDGE_VIC20_8KB_A000 },
- { "4KiB cartridge at $B000", CARTRIDGE_VIC20_4KB_B000 },
- { NULL, -1 }
-};
-#endif
/** \brief File filter pattern for CRT images */
static const char *pattern_crt[] = { "*.crt", NULL };
@@ -247,7 +230,10 @@
/** \brief Reference to the cart-set-default widget */
static GtkWidget *cart_set_default_widget = NULL;
+/** \brief Reference to the cart add widget */
+static GtkWidget *cart_add_widget = NULL;
+
/** \brief Reference to the cart ID widget */
static GtkWidget *cart_id_label = NULL;
@@ -433,6 +419,7 @@
if ((pattern == UICART_PATTERN_CRT) || (mask == 0x0)) {
gtk_widget_hide(GTK_WIDGET(cart_id_widget));
gtk_widget_hide(GTK_WIDGET(cart_id_label));
+ gtk_widget_hide(GTK_WIDGET(cart_add_widget));
} else {
gtk_widget_show(GTK_WIDGET(cart_id_widget));
gtk_widget_show(GTK_WIDGET(cart_id_label));
@@ -442,26 +429,7 @@
set_pattern(pattern);
break;
-#if 0
- case VICE_MACHINE_VIC20:
- if ((crt_type == UICART_VIC20_GENERIC) ||
- (crt_type == UICART_VIC20_ADD_GENERIC)) {
- id_model = create_cart_id_model_vic20();
- /* gtk_widget_set_sensitive(cart_id_widget, TRUE); */
- gtk_widget_show(GTK_WIDGET(cart_id_widget));
- gtk_widget_show(GTK_WIDGET(cart_id_label));
- } else {
- /* empty model */
- id_model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
- /* gtk_widget_set_sensitive(cart_id_widget, FALSE); */
- gtk_widget_hide(GTK_WIDGET(cart_id_widget));
- gtk_widget_hide(GTK_WIDGET(cart_id_label));
- }
- gtk_combo_box_set_model(GTK_COMBO_BOX(cart_id_widget), GTK_TREE_MODEL(id_model));
- gtk_combo_box_set_active(GTK_COMBO_BOX(cart_id_widget), 0);
- break;
-#endif
default:
break;
}
@@ -491,6 +459,46 @@
}
+/** \brief Handler for the "changed" event of the cart ID combo box
+ *
+ * \param[in] combo cart ID combo
+ * \param[in] data extra event data (unused)
+ */
+static void on_cart_id_changed(GtkComboBox *combo, gpointer data)
+{
+ int lasttype = cartridge_get_id(0);
+ int id = get_cart_id();
+ int generic_add = 0;
+
+ /* enable the "add to generic cartridge" checkbox only when a generic
+ cartridge is selected AND currently inserted! */
+ switch (machine_class) {
+ case VICE_MACHINE_C64: /* fall through */
+ case VICE_MACHINE_C64SC: /* fall through */
+ case VICE_MACHINE_C128: /* fall through */
+ case VICE_MACHINE_SCPU64: /* fall through */
+ case VICE_MACHINE_PLUS4: /* fall through */
+ case VICE_MACHINE_CBM5x0: /* fall through */
+ case VICE_MACHINE_CBM6x0:
+ break;
+ /* currently we only use this on vic20 */
+ case VICE_MACHINE_VIC20:
+ if (id >= CARTRIDGE_VIC20_DETECT) {
+ if (lasttype == CARTRIDGE_VIC20_GENERIC) {
+ generic_add = 1;
+ }
+ }
+ break;
+ }
+
+ if (generic_add) {
+ gtk_widget_show(cart_add_widget);
+ } else {
+ gtk_widget_hide(cart_add_widget);
+ }
+}
+
+
/** \brief Get the ID of the model for the 'cart ID' combo box
*
* \return ID or -1 on error
@@ -671,6 +679,15 @@
return 0;
break;
}
+
+ /* add to cartridge */
+ if ((cart_add_widget != NULL) &&
+ (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cart_add_widget)))) {
+ if ((cartridge_attach_add_image(id, path) == 0)) {
+ return 1;
+ }
+ }
+
/* printf("call cartridge_attach_image(id:%d path:%s)\n", id, path); */
if ((cartridge_attach_image(id, path) == 0)) {
/* check 'set default' */
@@ -765,32 +782,7 @@
return model;
}
-#if 0
-/** \brief Create a list of cartridges for VIC-20
- *
- * Only valid for VIC-20
- *
- * \return Two-column list store (name, id)
- */
-static GtkListStore *create_cart_id_model_vic20(void)
-{
- GtkListStore *model;
- GtkTreeIter iter;
- int i;
- model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
-
- for (i = 0; vic20_cart_types_generic[i].name != NULL; i++) {
- gtk_list_store_append(model, &iter);
- gtk_list_store_set(model, &iter,
- 0, vic20_cart_types_generic[i].name, /* cart name */
- 1, vic20_cart_types_generic[i].id, /* cart ID */
- -1);
- }
- return model;
-}
-#endif
-
/** \brief Create combo box with main cartridge types
*
* \return GtkComboBox
@@ -850,37 +842,15 @@
"text", 0, NULL);
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
+
+ g_signal_connect_unlocked(G_OBJECT(combo),
+ "changed",
+ G_CALLBACK(on_cart_id_changed),
+ NULL);
return combo;
}
-#if 0
-/** \brief Create combo box with generic VIC-20 cartridges
- *
- * \return GtkComboBox
- */
-static GtkWidget *create_cart_id_combo_box_vic20(void)
-{
- GtkWidget *combo;
- GtkListStore *model;
- GtkCellRenderer *renderer;
- model = create_cart_id_model_vic20();
- if (model == NULL) {
- return gtk_combo_box_new();
- }
- combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model));
- g_object_unref(model);
-
- renderer = gtk_cell_renderer_text_new();
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE);
- gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer,
- "text", 0, NULL);
-
- gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
- return combo;
-}
-#endif
-
/** \brief Create the 'extra' widget for the dialog
*
* \param[in] set_default initial state of the 'set as default' checkbox
@@ -954,7 +924,30 @@
break;
}
+ /* create "Set cartridge as default" check button */
+ switch (machine_class) {
+ case VICE_MACHINE_C64: /* fall through */
+ case VICE_MACHINE_C64SC: /* fall through */
+ case VICE_MACHINE_C128: /* fall through */
+ case VICE_MACHINE_SCPU64: /* fall through */
+ case VICE_MACHINE_PLUS4: /* fall through */
+ case VICE_MACHINE_CBM5x0: /* fall through */
+ case VICE_MACHINE_CBM6x0: /* fall through */
+ case VICE_MACHINE_VIC20:
+ cart_add_widget = gtk_check_button_new_with_label(
+ "add to cartridge");
+ gtk_toggle_button_set_active(
+ GTK_TOGGLE_BUTTON(cart_add_widget), 0);
+
+ gtk_grid_attach(GTK_GRID(grid), cart_add_widget, 4, 0, 1, 1);
+ break;
+ default:
+ /* Set cart as default is not supported for the current machine */
+ break;
+ }
+
gtk_widget_show_all(grid);
+ gtk_widget_hide(cart_add_widget);
return grid;
}
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/menu_vic20cart.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/menu_vic20cart.c 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/menu_vic20cart.c 2025-03-25 14:14:52 UTC (rev 45581)
@@ -204,6 +204,7 @@
return NULL;
}
+/* FIXME: this should be dynamic, like in x64 */
static UI_MENU_CALLBACK(attach_cart_callback)
{
const char *title;
@@ -276,11 +277,60 @@
return NULL;
}
+/* FIXME: this should be dynamic, like in x64 */
+static UI_MENU_CALLBACK(add_cart_callback)
+{
+ const char *title;
+ char *name = NULL;
+ int action = ACTION_NONE;
+
+ if (activated) {
+ switch (vice_ptr_to_int(param)) {
+ case CARTRIDGE_VIC20_DETECT: /* fall through */
+ case CARTRIDGE_VIC20_GENERIC:
+ title = "Select cartridge image";
+ break;
+ case CARTRIDGE_VIC20_16KB_2000:
+ title = "Select 4/8/16KiB image";
+ action = ACTION_CART_ATTACH_RAW_2000;
+ break;
+ case CARTRIDGE_VIC20_16KB_4000:
+ title = "Select 4/8/16KiB image";
+ action = ACTION_CART_ATTACH_RAW_4000;
+ break;
+ case CARTRIDGE_VIC20_16KB_6000:
+ title = "Select 4/8/16KiB image";
+ action = ACTION_CART_ATTACH_RAW_6000;
+ break;
+ case CARTRIDGE_VIC20_8KB_A000:
+ title = "Select 4/8KiB image";
+ action = ACTION_CART_ATTACH_RAW_A000;
+ break;
+ case CARTRIDGE_VIC20_4KB_B000:
+ action = ACTION_CART_ATTACH_RAW_B000; /* fall through */
+ default:
+ title = "Select 4KiB image";
+ break;
+ }
+ name = sdl_ui_file_selection_dialog(title, FILEREQ_MODE_CHOOSE_FILE);
+ if (name != NULL) {
+ if (cartridge_attach_add_image(vice_ptr_to_int(param), name) < 0) {
+ ui_error("Cannot load cartridge image.");
+ }
+ lib_free(name);
+ }
+ if (action > ACTION_NONE) {
+ ui_action_finish(action);
+ }
+ }
+ return NULL;
+}
+
/* TODO: Create UI action IDs/names for these items
* Smart-attach can probably use `ACTION_CART_ATTACH`, the rest needs
* new IDs like `ACTION_CART_ATTACH_2000`.
*/
-static const ui_menu_entry_t add_to_generic_cart_submenu[] = {
+static const ui_menu_entry_t attach_generic_cart_submenu[] = {
{ .string = "Smart-attach cartridge image",
.type = MENU_ENTRY_DIALOG,
.callback = attach_cart_callback,
@@ -319,6 +369,49 @@
SDL_MENU_LIST_END
};
+/* TODO: Create UI action IDs/names for these items
+ * Smart-attach can probably use `ACTION_CART_ATTACH_ADD`, the rest needs
+ * new IDs like `ACTION_CART_ATTACH_ADD_2000`.
+ */
+static const ui_menu_entry_t add_to_generic_cart_submenu[] = {
+ { .string = "Smart-attach cartridge image",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_DETECT
+ },
+ { .action = ACTION_CART_ATTACH_RAW_2000,
+ .string = "Attach 4/8/16KiB image at $2000",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_16KB_2000
+ },
+ { .action = ACTION_CART_ATTACH_RAW_4000,
+ .string = "Attach 4/8/16KiB image at $4000",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_16KB_4000
+ },
+ { .action = ACTION_CART_ATTACH_RAW_6000,
+ .string = "Attach 4/8/16KiB image at $6000",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_16KB_6000
+ },
+ { .action = ACTION_CART_ATTACH_RAW_A000,
+ .string = "Attach 4/8KiB image at $A000",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_8KB_A000
+ },
+ { .action = ACTION_CART_ATTACH_RAW_B000,
+ .string = "Attach 4KiB image at $B000",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_4KB_B000
+ },
+ SDL_MENU_LIST_END
+};
+
static UI_MENU_CALLBACK(set_cart_default_callback)
{
if (activated) {
@@ -755,9 +848,9 @@
SDL_MENU_ITEM_SEPARATOR,
{ .string = "Attach generic cartridge image",
- .type = MENU_ENTRY_DIALOG,
- .callback = attach_cart_callback,
- .data = (ui_callback_data_t)CARTRIDGE_VIC20_GENERIC
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)attach_generic_cart_submenu
},
{ .action = ACTION_CART_ATTACH_RAW_BEHRBONZ,
.string = "Attach " CARTRIDGE_VIC20_NAME_BEHRBONZ " image",
Modified: branches/compyx/joymap-001/vice/src/c128/cart/magicdesk128.c
===================================================================
--- branches/compyx/joymap-001/vice/src/c128/cart/magicdesk128.c 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/c128/cart/magicdesk128.c 2025-03-25 14:14:52 UTC (rev 45581)
@@ -262,7 +262,7 @@
static char snap_module_name[] = "MAGICDESK128";
#define SNAP_MAJOR 0
-#define SNAP_MINOR 0
+#define SNAP_MINOR 1
int magicdesk128_snapshot_write_module(snapshot_t *s)
{
@@ -274,7 +274,14 @@
return -1;
}
- /* FIXME */
+ if (0
+ || SMW_B(m, (uint8_t)md128reg) < 0
+ || SMW_B(m, (uint8_t)rombank) < 0
+ || SMW_B(m, (uint8_t)bankmask) < 0
+ || (SMW_BA(m, ext_function_rom, MD128_ROM_SIZE) < 0)) {
+ snapshot_module_close(m);
+ return -1;
+ }
return snapshot_module_close(m);
}
@@ -296,7 +303,13 @@
goto fail;
}
- /* FIXME */
+ if (0
+ || SMR_B_UINT(m, &md128reg) < 0
+ || SMR_B_UINT(m, &rombank) < 0
+ || SMR_B_UINT(m, &bankmask) < 0
+ || (SMR_BA(m, ext_function_rom, MD128_ROM_SIZE) < 0)) {
+ goto fail;
+ }
snapshot_module_close(m);
Modified: branches/compyx/joymap-001/vice/src/c128/cart/partner128.c
===================================================================
--- branches/compyx/joymap-001/vice/src/c128/cart/partner128.c 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/c128/cart/partner128.c 2025-03-25 14:14:52 UTC (rev 45581)
@@ -362,7 +362,7 @@
static char snap_module_name[] = "PARTNER128";
#define SNAP_MAJOR 0
-#define SNAP_MINOR 0
+#define SNAP_MINOR 1
int partner128_snapshot_write_module(snapshot_t *s)
{
@@ -375,6 +375,16 @@
}
/* FIXME */
+ if (0
+ || SMW_B(m, regvalue) < 0
+ || SMW_B(m, rambank) < 0
+ || SMW_B(m, isdefreezing) < 0
+ || (SMW_BA(m, nmivector, 2) < 0)
+ || (SMW_BA(m, ext_function_rom, PARTNER_ROM_SIZE) < 0)
+ || (SMW_BA(m, rambanks, PARTNER_RAM_SIZE) < 0)) {
+ snapshot_module_close(m);
+ return -1;
+ }
return snapshot_module_close(m);
}
@@ -397,6 +407,15 @@
}
/* FIXME */
+ if (0
+ || SMR_B(m, ®value) < 0
+ || SMR_B(m, &rambank) < 0
+ || SMR_B(m, &isdefreezing) < 0
+ || (SMR_BA(m, nmivector, 2) < 0)
+ || (SMR_BA(m, ext_function_rom, PARTNER_ROM_SIZE) < 0)
+ || (SMR_BA(m, rambanks, PARTNER_RAM_SIZE) < 0)) {
+ goto fail;
+ }
snapshot_module_close(m);
Modified: branches/compyx/joymap-001/vice/src/c64/cart/c64cart.c
===================================================================
--- branches/compyx/joymap-001/vice/src/c64/cart/c64cart.c 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/c64/cart/c64cart.c 2025-03-25 14:14:52 UTC (rev 45581)
@@ -349,11 +349,14 @@
return &cartlist[0];
}
-/* FIXME: this only works in slot 0 right now */
+/* FIXME: slot arg is ignored right now.
+ this should return a valid cartridge ID for a given slot, or CARTRIDGE_NONE
+ FIXME: should we return CARTRIDGE_CRT(0) or not?
+*/
int cartridge_get_id(int slot)
{
int type = cart_getid_slotmain();
- /*DBG(("cartridge_get_id(slot:%d): type:%d\n", slot, type));*/
+ /* DBG(("cartridge_get_id(slot:%d): type:%d\n", slot, type)); */
return type;
}
@@ -1178,6 +1181,12 @@
return -1;
}
+/* FIXME: add additional image to standard cartridge */
+int cartridge_attach_add_image(int type, const char *filename)
+{
+ return -1;
+}
+
void cart_power_off(void)
{
if (c64cartridge_reset) {
Modified: branches/compyx/joymap-001/vice/src/c64/vsid-stubs.c
===================================================================
--- branches/compyx/joymap-001/vice/src/c64/vsid-stubs.c 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/c64/vsid-stubs.c 2025-03-25 14:14:52 UTC (rev 45581)
@@ -200,6 +200,11 @@
return -1;
}
+int cartridge_attach_add_image(int type, const char *filename)
+{
+ return -1;
+}
+
void cartridge_detach_image(int type)
{
}
Modified: branches/compyx/joymap-001/vice/src/c64dtv/c64dtv-stubs.c
===================================================================
--- branches/compyx/joymap-001/vice/src/c64dtv/c64dtv-stubs.c 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/c64dtv/c64dtv-stubs.c 2025-03-25 14:14:52 UTC (rev 45581)
@@ -153,6 +153,11 @@
return -1;
}
+int cartridge_attach_add_image(int type, const char *filename)
+{
+ return -1;
+}
+
void cartridge_detach_image(int type)
{
}
Modified: branches/compyx/joymap-001/vice/src/cartridge.h
===================================================================
--- branches/compyx/joymap-001/vice/src/cartridge.h 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/cartridge.h 2025-03-25 14:14:52 UTC (rev 45581)
@@ -50,9 +50,14 @@
/* detect cartridge type (takes crt and bin files) */
int cartridge_detect(const char *filename);
-/* attach (and enable) a cartridge by type and filename (takes crt and bin files) */
+/* attach (and enable) a cartridge by type and filename (takes crt and bin files)
+ this function detaches previously attached image(s) in the (all) main slot(s) */
int cartridge_attach_image(int type, const char *filename);
+/* attach (and enable) a cartridge by type and filename (takes crt and bin files)
+ this function ADDs one (or more) images (usually to the generic cartridge) */
+int cartridge_attach_add_image(int type, const char *filename);
+
/* enable cartridge by type. loads default image if any.
should be used by the UI instead of using the resources directly */
int cartridge_enable(int type);
@@ -65,6 +70,7 @@
/* FIXME: slot arg is ignored right now.
this should return a valid cartridge ID for a given slot, or CARTRIDGE_NONE
+ (it does NOT return CARTRIDGE_CRT)
*/
int cartridge_get_id(int slot);
Modified: branches/compyx/joymap-001/vice/src/cbm2/cart/cbm2cart.c
===================================================================
--- branches/compyx/joymap-001/vice/src/cbm2/cart/cbm2cart.c 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/cbm2/cart/cbm2cart.c 2025-03-25 14:14:52 UTC (rev 45581)
@@ -790,6 +790,12 @@
return -1;
}
+/* FIXME: add additional image to standard cartridge */
+int cartridge_attach_add_image(int type, const char *filename)
+{
+ return -1;
+}
+
void cartridge_trigger_freeze(void)
{
}
@@ -849,8 +855,10 @@
return 0;
}
-/* return cartridge type of main slot
- returns 0 (CARTRIDGE_CRT) if crt file */
+/* FIXME: slot arg is ignored right now.
+ this should return a valid cartridge ID for a given slot, or CARTRIDGE_NONE
+ (it does NOT return CARTRIDGE_CRT)
+*/
int cartridge_get_id(int slot)
{
DBG(("cartridge_get_id(slot:%d): type:%d", slot, cbm2cart_type));
Modified: branches/compyx/joymap-001/vice/src/monitor/mon_memmap.c
===================================================================
--- branches/compyx/joymap-001/vice/src/monitor/mon_memmap.c 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/monitor/mon_memmap.c 2025-03-25 14:14:52 UTC (rev 45581)
@@ -68,21 +68,6 @@
#define MEMMAP_ELEM uint16_t
-struct cpuhistory_s {
- CLOCK cycle;
- uint16_t addr;
- uint16_t reg_st;
- uint8_t op;
- uint8_t p1;
- uint8_t p2;
- uint8_t reg_a;
- uint8_t reg_x;
- uint8_t reg_y;
- uint8_t reg_sp;
- MEMSPACE origin;
-};
-typedef struct cpuhistory_s cpuhistory_t;
-
/* CPU history variables */
static cpuhistory_t *cpuhistory = NULL;
static int cpuhistory_buffer_lines = 0; /* actual size of the cyclic buffer */
@@ -122,7 +107,7 @@
if (lines < 10140) {
lines = 10140;
}
- lines *= 5;
+ lines = lines * 5 + 1;
cpuhistory = lib_realloc(cpuhistory, (size_t)lines * sizeof(cpuhistory_t));
@@ -181,40 +166,19 @@
cpuhistory[cpuhistory_i].p2 = p2;
}
-void mon_cpuhistory(int count, MEMSPACE filter1, MEMSPACE filter2, MEMSPACE filter3,
- MEMSPACE filter4, MEMSPACE filter5)
-{
- uint8_t op, p1, p2, p3 = 0;
- MEMSPACE mem;
- uint16_t loc, addr;
- int hex_mode = 1;
- const char *dis_inst;
- unsigned opc_size;
+cpuhistory_t *mon_cpuhistory_seek(int count, MEMSPACE filter1, MEMSPACE filter2,
+ MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5) {
int i, pos;
- CLOCK cycle;
- char otext[10];
- /* if nothing passed, set the first filter to the default device */
- if ((filter1 == e_invalid_space) &&
- (filter2 == e_invalid_space) &&
- (filter3 == e_invalid_space) &&
- (filter4 == e_invalid_space) &&
- (filter5 == e_invalid_space)) {
- filter1 = default_memspace;
- }
-
- /* determine the actual maximum records to go through */
- if (count < 1) {
- count = cpuhistory_show_lines;
- } else if (count > cpuhistory_buffer_lines) {
- count = cpuhistory_buffer_lines;
- }
-
/* 'i' is the actual counter */
i = 0;
/* start looking at last entry */
pos = cpuhistory_i;
+ if (count >= cpuhistory_buffer_lines) {
+ count = cpuhistory_buffer_lines - 1;
+ }
+
/* find out where we need to start */
while (i < count) {
/* make sure the record matches */
@@ -234,51 +198,94 @@
/* this is totally possible since the emulation runs each CPU in
chunks and eventually syncs up. Syncing is more aggressive
when talking between devices. */
- if (pos == cpuhistory_i) {
+ if (pos == (cpuhistory_i + 1) % cpuhistory_buffer_lines) {
break;
}
}
+ return &cpuhistory[pos];
+}
+
+cpuhistory_t *mon_cpuhistory_next(cpuhistory_t *current, MEMSPACE filter1, MEMSPACE filter2,
+ MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5) {
+ cpuhistory_t *wrap = &cpuhistory[cpuhistory_buffer_lines];
+ cpuhistory_t *head = &cpuhistory[(cpuhistory_i + 1) % cpuhistory_buffer_lines];
+ do {
+ current += 1;
+ if (current >= wrap) {
+ current = &cpuhistory[0];
+ } else if (current == head) {
+ return NULL;
+ }
+ /* make sure the record matches */
+ } while (!((current->origin != e_invalid_space)
+ && ((filter1 == current->origin)
+ || (filter2 == current->origin)
+ || (filter3 == current->origin)
+ || (filter4 == current->origin)
+ || (filter5 == current->origin))));
+
+ return current;
+}
+
+void mon_cpuhistory(int count, MEMSPACE filter1, MEMSPACE filter2, MEMSPACE filter3,
+ MEMSPACE filter4, MEMSPACE filter5)
+{
+ uint8_t op, p1, p2, p3 = 0;
+ MEMSPACE mem;
+ uint16_t loc, addr;
+ int hex_mode = 1;
+ const char *dis_inst;
+ cpuhistory_t *current;
+ unsigned opc_size;
+ CLOCK cycle;
+ char otext[10];
+
+ /* if nothing passed, set the first filter to the default device */
+ if ((filter1 == e_invalid_space) &&
+ (filter2 == e_invalid_space) &&
+ (filter3 == e_invalid_space) &&
+ (filter4 == e_invalid_space) &&
+ (filter5 == e_invalid_space)) {
+ filter1 = default_memspace;
+ }
+
+ /* determine the actual maximum records to go through */
+ if (count < 1) {
+ count = cpuhistory_show_lines;
+ }
+
+ current = mon_cpuhistory_seek(count, filter1, filter2, filter3, filter4, filter5);
+
/* loop through all entries until we find the number records requested */
- while (i > 0) {
- /* adjust our buffer circular reference */
- pos = ( pos + 1) % cpuhistory_buffer_lines;
- /* make sure the record matches */
- if ((cpuhistory[pos].origin != e_invalid_space)
- && ((filter1 == cpuhistory[pos].origin)
- || (filter2 == cpuhistory[pos].origin)
- || (filter3 == cpuhistory[pos].origin)
- || (filter4 == cpuhistory[pos].origin)
- || (filter5 == cpuhistory[pos].origin))) {
- cycle = cpuhistory[pos].cycle;
- addr = cpuhistory[pos].addr;
- op = cpuhistory[pos].op;
- p1 = cpuhistory[pos].p1;
- p2 = cpuhistory[pos].p2;
+ while ((current = mon_cpuhistory_next(current, filter1, filter2, filter3, filter4, filter5))) {
+ cycle = current->cycle;
+ addr = current->addr;
+ op = current->op;
+ p1 = current->p1;
+ p2 = current->p2;
- mem = cpuhistory[pos].origin;
- loc = addr_location(addr);
+ mem = current->origin;
+ loc = addr_location(addr);
- dis_inst = mon_disassemble_to_string_ex(mem, loc, op, p1, p2, p3, hex_mode, &opc_size);
+ dis_inst = mon_disassemble_to_string_ex(mem, loc, op, p1, p2, p3, hex_mode, &opc_size);
- strncpy(otext, mon_memspace_string[mem], 4);
+ strncpy(otext, mon_memspace_string[mem], 4);
- /* Print the disassembled instruction */
- mon_out(".%s:%04x %-26s A:%02x X:%02x Y:%02x SP:%02x %c%c-%c%c%c%c%c %12"PRIu64"\n",
- otext, loc, dis_inst,
- cpuhistory[pos].reg_a, cpuhistory[pos].reg_x,
- cpuhistory[pos].reg_y, cpuhistory[pos].reg_sp,
- ((cpuhistory[pos].reg_st & (1 << 7)) != 0) ? 'N' : '.',
- ((cpuhistory[pos].reg_st & (1 << 6)) != 0) ? 'V' : '.',
- ((cpuhistory[pos].reg_st & (1 << 4)) != 0) ? 'B' : '.',
- ((cpuhistory[pos].reg_st & (1 << 3)) != 0) ? 'D' : '.',
- ((cpuhistory[pos].reg_st & (1 << 2)) != 0) ? 'I' : '.',
- ((cpuhistory[pos].reg_st & (1 << 1)) != 0) ? 'Z' : '.',
- ((cpuhistory[pos].reg_st & (1 << 0)) != 0) ? 'C' : '.',
- cycle
- );
- i--;
- }
+ /* Print the disassembled instruction */
+ mon_out(".%s:%04x %-26s A:%02x X:%02x Y:%02x SP:%02x %c%c-%c%c%c%c%c %12"PRIu64"\n",
+ otext, loc, dis_inst,
+ current->reg_a, current->reg_x,
+ current->reg_y, current->reg_sp,
+ ((current->reg_st & (1 << 7)) != 0) ? 'N' : '.',
+ ((current->reg_st & (1 << 6)) != 0) ? 'V' : '.',
+ ((current->reg_st & (1 << 4)) != 0) ? 'B' : '.',
+ ((current->reg_st & (1 << 3)) != 0) ? 'D' : '.',
+ ((current->reg_st & (1 << 2)) != 0) ? 'I' : '.',
+ ((current->reg_st & (1 << 1)) != 0) ? 'Z' : '.',
+ ((current->reg_st & (1 << 0)) != 0) ? 'C' : '.',
+ cycle
+ );
}
}
Modified: branches/compyx/joymap-001/vice/src/monitor/mon_memmap.h
===================================================================
--- branches/compyx/joymap-001/vice/src/monitor/mon_memmap.h 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/monitor/mon_memmap.h 2025-03-25 14:14:52 UTC (rev 45581)
@@ -30,6 +30,21 @@
#include "montypes.h"
#include "types.h"
+struct cpuhistory_s {
+ CLOCK cycle;
+ uint16_t addr;
+ uint16_t reg_st;
+ uint8_t op;
+ uint8_t p1;
+ uint8_t p2;
+ uint8_t reg_a;
+ uint8_t reg_x;
+ uint8_t reg_y;
+ uint8_t reg_sp;
+ MEMSPACE origin;
+};
+typedef struct cpuhistory_s cpuhistory_t;
+
void mon_memmap_init(void);
void mon_memmap_shutdown(void);
@@ -36,9 +51,14 @@
int monitor_cpuhistory_allocate(int lines);
void mon_cpuhistory(int count, MEMSPACE filter1, MEMSPACE filter2, MEMSPACE filter3,
MEMSPACE filter4, MEMSPACE filter5);
+cpuhistory_t *mon_cpuhistory_seek(int count, MEMSPACE filter1, MEMSPACE filter2,
+ MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5);
+cpuhistory_t *mon_cpuhistory_next(cpuhistory_t *current, MEMSPACE filter1, MEMSPACE filter2,
+ MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5);
void mon_memmap_zap(void);
void mon_memmap_show(int mask, MON_ADDR start_addr, MON_ADDR end_addr);
void mon_memmap_save(const char* filename, int format);
+
#endif
Modified: branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c
===================================================================
--- branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c 2025-03-25 09:08:38 UTC (rev 45580)
+++ branches/compyx/joymap-001/vice/src/monitor/monitor_binary.c 2025-03-25 14:14:52 UTC (rev 45581)
@@ -52,6 +52,7 @@
#include "machine-video.h"
#include "palette.h"
+#include "mon_memmap.h"
#include "mon_breakpoint.h"
#include "mon_file.h"
#include "mon_register.h"
@@ -110,6 +111,7 @@
e_MON_CMD_REGISTERS_AVAILABLE = 0x83,
e_MON_CMD_DISPLAY_GET = 0x84,
e_MON_CMD_VICE_INFO = 0x85,
+ e_MON_CMD_CPUHISTORY_GET = 0x86,
e_MON_CMD_PALETTE_GET = 0x91,
@@ -158,6 +160,7 @@
e_MON_RESPONSE_REGISTERS_AVAILABLE = 0x83,
e_MON_RESPONSE_DISPLAY_GET = 0x84,
e_MON_RESPONSE_VICE_INFO = 0x85,
+ e_MON_RESPONSE_CPUHISTORY_GET = 0x86,
e_MON_RESPONSE_PALETTE_GET = 0x91,
@@ -306,6 +309,15 @@
return output + 4;
}
+/*! \internal \brief Write uint64 to buffer and return pointer to byte after */
+static unsigned char *write_uint64(uint64_t input, unsigned char *output) {
+ for (int i = 0 ; i < 8 ; i++) {
+ output[i] = (uint8_t)(input >> (8 * i)) & 0xFFu;
+ }
+
+ return output + 8;
+}
+
/*! \internal \brief Write string to buffer and return pointer to byte after */
static unsigned char *write_string(uint8_t length, unsigned char *input, unsigned char *output) {
output[0] = length;
@@ -416,47 +428,58 @@
}
}
-static void monitor_binary_response_register_info(uint32_t request_id, MEMSPACE memspace)
-{
- mon_reg_list_t *regs;
- mon_reg_list_t *regs_cursor;
- unsigned char *response;
- unsigned char *response_cursor;
- uint32_t response_size = 2;
+#define MON_REGISTER_ITEM_SIZE 3
+
+static uint16_t count_registers(mon_reg_list_t *regs) {
uint16_t count = 0;
- uint8_t item_size = 3;
- regs = mon_register_list_get(memspace);
- regs_cursor = regs;
-
- for( ; regs_cursor->name ; regs_cursor++) {
- if (!ignore_fake_register(regs_cursor)) {
+ for( ; regs->name ; regs++) {
+ if (!ignore_fake_register(regs)) {
++count;
}
}
- response_size += count * (item_size + 1);
- response = lib_malloc(response_size);
- response_cursor = response;
+ return count;
+}
- regs_cursor = regs;
-
+static unsigned char *write_registers(mon_reg_list_t *regs, uint16_t count, unsigned char *response_cursor) {
response_cursor = write_uint16(count, response_cursor);
- for( ; regs_cursor->name ; regs_cursor++) {
- if (ignore_fake_register(regs_cursor)) {
+ for( ; regs->name ; regs++) {
+ if (ignore_fake_register(regs)) {
continue;
}
- *response_cursor = item_size;
+ *response_cursor = MON_REGISTER_ITEM_SIZE;
++response_cursor;
- *response_cursor = regs_cursor->id;
+ *response_cursor = regs->id;
++response_cursor;
- response_cursor = write_uint16((uint16_t)regs_cursor->val, response_cursor);
+ response_cursor = write_uint16((uint16_t)regs->val, response_cursor);
}
+ return response_cursor;
+}
+
+static void monitor_binary_response_register_info(uint32_t request_id, MEMSPACE memspace)
+{
+ mon_reg_list_t *regs;
+ unsigned char *response;
+ unsigned char *response_cursor;
+ uint16_t count;
+ uint32_t response_size = 2;
+
+ regs = mon_register_list_get(memspace);
+
+ count = count_registers(regs);
+
+ response_size += count * (MON_REGISTER_ITEM_SIZE + 1);
+ response = lib_malloc(response_size);
+ response_cursor = response;
+
+ response_cursor = write_registers(regs, count, response_cursor);
+
monitor_binary_response(response_size, e_MON_RESPONSE_REGISTER_INFO, e_MON_ERR_OK, request_id, response);
lib_free(response);
@@ -782,7 +805,7 @@
if(memspace == e_invalid_space) {
monitor_binary_error(e_MON_ERR_INVALID_MEMSPACE, command->request_id);
- log_message(LOG_DEFAULT, "monitor binary memset: Unknown memspace %u", requested_memspace);
+ log_message(LOG_DEFAULT, "monitor binary registers get: Unknown memspace %u", requested_memspace);
return;
}
@@ -1413,6 +1436,177 @@
monitor_binary_response(sizeof(response), e_MON_RESPONSE_VICE_INFO, e_MON_ERR_OK, command->request_id, response);
}
+#ifdef FEATURE_CPUMEMHISTORY
+static void monitor_binary_process_cpuhistory(binary_command_t *command)
+{
+ mon_reg_list_t *regs;
+ mon_reg_list_t *templates;
+ mon_reg_list_t *reg_a = NULL;
+ mon_reg_list_t *reg_x = NULL;
+ mon_reg_list_t *reg_y = NULL;
+ mon_reg_list_t *reg_sp = NULL;
+ mon_reg_list_t *reg_flags = NULL;
+ mon_reg_list_t *reg_pc = NULL;
+ mon_reg_list_t *reg_lin = NULL;
+ mon_reg_list_t *reg_cyc = NULL;
+ int i, j;
+ int registers_per_row = 8;
+ unsigned char *response;
+ unsigned char *response_cursor;
+ uint8_t instruction_length = 4;
+ uint16_t requested_count, count = 0;
+ uint32_t response_size;
+ int item_size = 2 + registers_per_row * (MON_REGISTER_ITEM_SIZE + 1) + 8 + 1 + instruction_length;
+
+ cpuhistory_t *current;
+
+ uint8_t requested_memspace = command->body[0];
+
+ MEMSPACE memspace;
+ if (command->length < 5) {
+ monitor_binary_error(e_MON_ERR_CMD_INVALID_LENGTH, command->request_id);
+ return;
+ }
+
+ memspace = get_requested_memspace(requested_memspace);
+
+ if (memspace == e_invalid_space) {
+ monitor_binary_error(e_MON_ERR_INVALID_MEMSPACE, command->request_id);
+ log_message(LOG_DEFAULT, "monitor binary cpuhistory: Unknown memspace %u", requested_memspace);
+ return;
+ }
+
+ requested_count = little_endian_to_uint32(&command->body[1]);
+
+ if (req...
[truncated message content] |
|
From: <co...@us...> - 2025-03-25 09:08:45
|
Revision: 45580
http://sourceforge.net/p/vice-emu/code/45580
Author: compyx
Date: 2025-03-25 09:08:38 +0000 (Tue, 25 Mar 2025)
Log Message:
-----------
Joystick: add optional `customize()` callback to customize default mapping/calibration
Add driver method `customize()` that is called after `joystick_device_register()`
has run the default mapper and set up default calibration. This allows drivers
to tweak mappings and calibrations if required, while keeping any device- or
OS-specific logic out of the common code.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
branches/compyx/joymap-001/vice/src/joyport/joystick.c
branches/compyx/joymap-001/vice/src/joyport/joystick.h
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-24 13:56:34 UTC (rev 45579)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-25 09:08:38 UTC (rev 45580)
@@ -353,6 +353,8 @@
}
+static void linux_joystick_customize(joystick_device_t *joydev);
+
/** \brief Object used to register driver for devices
*
* The address of this object is used in the joystick code, it isn't copied,
@@ -359,10 +361,11 @@
* so we cannot move this into `linux_joystick_init()` to use for registration.
*/
static joystick_driver_t driver = {
- .open = linux_joystick_evdev_open,
- .poll = linux_joystick_evdev_poll,
- .close = linux_joystick_evdev_close,
- .priv_free = joy_priv_free
+ .open = linux_joystick_evdev_open,
+ .poll = linux_joystick_evdev_poll,
+ .close = linux_joystick_evdev_close,
+ .priv_free = joy_priv_free,
+ .customize = linux_joystick_customize
};
@@ -417,3 +420,16 @@
}
free(namelist);
}
+
+
+/** \brief Custom mapping/calibration callback
+ *
+ * Just for debugging/testing right now.
+ *
+ * \param[in] joydev joystick device
+ */
+static void linux_joystick_customize(joystick_device_t *joydev)
+{
+ printf("%s() called for device %04x:%04x\n",
+ __func__, (unsigned int)joydev->vendor, (unsigned int)joydev->product);
+}
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 13:56:34 UTC (rev 45579)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-25 09:08:38 UTC (rev 45580)
@@ -3621,6 +3621,10 @@
/* Now we can try to apply a default mapping */
joystick_device_apply_default_mapping(joydev);
+ /* Call custom mapping/calibration function if defined */
+ if (joy_driver.customize != NULL) {
+ joy_driver.customize(joydev);
+ }
joystick_devices[num_joystick_devices] = joydev;
joystick_devices[++num_joystick_devices] = NULL;
@@ -4033,3 +4037,64 @@
}
return NULL;
}
+
+
+/** \brief Clear axis mappings
+ *
+ * \param[in] axis joystick axis
+ */
+void joystick_axis_clear_mappings(joystick_axis_t *axis)
+{
+ joystick_mapping_init(&axis->mapping.negative);
+ joystick_mapping_init(&axis->mapping.positive);
+ axis->mapping.pot = 0;
+}
+
+
+/** \brief Clear button mapping
+ *
+ * \param[in] button joystick button
+ *
+ * \note Using plural "mappings" in the name to be consistent with the
+ * axis and hat functions.
+ */
+void joystick_button_clear_mappings(joystick_button_t *button)
+{
+ joystick_mapping_init(&button->mapping);
+}
+
+
+/** \brief Clear hat mappings
+ *
+ * \param[in] hat joystick hat
+ */
+void joystick_hat_clear_mappings(joystick_hat_t *hat)
+{
+ joystick_mapping_init(&hat->mapping.up);
+ joystick_mapping_init(&hat->mapping.down);
+ joystick_mapping_init(&hat->mapping.left);
+ joystick_mapping_init(&hat->mapping.right);
+}
+
+
+/** \brief Clear all mappings assigned to a joystick device
+ *
+ * Clear all axis, button and hats mappings of \a joydev.
+ *
+ * \param[in] joydev joystick device
+ */
+void joystick_device_clear_mappings(joystick_device_t *joydev)
+{
+ int i;
+
+ for (i = 0; i < joydev->num_axes; i++) {
+ joystick_axis_clear_mappings(joydev->axes[i]);
+ }
+ for (i = 0; i < joydev->num_buttons; i++) {
+ joystick_button_clear_mappings(joydev->buttons[i]);
+ }
+ for (i = 0; i < joydev->num_hats; i++) {
+ joystick_hat_clear_mappings(joydev->hats[i]);
+ }
+
+}
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 13:56:34 UTC (rev 45579)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-25 09:08:38 UTC (rev 45580)
@@ -331,6 +331,15 @@
/** \brief Optional method to free arch-specific device data */
void (*priv_free)(void *);
+
+ /** \brief Function to call after registering a device
+ *
+ * This function is called after #joystick_device_register has processed
+ * its argument. It can be used to customize mappings or calibration if so
+ * required.
+ */
+ void (*customize)(joystick_device_t *);
+
} joystick_driver_t;
@@ -428,6 +437,7 @@
joystick_button_t *button);
void joystick_device_add_hat (joystick_device_t *joydev,
joystick_hat_t *hat);
+void joystick_device_clear_mappings(joystick_device_t *joydev);
void joystick_mapping_init (joystick_mapping_t *mapping);
void joystick_calibration_init (joystick_calibration_t *calibration);
@@ -436,15 +446,18 @@
joystick_axis_t *joystick_axis_from_code (joystick_device_t *joydev,
uint32_t code);
void joystick_axis_free (joystick_axis_t *axis);
+void joystick_axis_clear_mappings(joystick_axis_t *axis);
joystick_button_t *joystick_button_new (const char *name);
joystick_button_t *joystick_button_from_code (joystick_device_t *joydev,
uint32_t code);
void joystick_button_free (joystick_button_t *button);
+void joystick_button_clear_mappings(joystick_button_t *button);
joystick_hat_t *joystick_hat_new (const char *name);
joystick_hat_t *joystick_hat_from_code (joystick_device_t *joydev,
uint32_t code);
void joystick_hat_free (joystick_hat_t *hat);
+void joystick_hat_clear_mappings(joystick_hat_t *hat);
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-24 13:56:37
|
Revision: 45579
http://sourceforge.net/p/vice-emu/code/45579
Author: compyx
Date: 2025-03-24 13:56:34 +0000 (Mon, 24 Mar 2025)
Log Message:
-----------
Joystick: make SDL use raw axis values for `joy_axis_event()`
Also make sure to initialize pot mapping of axes to 0 (unassigned).
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/sdl/joy.c
branches/compyx/joymap-001/vice/src/joyport/joystick.c
branches/compyx/joymap-001/vice/src/joyport/joystick.h
Modified: branches/compyx/joymap-001/vice/src/arch/sdl/joy.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-24 09:51:03 UTC (rev 45578)
+++ branches/compyx/joymap-001/vice/src/arch/sdl/joy.c 2025-03-24 13:56:34 UTC (rev 45579)
@@ -683,13 +683,12 @@
{
joystick_device_t *joydev = joystick_device_by_index(joynum);
joystick_axis_t *axis = joydev->axes[axisnum];
- joystick_axis_value_t cur, prev;
-
+#if 0
prev = joy_axis_prev(joynum, axisnum);
cur = sdljoy_axis_direction(value, prev);
-
- joy_axis_event(joydev, axis, cur);
+#endif
+ joy_axis_event(joydev, axis, value);
}
static ui_menu_action_t sdljoy_perform_event_for_menu_action(joystick_mapping_t* event, Sint16 value)
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 09:51:03 UTC (rev 45578)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 13:56:34 UTC (rev 45579)
@@ -857,7 +857,7 @@
joystick_axis_t *axis = joydev->axes[axis_idx];
if ((joydev->joyport == 0 || joydev->joyport == 1) && (axis->mapping.pot > 0)) {
- joystick_axis_value[joydev->joyport][axis->mapping.pot- 1] = value;
+ joystick_axis_value[joydev->joyport][axis->mapping.pot - 1] = value;
}
}
}
@@ -3066,11 +3066,11 @@
}
}
#endif
- if (pressed != button->prev) {
+ if (value != button->prev) {
DBG(("joy_button_event: joy: %s, button: %d (%s) pressed: %d\n",
joydev->name, button->index, button->name, pressed));
joy_perform_event(&button->mapping, joydev->joyport, pressed);
- button->prev = pressed;
+ button->prev = value;
}
}
@@ -3119,7 +3119,7 @@
}
#ifdef HAVE_SDL_NUMJOYSTICKS
-joystick_axis_value_t joy_axis_prev(uint8_t joynum, uint8_t axis)
+int32_t joy_axis_prev(uint8_t joynum, uint8_t axis)
{
return joystick_devices[joynum]->axes[axis]->prev;
}
@@ -3736,6 +3736,7 @@
axis->digital = false;
joystick_mapping_init(&axis->mapping.negative);
joystick_mapping_init(&axis->mapping.positive);
+ axis->mapping.pot = 0; /* no POT mapped */
joystick_calibration_init(&axis->calibration);
}
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 09:51:03 UTC (rev 45578)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 13:56:34 UTC (rev 45579)
@@ -217,7 +217,7 @@
struct {
joystick_mapping_t negative; /**< negative direction */
joystick_mapping_t positive; /**< positive direction */
- unsigned int pot; /**< pot index (0 or 1) */
+ unsigned int pot; /**< pot number (1 or 2, 0 means unmapped) */
} mapping; /**< mapping for negative and positive directions, and
pot. TODO: support pot values other than on/off so
emulated paddles and mice can be mapped to axes. */
@@ -342,12 +342,13 @@
int joy_sdl_init(void);
int joy_sdl_resources_init(void);
int joy_sdl_cmdline_options_init(void);
+void joystick_set_axis_value(unsigned int index, unsigned int axis, uint8_t value);
+
int joystick_check_set(signed long key, int keysetnum, unsigned int joyport);
int joystick_check_clr(signed long key, int keysetnum, unsigned int joyport);
void joystick_joypad_clear(void);
-void joystick_set_axis_value(unsigned int index, unsigned int axis, uint8_t value);
uint8_t joystick_get_axis_value(unsigned int port, unsigned int pot);
void joystick_set_value_absolute(unsigned int joyport, uint16_t value);
@@ -391,7 +392,9 @@
const char *joystick_ui_get_next_device_name(int *id);
int joy_arch_mapping_dump(const char *filename);
int joy_arch_mapping_load(const char *filename);
-joystick_axis_value_t joy_axis_prev(uint8_t joynum, uint8_t axis);
+
+int32_t joy_axis_prev(uint8_t joynum, uint8_t axis);
+
char *get_joy_pot_mapping_string(int joystick_device_num, int pot);
char *get_joy_pin_mapping_string(int joystick_device, int pin);
char *get_joy_extra_mapping_string(int which);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-24 09:51:10
|
Revision: 45578
http://sourceforge.net/p/vice-emu/code/45578
Author: compyx
Date: 2025-03-24 09:51:03 +0000 (Mon, 24 Mar 2025)
Log Message:
-----------
Joystick: update BSD driver to pass raw values to `joy_axis_event()`
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-24 07:25:18 UTC (rev 45577)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-24 09:51:03 UTC (rev 45578)
@@ -197,23 +197,12 @@
/* axis */
axis = joystick_axis_from_code(joydev, (uint32_t)usage);
if (axis != NULL) {
- joystick_axis_value_t direction = JOY_AXIS_MIDDLE;
- int32_t range = axis->maximum - axis->minimum;
-#if 0
- printf("%s(): AXIS: index = %d, usage = %d, value = %d\n",
- __func__, index, usage, value);
-#endif
/* XXX: On my Logitech F710 the Y axis is inverted by
* FreeBSD, NetBSD just reports insane values.
* So for FreeBSD we'd need calibration to be
* implemented for the F710 to work.
*/
- if (value <= (axis->minimum + (range / 4))) {
- direction = JOY_AXIS_NEGATIVE;
- } else if (value >= (axis->maximum - (range / 4))) {
- direction = JOY_AXIS_POSITIVE;
- }
- joy_axis_event(joydev, axis, direction);
+ joy_axis_event(joydev, axis, (int32_t)value);
}
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-24 07:25:26
|
Revision: 45577
http://sourceforge.net/p/vice-emu/code/45577
Author: compyx
Date: 2025-03-24 07:25:18 +0000 (Mon, 24 Mar 2025)
Log Message:
-----------
Joystick: update DirectInput driver to pass raw axis values
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-24 07:05:56 UTC (rev 45576)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-24 07:25:18 UTC (rev 45577)
@@ -187,25 +187,12 @@
LONG prev = priv->prev_axes[i];
if (code < sizeof axis_map / sizeof axis_map[0]) {
- int32_t minimum = axis->minimum;
- int32_t maximum = axis->maximum;
- int32_t range = maximum - minimum;
- int32_t value = *(axis_map[code]);
+ LONG value = *(axis_map[code]);
- if (value == prev) {
- continue;
+ if (value != prev) {
+ priv->prev_axes[i] = value;
+ joy_axis_event(joydev, axis, (int32_t)value);
}
- priv->prev_axes[i] = value;
-
- //printf("axis %d raw value = %d\n", i, value);
-
- if (value <= minimum + (range / 4)) {
- joy_axis_event(joydev, axis, JOY_AXIS_NEGATIVE);
- } else if (value >= maximum - (range / 4)) {
- joy_axis_event(joydev, axis, JOY_AXIS_POSITIVE);
- } else {
- joy_axis_event(joydev, axis, JOY_AXIS_MIDDLE);
- }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-24 07:06:09
|
Revision: 45576
http://sourceforge.net/p/vice-emu/code/45576
Author: compyx
Date: 2025-03-24 07:05:56 +0000 (Mon, 24 Mar 2025)
Log Message:
-----------
Joystick: make `joy_axis_event()` accept raw values
Drivers can pass their raw axis values to `joy_axis_event()`, interpretation of
the value is done in common code by applying calibration (thresholds) and then
determining direction of axis. Linux evdev has been updated. SDL, Win32 and BSD
will follow shortly.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
branches/compyx/joymap-001/vice/src/joyport/joystick.c
branches/compyx/joymap-001/vice/src/joyport/joystick.h
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-24 06:45:21 UTC (rev 45575)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-03-24 07:05:56 UTC (rev 45576)
@@ -157,24 +157,7 @@
#endif
axis = joystick_axis_from_code(joydev, event->code);
if (axis != NULL) {
- int32_t minimum = axis->minimum;
- int32_t maximum = axis->maximum;
- int32_t range = maximum - minimum;
- joystick_axis_value_t direction = JOY_AXIS_MIDDLE;
-
- /* ABS_HAT[0-3]XY axes return -1, 0 or 1: */
- if (minimum == -1 && maximum == 1) {
- if (event->value < 0) {
- direction = JOY_AXIS_NEGATIVE;
- } else if (event->value > 0) {
- direction = JOY_AXIS_POSITIVE;
- }
- } else if (event->value < (minimum + (range / 4))) {
- direction = JOY_AXIS_NEGATIVE;
- } else if (event->value > (maximum - (range / 4))) {
- direction = JOY_AXIS_POSITIVE;
- }
- joy_axis_event(joydev, axis, direction);
+ joy_axis_event(joydev, axis, event->value);
}
}
}
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 06:45:21 UTC (rev 45575)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 07:05:56 UTC (rev 45576)
@@ -2999,17 +2999,35 @@
void joy_axis_event(joystick_device_t *joydev,
joystick_axis_t *axis,
- joystick_axis_value_t value)
+ int32_t value)
{
- joystick_axis_value_t prev = axis->prev;
- int joyport = joydev->joyport;
+ joystick_axis_value_t direction = JOY_AXIS_MIDDLE;
+ joystick_axis_value_t prev = axis->prev;
+ int joyport = joydev->joyport;
- if (value == prev) {
+
+ /* digital axes don't require calibration: */
+ if (axis->digital) {
+ if (value < 0) {
+ direction = JOY_AXIS_NEGATIVE;
+ } else if (value > 0) {
+ direction = JOY_AXIS_POSITIVE;
+ }
+ } else {
+ /* here we apply calibration */
+ if (value <= axis->calibration.threshold.negative) {
+ direction = JOY_AXIS_NEGATIVE;
+ } else if (value >= axis->calibration.threshold.positive) {
+ direction = JOY_AXIS_POSITIVE;
+ }
+ }
+
+ if (direction == prev) {
return;
}
- DBG(("joy_axis_event: joy: %s axis: %d value: %d prev: %u\n",
- joydev->name, axis->index, value, prev));
+ DBG(("joy_axis_event: joy: %s axis: %d value: %d: direction: %d prev: %d\n",
+ joydev->name, axis->index, value, direction, prev));
/* release directions first if needed */
if (prev == JOY_AXIS_POSITIVE) {
@@ -3020,14 +3038,14 @@
}
/* press new direction if needed */
- if (value == JOY_AXIS_POSITIVE) {
+ if (direction == JOY_AXIS_POSITIVE) {
joy_perform_event(&axis->mapping.positive, joyport, 1);
}
- if (value == JOY_AXIS_NEGATIVE) {
+ if (direction == JOY_AXIS_NEGATIVE) {
joy_perform_event(&axis->mapping.negative, joyport, 1);
}
- axis->prev = value;
+ axis->prev = direction;
}
void joy_button_event(joystick_device_t *joydev,
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 06:45:21 UTC (rev 45575)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 07:05:56 UTC (rev 45576)
@@ -179,7 +179,8 @@
*/
typedef struct joystick_calibration_s {
bool invert; /**< invert value */
- struct {
+ struct
+ {
int32_t negative; /**< axis threshold: V <= T: active input */
int32_t positive; /**< axis threshold: V >= T: active input */
} threshold;
@@ -379,15 +380,9 @@
void joystick_set_snes_mapping(int port);
-/* TODO: Pass raw value to joy_axis_event(), let the joystick code figure out
- * what the axis value should be, based on limits and calibration data
- * inside the axis object.
- * Same for buttons and hats: let the joystick code decide what to do,
- * not the driver.
- */
-void joy_axis_event (joystick_device_t *joydev, joystick_axis_t *axis, joystick_axis_value_t value);
-void joy_button_event(joystick_device_t *joydev, joystick_button_t *button, int32_t value);
-void joy_hat_event (joystick_device_t *joydev, joystick_hat_t *hat, int32_t value);
+void joy_axis_event (joystick_device_t *joydev, joystick_axis_t *axis, int32_t value);
+void joy_button_event(joystick_device_t *joydev, joystick_button_t *button, int32_t value);
+void joy_hat_event (joystick_device_t *joydev, joystick_hat_t *hat, int32_t value);
void joystick(void);
void joystick_close(void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-24 06:45:23
|
Revision: 45575
http://sourceforge.net/p/vice-emu/code/45575
Author: compyx
Date: 2025-03-24 06:45:21 +0000 (Mon, 24 Mar 2025)
Log Message:
-----------
Joystick: add simple calibration data struct
Add `joystick_calibration_t` members to axes, buttons and hats. Right now just
containing an `invert` flag and thresholds for axes. When we decide to support
using axes for mice, paddles etc we can add deadzones.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/joyport/joystick.c
branches/compyx/joymap-001/vice/src/joyport/joystick.h
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.c
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-23 17:33:32 UTC (rev 45574)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.c 2025-03-24 06:45:21 UTC (rev 45575)
@@ -3658,6 +3658,45 @@
}
+/** \brief Initialize joystick host input calibration
+ *
+ * \param[in] calibration calibration for an input
+ */
+void joystick_calibration_init(joystick_calibration_t *calibration)
+{
+ calibration->invert = false;
+ calibration->threshold.negative = 0;
+ calibration->threshold.positive = 0;
+}
+
+
+/** \brief Apply default calibration parameters on an axis
+ *
+ * Set thresholds for \a axis just like the old drivers interpreted axis values.
+ * For an entire range (minimum to maximum) that would be 0-25%: negative,
+ * 25-75%: neutral, 75-100%: positive.
+ *
+ * \param[in] axis joystick axis
+ */
+static void joystick_calibration_default_for_axis(joystick_axis_t *axis)
+{
+ if (!axis->digital) {
+ int32_t range = axis->maximum - axis->minimum;
+
+ /* add one to get proper range, but only if the result fits */
+ if (range < INT32_MAX) {
+ range++;
+ }
+ /* default: 0-25% negative, 25-75% neutral, 75-100% positive */
+ axis->calibration.threshold.negative = axis->minimum + (range / 4);
+ axis->calibration.threshold.positive = axis->minimum + ((range / 4) * 3);
+ } else {
+ axis->calibration.threshold.negative = -1;
+ axis->calibration.threshold.positive = +1;
+ }
+}
+
+
/** \brief Initialize joystick axis
*
* Intialize \a axis to default values, including its \c positive and \c negative
@@ -3679,6 +3718,7 @@
axis->digital = false;
joystick_mapping_init(&axis->mapping.negative);
joystick_mapping_init(&axis->mapping.positive);
+ joystick_calibration_init(&axis->calibration);
}
/** \brief Initialize joystick button
@@ -3695,6 +3735,7 @@
button->prev = 0;
button->index = -1;
joystick_mapping_init(&button->mapping);
+ joystick_calibration_init(&button->calibration);
}
/** \brief Initialize joystick hat
@@ -3714,6 +3755,7 @@
joystick_mapping_init(&hat->mapping.down);
joystick_mapping_init(&hat->mapping.left);
joystick_mapping_init(&hat->mapping.right);
+ joystick_calibration_init(&hat->calibration);
}
@@ -3840,6 +3882,14 @@
joydev->axes = lib_realloc(joydev->axes,
sizeof *joydev->axes * (size_t)joydev->max_axes);
}
+
+ /* set default calibration */
+ joystick_calibration_default_for_axis(axis);
+ printf("AXIS %d: min: %d, N-threshold: %d, P-threshold: %d, max: %d\n",
+ joydev->num_axes,
+ axis->minimum, axis->calibration.threshold.negative,
+ axis->calibration.threshold.positive, axis->maximum);
+
joydev->axes[joydev->num_axes++] = axis;
}
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-23 17:33:32 UTC (rev 45574)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-24 06:45:21 UTC (rev 45575)
@@ -175,6 +175,15 @@
} value;
} joystick_mapping_t;
+/** \brief Calibration for a host input
+ */
+typedef struct joystick_calibration_s {
+ bool invert; /**< invert value */
+ struct {
+ int32_t negative; /**< axis threshold: V <= T: active input */
+ int32_t positive; /**< axis threshold: V >= T: active input */
+ } threshold;
+} joystick_calibration_t;
/** \brief Joystick button object
*
@@ -181,12 +190,12 @@
* Information on a host device button input.
*/
typedef struct joystick_button_s {
- uint32_t code; /**< event code */
- char *name; /**< button name */
- int32_t prev; /**< previous polled value */
- int32_t index; /**< index in buttons array */
- joystick_mapping_t mapping; /**< button mapping */
- /* TODO: add calibration data struct */
+ uint32_t code; /**< event code */
+ char *name; /**< button name */
+ int32_t prev; /**< previous polled value */
+ int32_t index; /**< index in buttons array */
+ joystick_mapping_t mapping; /**< button mapping */
+ joystick_calibration_t calibration; /**< button calibration */
} joystick_button_t;
@@ -212,7 +221,7 @@
pot. TODO: support pot values other than on/off so
emulated paddles and mice can be mapped to axes. */
- /* TODO: add calibration data */
+ joystick_calibration_t calibration; /**< axis calibration */
} joystick_axis_t;
@@ -232,6 +241,8 @@
joystick_mapping_t left; /**< mapping for 'left' direction */
joystick_mapping_t right; /**< mapping for 'right' direction */
} mapping; /**< mappings per direction */
+ joystick_calibration_t calibration; /* XXX: no idea if this makes sense
+ for hats */
} joystick_hat_t;
@@ -421,6 +432,7 @@
joystick_hat_t *hat);
void joystick_mapping_init (joystick_mapping_t *mapping);
+void joystick_calibration_init (joystick_calibration_t *calibration);
joystick_axis_t *joystick_axis_new (const char *name);
joystick_axis_t *joystick_axis_from_code (joystick_device_t *joydev,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-23 17:33:34
|
Revision: 45574
http://sourceforge.net/p/vice-emu/code/45574
Author: compyx
Date: 2025-03-23 17:33:32 +0000 (Sun, 23 Mar 2025)
Log Message:
-----------
Joystick: simplify BSD driver a lot
Get rid of custom insertion sort for axes, buttons and hats, the common code
takes care of sorting inputs. Get rid of custom event-code-to-[axis|button|hat]
functions: again implemented in common code.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-23 16:59:00 UTC (rev 45573)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-03-23 17:33:32 UTC (rev 45574)
@@ -92,139 +92,7 @@
int fd;
} joy_priv_t;
-/** \brief Function to free data in a input node list
- *
- * Function to call on the \c data member of an #input_node_t if #input_list_free()
- * is called with \c with_data set to <tt>true</tt>.
- * This typedef allows us to cast #joystick_axis_free(). #joystick_button_free()
- * and #joystick_hat_free() to the type expected by #input_list_init(), avoiding
- * wrapper functions.
- */
-typedef void (*data_free_t)(void*);
-/** \brief Node in an ordered linked list of inputs
- */
-typedef struct input_node_s {
- struct input_node_s *next; /**< next node */
- void *data; /**< data (axis/button/hat object pointer) */
-} input_node_t;
-
-/** \brief Ordered list of inputs
- */
-typedef struct input_list_s {
- /** \brief Head node */
- input_node_t *head;
-
- /** \brief Function to call to free the data of a node
- *
- * This function is called on the \c data member of a node if #input_list_free()
- * is called with its \c with_data argument set to <tt>true</tt>. This
- * allows cleaning up the list and its data when an error occurs during
- * scanning.
- */
- void (*data_free)(void *);
-
- /** \brief Comparison function for ordered insertion
- *
- * Return 0 when the codes of both arguments are equal, return < 0 when
- * \c arg1->code < \c arg2->code, return > 0 when \c arg1->code
- * > \c arg2->code.
- */
- int (*data_comp)(const void *, const void *);
-} input_list_t;
-
-
-/** \brief Initialize ordered input list
- *
- * \param[in] list input list
- * \param[in] data_free function to free the \c data member of the list nodes
- * \param[in] data_comp function to compare two \c data members
- */
-static void input_list_init(input_list_t *list,
- void (*data_free)(void *),
- int (*data_comp)(const void *, const void *))
-{
- list->head = NULL;
- list->data_free = data_free;
- list->data_comp = data_comp;
-}
-
-/** \brief Free input list
- *
- * Free input list node and optionally free each node's \c data member.
- *
- * \param[in] list input list
- * \param[in] with_data also free the \c data member of each node
- */
-static void input_list_free(input_list_t *list, bool with_data)
-{
- input_node_t *node = list->head;
- while (node != NULL) {
- input_node_t *next = node->next;
- if (with_data) {
- list->data_free(node->data);
- }
- lib_free(node);
- node = next;
- }
- list->head = NULL;
-}
-
-/** \brief Insert data into input list in-order
- *
- * Insert \a data into \a list, using the \c data_comp function specified in
- * #input_list_init() to determine its location in the list.
- *
- * \param[in] list input list
- * \param[in] data input object to insert into \a list
- *
- * \return <tt>true</tt> on success, <tt>false</tt> if an input with the same
- * code is already present (which should not happen)
- */
-static bool input_list_insert(input_list_t *list, void *data)
-{
- input_node_t *node = lib_malloc(sizeof *node);
-
- node->next = NULL;
- node->data = data;
-
- if (list->head == NULL) {
- list->head = node;
- return true;
- } else {
- input_node_t *curr = list->head;
- input_node_t *prev = NULL;
-
- while (curr != NULL) {
- int cmp = list->data_comp(node->data, curr->data);
-
- if (cmp == 0) {
- /* error: duplicate code */
- return false;
- } else if (cmp < 0) {
- /* insert before curr */
- if (prev == NULL) {
- /* no previous items */
- node->next = curr;
- list->head = node;
- } else {
- prev->next = node;
- node->next = curr;
- }
- return true;
- } else {
- /* keep going */
- prev = curr;
- curr = curr->next;
- }
- }
- /* append to tail of list */
- prev->next = node;
- return true;
- }
-}
-
-
/* Forward declarations */
static bool bsd_joy_open (joystick_device_t *joydev);
static void bsd_joy_poll (joystick_device_t *joydev);
@@ -235,16 +103,6 @@
/** \brief Log for BSD joystick driver */
static log_t bsd_joy_log;
-/** \brief Temporary ordered list of axes */
-static input_list_t axis_list;
-
-/** \brief Temporary ordered list of buttons */
-static input_list_t button_list;
-
-/** \brief Temporary ordered list of hats */
-static input_list_t hat_list;
-
-
/** \brief BSD joystick driver declaration */
static joystick_driver_t driver = {
.open = bsd_joy_open,
@@ -297,56 +155,11 @@
}
}
-
static bool bsd_joy_open (joystick_device_t *joydev)
{
return true; /* NOP */
}
-
-static int joy_axis_index(joystick_device_t *joydev, uint32_t code)
-{
- int i;
-
- for (i = 0; i < joydev->num_axes; i++) {
- if (joydev->axes[i]->code == code) {
- return i;
- } else if (joydev->axes[i]->code > code) {
- return -1;
- }
- }
- return -1;
-}
-
-static int joy_button_index(joystick_device_t *joydev, uint32_t code)
-{
- int i;
-
- for (i = 0; i < joydev->num_buttons; i++) {
- if (joydev->buttons[i]->code == code) {
- return i;
- } else if (joydev->buttons[i]->code > code) {
- return -1;
- }
- }
- return -1;
-}
-
-static int joy_hat_index(joystick_device_t *joydev, uint32_t code)
-{
- int i;
-
- for (i = 0; i < joydev->num_hats; i++) {
- if (joydev->hats[i]->code == code) {
- return i;
- } else if (joydev->hats[i]->code > code) {
- return -1;
- }
- }
- return -1;
-}
-
-
static void bsd_joy_poll(joystick_device_t *joydev)
{
joy_priv_t *priv = joydev->priv;
@@ -357,7 +170,6 @@
while ((rsize = read(priv->fd, priv->buffer, (size_t)priv->rep_size)) == priv->rep_size) {
struct hid_data *data;
struct hid_item item;
- int index;
data = hid_start_parse(priv->rep_desc, 1 << hid_input, priv->rep_id);
if (data == NULL) {
@@ -364,11 +176,13 @@
return;
}
-
while (hid_get_item(data, &item) > 0) {
- int value = hid_get_data(priv->buffer, &item);
- int usage = HID_USAGE(item.usage);
- unsigned int page = HID_PAGE(item.usage);
+ joystick_axis_t *axis;
+ joystick_button_t *button;
+ joystick_hat_t *hat;
+ int value = hid_get_data(priv->buffer, &item);
+ int usage = HID_USAGE(item.usage);
+ unsigned int page = HID_PAGE(item.usage);
switch (page) {
case HUP_GENERIC_DESKTOP:
@@ -381,11 +195,10 @@
case HUG_RZ: /* fall through */
case HUG_SLIDER:
/* axis */
- index = joy_axis_index(joydev, (uint32_t)usage);
- if (index >= 0) {
- joystick_axis_t *axis = joydev->axes[index];
- joystick_axis_value_t direction = JOY_AXIS_MIDDLE;
- int32_t range = axis->maximum - axis->minimum;
+ axis = joystick_axis_from_code(joydev, (uint32_t)usage);
+ if (axis != NULL) {
+ joystick_axis_value_t direction = JOY_AXIS_MIDDLE;
+ int32_t range = axis->maximum - axis->minimum;
#if 0
printf("%s(): AXIS: index = %d, usage = %d, value = %d\n",
__func__, index, usage, value);
@@ -406,11 +219,9 @@
case HUG_HAT_SWITCH:
/* hat */
- index = joy_hat_index(joydev, (uint32_t)usage);
- if (index >= 0) {
- joy_hat_event(joydev,
- joydev->hats[index],
- (int32_t)value);
+ hat = joystick_hat_from_code(joydev, (uint32_t)usage);
+ if (hat != NULL) {
+ joy_hat_event(joydev, hat, (int32_t)value);
}
break;
@@ -419,11 +230,9 @@
case HUG_D_PAD_LEFT: /* fall through */
case HUG_D_PAD_RIGHT:
/* D-Pad is mapped as buttons */
- index = joy_button_index(joydev, (uint32_t)usage);
- if (index >= 0) {
- joy_button_event(joydev,
- joydev->buttons[index],
- (int32_t)value);
+ button = joystick_button_from_code(joydev, (uint32_t)usage);
+ if (button != NULL) {
+ joy_button_event(joydev, button, (int32_t)value);
}
break;
default:
@@ -432,11 +241,9 @@
break;
case HUP_BUTTON:
/* button event */
- index = joy_button_index(joydev, (uint32_t)usage);
- if (index >= 0) {
- joy_button_event(joydev,
- joydev->buttons[index],
- (int32_t)value);
+ button = joystick_button_from_code(joydev, (uint32_t)usage);
+ if (button != NULL) {
+ joy_button_event(joydev, button, (int32_t)value);
}
break;
default:
@@ -511,11 +318,11 @@
*/
static joy_priv_t *joy_hid_open(const char *node)
{
- joy_priv_t *priv;
- report_desc_t rep_desc;
- int rep_id;
- int rep_size;
- int fd;
+ joy_priv_t *priv;
+ report_desc_t rep_desc;
+ int rep_id;
+ int rep_size;
+ int fd;
fd = open(node, O_RDONLY|O_NONBLOCK);
if (fd < 0) {
@@ -583,7 +390,7 @@
axis->maximum = item->logical_maximum;
log_message(bsd_joy_log, "axis %u: %s", axis->code, axis->name);
- input_list_insert(&axis_list, axis);
+ joystick_device_add_axis(joydev, axis);
}
/** \brief Add button to joystick device
@@ -600,7 +407,7 @@
button->code = (uint32_t)HID_USAGE(item->usage);
log_message(bsd_joy_log, "button %u: %s", button->code, button->name);
- input_list_insert(&button_list, button);
+ joystick_device_add_button(joydev, button);
}
/** \brief Add hat to joystick device
@@ -617,7 +424,7 @@
hat->code = (uint32_t)HID_USAGE(item->usage);
log_message(bsd_joy_log, "hat %u: %s", hat->code, hat->name);
- input_list_insert(&hat_list, hat);
+ joystick_device_add_hat(joydev, hat);
}
/** \brief Scan device for inputs
@@ -730,113 +537,7 @@
return joydev;
}
-/** \brief Ordered list comparison callback for axes
- *
- * Compare code of axis \a a1 with code of axis \a a2.
- *
- * \param[in] a1 joystick axis object
- * \param[in] a2 joystick axis object
- *
- * \return 0 if equal, < 0 if \a a1 < \a a2, > 0 if \a a1 > \a a2
- */
-static int axis_comp(const void *a1, const void *a2)
-{
- const joystick_axis_t *axis1 = a1;
- const joystick_axis_t *axis2 = a2;
- if (axis1->code == axis2->code) {
- return 0;
- } else if (axis1->code < axis2->code) {
- return -1;
- } else {
- return 1;
- }
-}
-
-/** \brief Ordered list comparison callback for buttons
- *
- * Compare code of button \a b1 with code of button \a b2.
- *
- * \param[in] b1 joystick button object
- * \param[in] b2 joystick button object
- *
- * \return 0 if equal, < 0 if \a b1 < \a b2, > 0 if \a b1 > \a b2
- */
-static int button_comp(const void *b1, const void *b2)
-{
- const joystick_button_t *btn1 = b1;
- const joystick_button_t *btn2 = b2;
-
- if (btn1->code == btn2->code) {
- return 0;
- } else if (btn1->code < btn2->code) {
- return -1;
- } else {
- return 1;
- }
-}
-
-/** \brief Ordered list comparison callback for hats
- *
- * Compare code of hat \a h1 with code of hat \a h2.
- *
- * \param[in] h1 joystick hat object
- * \param[in] h2 joystick hat object
- *
- * \return 0 if equal, < 0 if \a h1 < \a h2, > 0 if \a h1 > \a h2
- */
-static int hat_comp(const void *h1, const void *h2)
-{
- const joystick_hat_t *hat1 = h1;
- const joystick_hat_t *hat2 = h2;
-
- if (hat1->code == hat2->code) {
- return 0;
- } else if (hat1->code < hat2->code) {
- return -1;
- } else {
- return 1;
- }
-}
-
-/* kept for debugging */
-#if 0
-static void add_ordered_buttons(joystick_device_t *joydev)
-{
- input_node_t *node;
- int num = 0;
-
- for (node = button_list.head; node != NULL; node = node->next) {
- joystick_button_t *button = node->data;
-
- printf("BUTTON LIST: %d: 0x%04x \"%s\"\n", num++, button->code, button->name);
- joystick_device_add_button(joydev, node->data);
- }
-}
-#endif
-
-/** \brief Add inputs ordered by code
- *
- * Add axes, buttons and hats ordered by their code (hid usage) to \a joydev.
- *
- * \param[in] joydev joystick device
- */
-static void add_ordered_inputs(joystick_device_t *joydev)
-{
- input_node_t *node;
-
- for (node = axis_list.head; node != NULL; node = node->next) {
- joystick_device_add_axis(joydev, node->data);
- }
- for (node = button_list.head; node != NULL; node = node->next) {
- joystick_device_add_button(joydev, node->data);
- }
- for (node = hat_list.head; node != NULL; node = node->next) {
- joystick_device_add_hat(joydev, node->data);
- }
-}
-
-
/** \brief Initialize BSD joystick driver and add available devices
*/
void bsd_joystick_init(void)
@@ -877,16 +578,8 @@
if (joydev != NULL) {
log_message(bsd_joy_log, "%s: %s", joydev->node, joydev->name);
- /* initialize lists to sort inputs on code */
- input_list_init(&axis_list, (data_free_t)joystick_axis_free, axis_comp);
- input_list_init(&button_list, (data_free_t)joystick_button_free, button_comp);
- input_list_init(&hat_list, (data_free_t)joystick_hat_free, hat_comp);
-
/* scan axes, buttons and hats */
if (scan_inputs(joydev)) {
- /* add inputs to device in-order */
- add_ordered_inputs(joydev);
-
/* OK: try to register */
if (!joystick_device_register(joydev)) {
/* failure */
@@ -895,11 +588,6 @@
joydev->node, joydev->name);
joystick_device_free(joydev);
}
-
- /* free lists, but not their data */
- input_list_free(&axis_list, false);
- input_list_free(&button_list, false);
- input_list_free(&hat_list, false);
} else {
log_warning(bsd_joy_log,
"failed to scan inputs for device %s (\"%s\")",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-03-23 16:59:13
|
Revision: 45573
http://sourceforge.net/p/vice-emu/code/45573
Author: gpz
Date: 2025-03-23 16:59:00 +0000 (Sun, 23 Mar 2025)
Log Message:
-----------
implemented snapshot for magicdesk128 and partner128
Modified Paths:
--------------
trunk/vice/src/c128/cart/magicdesk128.c
trunk/vice/src/c128/cart/partner128.c
Modified: trunk/vice/src/c128/cart/magicdesk128.c
===================================================================
--- trunk/vice/src/c128/cart/magicdesk128.c 2025-03-23 16:25:20 UTC (rev 45572)
+++ trunk/vice/src/c128/cart/magicdesk128.c 2025-03-23 16:59:00 UTC (rev 45573)
@@ -262,7 +262,7 @@
static char snap_module_name[] = "MAGICDESK128";
#define SNAP_MAJOR 0
-#define SNAP_MINOR 0
+#define SNAP_MINOR 1
int magicdesk128_snapshot_write_module(snapshot_t *s)
{
@@ -274,7 +274,14 @@
return -1;
}
- /* FIXME */
+ if (0
+ || SMW_B(m, (uint8_t)md128reg) < 0
+ || SMW_B(m, (uint8_t)rombank) < 0
+ || SMW_B(m, (uint8_t)bankmask) < 0
+ || (SMW_BA(m, ext_function_rom, MD128_ROM_SIZE) < 0)) {
+ snapshot_module_close(m);
+ return -1;
+ }
return snapshot_module_close(m);
}
@@ -296,7 +303,13 @@
goto fail;
}
- /* FIXME */
+ if (0
+ || SMR_B_UINT(m, &md128reg) < 0
+ || SMR_B_UINT(m, &rombank) < 0
+ || SMR_B_UINT(m, &bankmask) < 0
+ || (SMR_BA(m, ext_function_rom, MD128_ROM_SIZE) < 0)) {
+ goto fail;
+ }
snapshot_module_close(m);
Modified: trunk/vice/src/c128/cart/partner128.c
===================================================================
--- trunk/vice/src/c128/cart/partner128.c 2025-03-23 16:25:20 UTC (rev 45572)
+++ trunk/vice/src/c128/cart/partner128.c 2025-03-23 16:59:00 UTC (rev 45573)
@@ -362,7 +362,7 @@
static char snap_module_name[] = "PARTNER128";
#define SNAP_MAJOR 0
-#define SNAP_MINOR 0
+#define SNAP_MINOR 1
int partner128_snapshot_write_module(snapshot_t *s)
{
@@ -375,6 +375,16 @@
}
/* FIXME */
+ if (0
+ || SMW_B(m, regvalue) < 0
+ || SMW_B(m, rambank) < 0
+ || SMW_B(m, isdefreezing) < 0
+ || (SMW_BA(m, nmivector, 2) < 0)
+ || (SMW_BA(m, ext_function_rom, PARTNER_ROM_SIZE) < 0)
+ || (SMW_BA(m, rambanks, PARTNER_RAM_SIZE) < 0)) {
+ snapshot_module_close(m);
+ return -1;
+ }
return snapshot_module_close(m);
}
@@ -397,6 +407,15 @@
}
/* FIXME */
+ if (0
+ || SMR_B(m, ®value) < 0
+ || SMR_B(m, &rambank) < 0
+ || SMR_B(m, &isdefreezing) < 0
+ || (SMR_BA(m, nmivector, 2) < 0)
+ || (SMR_BA(m, ext_function_rom, PARTNER_ROM_SIZE) < 0)
+ || (SMR_BA(m, rambanks, PARTNER_RAM_SIZE) < 0)) {
+ goto fail;
+ }
snapshot_module_close(m);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2025-03-23 16:25:24
|
Revision: 45572
http://sourceforge.net/p/vice-emu/code/45572
Author: gpz
Date: 2025-03-23 16:25:20 +0000 (Sun, 23 Mar 2025)
Log Message:
-----------
add cartridge_attach_add_image to the cartridge API, which 'adds' more images to the generic cartridge (common for vic20). using a seperate function makes the code a bit less hacky and allows explict UI options that do not have strange unexpected side effects. also update the UIs, currently only used for vic20
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/uicart.c
trunk/vice/src/arch/sdl/menu_vic20cart.c
trunk/vice/src/c64/cart/c64cart.c
trunk/vice/src/c64/vsid-stubs.c
trunk/vice/src/c64dtv/c64dtv-stubs.c
trunk/vice/src/cartridge.h
trunk/vice/src/cbm2/cart/cbm2cart.c
trunk/vice/src/pet/pet-stubs.c
trunk/vice/src/plus4/cart/plus4cart.c
trunk/vice/src/vic20/cart/vic20cart.c
Modified: trunk/vice/src/arch/gtk3/uicart.c
===================================================================
--- trunk/vice/src/arch/gtk3/uicart.c 2025-03-23 15:43:50 UTC (rev 45571)
+++ trunk/vice/src/arch/gtk3/uicart.c 2025-03-23 16:25:20 UTC (rev 45572)
@@ -140,13 +140,10 @@
/** \brief List of VIC-20 'main' cart types
- *
- * The generic type will use the generic carts list in #vic20_cart_types_generic
*/
static const cart_type_list_t vic20_cart_types[] = {
{ "Smart-attach", UICART_VIC20_SMART },
{ "Generic", UICART_VIC20_GENERIC },
-/* { "Add to generic cartridge", UICART_VIC20_ADD_GENERIC }, */
{ "Freezer", UICART_VIC20_FREEZER },
{ "Games", UICART_VIC20_GAME },
{ "Utilities", UICART_VIC20_UTIL },
@@ -177,20 +174,6 @@
{ NULL, -1 }
};
-#if 0
-/** \brief List of VIC-20 cart types of the 'generic' variety
- */
-static const cart_type_list_t vic20_cart_types_generic[] = {
- { "Smart-attach cartridge image", CARTRIDGE_VIC20_DETECT },
- { "32KiB cartridge at $2000", CARTRIDGE_VIC20_32KB_2000 },
- { "4/8/16KiB cartridge at $2000", CARTRIDGE_VIC20_16KB_2000 },
- { "4/8/16KiB cartridge at $4000", CARTRIDGE_VIC20_16KB_4000 },
- { "4/8/16KiB cartridge at $6000", CARTRIDGE_VIC20_16KB_6000 },
- { "4/8KiB cartridge at $A000", CARTRIDGE_VIC20_8KB_A000 },
- { "4KiB cartridge at $B000", CARTRIDGE_VIC20_4KB_B000 },
- { NULL, -1 }
-};
-#endif
/** \brief File filter pattern for CRT images */
static const char *pattern_crt[] = { "*.crt", NULL };
@@ -247,7 +230,10 @@
/** \brief Reference to the cart-set-default widget */
static GtkWidget *cart_set_default_widget = NULL;
+/** \brief Reference to the cart add widget */
+static GtkWidget *cart_add_widget = NULL;
+
/** \brief Reference to the cart ID widget */
static GtkWidget *cart_id_label = NULL;
@@ -433,6 +419,7 @@
if ((pattern == UICART_PATTERN_CRT) || (mask == 0x0)) {
gtk_widget_hide(GTK_WIDGET(cart_id_widget));
gtk_widget_hide(GTK_WIDGET(cart_id_label));
+ gtk_widget_hide(GTK_WIDGET(cart_add_widget));
} else {
gtk_widget_show(GTK_WIDGET(cart_id_widget));
gtk_widget_show(GTK_WIDGET(cart_id_label));
@@ -442,26 +429,7 @@
set_pattern(pattern);
break;
-#if 0
- case VICE_MACHINE_VIC20:
- if ((crt_type == UICART_VIC20_GENERIC) ||
- (crt_type == UICART_VIC20_ADD_GENERIC)) {
- id_model = create_cart_id_model_vic20();
- /* gtk_widget_set_sensitive(cart_id_widget, TRUE); */
- gtk_widget_show(GTK_WIDGET(cart_id_widget));
- gtk_widget_show(GTK_WIDGET(cart_id_label));
- } else {
- /* empty model */
- id_model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
- /* gtk_widget_set_sensitive(cart_id_widget, FALSE); */
- gtk_widget_hide(GTK_WIDGET(cart_id_widget));
- gtk_widget_hide(GTK_WIDGET(cart_id_label));
- }
- gtk_combo_box_set_model(GTK_COMBO_BOX(cart_id_widget), GTK_TREE_MODEL(id_model));
- gtk_combo_box_set_active(GTK_COMBO_BOX(cart_id_widget), 0);
- break;
-#endif
default:
break;
}
@@ -491,6 +459,46 @@
}
+/** \brief Handler for the "changed" event of the cart ID combo box
+ *
+ * \param[in] combo cart ID combo
+ * \param[in] data extra event data (unused)
+ */
+static void on_cart_id_changed(GtkComboBox *combo, gpointer data)
+{
+ int lasttype = cartridge_get_id(0);
+ int id = get_cart_id();
+ int generic_add = 0;
+
+ /* enable the "add to generic cartridge" checkbox only when a generic
+ cartridge is selected AND currently inserted! */
+ switch (machine_class) {
+ case VICE_MACHINE_C64: /* fall through */
+ case VICE_MACHINE_C64SC: /* fall through */
+ case VICE_MACHINE_C128: /* fall through */
+ case VICE_MACHINE_SCPU64: /* fall through */
+ case VICE_MACHINE_PLUS4: /* fall through */
+ case VICE_MACHINE_CBM5x0: /* fall through */
+ case VICE_MACHINE_CBM6x0:
+ break;
+ /* currently we only use this on vic20 */
+ case VICE_MACHINE_VIC20:
+ if (id >= CARTRIDGE_VIC20_DETECT) {
+ if (lasttype == CARTRIDGE_VIC20_GENERIC) {
+ generic_add = 1;
+ }
+ }
+ break;
+ }
+
+ if (generic_add) {
+ gtk_widget_show(cart_add_widget);
+ } else {
+ gtk_widget_hide(cart_add_widget);
+ }
+}
+
+
/** \brief Get the ID of the model for the 'cart ID' combo box
*
* \return ID or -1 on error
@@ -671,6 +679,15 @@
return 0;
break;
}
+
+ /* add to cartridge */
+ if ((cart_add_widget != NULL) &&
+ (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cart_add_widget)))) {
+ if ((cartridge_attach_add_image(id, path) == 0)) {
+ return 1;
+ }
+ }
+
/* printf("call cartridge_attach_image(id:%d path:%s)\n", id, path); */
if ((cartridge_attach_image(id, path) == 0)) {
/* check 'set default' */
@@ -765,32 +782,7 @@
return model;
}
-#if 0
-/** \brief Create a list of cartridges for VIC-20
- *
- * Only valid for VIC-20
- *
- * \return Two-column list store (name, id)
- */
-static GtkListStore *create_cart_id_model_vic20(void)
-{
- GtkListStore *model;
- GtkTreeIter iter;
- int i;
- model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
-
- for (i = 0; vic20_cart_types_generic[i].name != NULL; i++) {
- gtk_list_store_append(model, &iter);
- gtk_list_store_set(model, &iter,
- 0, vic20_cart_types_generic[i].name, /* cart name */
- 1, vic20_cart_types_generic[i].id, /* cart ID */
- -1);
- }
- return model;
-}
-#endif
-
/** \brief Create combo box with main cartridge types
*
* \return GtkComboBox
@@ -850,37 +842,15 @@
"text", 0, NULL);
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
+
+ g_signal_connect_unlocked(G_OBJECT(combo),
+ "changed",
+ G_CALLBACK(on_cart_id_changed),
+ NULL);
return combo;
}
-#if 0
-/** \brief Create combo box with generic VIC-20 cartridges
- *
- * \return GtkComboBox
- */
-static GtkWidget *create_cart_id_combo_box_vic20(void)
-{
- GtkWidget *combo;
- GtkListStore *model;
- GtkCellRenderer *renderer;
- model = create_cart_id_model_vic20();
- if (model == NULL) {
- return gtk_combo_box_new();
- }
- combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model));
- g_object_unref(model);
-
- renderer = gtk_cell_renderer_text_new();
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE);
- gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer,
- "text", 0, NULL);
-
- gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
- return combo;
-}
-#endif
-
/** \brief Create the 'extra' widget for the dialog
*
* \param[in] set_default initial state of the 'set as default' checkbox
@@ -954,7 +924,30 @@
break;
}
+ /* create "Set cartridge as default" check button */
+ switch (machine_class) {
+ case VICE_MACHINE_C64: /* fall through */
+ case VICE_MACHINE_C64SC: /* fall through */
+ case VICE_MACHINE_C128: /* fall through */
+ case VICE_MACHINE_SCPU64: /* fall through */
+ case VICE_MACHINE_PLUS4: /* fall through */
+ case VICE_MACHINE_CBM5x0: /* fall through */
+ case VICE_MACHINE_CBM6x0: /* fall through */
+ case VICE_MACHINE_VIC20:
+ cart_add_widget = gtk_check_button_new_with_label(
+ "add to cartridge");
+ gtk_toggle_button_set_active(
+ GTK_TOGGLE_BUTTON(cart_add_widget), 0);
+
+ gtk_grid_attach(GTK_GRID(grid), cart_add_widget, 4, 0, 1, 1);
+ break;
+ default:
+ /* Set cart as default is not supported for the current machine */
+ break;
+ }
+
gtk_widget_show_all(grid);
+ gtk_widget_hide(cart_add_widget);
return grid;
}
Modified: trunk/vice/src/arch/sdl/menu_vic20cart.c
===================================================================
--- trunk/vice/src/arch/sdl/menu_vic20cart.c 2025-03-23 15:43:50 UTC (rev 45571)
+++ trunk/vice/src/arch/sdl/menu_vic20cart.c 2025-03-23 16:25:20 UTC (rev 45572)
@@ -204,6 +204,7 @@
return NULL;
}
+/* FIXME: this should be dynamic, like in x64 */
static UI_MENU_CALLBACK(attach_cart_callback)
{
const char *title;
@@ -276,11 +277,60 @@
return NULL;
}
+/* FIXME: this should be dynamic, like in x64 */
+static UI_MENU_CALLBACK(add_cart_callback)
+{
+ const char *title;
+ char *name = NULL;
+ int action = ACTION_NONE;
+
+ if (activated) {
+ switch (vice_ptr_to_int(param)) {
+ case CARTRIDGE_VIC20_DETECT: /* fall through */
+ case CARTRIDGE_VIC20_GENERIC:
+ title = "Select cartridge image";
+ break;
+ case CARTRIDGE_VIC20_16KB_2000:
+ title = "Select 4/8/16KiB image";
+ action = ACTION_CART_ATTACH_RAW_2000;
+ break;
+ case CARTRIDGE_VIC20_16KB_4000:
+ title = "Select 4/8/16KiB image";
+ action = ACTION_CART_ATTACH_RAW_4000;
+ break;
+ case CARTRIDGE_VIC20_16KB_6000:
+ title = "Select 4/8/16KiB image";
+ action = ACTION_CART_ATTACH_RAW_6000;
+ break;
+ case CARTRIDGE_VIC20_8KB_A000:
+ title = "Select 4/8KiB image";
+ action = ACTION_CART_ATTACH_RAW_A000;
+ break;
+ case CARTRIDGE_VIC20_4KB_B000:
+ action = ACTION_CART_ATTACH_RAW_B000; /* fall through */
+ default:
+ title = "Select 4KiB image";
+ break;
+ }
+ name = sdl_ui_file_selection_dialog(title, FILEREQ_MODE_CHOOSE_FILE);
+ if (name != NULL) {
+ if (cartridge_attach_add_image(vice_ptr_to_int(param), name) < 0) {
+ ui_error("Cannot load cartridge image.");
+ }
+ lib_free(name);
+ }
+ if (action > ACTION_NONE) {
+ ui_action_finish(action);
+ }
+ }
+ return NULL;
+}
+
/* TODO: Create UI action IDs/names for these items
* Smart-attach can probably use `ACTION_CART_ATTACH`, the rest needs
* new IDs like `ACTION_CART_ATTACH_2000`.
*/
-static const ui_menu_entry_t add_to_generic_cart_submenu[] = {
+static const ui_menu_entry_t attach_generic_cart_submenu[] = {
{ .string = "Smart-attach cartridge image",
.type = MENU_ENTRY_DIALOG,
.callback = attach_cart_callback,
@@ -319,6 +369,49 @@
SDL_MENU_LIST_END
};
+/* TODO: Create UI action IDs/names for these items
+ * Smart-attach can probably use `ACTION_CART_ATTACH_ADD`, the rest needs
+ * new IDs like `ACTION_CART_ATTACH_ADD_2000`.
+ */
+static const ui_menu_entry_t add_to_generic_cart_submenu[] = {
+ { .string = "Smart-attach cartridge image",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_DETECT
+ },
+ { .action = ACTION_CART_ATTACH_RAW_2000,
+ .string = "Attach 4/8/16KiB image at $2000",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_16KB_2000
+ },
+ { .action = ACTION_CART_ATTACH_RAW_4000,
+ .string = "Attach 4/8/16KiB image at $4000",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_16KB_4000
+ },
+ { .action = ACTION_CART_ATTACH_RAW_6000,
+ .string = "Attach 4/8/16KiB image at $6000",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_16KB_6000
+ },
+ { .action = ACTION_CART_ATTACH_RAW_A000,
+ .string = "Attach 4/8KiB image at $A000",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_8KB_A000
+ },
+ { .action = ACTION_CART_ATTACH_RAW_B000,
+ .string = "Attach 4KiB image at $B000",
+ .type = MENU_ENTRY_DIALOG,
+ .callback = add_cart_callback,
+ .data = (ui_callback_data_t)CARTRIDGE_VIC20_4KB_B000
+ },
+ SDL_MENU_LIST_END
+};
+
static UI_MENU_CALLBACK(set_cart_default_callback)
{
if (activated) {
@@ -755,9 +848,9 @@
SDL_MENU_ITEM_SEPARATOR,
{ .string = "Attach generic cartridge image",
- .type = MENU_ENTRY_DIALOG,
- .callback = attach_cart_callback,
- .data = (ui_callback_data_t)CARTRIDGE_VIC20_GENERIC
+ .type = MENU_ENTRY_SUBMENU,
+ .callback = submenu_callback,
+ .data = (ui_callback_data_t)attach_generic_cart_submenu
},
{ .action = ACTION_CART_ATTACH_RAW_BEHRBONZ,
.string = "Attach " CARTRIDGE_VIC20_NAME_BEHRBONZ " image",
Modified: trunk/vice/src/c64/cart/c64cart.c
===================================================================
--- trunk/vice/src/c64/cart/c64cart.c 2025-03-23 15:43:50 UTC (rev 45571)
+++ trunk/vice/src/c64/cart/c64cart.c 2025-03-23 16:25:20 UTC (rev 45572)
@@ -349,11 +349,14 @@
return &cartlist[0];
}
-/* FIXME: this only works in slot 0 right now */
+/* FIXME: slot arg is ignored right now.
+ this should return a valid cartridge ID for a given slot, or CARTRIDGE_NONE
+ FIXME: should we return CARTRIDGE_CRT(0) or not?
+*/
int cartridge_get_id(int slot)
{
int type = cart_getid_slotmain();
- /*DBG(("cartridge_get_id(slot:%d): type:%d\n", slot, type));*/
+ /* DBG(("cartridge_get_id(slot:%d): type:%d\n", slot, type)); */
return type;
}
@@ -1178,6 +1181,12 @@
return -1;
}
+/* FIXME: add additional image to standard cartridge */
+int cartridge_attach_add_image(int type, const char *filename)
+{
+ return -1;
+}
+
void cart_power_off(void)
{
if (c64cartridge_reset) {
Modified: trunk/vice/src/c64/vsid-stubs.c
===================================================================
--- trunk/vice/src/c64/vsid-stubs.c 2025-03-23 15:43:50 UTC (rev 45571)
+++ trunk/vice/src/c64/vsid-stubs.c 2025-03-23 16:25:20 UTC (rev 45572)
@@ -200,6 +200,11 @@
return -1;
}
+int cartridge_attach_add_image(int type, const char *filename)
+{
+ return -1;
+}
+
void cartridge_detach_image(int type)
{
}
Modified: trunk/vice/src/c64dtv/c64dtv-stubs.c
===================================================================
--- trunk/vice/src/c64dtv/c64dtv-stubs.c 2025-03-23 15:43:50 UTC (rev 45571)
+++ trunk/vice/src/c64dtv/c64dtv-stubs.c 2025-03-23 16:25:20 UTC (rev 45572)
@@ -153,6 +153,11 @@
return -1;
}
+int cartridge_attach_add_image(int type, const char *filename)
+{
+ return -1;
+}
+
void cartridge_detach_image(int type)
{
}
Modified: trunk/vice/src/cartridge.h
===================================================================
--- trunk/vice/src/cartridge.h 2025-03-23 15:43:50 UTC (rev 45571)
+++ trunk/vice/src/cartridge.h 2025-03-23 16:25:20 UTC (rev 45572)
@@ -50,9 +50,14 @@
/* detect cartridge type (takes crt and bin files) */
int cartridge_detect(const char *filename);
-/* attach (and enable) a cartridge by type and filename (takes crt and bin files) */
+/* attach (and enable) a cartridge by type and filename (takes crt and bin files)
+ this function detaches previously attached image(s) in the (all) main slot(s) */
int cartridge_attach_image(int type, const char *filename);
+/* attach (and enable) a cartridge by type and filename (takes crt and bin files)
+ this function ADDs one (or more) images (usually to the generic cartridge) */
+int cartridge_attach_add_image(int type, const char *filename);
+
/* enable cartridge by type. loads default image if any.
should be used by the UI instead of using the resources directly */
int cartridge_enable(int type);
@@ -65,6 +70,7 @@
/* FIXME: slot arg is ignored right now.
this should return a valid cartridge ID for a given slot, or CARTRIDGE_NONE
+ (it does NOT return CARTRIDGE_CRT)
*/
int cartridge_get_id(int slot);
Modified: trunk/vice/src/cbm2/cart/cbm2cart.c
===================================================================
--- trunk/vice/src/cbm2/cart/cbm2cart.c 2025-03-23 15:43:50 UTC (rev 45571)
+++ trunk/vice/src/cbm2/cart/cbm2cart.c 2025-03-23 16:25:20 UTC (rev 45572)
@@ -790,6 +790,12 @@
return -1;
}
+/* FIXME: add additional image to standard cartridge */
+int cartridge_attach_add_image(int type, const char *filename)
+{
+ return -1;
+}
+
void cartridge_trigger_freeze(void)
{
}
@@ -849,8 +855,10 @@
return 0;
}
-/* return cartridge type of main slot
- returns 0 (CARTRIDGE_CRT) if crt file */
+/* FIXME: slot arg is ignored right now.
+ this should return a valid cartridge ID for a given slot, or CARTRIDGE_NONE
+ (it does NOT return CARTRIDGE_CRT)
+*/
int cartridge_get_id(int slot)
{
DBG(("cartridge_get_id(slot:%d): type:%d", slot, cbm2cart_type));
Modified: trunk/vice/src/pet/pet-stubs.c
===================================================================
--- trunk/vice/src/pet/pet-stubs.c 2025-03-23 15:43:50 UTC (rev 45571)
+++ trunk/vice/src/pet/pet-stubs.c 2025-03-23 16:25:20 UTC (rev 45572)
@@ -44,6 +44,11 @@
return -1;
}
+int cartridge_attach_add_image(int type, const char *filename)
+{
+ return -1;
+}
+
void cartridge_detach_image(int type)
{
}
Modified: trunk/vice/src/plus4/cart/plus4cart.c
===================================================================
--- trunk/vice/src/plus4/cart/plus4cart.c 2025-03-23 15:43:50 UTC (rev 45571)
+++ trunk/vice/src/plus4/cart/plus4cart.c 2025-03-23 16:25:20 UTC (rev 45572)
@@ -126,8 +126,10 @@
return &cartlist[0];
}
-/* return cartridge type of main slot
- returns 0 (CARTRIDGE_CRT) if crt file */
+/* FIXME: slot arg is ignored right now.
+ this should return a valid cartridge ID for a given slot, or CARTRIDGE_NONE
+ (it does NOT return CARTRIDGE_CRT)
+*/
int cartridge_get_id(int slot)
{
int type = plus4cart_type;
@@ -792,6 +794,11 @@
DBG(("cartridge_trigger_freeze delay %d cycles", delay));
}
+/* FIXME: add additional image to standard cartridge */
+int cartridge_attach_add_image(int type, const char *filename)
+{
+ return -1;
+}
int cartridge_save_image(int type, const char *filename)
{
Modified: trunk/vice/src/vic20/cart/vic20cart.c
===================================================================
--- trunk/vice/src/vic20/cart/vic20cart.c 2025-03-23 15:43:50 UTC (rev 45571)
+++ trunk/vice/src/vic20/cart/vic20cart.c 2025-03-23 16:25:20 UTC (rev 45572)
@@ -288,7 +288,13 @@
static int attach_cartridge_cmdline(const char *param, void *extra_param)
{
- return cartridge_attach_image(vice_ptr_to_int(extra_param), param);
+ int lasttype = cartridge_get_id(0);
+ if (lasttype == CARTRIDGE_NONE) {
+ /* first cartridge */
+ return cartridge_attach_image(vice_ptr_to_int(extra_param), param);
+ }
+ /* extra images */
+ return cartridge_attach_add_image(vice_ptr_to_int(extra_param), param);
}
static const cmdline_option_t cmdline_options[] =
@@ -542,9 +548,8 @@
char *abs_filename;
int carttype = CARTRIDGE_NONE;
int cartid = CARTRIDGE_NONE;
- int generic_multifile = 0;
- DBG(("cartridge_attach_image type '%d' name: '%s'\n", type, filename));
+ DBG(("cartridge_attach_image type '%d'(0x%04x) name: '%s'\n", type, type, filename));
/*
if (filename == NULL) {
return -1;
@@ -555,6 +560,7 @@
return 0;
}
+ /* get absolute path to image */
if (archdep_path_is_relative(filename)) {
archdep_expand_path(&abs_filename, filename);
} else {
@@ -578,6 +584,9 @@
log_message(LOG_DEFAULT, "Attached cartridge type %d, file=`%s'.", type, filename);
+ /* always detach all other carts */
+ cartridge_detach_image(-1);
+
switch (carttype) {
case CARTRIDGE_VIC20_DETECT:
case CARTRIDGE_VIC20_4KB_2000:
@@ -593,27 +602,8 @@
case CARTRIDGE_VIC20_16KB_2000:
case CARTRIDGE_VIC20_16KB_4000:
case CARTRIDGE_VIC20_16KB_6000:
- /*
- * For specific layouts only detach if we were something else than
- * CARTRIDGE_VIC20_GENERIC before.
- * This allows us to add images to a generic type.
- */
- if (vic20cart_type != CARTRIDGE_VIC20_GENERIC) {
- cartridge_detach_image(-1);
- }
- generic_multifile = 1;
- carttype = CARTRIDGE_VIC20_GENERIC;
+ vic20cart_type = CARTRIDGE_VIC20_GENERIC;
break;
- case CARTRIDGE_VIC20_GENERIC:
- /*
- * this is because the only generic cart that is attachable
- * will be attached as a auto detected multi file cart for now
- * Remove when this changes.
- */
- generic_multifile = 1;
- break;
- default:
- cartridge_detach_image(-1);
}
if (type == CARTRIDGE_CRT) {
@@ -622,7 +612,7 @@
if (cartid == CARTRIDGE_NONE) {
goto exiterror;
}
- carttype = cartid;
+ vic20cart_type = cartid;
} else {
DBG(("CART: attach BIN ID: %d '%s'\n", carttype, filename));
if (cart_bin_attach(carttype, abs_filename, rawcart) < 0) {
@@ -630,16 +620,98 @@
}
}
- DBG(("CART: attach RAW ID: %d carttype: %d\n", cartid, carttype));
- vic20cart_type = carttype;
- if (generic_multifile) {
- util_string_set(&cartfile, NULL);
+ DBG(("CART: attach RAW ID: %d carttype: %d vic20cart_type:%d\n",
+ cartid, carttype, vic20cart_type));
+
+ util_string_set(&cartfile, filename);
+ cartridge_attach(vic20cart_type, NULL);
+
+ DBG(("CART: cartridge_attach_image type: %d ID: %d done.\n", type, carttype));
+ lib_free(rawcart);
+ log_message(LOG_DEFAULT, "CART: attached '%s' as ID %d.", abs_filename, carttype);
+ lib_free(abs_filename);
+ return 0;
+
+exiterror:
+ DBG(("CART: error\n"));
+ lib_free(rawcart);
+ log_message(LOG_DEFAULT, "CART: could not attach '%s'.", abs_filename);
+ lib_free(abs_filename);
+ return -1;
+}
+
+/*
+ attach cartridge image (add to generic cartridge)
+
+ type == -1 NONE
+ type == 0 CRT format
+
+ returns -1 on error, 0 on success
+*/
+int cartridge_attach_add_image(int type, const char *filename)
+{
+ uint8_t *rawcart;
+ char *abs_filename;
+ int carttype = CARTRIDGE_NONE;
+ int cartid = CARTRIDGE_NONE;
+
+ DBG(("cartridge_attach_add_image type '%d'(0x%04x) name: '%s'\n", type, type, filename));
+/*
+ if (filename == NULL) {
+ return -1;
+ }
+*/
+ /* Attaching no cartridge always works. */
+ if (type == CARTRIDGE_NONE || filename == NULL || *filename == '\0') {
+ return 0;
+ }
+
+ /* get absolute path to image */
+ if (archdep_path_is_relative(filename)) {
+ archdep_expand_path(&abs_filename, filename);
} else {
- util_string_set(&cartfile, filename);
+ abs_filename = lib_strdup(filename);
}
- cartridge_attach(carttype, NULL);
- DBG(("CART: cartridge_attach_image type: %d ID: %d done.\n", type, carttype));
+ if (type == CARTRIDGE_CRT) {
+ carttype = crt_getid(abs_filename);
+ if (carttype == -1) {
+ log_message(LOG_DEFAULT, "CART: '%s' is not a valid CRT file.", abs_filename);
+ lib_free(abs_filename);
+ return -1;
+ }
+ } else {
+ carttype = type;
+ }
+ /* allocate temporary array */
+ rawcart = lib_malloc(VIC20CART_IMAGE_LIMIT);
+
+ DBG(("CART: cartridge_attach_add_image type: %d ID: %d\n", type, carttype));
+
+ log_message(LOG_DEFAULT, "Attached cartridge type %d, file=`%s'.", type, filename);
+
+ if (type == CARTRIDGE_CRT) {
+ DBG(("CART: attach CRT ID: %d '%s'\n", carttype, filename));
+ cartid = crt_attach(abs_filename, rawcart);
+ if (cartid == CARTRIDGE_NONE) {
+ goto exiterror;
+ }
+ carttype = cartid;
+ } else {
+ DBG(("CART: attach BIN ID: %d '%s'\n", carttype, filename));
+ if (cart_bin_attach(carttype, abs_filename, rawcart) < 0) {
+ goto exiterror;
+ }
+ }
+
+ DBG(("CART: attach RAW ID: %d carttype: %d vic20cart_type:%d\n",
+ cartid, carttype, vic20cart_type));
+
+ /* NOTE: when we use more than one .bin file, we cant set it as default cartridge */
+ util_string_set(&cartfile, NULL);
+ cartridge_attach(vic20cart_type, NULL);
+
+ DBG(("CART: cartridge_attach_add_image type: %d ID: %d done.\n", type, carttype));
lib_free(rawcart);
log_message(LOG_DEFAULT, "CART: attached '%s' as ID %d.", abs_filename, carttype);
lib_free(abs_filename);
@@ -946,12 +1018,14 @@
return 0;
}
-/* return cartridge type of main slot
- returns 0 (CARTRIDGE_CRT) if crt file */
+/* FIXME: slot arg is ignored right now.
+ this should return a valid cartridge ID for a given slot, or CARTRIDGE_NONE
+ (it does NOT return CARTRIDGE_CRT)
+*/
int cartridge_get_id(int slot)
{
- int type = cartridge_type;
- /*DBG(("cartridge_get_id(slot:%d): type:%d\n", slot, type));*/
+ int type = vic20cart_type;
+ DBG(("cartridge_get_id(slot:%d): %d %d type:%d\n", slot, cartridge_type, vic20cart_type, type));
return type;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-03-23 15:44:02
|
Revision: 45571
http://sourceforge.net/p/vice-emu/code/45571
Author: empathicqubit
Date: 2025-03-23 15:43:50 +0000 (Sun, 23 Mar 2025)
Log Message:
-----------
Fix uninitialized warnings
Modified Paths:
--------------
trunk/vice/src/monitor/monitor_binary.c
Modified: trunk/vice/src/monitor/monitor_binary.c
===================================================================
--- trunk/vice/src/monitor/monitor_binary.c 2025-03-23 15:00:41 UTC (rev 45570)
+++ trunk/vice/src/monitor/monitor_binary.c 2025-03-23 15:43:50 UTC (rev 45571)
@@ -1441,15 +1441,15 @@
{
mon_reg_list_t *regs;
mon_reg_list_t *templates;
- mon_reg_list_t *reg_a;
- mon_reg_list_t *reg_x;
- mon_reg_list_t *reg_y;
- mon_reg_list_t *reg_sp;
- mon_reg_list_t *reg_flags;
- mon_reg_list_t *reg_pc;
- mon_reg_list_t *reg_lin;
- mon_reg_list_t *reg_cyc;
- int i;
+ mon_reg_list_t *reg_a = NULL;
+ mon_reg_list_t *reg_x = NULL;
+ mon_reg_list_t *reg_y = NULL;
+ mon_reg_list_t *reg_sp = NULL;
+ mon_reg_list_t *reg_flags = NULL;
+ mon_reg_list_t *reg_pc = NULL;
+ mon_reg_list_t *reg_lin = NULL;
+ mon_reg_list_t *reg_cyc = NULL;
+ int i, j;
int registers_per_row = 8;
unsigned char *response;
unsigned char *response_cursor;
@@ -1502,36 +1502,43 @@
templates = mon_register_list_get(memspace);
- for (i = 0; templates[i].name != NULL; i++) {
+ for (i = 0, j = 0; templates[i].name != NULL; i++) {
unsigned int id = templates[i].id;
+ bool set_reg = false;
+ mon_reg_list_t *reg = ®s[j];
mon_reg_list_t *template = &templates[i];
if (ignore_fake_register(template)) {
continue;
} else if (id == e_PC) {
- memcpy(®s[0], template, sizeof(mon_reg_list_t));
- reg_pc = ®s[0];
+ set_reg = true;
+ reg_pc = reg;
} else if (id == e_A) {
- memcpy(®s[1], template, sizeof(mon_reg_list_t));
- reg_a = ®s[1];
+ set_reg = true;
+ reg_a = reg;
} else if (id == e_X) {
- memcpy(®s[2], template, sizeof(mon_reg_list_t));
- reg_x = ®s[2];
+ set_reg = true;
+ reg_x = reg;
} else if (id == e_Y) {
- memcpy(®s[3], template, sizeof(mon_reg_list_t));
- reg_y = ®s[3];
+ set_reg = true;
+ reg_y = reg;
} else if (id == e_SP) {
- memcpy(®s[4], template, sizeof(mon_reg_list_t));
- reg_sp = ®s[4];
+ set_reg = true;
+ reg_sp = reg;
} else if (id == e_FLAGS) {
- memcpy(®s[5], template, sizeof(mon_reg_list_t));
- reg_flags = ®s[5];
+ set_reg = true;
+ reg_flags = reg;
} else if (id == e_Rasterline) {
- memcpy(®s[6], template, sizeof(mon_reg_list_t));
- reg_lin = ®s[6];
+ set_reg = true;
+ reg_lin = reg;
} else if (id == e_Cycle) {
- memcpy(®s[7], template, sizeof(mon_reg_list_t));
- reg_cyc = ®s[7];
+ set_reg = true;
+ reg_cyc = reg;
}
+
+ if (set_reg) {
+ memcpy(reg, template, sizeof(mon_reg_list_t));
+ j++;
+ }
}
response_cursor = write_uint32(count, response_cursor);
@@ -1538,14 +1545,30 @@
current = mon_cpuhistory_seek(count, memspace, memspace, memspace, memspace, memspace);
while ((current = mon_cpuhistory_next(current, memspace, memspace, memspace, memspace, memspace))) {
- reg_a->val = current->reg_a;
- reg_x->val = current->reg_x;
- reg_y->val = current->reg_y;
- reg_sp->val = current->reg_sp;
- reg_flags->val = current->reg_st;
- reg_pc->val = current->addr;
- reg_lin->val = 0xffff;
- reg_cyc->val = 0xffff;
+ if(reg_a != NULL) {
+ reg_a->val = current->reg_a;
+ }
+ if (reg_x != NULL) {
+ reg_x->val = current->reg_x;
+ }
+ if (reg_y != NULL) {
+ reg_y->val = current->reg_y;
+ }
+ if (reg_sp != NULL) {
+ reg_sp->val = current->reg_sp;
+ }
+ if (reg_flags != NULL) {
+ reg_flags->val = current->reg_st;
+ }
+ if (reg_pc != NULL) {
+ reg_pc->val = current->addr;
+ }
+ if (reg_lin != NULL) {
+ reg_lin->val = 0xffff;
+ }
+ if (reg_cyc != NULL) {
+ reg_cyc->val = 0xffff;
+ }
*response_cursor = item_size;
++response_cursor;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-03-23 15:00:55
|
Revision: 45570
http://sourceforge.net/p/vice-emu/code/45570
Author: empathicqubit
Date: 2025-03-23 15:00:41 +0000 (Sun, 23 Mar 2025)
Log Message:
-----------
Reformat some binary monitor examples which overflow the PDF
Modified Paths:
--------------
trunk/vice/doc/vice.texi
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2025-03-23 06:47:32 UTC (rev 45569)
+++ trunk/vice/doc/vice.texi 2025-03-23 15:00:41 UTC (rev 45570)
@@ -21831,7 +21831,11 @@
Command body:
@example
-MS | RC RC [ IS[0] @{ RI[0] RV[0] RV[0] @} ... IS[RC-1] @{ RI[RC-1] RV[RC-1] RV[RC-1] @} ]
+MS | RC RC [
+ IS[0] @{ RI[0] | RV[0] RV[0] @}
+ ...
+ IS[RC-1] @{ RI[RC-1] | RV[RC-1] RV[RC-1] @}
+]
@end example
@*
@@ -22170,7 +22174,11 @@
Response body:
@example
-BC BC [ IS[0] @{ BI[0] BI[0] | NL[0] | BN[0][0] BN[0][1] ... BN[0][NL[0]-1] @} ... IS[BC-1] @{ ... @} ]
+BC BC [
+ IS[0] @{ BI[0] BI[0] | NL[0] | BN[0][0] BN[0][1] ... BN[0][NL[0]-1] @}
+ ...
+ IS[BC-1] @{ ... @}
+]
@end example
@*
@@ -22293,7 +22301,8 @@
Response body:
@example
-FL FL FL FL | DW DW | DH DH | XO XO | YO YO | IW IW | IH IH | BP | BL BL BL BL | BD[0] BD[1] ... BD[BL-1]
+FL FL FL FL | DW DW | DH DH | XO XO | YO YO | IW IW | IH IH | BP |
+ BL BL BL BL | BD[0] BD[1] ... BD[BL-1]
@end example
@*
@@ -22759,7 +22768,8 @@
Response body:
@example
-CN CN CN CN | CH | SA SA | EA EA | ST | EN | OP | TM | HC HC HC HC | IC IC IC IC | CE | MS
+CN CN CN CN | CH | SA SA | EA EA | ST | EN | OP | TM |
+ HC HC HC HC | IC IC IC IC | CE | MS
@end example
@*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-23 06:47:49
|
Revision: 45569
http://sourceforge.net/p/vice-emu/code/45569
Author: compyx
Date: 2025-03-23 06:47:32 +0000 (Sun, 23 Mar 2025)
Log Message:
-----------
Joystick: Windows: remove deprecated code, disable debug log message
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-23 06:41:11 UTC (rev 45568)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-23 06:47:32 UTC (rev 45569)
@@ -375,85 +375,6 @@
return DIENUM_CONTINUE;
}
-#if 0
-/** \brief Callback for EnumObjects to enumerate axes
- *
- * \param[in] lpddoi direct input device object instance
- * \param[in] pvref joystick device
- *
- * \return \c DIENUM_CONTINUE
- */
-static BOOL enum_axes_callback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvref)
-{
- joystick_device_t *joydev = pvref;
- joy_priv_t *priv = joydev->priv;
- joystick_axis_t *axis;
- DIPROPRANGE range;
- HRESULT result;
-
- axis = joystick_axis_new(lpddoi->tszName);
- axis->code = DIDFT_GETINSTANCE(lpddoi->dwType);
-
- /* get logical range */
- range.diph.dwSize = sizeof(DIPROPRANGE);
- range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
- range.diph.dwObj = lpddoi->dwType;
- range.diph.dwHow = DIPH_BYID;
- result = IDirectInputDevice8_GetProperty(priv->didev,
- DIPROP_LOGICALRANGE,
- &range.diph);
- if (SUCCEEDED(result)) {
- axis->minimum = (int32_t)range.lMin;
- axis->maximum = (int32_t)range.lMax;
- }
-
- /* add axis and continue */
- joystick_device_add_axis(joydev, axis);
- // log_message(winjoy_log, "axis %d: %s (%u): [%d - %d]",
- // joydev->num_axes - 1, axis->name, axis->code, axis->minimum, axis->maximum);
- return DIENUM_CONTINUE;
-}
-
-/** \brief Callback for EnumObjects to enumerate buttons
- *
- * \param[in] lpddoi direct input device object instance
- * \param[in] pvref joystick device
- *
- * \return \c DIENUM_CONTINUE
- */
-static BOOL enum_buttons_callback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvref)
-{
- joystick_device_t *joydev = pvref;
- joystick_button_t *button;
-
- button = joystick_button_new(lpddoi->tszName);
- button->code = DIDFT_GETINSTANCE(lpddoi->dwType);
- joystick_device_add_button(joydev, button);
- // log_message(winjoy_log, "button %d: %s (%d)", joydev->num_buttons - 1, button->name, button->code);
- return DIENUM_CONTINUE;
-}
-
-/** \brief Callback for EnumObjects to enumerate hats (POVs)
- *
- * \param[in] lpddoi direct input device object instance
- * \param[in] pvref joystick device
- *
- * \return \c DIENUM_CONTINUE
- */
-static BOOL enum_hats_callback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvref)
-{
- joystick_device_t *joydev = pvref;
- joystick_hat_t *hat;
-
- hat = joystick_hat_new(lpddoi->tszName);
- hat->code = DIDFT_GETINSTANCE(lpddoi->dwType);
-
- joystick_device_add_hat(joydev, hat);
- // log_message(winjoy_log, "POV %d: %s (%u)", joydev->num_hats - 1, hat->name, hat->code);
- return DIENUM_CONTINUE;
-}
-#endif
-
/** \brief Callback for IDirectInput8_EnumDevices()
*
*
@@ -469,9 +390,11 @@
joystick_device_t *joydev;
joy_priv_t *priv;
HRESULT result;
+#if 0
int raxes; /* reported number of axes */
int rbuttons; /* reported number of buttons */
int rpovs; /* reported number of POVs */
+#endif
/* create device instance */
result = IDirectInput8_CreateDevice(dinput_handle,
@@ -502,49 +425,35 @@
joydev->name = lib_strdup(lpddi->tszProductName);
joydev->vendor = (uint16_t)(lpddi->guidProduct.Data1 & 0xffff);
joydev->product = (uint16_t)((lpddi->guidProduct.Data1 > 16u) & 0xffff);
- /* don't set num axes etc here, the joystick_device_add_foo() functions
+ /* Don't set num axes etc here, the joystick_device_add_foo() functions
* update the number of inputs when called. */
+#if 0
raxes = caps.dwAxes;
rbuttons = caps.dwButtons;
rpovs = caps.dwPOVs;
+#endif
/* generate GUID as string for the node member */
joydev->node = lib_calloc(GUIDSTR_BUFSIZE, 1);
guid_to_str(&lpddi->guidInstance, joydev->node);
-
+#if 0
log_message(winjoy_log,
"got device \"%s\" [%04x:%04x] GUID: %s, axes: %d, buttons: %d, POVs: %d",
joydev->name, (unsigned int)joydev->vendor, (unsigned int)joydev->product,
joydev->node, raxes, rbuttons, rpovs);
-
+#endif
/* store arch-specific data */
priv = joy_priv_new();
priv->guid = lpddi->guidInstance;
priv->didev = didev;
joydev->priv = priv;
-#if 0
- /* enumerate (absolute) axes */
- IDirectInputDevice8_EnumObjects(didev,
- enum_axes_callback,
- (LPVOID)joydev,
- DIDFT_ABSAXIS);
- /* enumerate buttons */
+ /* enumerate axes, buttons and hats */
IDirectInputDevice8_EnumObjects(didev,
- enum_buttons_callback,
- (LPVOID)joydev,
- DIDFT_BUTTON);
- /* enumerate POVs */
- IDirectInputDevice8_EnumObjects(didev,
- enum_hats_callback,
- (LPVOID)joydev,
- DIDFT_POV);
-#else
- IDirectInputDevice8_EnumObjects(didev,
enum_objects_callback,
(LPVOID)joydev,
DIDFT_ABSAXIS|DIDFT_BUTTON|DIDFT_POV);
-#endif
+
/* Open device manually for polling, until the driver's open() method has
* been properly implemented and tested (changing resource "JoyDeviceN"
* should close the old device and open the new one)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-23 06:41:15
|
Revision: 45568
http://sourceforge.net/p/vice-emu/code/45568
Author: compyx
Date: 2025-03-23 06:41:11 +0000 (Sun, 23 Mar 2025)
Log Message:
-----------
Joystick: Windows: avoid needless calls to joy_foo_event()
Keep track of previous values of axes, buttons and POVs: if the raw value didn't
change the value interpreted by the common joystick event handlers certainly
won't change.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-22 21:43:07 UTC (rev 45567)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-23 06:41:11 UTC (rev 45568)
@@ -40,6 +40,15 @@
* New API
*/
+/** \brief Maximum number of axes in a DIJOYSTATE2 struct */
+#define DIJS2_MAX_AXES 24
+
+/** \brief Maximum number of buttons in a DIJOYSTATE2 struct */
+#define DIJS2_MAX_BUTTONS 128
+
+/** \brief Maximum number of hat (POVs) in a DIJOYSTATE2 struct */
+#define DIJS2_MAX_HATS 4
+
/** \brief Private data object
*
* Contains arch-specific data of a joystick device.
@@ -47,6 +56,9 @@
typedef struct joy_priv_s {
GUID guid; /**< GUID */
LPDIRECTINPUTDEVICE8 didev; /**< DirectInput device instance */
+ LONG prev_axes[DIJS2_MAX_AXES]; /**< prev state of axes */
+ BYTE prev_buttons[DIJS2_MAX_BUTTONS]; /**< prev state of buttons */
+ LONG prev_hats[DIJS2_MAX_HATS]; /**< prev state of POVs */
} joy_priv_t;
@@ -69,9 +81,7 @@
*/
static joy_priv_t *joy_priv_new(void)
{
- joy_priv_t *priv = lib_malloc(sizeof *priv);
-
- memset(&priv->guid, 0, sizeof(priv->guid));
+ joy_priv_t *priv = lib_calloc(sizeof *priv, 1);
priv->didev = NULL;
return priv;
}
@@ -160,7 +170,13 @@
/* buttons are simply listed in sequence, starting at 0 */
joystick_button_t *button = joydev->buttons[i];
int32_t value = jstate.rgbButtons[i] & 0x80;
+ BYTE prev = priv->prev_buttons[i];
+ if (prev == value) {
+ continue;
+ }
+ priv->prev_buttons[i] = (BYTE)value;
+
joy_button_event(joydev, button, value);
}
@@ -168,6 +184,7 @@
for (i = 0; i < joydev->num_axes; i++) {
joystick_axis_t *axis = joydev->axes[i];
uint32_t code = axis->code;
+ LONG prev = priv->prev_axes[i];
if (code < sizeof axis_map / sizeof axis_map[0]) {
int32_t minimum = axis->minimum;
@@ -175,6 +192,11 @@
int32_t range = maximum - minimum;
int32_t value = *(axis_map[code]);
+ if (value == prev) {
+ continue;
+ }
+ priv->prev_axes[i] = value;
+
//printf("axis %d raw value = %d\n", i, value);
if (value <= minimum + (range / 4)) {
@@ -193,7 +215,13 @@
joystick_hat_t *hat = joydev->hats[i];
int32_t value = LOWORD(jstate.rgdwPOV[i]);
int32_t direction = JOYSTICK_DIRECTION_NONE; /* neutral */
+ LONG prev = priv->prev_hats[i];
+ if (prev == value) {
+ continue;
+ }
+ priv->prev_hats[i] = prev;
+
/* POVs map to 360 degrees, in units of 1/100th of a degree, neutral
* is reported as -1 / 0xffffffff.
* Translate position on a circle to joystick directions, clockwise
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-22 21:43:22
|
Revision: 45567
http://sourceforge.net/p/vice-emu/code/45567
Author: compyx
Date: 2025-03-22 21:43:07 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
Joystick: Windows: delete remnants of old joystick driver
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-22 18:02:55 UTC (rev 45566)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-22 21:43:07 UTC (rev 45567)
@@ -1,8 +1,7 @@
/** \file joystick_win32_directinput.c
* \brief Joystick support for Windows
*
- * \author Tibor Biczo <cr...@ma...>
- * \author Ettore Perazzoli <et...@co...>
+ * \author Bas Wassink <b.w...@zi...>
*/
/*
@@ -37,324 +36,6 @@
#define INITGUID
#include <dinput.h>
-#if 0
-typedef struct _JoyAxis {
- struct _JoyAxis *next;
- DWORD id;
- char *name;
-} JoyAxis;
-
-typedef struct _JoyButton {
- struct _JoyButton *next;
- DWORD id;
- char *name;
-} JoyButton;
-
-typedef struct _JoyInfo {
- GUID guid;
- JoyAxis *axes;
- JoyButton *buttons;
- int numaxes;
- int numbuttons;
- int numPOVs;
- LPDIRECTINPUTDEVICE8 di_device;
-} JoyInfo;
-
-
-static LPDIRECTINPUT8 di = NULL;
-
-
-static BOOL CALLBACK EnumJoyAxes(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef)
-{
- JoyAxis *axis;
- JoyInfo *joy;
-
- joy = (JoyInfo*)pvRef;
-
- /* Save info about axis */
- axis = lib_malloc(sizeof(JoyAxis));
- axis->next = NULL;
- axis->id = DIDFT_GETINSTANCE(lpddoi->dwType);
- axis->name = lib_strdup(lpddoi->tszName);
-
- /* Link axis into list for this joystick */
- if (joy->axes == NULL) {
- joy->axes = axis;
- } else {
- JoyAxis *s;
- s = joy->axes;
- while (s->next != NULL) {
- s = s->next;
- }
- s->next = axis;
- }
- joy->numaxes += 1;
- return DIENUM_CONTINUE;
-}
-
-static BOOL CALLBACK EnumJoyButtons(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef)
-{
- JoyButton *button;
- JoyInfo *joy;
-
- joy = (JoyInfo*)pvRef;
-
- /* Save info about button */
- button = lib_malloc(sizeof(JoyButton));
- button->next = NULL;
- button->id = DIDFT_GETINSTANCE(lpddoi->dwType);
- button->name = lib_strdup(lpddoi->tszName);
-
- /* Link button into list for this joystick */
- if (joy->buttons == NULL) {
- joy->buttons = button;
- } else {
- JoyButton *s;
- s = joy->buttons;
- while (s->next != NULL) {
- s = s->next;
- }
- s->next = button;
- }
- joy->numbuttons += 1;
- return DIENUM_CONTINUE;
-}
-
-static BOOL CALLBACK EnumJoyPOVs(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef)
-{
- JoyInfo *joy;
-
- joy = (JoyInfo*)pvRef;
-
- /* Save info about POV */
- joy->numPOVs += 1;
-
- return DIENUM_CONTINUE;
-}
-
-static void joystick_release_axes(JoyAxis *axis)
-{
- while (axis != NULL) {
- JoyAxis *next;
-
- next = axis->next;
- lib_free(axis->name);
- lib_free(axis);
- axis = next;
- }
-}
-static void joystick_release_buttons(JoyButton *button)
-{
- while (button != NULL) {
- JoyButton *next;
-
- next = button->next;
- lib_free(button->name);
- lib_free(button);
- button = next;
- }
-}
-
-static void joystick_di8_update(int joyport, void* priv)
-{
- BYTE value;
- int i;
- DIPROPRANGE prop;
- DIJOYSTATE js;
- JoyInfo *joy;
-
- value = 0;
- joy = priv;
-
- IDirectInputDevice8_Poll(joy->di_device);
- IDirectInputDevice8_GetDeviceState(joy->di_device, sizeof(DIJOYSTATE), &js);
-
- /* Get boundary values for X axis */
- prop.diph.dwSize = sizeof(DIPROPRANGE);
- prop.diph.dwHeaderSize = sizeof(DIPROPHEADER);
- prop.diph.dwObj = 0; /* Offset of X axis */
- prop.diph.dwHow = DIPH_BYOFFSET;
- IDirectInputDevice8_GetProperty(joy->di_device, DIPROP_RANGE, (DIPROPHEADER*)&prop);
- if (js.lX <= prop.lMin + (prop.lMax - prop.lMin) / 4) {
- joy_axis_event(joyport, 0, JOY_AXIS_NEGATIVE);
- } else if (js.lX >= prop.lMin + (prop.lMax - prop.lMin) / 4 * 3) {
- joy_axis_event(joyport, 0, JOY_AXIS_POSITIVE);
- } else {
- joy_axis_event(joyport, 0, JOY_AXIS_MIDDLE);
- }
-
- /* Get boundary values for Y axis */
- prop.diph.dwSize = sizeof(DIPROPRANGE);
- prop.diph.dwHeaderSize = sizeof(DIPROPHEADER);
- prop.diph.dwObj = 4; /* Offset of Y axis */
- prop.diph.dwHow = DIPH_BYOFFSET;
- IDirectInputDevice8_GetProperty(joy->di_device, DIPROP_RANGE, (DIPROPHEADER*)&prop);
- if (js.lY <= prop.lMin + (prop.lMax - prop.lMin) / 4) {
- joy_axis_event(joyport, 1, JOY_AXIS_NEGATIVE);
- } else if (js.lY >= prop.lMin + (prop.lMax - prop.lMin) / 4 * 3) {
- joy_axis_event(joyport, 1, JOY_AXIS_POSITIVE);
- } else {
- joy_axis_event(joyport, 1, JOY_AXIS_MIDDLE);
- }
-
- /* Get boundary values for X-rotation axis */
- prop.diph.dwSize = sizeof(DIPROPRANGE);
- prop.diph.dwHeaderSize = sizeof(DIPROPHEADER);
- prop.diph.dwObj = 0x0c; /* Offset of X-rotation axis */
- prop.diph.dwHow = DIPH_BYOFFSET;
- IDirectInputDevice8_GetProperty(joy->di_device, DIPROP_RANGE, (DIPROPHEADER*)&prop);
- if (js.lRx <= prop.lMin + (prop.lMax - prop.lMin) / 4) {
- joy_axis_event(joyport, 2, JOY_AXIS_NEGATIVE);
- } else if (js.lRx >= prop.lMin + (prop.lMax - prop.lMin) / 4 * 3) {
- joy_axis_event(joyport, 2, JOY_AXIS_POSITIVE);
- } else {
- joy_axis_event(joyport, 2, JOY_AXIS_MIDDLE);
- }
-
- /* Get boundary values for Y-rotation axis */
- prop.diph.dwSize = sizeof(DIPROPRANGE);
- prop.diph.dwHeaderSize = sizeof(DIPROPHEADER);
- prop.diph.dwObj = 0x10; /* Offset of Y-rotation axis */
- prop.diph.dwHow = DIPH_BYOFFSET;
- IDirectInputDevice8_GetProperty(joy->di_device, DIPROP_RANGE, (DIPROPHEADER*)&prop);
- if (js.lRy <= prop.lMin + (prop.lMax - prop.lMin) / 4) {
- joy_axis_event(joyport, 3, JOY_AXIS_NEGATIVE);
- } else if (js.lRy >= prop.lMin + (prop.lMax - prop.lMin) / 4 * 3) {
- joy_axis_event(joyport, 3, JOY_AXIS_POSITIVE);
- } else {
- joy_axis_event(joyport, 3, JOY_AXIS_MIDDLE);
- }
-
- /* Get boundary values for Z axis */
- prop.diph.dwSize = sizeof(DIPROPRANGE);
- prop.diph.dwHeaderSize = sizeof(DIPROPHEADER);
- prop.diph.dwObj = 8; /* Offset of Z axis */
- prop.diph.dwHow = DIPH_BYOFFSET;
- IDirectInputDevice8_GetProperty(joy->di_device, DIPROP_RANGE, (DIPROPHEADER*)&prop);
- if (js.lZ <= prop.lMin + (prop.lMax - prop.lMin) / 4) {
- joy_axis_event(joyport, 4, JOY_AXIS_NEGATIVE);
- } else if (js.lZ >= prop.lMin + (prop.lMax - prop.lMin) / 4 * 3) {
- joy_axis_event(joyport, 4, JOY_AXIS_POSITIVE);
- } else {
- joy_axis_event(joyport, 4, JOY_AXIS_MIDDLE);
- }
-
- /* Get boundary values for Z-rotation axis */
- prop.diph.dwSize = sizeof(DIPROPRANGE);
- prop.diph.dwHeaderSize = sizeof(DIPROPHEADER);
- prop.diph.dwObj = 0x14; /* Offset of Z-rotation axis */
- prop.diph.dwHow = DIPH_BYOFFSET;
- IDirectInputDevice8_GetProperty(joy->di_device, DIPROP_RANGE, (DIPROPHEADER*)&prop);
- if (js.lRz <= prop.lMin + (prop.lMax - prop.lMin) / 4) {
- joy_axis_event(joyport, 5, JOY_AXIS_NEGATIVE);
- } else if (js.lRz >= prop.lMin + (prop.lMax - prop.lMin) / 4 * 3) {
- joy_axis_event(joyport, 5, JOY_AXIS_POSITIVE);
- } else {
- joy_axis_event(joyport, 5, JOY_AXIS_MIDDLE);
- }
-
- for (i = 0; i < joy->numPOVs; ++i) {
- if (LOWORD(js.rgdwPOV[i]) != 0xffff) {
- if (js.rgdwPOV[i] > 20250 && js.rgdwPOV[i] < 33750) {
- value |= JOYSTICK_DIRECTION_LEFT;
- }
- if (js.rgdwPOV[i] > 2250 && js.rgdwPOV[i] < 15750) {
- value |= JOYSTICK_DIRECTION_RIGHT;
- }
- if (js.rgdwPOV[i] > 29250 || js.rgdwPOV[i] < 6750) {
- value |= JOYSTICK_DIRECTION_UP;
- }
- if (js.rgdwPOV[i] > 11250 && js.rgdwPOV[i] < 24750) {
- value |= JOYSTICK_DIRECTION_DOWN;
- }
- }
- joy_hat_event(joyport, i, value);
- }
- for (i = 0; i < joy->numbuttons; ++i) {
- joy_button_event(joyport, i, (js.rgbButtons[i] & 0x80));
- }
-}
-
-static void joystick_release_joystick(void* priv)
-{
- JoyInfo *joystick = priv;
- joystick_release_axes(joystick->axes);
- joystick_release_buttons(joystick->buttons);
- IDirectInputDevice8_Unacquire(joystick->di_device);
- IDirectInputDevice8_Release(joystick->di_device);
- lib_free(joystick);
-}
-
-static joystick_driver_t win32_directinput_joystick_driver = {
- .poll = joystick_di8_update,
- .close = joystick_release_joystick
-};
-
-
-#ifdef HAVE_DEBUG_GTK3UI
-static void dump_guid(GUID guid)
-{
- printf(".Data1 (ulong) = %08lx\n", guid.Data1);
- printf(".Data2 (ushort) = %04x\n", guid.Data2);
- printf(".Data3 (ushort) = %04x\n", guid.Data3);
- printf(".Data4 (uchar[8]) =");
- for (size_t i = 0; i < sizeof guid.Data4; i++) {
- printf(" %02x", guid.Data4[i]);
- }
- printf("\n");
-}
-#endif
-
-static BOOL CALLBACK EnumCallBack(LPCDIDEVICEINSTANCE lpddi, LPVOID pvref)
-{
- JoyInfo *new_joystick;
- HINSTANCE ui_active_window = GetModuleHandle(NULL); /* FIXME */
-
- new_joystick = lib_malloc(sizeof(JoyInfo));
- memcpy(&new_joystick->guid, &lpddi->guidInstance, sizeof(GUID));
-
-#ifdef HAVE_DEBUG_GTK3UI
- printf("%s(): lpddi.guidProduct:\n", __func__);
- dump_guid(lpddi->guidProduct);
- printf("%s(): lpddi.guidInstance:\n", __func__);
- dump_guid(lpddi->guidInstance);
-#endif
-
- new_joystick->axes = NULL;
- new_joystick->buttons = NULL;
- new_joystick->numPOVs = 0;
- new_joystick->numaxes = 0;
- new_joystick->numbuttons = 0;
- IDirectInput8_CreateDevice(di, &new_joystick->guid, &new_joystick->di_device, NULL);
- IDirectInputDevice8_SetDataFormat(new_joystick->di_device, &c_dfDIJoystick);
- IDirectInputDevice8_SetCooperativeLevel(new_joystick->di_device,
- (HWND)ui_active_window, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
- IDirectInputDevice8_Acquire(new_joystick->di_device);
- IDirectInputDevice8_EnumObjects(new_joystick->di_device, EnumJoyAxes, (LPVOID)new_joystick, DIDFT_AXIS);
- IDirectInputDevice8_EnumObjects(new_joystick->di_device, EnumJoyButtons, (LPVOID)new_joystick, DIDFT_BUTTON);
- IDirectInputDevice8_EnumObjects(new_joystick->di_device, EnumJoyPOVs, (LPVOID)new_joystick, DIDFT_POV);
- register_joystick_driver(&win32_directinput_joystick_driver,
- lpddi->tszInstanceName,
- new_joystick,
- new_joystick->numaxes,
- new_joystick->numbuttons,
- new_joystick->numPOVs
- );
-
- return DIENUM_CONTINUE;
-}
-
-int win32_directinput_joystick_init(void)
-{
- HINSTANCE winmain_instance = GetModuleHandle(NULL); /* FIXME */
- if (DirectInput8Create(winmain_instance, DIRECTINPUT_VERSION, &IID_IDirectInput8, (LPVOID*)&di, NULL) != DI_OK) {
- return 0;
- }
- IDirectInput8_EnumDevices(di, DIDEVTYPE_JOYSTICK, EnumCallBack, NULL, DIEDFL_ALLDEVICES);
- return 1;
-}
-#endif
-
/*
* New API
*/
@@ -438,6 +119,10 @@
return false;
}
+/** \brief Joystick drive poll() method
+ *
+ * \param[in] joydev joystick device to poll
+ */
static void win32_joy_poll(joystick_device_t *joydev)
{
joy_priv_t *priv;
@@ -607,7 +292,15 @@
buffer[GUIDSTR_BUFSIZE - 1] = '\0';
}
-
+/** \brief Callback for IDirectInputDevice8::EnumObjects
+ *
+ * Callback function enumerating axes, buttons and hats (POVs).
+ *
+ * \param[in] lpddoi DirectInput device instance
+ * \param[in] pvref extra callback param (VICE joystick device instance)
+ *
+ * \return \c DIENUM_CONTINUE
+ */
static BOOL enum_objects_callback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvref)
{
joystick_device_t *joydev = pvref;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-03-22 18:03:03
|
Revision: 45566
http://sourceforge.net/p/vice-emu/code/45566
Author: empathicqubit
Date: 2025-03-22 18:02:55 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
Fix warnings
Modified Paths:
--------------
trunk/vice/src/monitor/monitor_binary.c
Modified: trunk/vice/src/monitor/monitor_binary.c
===================================================================
--- trunk/vice/src/monitor/monitor_binary.c 2025-03-22 17:57:16 UTC (rev 45565)
+++ trunk/vice/src/monitor/monitor_binary.c 2025-03-22 18:02:55 UTC (rev 45566)
@@ -430,8 +430,8 @@
#define MON_REGISTER_ITEM_SIZE 3
-static uint16_t *count_registers(mon_reg_list_t *regs) {
- uint16_t count;
+static uint16_t count_registers(mon_reg_list_t *regs) {
+ uint16_t count = 0;
for( ; regs->name ; regs++) {
if (!ignore_fake_register(regs)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-03-22 17:57:28
|
Revision: 45565
http://sourceforge.net/p/vice-emu/code/45565
Author: empathicqubit
Date: 2025-03-22 17:57:16 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
Wrap binary monitor cpuhistory in FEATURE_CPUMEMHISTORY check
Modified Paths:
--------------
trunk/vice/src/monitor/monitor_binary.c
Modified: trunk/vice/src/monitor/monitor_binary.c
===================================================================
--- trunk/vice/src/monitor/monitor_binary.c 2025-03-22 17:37:18 UTC (rev 45564)
+++ trunk/vice/src/monitor/monitor_binary.c 2025-03-22 17:57:16 UTC (rev 45565)
@@ -1436,6 +1436,7 @@
monitor_binary_response(sizeof(response), e_MON_RESPONSE_VICE_INFO, e_MON_ERR_OK, command->request_id, response);
}
+#ifdef FEATURE_CPUMEMHISTORY
static void monitor_binary_process_cpuhistory(binary_command_t *command)
{
mon_reg_list_t *regs;
@@ -1576,8 +1577,13 @@
lib_free(templates);
lib_free(response);
}
+#else
+static void monitor_binary_process_cpuhistory(binary_command_t *command)
+{
+ monitor_binary_error(e_MON_ERR_CMD_FAILURE, command->request_id);
+}
+#endif /* FEATURE_CPUMEMHISTORY */
-
static void monitor_binary_process_mem_get(binary_command_t *command)
{
unsigned char *response;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-03-22 17:37:31
|
Revision: 45564
http://sourceforge.net/p/vice-emu/code/45564
Author: empathicqubit
Date: 2025-03-22 17:37:18 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
Fix texi file formatting
Modified Paths:
--------------
trunk/vice/doc/vice.texi
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2025-03-22 17:02:13 UTC (rev 45563)
+++ trunk/vice/doc/vice.texi 2025-03-22 17:37:18 UTC (rev 45564)
@@ -9572,7 +9572,7 @@
@itemize @bullet
@item
-@file{.crt} images, as used by the CCS64 emulator by Per H�kan Sundell
+@file{.crt} images, as used by the CCS64 emulator by Per H\xE5kan Sundell
@item
raw @file{.bin} images, with or without load address
@end itemize
@@ -11646,7 +11646,7 @@
@item
@file{c64s.vpl} (``C64S''), palette taken from the shareware C64S emulator by Miha Peternel.
@item
-@file{ccs64.vpl} (``CCS64''), palette taken from the shareware CCS64 emulator by Per H�kan Sundell.
+@file{ccs64.vpl} (``CCS64''), palette taken from the shareware CCS64 emulator by Per H\xE5kan Sundell.
@item
@file{frodo.vpl} (``Frodo''), palette taken from the free Frodo emulator by Christian Bauer
(@uref{https://frodo.cebix.net/}).
@@ -24168,7 +24168,7 @@
Ettore Perazzoli.)
This format was defined in 1998 as a cooperative effort between several
-emulator people, mainly Per H�kan Sundell, author of the CCS64 C64
+emulator people, mainly Per H\xE5kan Sundell, author of the CCS64 C64
emulator, Andreas Boose of the VICE CBM emulator team and Joe
Forster/STA, the author of Star Commander. It was the first real public
attempt to create a format for the emulator community which removed
@@ -36502,7 +36502,7 @@
GP2X/Dingoo SDL UI issues.
@item
-@b{Istv�n F�bi�n}
+@b{Istv\xE1n F\xE1bi\xE1n}
Contributed a initial patch with the more correct 1541 bus
timing code and which gave us hints for to improving the 1541
emulation.
@@ -36613,7 +36613,7 @@
other patches.
@item
-@b{Frank K�nig}
+@b{Frank K\xF6nig}
Contributed the Win32 joystick autofire feature.
@item
@@ -36662,7 +36662,7 @@
Provided some monitor fixes.
@item
-@b{Marko M�kel�}
+@b{Marko M\xE4kel\xE4}
Wrote lots of CPU documentation. Wrote the VIC Flash Plugin
cartridge emulation in xvic. Wrote the Ultimem cartridge
emulation in xvic.
@@ -36729,7 +36729,7 @@
Digitalized the C64 colors used in the (old) default palette.
@item
-@b{Lasse ��rni}
+@b{Lasse \xD6\xF6rni}
Contributed the Windows Multimedia sound driver
@item
@@ -36976,7 +36976,7 @@
Last but not least, a very special thank to Andreas Arens, Lutz
Sammer, Edgar Tornig, Christian Bauer, Wolfgang Lorenz, Miha
-Peternel, Per H�kan Sundell, David Horrocks, Benjamin Rosseaux and William McCabe
+Peternel, Per H\xE5kan Sundell, David Horrocks, Benjamin Rosseaux and William McCabe
for writing cool emulators to compete with. @t{:-)}
@c end of file generation section.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-03-22 17:02:17
|
Revision: 45563
http://sourceforge.net/p/vice-emu/code/45563
Author: empathicqubit
Date: 2025-03-22 17:02:13 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
Fix style issues
Modified Paths:
--------------
trunk/vice/src/monitor/mon_memmap.c
trunk/vice/src/monitor/monitor_binary.c
Modified: trunk/vice/src/monitor/mon_memmap.c
===================================================================
--- trunk/vice/src/monitor/mon_memmap.c 2025-03-22 16:47:31 UTC (rev 45562)
+++ trunk/vice/src/monitor/mon_memmap.c 2025-03-22 17:02:13 UTC (rev 45563)
@@ -224,7 +224,7 @@
|| (filter3 == current->origin)
|| (filter4 == current->origin)
|| (filter5 == current->origin))));
-
+
return current;
}
Modified: trunk/vice/src/monitor/monitor_binary.c
===================================================================
--- trunk/vice/src/monitor/monitor_binary.c 2025-03-22 16:47:31 UTC (rev 45562)
+++ trunk/vice/src/monitor/monitor_binary.c 2025-03-22 17:02:13 UTC (rev 45563)
@@ -1481,7 +1481,7 @@
monitor_binary_error(e_MON_ERR_INVALID_PARAMETER, command->request_id);
log_message(LOG_DEFAULT, "monitor binary cpuhistory: Invalid count %u", count);
return;
- }
+ }
current = mon_cpuhistory_seek(requested_count, memspace, memspace, memspace, memspace, memspace);
while ((current = mon_cpuhistory_next(current, memspace, memspace, memspace, memspace, memspace))) {
@@ -1545,7 +1545,7 @@
reg_pc->val = current->addr;
reg_lin->val = 0xffff;
reg_cyc->val = 0xffff;
-
+
*response_cursor = item_size;
++response_cursor;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-03-22 16:47:45
|
Revision: 45562
http://sourceforge.net/p/vice-emu/code/45562
Author: empathicqubit
Date: 2025-03-22 16:47:31 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
Added documentation for binary monitor CPUHISTORY_GET command. Made documentation more visual so that variable length responses are theoretically less confusing. Removed exact offset numbers and use byte sizes instead.
Modified Paths:
--------------
trunk/vice/doc/vice.texi
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2025-03-22 16:44:59 UTC (rev 45561)
+++ trunk/vice/doc/vice.texi 2025-03-22 16:47:31 UTC (rev 45562)
@@ -9572,7 +9572,7 @@
@itemize @bullet
@item
-@file{.crt} images, as used by the CCS64 emulator by Per H\xE5kan Sundell
+@file{.crt} images, as used by the CCS64 emulator by Per H�kan Sundell
@item
raw @file{.bin} images, with or without load address
@end itemize
@@ -11646,7 +11646,7 @@
@item
@file{c64s.vpl} (``C64S''), palette taken from the shareware C64S emulator by Miha Peternel.
@item
-@file{ccs64.vpl} (``CCS64''), palette taken from the shareware CCS64 emulator by Per H\xE5kan Sundell.
+@file{ccs64.vpl} (``CCS64''), palette taken from the shareware CCS64 emulator by Per H�kan Sundell.
@item
@file{frodo.vpl} (``Frodo''), palette taken from the free Frodo emulator by Christian Bauer
(@uref{https://frodo.cebix.net/}).
@@ -21472,6 +21472,7 @@
* MON_CMD_REGISTERS_AVAILABLE::
* MON_CMD_DISPLAY_GET::
* MON_CMD_VICE_INFO::
+* MON_CMD_CPUHISTORY_GET::
* MON_CMD_PALETTE_GET::
* MON_CMD_JOYPORT_SET::
* MON_CMD_USERPORT_SET::
@@ -21490,15 +21491,20 @@
Command body:
+@example
+FX | SA SA | EA EA | MS | BI BI
+@end example
+@*
+
@table @strong
-@item byte 0: side effects?
+@item FX: 1 byte: side effects?
Should the read cause side effects?
-@item byte 1-2: start address
+@item SA: 2 bytes: start address
-@item byte 3-4: end address
+@item EA: 2 bytes: end address
-@item byte 5: memspace
+@item MS: 1 byte: memspace
Describes which part of the computer you want to read:
@itemize
@@ -21509,7 +21515,7 @@
@item 0x04: drive 11
@end itemize
-@item byte 6-7: bank ID
+@item BI: 2 bytes: bank ID
Describes which bank you want. This is dependent on your
machine. @xref{MON_CMD_BANKS_AVAILABLE}. If the memspace selected
doesn't support banks, this value is ignored.
@@ -21522,10 +21528,16 @@
Response body:
+@example
+ML ML | MM[0] MM[1] ... MM[ML-1]
+@end example
+@*
+
@table @strong
-@item byte 0-1: The length of the memory segment. Will be zero for start 0x0000, end 0xffff.
+@item ML: 2 bytes: Memory segment length.
+ Will be zero for start 0x0000, end 0xffff.
-@item byte 2+: The memory at the address.
+@item MM: ML bytes: The memory at the address.
@end table
@@ -21538,15 +21550,20 @@
Command body:
+@example
+FX | SA SA | EA EA | MS | BI BI | MM[0] MM[1] ... MM[EA-SA]
+@end example
+@*
+
@table @strong
-@item byte 0: side effects?
+@item FX: 1 byte: side effects?
Should the write cause side effects?
-@item byte 1-2: start address
+@item SA: 2 bytes: start address
-@item byte 3-4: end address
+@item EA: 2 bytes: end address
-@item byte 5: memspace
+@item MS: 1 byte: memspace
Describes which part of the computer you want to write:
@itemize
@@ -21557,12 +21574,12 @@
@item 0x04: drive 11
@end itemize
-@item byte 6-7: bank ID
+@item BI: 2 bytes: bank ID
Describes which bank you want. This is dependent on your machine.
@xref{MON_CMD_BANKS_AVAILABLE}.
If the memspace selected doesn't support banks, this byte is ignored.
-@item byte 8+: Memory contents to write
+@item MM: 1+EA-SA bytes: Memory contents to write
@end table
@@ -21572,7 +21589,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_CHECKPOINT_GET
@subsection Checkpoint get (0x11)
@@ -21583,8 +21603,13 @@
Command body:
+@example
+CN CN CN CN
+@end example
+@*
+
@table @strong
-@item byte 0-3: checkpoint number
+@item CN: 4 bytes: checkpoint number
@end table
@@ -21600,25 +21625,30 @@
Command body:
+@example
+SA SA | EA EA | ST | EN | OP | TM | MS?
+@end example
+@*
+
@table @strong
-@item byte 0-1: start address
+@item SA: 2 bytes: start address
-@item byte 2-3: end address
+@item EA: 2 bytes: end address
-@item byte 4: stop when hit
+@item ST: 1 byte: stop when hit
>=0x01: true, 0x00: false
-@item byte 5: enabled
+@item EN: 1 byte: enabled
>=0x01: true, 0x00: false
-@item byte 6: CPU operation
+@item OP: 1 byte: CPU operation
>=0x01: load, 0x02: store, 0x04: exec
-@item byte 7: temporary
+@item TM: 1 byte: temporary
Deletes the checkpoint after it has been hit once. This is similar to
"until" command, but it will not resume the emulator.
-@item byte 8 (optional): memspace
+@item MS: 1 byte (optional): memspace
Describes which part of the computer to checkpoint:
@itemize
@@ -21642,8 +21672,13 @@
Command body:
+@example
+CN CN CN CN
+@end example
+@*
+
@table @strong
-@item byte 0-3: checkpoint number
+@item CN: 4 bytes: checkpoint number
@end table
@@ -21653,7 +21688,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_CHECKPOINT_LIST
@subsection Checkpoint list (0x14)
@@ -21662,7 +21700,10 @@
Command body:
+@example
Currently empty.
+@end example
+@*
Response type:
@@ -21673,8 +21714,13 @@
Response body:
+@example
+CC CC CC CC
+@end example
+@*
+
@table @strong
-@item byte 0-3: The total number of checkpoints
+@item CC: 4 bytes: The total count of checkpoints
@end table
@@ -21685,10 +21731,15 @@
Command body:
+@example
+CN CN CN CN | EN
+@end example
+@*
+
@table @strong
-@item byte 0-3: Checkpoint number
+@item CN: 4 bytes: Checkpoint number
-@item byte 4: Enabled?
+@item EN: 1 byte: Enabled?
0x00: disabled, 0x01: enabled
@end table
@@ -21699,7 +21750,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_CONDITION_SET
@subsection Condition set (0x22)
@@ -21711,13 +21765,18 @@
Command body:
+@example
+CN CN CN CN | EL | ES[0] ES[1] ... ES[EL-1]
+@end example
+@*
+
@table @strong
-@item byte 0-3: checkpoint number
+@item CN: 4 bytes: checkpoint number
-@item byte 4: condition expression length
+@item EL: 1 byte: condition expression length
-@item byte 5+: condition expression string
-This is the same format used on the command line. Not null terminated.
+@item ES: EL bytes: condition expression string
+This is the same format used in the text monitor. Not null terminated.
@end table
@@ -21727,7 +21786,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_REGISTERS_GET
@subsection Registers get (0x31)
@@ -21738,8 +21800,13 @@
Command body:
+@example
+MS
+@end example
+@*
+
@table @strong
-@item byte 0: memspace
+@item MS: 1 byte: memspace
Describes which part of the computer you want to read:
@itemize
@@ -21763,8 +21830,13 @@
Command body:
+@example
+MS | RC RC [ IS[0] @{ RI[0] RV[0] RV[0] @} ... IS[RC-1] @{ RI[RC-1] RV[RC-1] RV[RC-1] @} ]
+@end example
+@*
+
@table @strong
-@item byte 0: memspace
+@item MS: 1 byte: memspace
Describes which part of the computer you want to write:
@itemize
@@ -21775,14 +21847,24 @@
@item 0x04: drive 11
@end itemize
-@item byte 1-2: The count of the array items
+@item RC: 2 bytes: Register count
-@item byte 3+: An array with items of structure:
+@item Array: RC*(IS+1) bytes: An array with items of structure:
@table @strong
-@item byte 0: Size of the item, excluding this byte
-@item byte 1: ID of the register
-@item byte 2-3: register value
+
+@item
+
+[
+
+@item IS: 1 byte: Item size, excluding this byte
+@item RI: 1 byte: Register ID
+@item RV: 2 bytes: Register value
+
+@item
+
+]
+
@end table
@end table
@@ -21798,16 +21880,21 @@
Command body:
+@example
+SR | SD | FL | FN[0] FN[1] ... FN[FL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Save ROMs to snapshot file?
+@item SR: 1 byte: Save ROMs to snapshot file?
>=0x01: true, 0x00: false
-@item byte 1: Save disks to snapshot file?
+@item SD: 1 byte: Save disks to snapshot file?
>=0x01: true, 0x00: false
-@item byte 2: Length of filename
+@item FL: 1 byte: Length of filename
-@item byte 3+: Filename
+@item FN: FL bytes: Filename
The filename to save the snapshot to.
@end table
@@ -21818,7 +21905,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_UNDUMP
@subsection Undump (0x42)
@@ -21829,10 +21919,15 @@
Command body:
+@example
+FL | FN[0] FN[1] ... FN[FL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Length of filename
+@item FL: 1 byte: Length of filename
-@item byte 1+: Filename
+@item FN: FL bytes: Filename
The filename to load the snapshot from.
@end table
@@ -21843,8 +21938,13 @@
Response body:
+@example
+PC PC
+@end example
+@*
+
@table @strong
-@item byte 0-1: The current program counter position
+@item PC: 2 bytes: The current program counter position
@end table
@@ -21857,10 +21957,15 @@
Command body:
+@example
+NL | RN[0] RN[1] ... RN[NL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Length of resource name
+@item NL: 1 byte: Resource name length
-@item byte 1+: Resource name
+@item RN: NL bytes: Resource name
@end table
@@ -21870,13 +21975,18 @@
Response body:
+@example
+RT | VL | RV[0] RV[1] ... RV[VL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Type of the resource
+@item RT: 1 byte: Resource type
0x00: String, 0x01: Integer
-@item byte 1: Length of the value
+@item VL: 1 byte: Resource value length
-@item byte 2+: The value
+@item RV: VL bytes: The resource value
@end table
@@ -21889,18 +21999,23 @@
Command body:
+@example
+RT | NL | RN[0] RN[1] ... RN[NL-1] | VL | RV[0] RV[1] ... RV[VL-1]
+@end example
+@*
+
@table @strong
-@item 1 byte: Type of the resource value
+@item RT: 1 byte: Type of the resource value
0x00: String, 0x01: Integer@*
Strings will be interpreted if the destination is an Integer.
-@item 1 byte: Resource name length = (&name)
+@item NL: 1 byte: Resource name length
-@item (*name) bytes: The resource name
+@item RN: NL bytes: The resource name
-@item 1 byte: Resource value length = (&value)
+@item VL: 1 byte: Resource value length
-@item (*value) bytes: The resource value
+@item RV: VL bytes: The resource value
@end table
@@ -21910,7 +22025,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_ADVANCE_INSTRUCTIONS
@subsection Advance Instructions (0x71)
@@ -21921,11 +22039,16 @@
Command body:
+@example
+SO | IC IC
+@end example
+@*
+
@table @strong
-@item byte 0: Step over subroutines?
+@item SO: 1 byte: Step over subroutines?
Should subroutines count as a single instruction?
-@item byte 1-2: How many instructions to step over.
+@item IC: 2 bytes: How many instructions to step over.
@end table
@@ -21935,7 +22058,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_KEYBOARD_FEED
@subsection Keyboard feed (0x72)
@@ -21948,10 +22074,15 @@
Command body:
+@example
+TL | TC[0] TC[1] ... TC[TL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Length of text
+@item TL: 1 byte: Text Length
-@item byte 1+: The text, in PETSCII
+@item TC: TL bytes: The text content, in PETSCII
@end table
@@ -21961,7 +22092,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_EXECUTE_UNTIL_RETURN
@subsection Execute until return (0x73)
@@ -21974,7 +22108,10 @@
Command body:
+@example
Currently empty.
+@end example
+@*
Response type:
@@ -21982,7 +22119,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_PING
@subsection Ping (0x81)
@@ -21993,7 +22133,10 @@
Command body:
+@example
Always empty
+@end example
+@*
Response type:
@@ -22001,7 +22144,10 @@
Response body:
+@example
Always empty
+@end example
+@*
@node MON_CMD_BANKS_AVAILABLE
@subsection Banks available (0x82)
@@ -22012,7 +22158,10 @@
Command body:
+@example
Currently empty.
+@end example
+@*
Response type:
@@ -22020,19 +22169,33 @@
Response body:
+@example
+BC BC [ IS[0] @{ BI[0] BI[0] | NL[0] | BN[0][0] BN[0][1] ... BN[0][NL[0]-1] @} ... IS[BC-1] @{ ... @} ]
+@end example
+@*
+
@table @strong
-@item byte 0-1: The count of the array items
-@item byte 2+: An array with items of structure:
+@item BC: 2 bytes: Bank item count
+@item Array 1+BC*IS bytes: An array with items of structure:
@table @strong
-@item byte 0: Size of the item, excluding this byte
-@item byte 1-2: bank ID
+@item
-@item byte 3: Name length
+[
-@item byte 4+: Name
+@item IS: 1 byte: Item size, excluding this byte
+@item BI: 2 bytes: Bank ID
+
+@item NL: 1 byte: Name Length
+
+@item BN: NL bytes: Name
+
+@item
+
+]
+
@end table
@end table
@@ -22046,9 +22209,14 @@
Command body:
+@example
+MS
+@end example
+@*
+
@table @strong
-@item byte 0: memspace
+@item MS: 1 byte: memspace
Describes which part of the computer you want to read:
@itemize
@@ -22063,25 +22231,30 @@
Response type:
-0x82: MON_RESPONSE_REGISTERS_AVAILABLE
+0x83: MON_RESPONSE_REGISTERS_AVAILABLE
Response body:
+@example
+RC RC [ IS[0] @{ RI[0] | RS[0] | NL[0] | RN[0][0] RN[0][1] ... RN[0][NL[0]-1] @} ... IS[RC-1] @{ ... @} ]
+@end example
+@*
+
@table @strong
-@item byte 0-1: The count of the array items
-@item byte 2+: An array with items of structure:
+@item RC: 2 bytes: Register item count
+@item Array: RC*(IS+1) bytes: An array with items of structure:
@table @strong
-@item byte 0: Size of the item, excluding this byte
+@item IS: 1 byte: Item Size, excluding this byte
-@item byte 1: ID of the register
+@item RI: 1 byte: Register ID
-@item byte 2: Size of the register in bits
+@item RS: 1 byte: Register Size in bits
-@item byte 3: Length of name
+@item NL: 1 byte: Length of name
-@item byte 4+: Name
+@item RN: NL bytes : Register name
@end table
@@ -22098,12 +22271,17 @@
Command body:
+@example
+VC | FM
+@end example
+@*
+
@table @strong
-@item byte 0: USE VIC-II?
+@item VC: 1 byte: USE VIC-II?
Must be included, but ignored for all but the C128. If true, (>=0x01) the screen
returned will be from the VIC-II. If false (0x00), it will be from the VDC.
-@item byte 1: Format
+@item FM: 1 byte: Format
0x00: Indexed, 8 bit@*
@end table
@@ -22114,32 +22292,36 @@
Response body:
+@example
+FL FL FL FL | DW DW | DH DH | XO XO | YO YO | IW IW | IH IH | BP | BL BL BL BL | BD[0] BD[1] ... BD[BL-1]
+@end example
+@*
+
@table @strong
-@item 4 bytes: Length of the fields before the display buffer
+@item FL: 4 bytes: Length of the fields before the display buffer
-@item 2 bytes: Debug width of display buffer (uncropped)
+@item DW: 2 bytes: Debug width of display buffer (uncropped)
The largest width the screen gets.
-@item 2 bytes: Debug height of display buffer (uncropped)
+@item DH: 2 bytes: Debug height of display buffer (uncropped)
The largest height the screen gets.
-@item 2 bytes: X offset
+@item XO: 2 bytes: X offset
X offset to the inner part of the screen.
-@item 2 bytes: Y offset
+@item YO: 2 bytes: Y offset
Y offset to the inner part of the screen.
-@item 2 bytes: Width of the inner part of the screen.
+@item IW: 2 bytes: Width of the inner part of the screen.
-@item 2 bytes: Height of the inner part of the screen.
+@item IH: 2 bytes: Height of the inner part of the screen.
-@item 1 byte: Bits per pixel of display buffer, 8
+@item BP: 1 byte: Bits per pixel of display buffer, 8
+@item BL: 4 bytes: Length of display buffer
-@item 4 bytes: Length of display buffer = (&buffer)
+@item BD: BL bytes: Display buffer data
-@item (*buffer) bytes: Display buffer data
-
@end table
@node MON_CMD_VICE_INFO
@@ -22151,7 +22333,10 @@
Command body:
+@example
Always empty
+@end example
+@*
Response type:
@@ -22159,19 +22344,122 @@
Response body:
+@example
+ML | MV[0] MV[1] ... MV[ML-1] | SL | SV[0] SV[1] ... SV[SL-1]
+@end example
+@*
+
@table @strong
-@item 1 byte: Length of main version = (&main)
+@item ML: 1 byte: Length of main version
-@item (*main) bytes: Main version
+@item MV: ML bytes: Main version
In linear format. For example 0x03, 0x05, 0x00, 0x00 for 3.5.0.0
-@item 1 byte: Length of SVN revision = (&rev)
+@item SL: 1 byte: Length of SVN revision
-@item (*rev) bytes: SVN revision
+@item SV: SL bytes: SVN revision
In little endian format. Returns zero if it's not an SVN build.
@end table
+@node MON_CMD_CPUHISTORY_GET
+@subsection CPU History (0x86)
+
+Gets records of every instruction executed by an emulated CPU.
+
+Minimum VICE version: 3.10
+
+Command body:
+
+@example
+MS | HC HC HC HC
+@end example
+@*
+
+@table @strong
+@item MS: 1 byte: memspace
+
+@itemize
+@item 0x00: main memory
+@item 0x01: drive 8
+@item 0x02: drive 9
+@item 0x03: drive 10
+@item 0x04: drive 11
+@end itemize
+
+@item HC: 4 bytes: count of items to retrieve
+
+@end table
+
+Response type:
+
+0x86: MON_RESPONSE_CPUHISTORY_GET
+
+Response body:
+
+@example
+HC HC HC HC [
+ IS[0] @{
+ RC[0] RC[0] [
+ RS[0][0] @{ ... @}
+ ...
+ RS[0][RC-1] @{ ... @}
+ ]
+ @}
+ ...
+ IS[HC-1] @{ ... @}
+]
+CL CL CL CL CL CL CL CL | IL | IB[0] IB[1] ... IB[IL-1]
+@end example
+@*
+
+@table @strong
+@item HC: 4 bytes: CPU history item count
+
+@item Array: HC*(IS+1) bytes:
+An array with items of structure:
+
+@table @strong
+@item
+
+[
+
+@item IS: 1 bytes: Item size, excluding this byte
+
+@item RC: 2 bytes: Register item count
+
+@item Array: RC*(RS+1) bytes: Array items of structure:
+
+@table @strong
+@item
+
+[
+
+@item RS: 1 byte: Item size, excluding this byte
+
+@item @{...@}: RS bytes: The array item body from @ref{MON_RESPONSE_REGISTER_INFO}
+
+@item
+
+]
+
+@end table
+
+@item CL: 8 bytes: The CPU clock
+
+@item IL: 1 bytes: instruction bytes length
+
+@item IB: IL bytes: Instruction byte string.
+This is a fixed length and must be interpreted by the client.
+
+@end table
+
+@item
+
+]
+
+@end table
+
@node MON_CMD_PALETTE_GET
@subsection Palette get (0x91)
@@ -22181,8 +22469,13 @@
Command body:
+@example
+VC
+@end example
+@*
+
@table @strong
-@item byte 0: USE VIC-II?
+@item VC: 1 byte: USE VIC-II?
Must be included, but ignored for all but the C128. If true, (>=0x01) the screen
returned will be from the VIC-II. If false (0x00), it will be from the VDC.
@@ -22194,20 +22487,37 @@
Response body:
+@example
+PC PC [
+ IS[0] { RR[0] | GG[0] | BB[0] }
+ ...
+ IS[PC-1] { RR[PC-1] | GG[PC-1] | BB[PC-1] }
+]
+@end example
+@*
+
@table @strong
-@item byte 0-1: The number of palette items.
+@item PC: 2 bytes: The palette item count
-@item byte 2+: An array with items of structure:
+@item Array : PC*(IS+1): An array with items of structure:
@table @strong
-@item byte 0: Size of the item, excluding this byte
+@item
-@item byte 1: Red
+[
-@item byte 2: Green
+@item IS: 1 byte: Item size, excluding this byte
-@item byte 3: Blue
+@item RR: 1 byte: Red
+@item GG: 1 byte: Green
+
+@item BB: 1 byte: Blue
+
+@item
+
+]
+
@end table
@end table
@@ -22221,9 +22531,14 @@
Command body:
+@example
+PN PN | PV PV
+@end example
+@*
+
@table @strong
-@item byte 0-1: The port to set the value on
-@item byte 2-3: The value to set
+@item PN: 2 bytes: The port to set the value on
+@item PV: 2 bytes: The value to set
@end table
@@ -22233,9 +22548,11 @@
Response body:
+@example
Currently empty.
+@end example
+@*
-
@node MON_CMD_USERPORT_SET
@subsection Userport set (0xb2)
@@ -22245,8 +22562,13 @@
Command body:
+@example
+UV UV
+@end example
+@*
+
@table @strong
-@item byte 0-1: The value to set
+@item UV: 2 bytes: The value to set
@end table
@@ -22256,7 +22578,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_EXIT
@subsection Exit (0xaa)
@@ -22267,7 +22592,10 @@
Command body:
+@example
Currently empty.
+@end example
+@*
Response type:
@@ -22275,7 +22603,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_QUIT
@subsection Quit (0xbb)
@@ -22286,7 +22617,10 @@
Command body:
+@example
Currently empty.
+@end example
+@*
Response type:
@@ -22294,7 +22628,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_RESET
@subsection Reset (0xcc)
@@ -22305,8 +22642,13 @@
Command body:
+@example
+RS
+@end example
+@*
+
@table @strong
-@item byte 0: What to reset
+@item RS: 1 byte: What to reset
@itemize
@item 0x00: Reset system
@@ -22322,7 +22664,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node MON_CMD_AUTOSTART
@subsection Autostart / autoload (0xdd)
@@ -22333,16 +22678,21 @@
Command body:
+@example
+RL | FI FI | FL | FN[0] FN[1] ... FN[FL-1]
+@end example
+@*
+
@table @strong
-@item byte 0: Run after loading?
+@item RL: 1 byte: Run after loading?
>=0x01: true, 0x00: false
-@item byte 1-2: File index
+@item FI: 2 bytes: File index
The index of the file to execute, if a disk image. 0x00 is the default value.
-@item byte 3: Length of filename
+@item FL: byte 3: Length of filename
-@item byte 4+: Filename
+@item FN: FL bytes: Filename
The filename to autoload.
@end table
@@ -22353,7 +22703,10 @@
Response body:
+@example
Currently empty.
+@end example
+@*
@node Binary Responses
@section Responses
@@ -22382,7 +22735,10 @@
Response body:
+@example
Usually empty
+@end example
+@*
@node MON_RESPONSE_CHECKPOINT_INFO
@subsection Checkpoint Response (0x11)
@@ -22402,37 +22758,43 @@
Response body:
+@example
+CN CN CN CN | CH | SA SA | EA EA | ST | EN | OP | TM | HC HC HC HC | IC IC IC IC | CE | MS
+@end example
+@*
+
@table @strong
-@item byte 0-3: Checkpoint number
+@item CN: 4 bytes: Checkpoint number
-@item byte 4: Currently hit?
+@item CH: 1 byte: Currently hit?
>=0x01: true, 0x00: false
-@item byte 5-6: start address
+@item SA: 2 bytes: start address
-@item byte 7-8: end address
+@item EA: 2 bytes: end address
-@item byte 9: stop when hit
+@item ST: 1 byte: stop when hit
>=0x01: true, 0x00: false
-@item byte 10: enabled
+@item EN: 1 byte: enabled
>=0x01: true, 0x00: false
-@item byte 11: CPU operation
+@item OP: 1 byte: CPU operation
0x01: load, 0x02: store, 0x04: exec
-@item byte 12: temporary
-Deletes the checkpoint after it has been hit once. This is similar to
-"until" command, but it will not resume the emulator.
+@item TM: 1 byte: temporary
+ Deletes the checkpoint after it has been hit once. This is similar to
+ "until" command, but it will not resume the emulator.
-@item byte 13-16: hit count
+@item HC: 4 bytes: hit count
-@item byte 17-20: ignore count
+@item IC: 4 bytes: ignore count
-@item byte 21: Has condition?
+@item CE: 1 byte: Has condition?
>=0x01: true, 0x00: false
-@item byte 22: memspace
+@item MS: 1 byte: memspace
+Describes which part of the computer to checkpoint:
@itemize
@item 0x00: main memory
@@ -22453,18 +22815,35 @@
Response body:
+@example
+RC RC [
+ IS[0] @{ RI[0] | RV[0] RV[0] @}
+ ...
+ IS[RC-1] @{ RI[RC-1] | RV[RC-1] RV[RC-1] @}
+]
+@end example
+@*
+
@table @strong
-@item byte 0-1: The count of the array items
+@item RC: 2 bytes: The count of the array items
-@item byte 2+: An array with items of structure:
+@item Array: RC*(IS+1): An array with items of structure:
@table @strong
-@item byte 0: Size of the item, excluding this byte
+@item
-@item byte 1: ID of the register
+[
-@item byte 2-3: register value
+@item IS: 1 byte: Item size, excluding this byte
+@item RI: 1 byte: ID of the register
+
+@item RV: 2 bytes: register value
+
+@item
+
+]
+
@end table
@end table
@@ -22481,8 +22860,13 @@
Response body:
+@example
+PC PC
+@end example
+@*
+
@table @strong
-@item byte 0-1: The current program counter position
+@item PC: 2 bytes: The current program counter position
@end table
@@ -22498,8 +22882,13 @@
Response body:
+@example
+PC PC
+@end example
+@*
+
@table @strong
-@item byte 0-1: The current program counter position
+@item PC: 2 bytes: The current program counter position
@end table
@@ -22514,8 +22903,13 @@
Response body:
+@example
+PC PC
+@end example
+@*
+
@table @strong
-@item byte 0-1: The current program counter position
+@item PC: 2 bytes: The current program counter position
@end table
@@ -23774,7 +24168,7 @@
Ettore Perazzoli.)
This format was defined in 1998 as a cooperative effort between several
-emulator people, mainly Per H\xE5kan Sundell, author of the CCS64 C64
+emulator people, mainly Per H�kan Sundell, author of the CCS64 C64
emulator, Andreas Boose of the VICE CBM emulator team and Joe
Forster/STA, the author of Star Commander. It was the first real public
attempt to create a format for the emulator community which removed
@@ -36108,7 +36502,7 @@
GP2X/Dingoo SDL UI issues.
@item
-@b{Istv\xE1n F\xE1bi\xE1n}
+@b{Istv�n F�bi�n}
Contributed a initial patch with the more correct 1541 bus
timing code and which gave us hints for to improving the 1541
emulation.
@@ -36219,7 +36613,7 @@
other patches.
@item
-@b{Frank K\xF6nig}
+@b{Frank K�nig}
Contributed the Win32 joystick autofire feature.
@item
@@ -36268,7 +36662,7 @@
Provided some monitor fixes.
@item
-@b{Marko M\xE4kel\xE4}
+@b{Marko M�kel�}
Wrote lots of CPU documentation. Wrote the VIC Flash Plugin
cartridge emulation in xvic. Wrote the Ultimem cartridge
emulation in xvic.
@@ -36335,7 +36729,7 @@
Digitalized the C64 colors used in the (old) default palette.
@item
-@b{Lasse \xD6\xF6rni}
+@b{Lasse ��rni}
Contributed the Windows Multimedia sound driver
@item
@@ -36582,7 +36976,7 @@
Last but not least, a very special thank to Andreas Arens, Lutz
Sammer, Edgar Tornig, Christian Bauer, Wolfgang Lorenz, Miha
-Peternel, Per H\xE5kan Sundell, David Horrocks, Benjamin Rosseaux and William McCabe
+Peternel, Per H�kan Sundell, David Horrocks, Benjamin Rosseaux and William McCabe
for writing cool emulators to compete with. @t{:-)}
@c end of file generation section.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-03-22 16:45:01
|
Revision: 45561
http://sourceforge.net/p/vice-emu/code/45561
Author: empathicqubit
Date: 2025-03-22 16:44:59 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
Add binary monitor CPUHISTORY_GET command. Refactored cpuhistory filtering into separate functions from the text monitor output. Refactored the binary monitor register writing into separate function.
Modified Paths:
--------------
trunk/vice/src/monitor/mon_memmap.c
trunk/vice/src/monitor/mon_memmap.h
trunk/vice/src/monitor/monitor_binary.c
Modified: trunk/vice/src/monitor/mon_memmap.c
===================================================================
--- trunk/vice/src/monitor/mon_memmap.c 2025-03-22 16:36:49 UTC (rev 45560)
+++ trunk/vice/src/monitor/mon_memmap.c 2025-03-22 16:44:59 UTC (rev 45561)
@@ -68,21 +68,6 @@
#define MEMMAP_ELEM uint16_t
-struct cpuhistory_s {
- CLOCK cycle;
- uint16_t addr;
- uint16_t reg_st;
- uint8_t op;
- uint8_t p1;
- uint8_t p2;
- uint8_t reg_a;
- uint8_t reg_x;
- uint8_t reg_y;
- uint8_t reg_sp;
- MEMSPACE origin;
-};
-typedef struct cpuhistory_s cpuhistory_t;
-
/* CPU history variables */
static cpuhistory_t *cpuhistory = NULL;
static int cpuhistory_buffer_lines = 0; /* actual size of the cyclic buffer */
@@ -122,7 +107,7 @@
if (lines < 10140) {
lines = 10140;
}
- lines *= 5;
+ lines = lines * 5 + 1;
cpuhistory = lib_realloc(cpuhistory, (size_t)lines * sizeof(cpuhistory_t));
@@ -181,40 +166,19 @@
cpuhistory[cpuhistory_i].p2 = p2;
}
-void mon_cpuhistory(int count, MEMSPACE filter1, MEMSPACE filter2, MEMSPACE filter3,
- MEMSPACE filter4, MEMSPACE filter5)
-{
- uint8_t op, p1, p2, p3 = 0;
- MEMSPACE mem;
- uint16_t loc, addr;
- int hex_mode = 1;
- const char *dis_inst;
- unsigned opc_size;
+cpuhistory_t *mon_cpuhistory_seek(int count, MEMSPACE filter1, MEMSPACE filter2,
+ MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5) {
int i, pos;
- CLOCK cycle;
- char otext[10];
- /* if nothing passed, set the first filter to the default device */
- if ((filter1 == e_invalid_space) &&
- (filter2 == e_invalid_space) &&
- (filter3 == e_invalid_space) &&
- (filter4 == e_invalid_space) &&
- (filter5 == e_invalid_space)) {
- filter1 = default_memspace;
- }
-
- /* determine the actual maximum records to go through */
- if (count < 1) {
- count = cpuhistory_show_lines;
- } else if (count > cpuhistory_buffer_lines) {
- count = cpuhistory_buffer_lines;
- }
-
/* 'i' is the actual counter */
i = 0;
/* start looking at last entry */
pos = cpuhistory_i;
+ if (count >= cpuhistory_buffer_lines) {
+ count = cpuhistory_buffer_lines - 1;
+ }
+
/* find out where we need to start */
while (i < count) {
/* make sure the record matches */
@@ -234,51 +198,94 @@
/* this is totally possible since the emulation runs each CPU in
chunks and eventually syncs up. Syncing is more aggressive
when talking between devices. */
- if (pos == cpuhistory_i) {
+ if (pos == (cpuhistory_i + 1) % cpuhistory_buffer_lines) {
break;
}
}
+ return &cpuhistory[pos];
+}
+
+cpuhistory_t *mon_cpuhistory_next(cpuhistory_t *current, MEMSPACE filter1, MEMSPACE filter2,
+ MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5) {
+ cpuhistory_t *wrap = &cpuhistory[cpuhistory_buffer_lines];
+ cpuhistory_t *head = &cpuhistory[(cpuhistory_i + 1) % cpuhistory_buffer_lines];
+ do {
+ current += 1;
+ if (current >= wrap) {
+ current = &cpuhistory[0];
+ } else if (current == head) {
+ return NULL;
+ }
+ /* make sure the record matches */
+ } while (!((current->origin != e_invalid_space)
+ && ((filter1 == current->origin)
+ || (filter2 == current->origin)
+ || (filter3 == current->origin)
+ || (filter4 == current->origin)
+ || (filter5 == current->origin))));
+
+ return current;
+}
+
+void mon_cpuhistory(int count, MEMSPACE filter1, MEMSPACE filter2, MEMSPACE filter3,
+ MEMSPACE filter4, MEMSPACE filter5)
+{
+ uint8_t op, p1, p2, p3 = 0;
+ MEMSPACE mem;
+ uint16_t loc, addr;
+ int hex_mode = 1;
+ const char *dis_inst;
+ cpuhistory_t *current;
+ unsigned opc_size;
+ CLOCK cycle;
+ char otext[10];
+
+ /* if nothing passed, set the first filter to the default device */
+ if ((filter1 == e_invalid_space) &&
+ (filter2 == e_invalid_space) &&
+ (filter3 == e_invalid_space) &&
+ (filter4 == e_invalid_space) &&
+ (filter5 == e_invalid_space)) {
+ filter1 = default_memspace;
+ }
+
+ /* determine the actual maximum records to go through */
+ if (count < 1) {
+ count = cpuhistory_show_lines;
+ }
+
+ current = mon_cpuhistory_seek(count, filter1, filter2, filter3, filter4, filter5);
+
/* loop through all entries until we find the number records requested */
- while (i > 0) {
- /* adjust our buffer circular reference */
- pos = ( pos + 1) % cpuhistory_buffer_lines;
- /* make sure the record matches */
- if ((cpuhistory[pos].origin != e_invalid_space)
- && ((filter1 == cpuhistory[pos].origin)
- || (filter2 == cpuhistory[pos].origin)
- || (filter3 == cpuhistory[pos].origin)
- || (filter4 == cpuhistory[pos].origin)
- || (filter5 == cpuhistory[pos].origin))) {
- cycle = cpuhistory[pos].cycle;
- addr = cpuhistory[pos].addr;
- op = cpuhistory[pos].op;
- p1 = cpuhistory[pos].p1;
- p2 = cpuhistory[pos].p2;
+ while ((current = mon_cpuhistory_next(current, filter1, filter2, filter3, filter4, filter5))) {
+ cycle = current->cycle;
+ addr = current->addr;
+ op = current->op;
+ p1 = current->p1;
+ p2 = current->p2;
- mem = cpuhistory[pos].origin;
- loc = addr_location(addr);
+ mem = current->origin;
+ loc = addr_location(addr);
- dis_inst = mon_disassemble_to_string_ex(mem, loc, op, p1, p2, p3, hex_mode, &opc_size);
+ dis_inst = mon_disassemble_to_string_ex(mem, loc, op, p1, p2, p3, hex_mode, &opc_size);
- strncpy(otext, mon_memspace_string[mem], 4);
+ strncpy(otext, mon_memspace_string[mem], 4);
- /* Print the disassembled instruction */
- mon_out(".%s:%04x %-26s A:%02x X:%02x Y:%02x SP:%02x %c%c-%c%c%c%c%c %12"PRIu64"\n",
- otext, loc, dis_inst,
- cpuhistory[pos].reg_a, cpuhistory[pos].reg_x,
- cpuhistory[pos].reg_y, cpuhistory[pos].reg_sp,
- ((cpuhistory[pos].reg_st & (1 << 7)) != 0) ? 'N' : '.',
- ((cpuhistory[pos].reg_st & (1 << 6)) != 0) ? 'V' : '.',
- ((cpuhistory[pos].reg_st & (1 << 4)) != 0) ? 'B' : '.',
- ((cpuhistory[pos].reg_st & (1 << 3)) != 0) ? 'D' : '.',
- ((cpuhistory[pos].reg_st & (1 << 2)) != 0) ? 'I' : '.',
- ((cpuhistory[pos].reg_st & (1 << 1)) != 0) ? 'Z' : '.',
- ((cpuhistory[pos].reg_st & (1 << 0)) != 0) ? 'C' : '.',
- cycle
- );
- i--;
- }
+ /* Print the disassembled instruction */
+ mon_out(".%s:%04x %-26s A:%02x X:%02x Y:%02x SP:%02x %c%c-%c%c%c%c%c %12"PRIu64"\n",
+ otext, loc, dis_inst,
+ current->reg_a, current->reg_x,
+ current->reg_y, current->reg_sp,
+ ((current->reg_st & (1 << 7)) != 0) ? 'N' : '.',
+ ((current->reg_st & (1 << 6)) != 0) ? 'V' : '.',
+ ((current->reg_st & (1 << 4)) != 0) ? 'B' : '.',
+ ((current->reg_st & (1 << 3)) != 0) ? 'D' : '.',
+ ((current->reg_st & (1 << 2)) != 0) ? 'I' : '.',
+ ((current->reg_st & (1 << 1)) != 0) ? 'Z' : '.',
+ ((current->reg_st & (1 << 0)) != 0) ? 'C' : '.',
+ cycle
+ );
}
}
Modified: trunk/vice/src/monitor/mon_memmap.h
===================================================================
--- trunk/vice/src/monitor/mon_memmap.h 2025-03-22 16:36:49 UTC (rev 45560)
+++ trunk/vice/src/monitor/mon_memmap.h 2025-03-22 16:44:59 UTC (rev 45561)
@@ -30,6 +30,21 @@
#include "montypes.h"
#include "types.h"
+struct cpuhistory_s {
+ CLOCK cycle;
+ uint16_t addr;
+ uint16_t reg_st;
+ uint8_t op;
+ uint8_t p1;
+ uint8_t p2;
+ uint8_t reg_a;
+ uint8_t reg_x;
+ uint8_t reg_y;
+ uint8_t reg_sp;
+ MEMSPACE origin;
+};
+typedef struct cpuhistory_s cpuhistory_t;
+
void mon_memmap_init(void);
void mon_memmap_shutdown(void);
@@ -36,9 +51,14 @@
int monitor_cpuhistory_allocate(int lines);
void mon_cpuhistory(int count, MEMSPACE filter1, MEMSPACE filter2, MEMSPACE filter3,
MEMSPACE filter4, MEMSPACE filter5);
+cpuhistory_t *mon_cpuhistory_seek(int count, MEMSPACE filter1, MEMSPACE filter2,
+ MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5);
+cpuhistory_t *mon_cpuhistory_next(cpuhistory_t *current, MEMSPACE filter1, MEMSPACE filter2,
+ MEMSPACE filter3, MEMSPACE filter4, MEMSPACE filter5);
void mon_memmap_zap(void);
void mon_memmap_show(int mask, MON_ADDR start_addr, MON_ADDR end_addr);
void mon_memmap_save(const char* filename, int format);
+
#endif
Modified: trunk/vice/src/monitor/monitor_binary.c
===================================================================
--- trunk/vice/src/monitor/monitor_binary.c 2025-03-22 16:36:49 UTC (rev 45560)
+++ trunk/vice/src/monitor/monitor_binary.c 2025-03-22 16:44:59 UTC (rev 45561)
@@ -52,6 +52,7 @@
#include "machine-video.h"
#include "palette.h"
+#include "mon_memmap.h"
#include "mon_breakpoint.h"
#include "mon_file.h"
#include "mon_register.h"
@@ -110,6 +111,7 @@
e_MON_CMD_REGISTERS_AVAILABLE = 0x83,
e_MON_CMD_DISPLAY_GET = 0x84,
e_MON_CMD_VICE_INFO = 0x85,
+ e_MON_CMD_CPUHISTORY_GET = 0x86,
e_MON_CMD_PALETTE_GET = 0x91,
@@ -158,6 +160,7 @@
e_MON_RESPONSE_REGISTERS_AVAILABLE = 0x83,
e_MON_RESPONSE_DISPLAY_GET = 0x84,
e_MON_RESPONSE_VICE_INFO = 0x85,
+ e_MON_RESPONSE_CPUHISTORY_GET = 0x86,
e_MON_RESPONSE_PALETTE_GET = 0x91,
@@ -306,6 +309,15 @@
return output + 4;
}
+/*! \internal \brief Write uint64 to buffer and return pointer to byte after */
+static unsigned char *write_uint64(uint64_t input, unsigned char *output) {
+ for (int i = 0 ; i < 8 ; i++) {
+ output[i] = (uint8_t)(input >> (8 * i)) & 0xFFu;
+ }
+
+ return output + 8;
+}
+
/*! \internal \brief Write string to buffer and return pointer to byte after */
static unsigned char *write_string(uint8_t length, unsigned char *input, unsigned char *output) {
output[0] = length;
@@ -416,47 +428,58 @@
}
}
-static void monitor_binary_response_register_info(uint32_t request_id, MEMSPACE memspace)
-{
- mon_reg_list_t *regs;
- mon_reg_list_t *regs_cursor;
- unsigned char *response;
- unsigned char *response_cursor;
- uint32_t response_size = 2;
- uint16_t count = 0;
- uint8_t item_size = 3;
+#define MON_REGISTER_ITEM_SIZE 3
- regs = mon_register_list_get(memspace);
- regs_cursor = regs;
+static uint16_t *count_registers(mon_reg_list_t *regs) {
+ uint16_t count;
- for( ; regs_cursor->name ; regs_cursor++) {
- if (!ignore_fake_register(regs_cursor)) {
+ for( ; regs->name ; regs++) {
+ if (!ignore_fake_register(regs)) {
++count;
}
}
- response_size += count * (item_size + 1);
- response = lib_malloc(response_size);
- response_cursor = response;
+ return count;
+}
- regs_cursor = regs;
-
+static unsigned char *write_registers(mon_reg_list_t *regs, uint16_t count, unsigned char *response_cursor) {
response_cursor = write_uint16(count, response_cursor);
- for( ; regs_cursor->name ; regs_cursor++) {
- if (ignore_fake_register(regs_cursor)) {
+ for( ; regs->name ; regs++) {
+ if (ignore_fake_register(regs)) {
continue;
}
- *response_cursor = item_size;
+ *response_cursor = MON_REGISTER_ITEM_SIZE;
++response_cursor;
- *response_cursor = regs_cursor->id;
+ *response_cursor = regs->id;
++response_cursor;
- response_cursor = write_uint16((uint16_t)regs_cursor->val, response_cursor);
+ response_cursor = write_uint16((uint16_t)regs->val, response_cursor);
}
+ return response_cursor;
+}
+
+static void monitor_binary_response_register_info(uint32_t request_id, MEMSPACE memspace)
+{
+ mon_reg_list_t *regs;
+ unsigned char *response;
+ unsigned char *response_cursor;
+ uint16_t count;
+ uint32_t response_size = 2;
+
+ regs = mon_register_list_get(memspace);
+
+ count = count_registers(regs);
+
+ response_size += count * (MON_REGISTER_ITEM_SIZE + 1);
+ response = lib_malloc(response_size);
+ response_cursor = response;
+
+ response_cursor = write_registers(regs, count, response_cursor);
+
monitor_binary_response(response_size, e_MON_RESPONSE_REGISTER_INFO, e_MON_ERR_OK, request_id, response);
lib_free(response);
@@ -782,7 +805,7 @@
if(memspace == e_invalid_space) {
monitor_binary_error(e_MON_ERR_INVALID_MEMSPACE, command->request_id);
- log_message(LOG_DEFAULT, "monitor binary memset: Unknown memspace %u", requested_memspace);
+ log_message(LOG_DEFAULT, "monitor binary registers get: Unknown memspace %u", requested_memspace);
return;
}
@@ -1413,6 +1436,148 @@
monitor_binary_response(sizeof(response), e_MON_RESPONSE_VICE_INFO, e_MON_ERR_OK, command->request_id, response);
}
+static void monitor_binary_process_cpuhistory(binary_command_t *command)
+{
+ mon_reg_list_t *regs;
+ mon_reg_list_t *templates;
+ mon_reg_list_t *reg_a;
+ mon_reg_list_t *reg_x;
+ mon_reg_list_t *reg_y;
+ mon_reg_list_t *reg_sp;
+ mon_reg_list_t *reg_flags;
+ mon_reg_list_t *reg_pc;
+ mon_reg_list_t *reg_lin;
+ mon_reg_list_t *reg_cyc;
+ int i;
+ int registers_per_row = 8;
+ unsigned char *response;
+ unsigned char *response_cursor;
+ uint8_t instruction_length = 4;
+ uint16_t requested_count, count = 0;
+ uint32_t response_size;
+ int item_size = 2 + registers_per_row * (MON_REGISTER_ITEM_SIZE + 1) + 8 + 1 + instruction_length;
+
+ cpuhistory_t *current;
+
+ uint8_t requested_memspace = command->body[0];
+
+ MEMSPACE memspace;
+ if (command->length < 5) {
+ monitor_binary_error(e_MON_ERR_CMD_INVALID_LENGTH, command->request_id);
+ return;
+ }
+
+ memspace = get_requested_memspace(requested_memspace);
+
+ if (memspace == e_invalid_space) {
+ monitor_binary_error(e_MON_ERR_INVALID_MEMSPACE, command->request_id);
+ log_message(LOG_DEFAULT, "monitor binary cpuhistory: Unknown memspace %u", requested_memspace);
+ return;
+ }
+
+ requested_count = little_endian_to_uint32(&command->body[1]);
+
+ if (requested_count < 1) {
+ monitor_binary_error(e_MON_ERR_INVALID_PARAMETER, command->request_id);
+ log_message(LOG_DEFAULT, "monitor binary cpuhistory: Invalid count %u", count);
+ return;
+ }
+
+ current = mon_cpuhistory_seek(requested_count, memspace, memspace, memspace, memspace, memspace);
+ while ((current = mon_cpuhistory_next(current, memspace, memspace, memspace, memspace, memspace))) {
+ ++count;
+ response_size = 4 + count * (item_size + 1);
+ if (response_size >= UINT32_MAX) {
+ --count;
+ break;
+ }
+ }
+
+ response_size = 4 + count * (item_size + 1);
+ response = lib_malloc(response_size);
+ response_cursor = response;
+
+ regs = lib_calloc(1, sizeof(mon_reg_list_t) * (registers_per_row + 1));
+
+ templates = mon_register_list_get(memspace);
+
+ for (i = 0; templates[i].name != NULL; i++) {
+ unsigned int id = templates[i].id;
+ mon_reg_list_t *template = &templates[i];
+ if (ignore_fake_register(template)) {
+ continue;
+ } else if (id == e_PC) {
+ memcpy(®s[0], template, sizeof(mon_reg_list_t));
+ reg_pc = ®s[0];
+ } else if (id == e_A) {
+ memcpy(®s[1], template, sizeof(mon_reg_list_t));
+ reg_a = ®s[1];
+ } else if (id == e_X) {
+ memcpy(®s[2], template, sizeof(mon_reg_list_t));
+ reg_x = ®s[2];
+ } else if (id == e_Y) {
+ memcpy(®s[3], template, sizeof(mon_reg_list_t));
+ reg_y = ®s[3];
+ } else if (id == e_SP) {
+ memcpy(®s[4], template, sizeof(mon_reg_list_t));
+ reg_sp = ®s[4];
+ } else if (id == e_FLAGS) {
+ memcpy(®s[5], template, sizeof(mon_reg_list_t));
+ reg_flags = ®s[5];
+ } else if (id == e_Rasterline) {
+ memcpy(®s[6], template, sizeof(mon_reg_list_t));
+ reg_lin = ®s[6];
+ } else if (id == e_Cycle) {
+ memcpy(®s[7], template, sizeof(mon_reg_list_t));
+ reg_cyc = ®s[7];
+ }
+ }
+
+ response_cursor = write_uint32(count, response_cursor);
+
+ current = mon_cpuhistory_seek(count, memspace, memspace, memspace, memspace, memspace);
+ while ((current = mon_cpuhistory_next(current, memspace, memspace, memspace, memspace, memspace))) {
+ reg_a->val = current->reg_a;
+ reg_x->val = current->reg_x;
+ reg_y->val = current->reg_y;
+ reg_sp->val = current->reg_sp;
+ reg_flags->val = current->reg_st;
+ reg_pc->val = current->addr;
+ reg_lin->val = 0xffff;
+ reg_cyc->val = 0xffff;
+
+ *response_cursor = item_size;
+ ++response_cursor;
+
+ response_cursor = write_registers(regs, registers_per_row, response_cursor);
+
+ /* This is here so that the register array doesn't separate it from future fields. */
+ response_cursor = write_uint64(current->cycle, response_cursor);
+
+ *response_cursor = instruction_length;
+ ++response_cursor;
+
+ *response_cursor = current->op;
+ ++response_cursor;
+
+ *response_cursor = current->p1;
+ ++response_cursor;
+
+ *response_cursor = current->p2;
+ ++response_cursor;
+
+ /* Placeholder for third parameter, which exists on some machines */
+ *response_cursor = 0xff;
+ ++response_cursor;
+ }
+
+ monitor_binary_response(response_size, e_MON_RESPONSE_CPUHISTORY_GET, e_MON_ERR_OK, command->request_id, response);
+
+ lib_free(templates);
+ lib_free(response);
+}
+
+
static void monitor_binary_process_mem_get(binary_command_t *command)
{
unsigned char *response;
@@ -1628,6 +1793,8 @@
monitor_binary_process_display_get(&command);
} else if (command_type == e_MON_CMD_VICE_INFO) {
monitor_binary_process_vice_info(&command);
+ } else if (command_type == e_MON_CMD_CPUHISTORY_GET) {
+ monitor_binary_process_cpuhistory(&command);
} else if (command_type == e_MON_CMD_EXIT) {
monitor_binary_process_exit(&command);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <emp...@us...> - 2025-03-22 16:37:02
|
Revision: 45560
http://sourceforge.net/p/vice-emu/code/45560
Author: empathicqubit
Date: 2025-03-22 16:36:49 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
Add test for CPUHISTORY_GET binary monitor command
Modified Paths:
--------------
testprogs/remotemonitor/binmontest/main.c
testprogs/remotemonitor/binmontest/util.c
testprogs/remotemonitor/binmontest/util.h
Modified: testprogs/remotemonitor/binmontest/main.c
===================================================================
--- testprogs/remotemonitor/binmontest/main.c 2025-03-22 16:02:07 UTC (rev 45559)
+++ testprogs/remotemonitor/binmontest/main.c 2025-03-22 16:36:49 UTC (rev 45560)
@@ -175,7 +175,72 @@
CuAssertIntEquals(tc, 7, assert_count);
}
+void cpuhistory_works(CuTest *tc) {
+ int length, count, i, j;
+ int assert_count = 0;
+ unsigned char* cursor;
+ // Get
+ unsigned char get_command[] = {
+ 0x02, API_VERSION,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xa3, 0x1f, 0xd8, 0xc7,
+
+ 0x86,
+
+ // memspace
+ 0x00,
+
+ // record count
+ 0x0a, 0x00, 0x00, 0x00
+ };
+
+ connection_setup(tc);
+
+ send_command(get_command);
+
+ length = wait_for_response_id(tc, get_command);
+
+ CuAssertIntEquals(tc, 0x86, response[RESPONSE_TYPE]);
+
+ count = little_endian_to_uint32(&response[HEADER_LENGTH]);
+
+ // record count
+ CuAssertIntEquals(tc, 10, count);
+
+ cursor = &response[HEADER_LENGTH + 4];
+
+ for (i = 0 ; i < count ; i++) {
+ uint8_t item_size = cursor[0];
+ uint8_t reg_count = little_endian_to_uint16(&cursor[1]);
+ unsigned char *reg_cursor = &cursor[3];
+
+ CuAssertIntEquals(tc, 47, item_size);
+ CuAssertIntEquals(tc, 8, reg_count);
+
+ for (j = 0 ; j < reg_count ; j++) {
+ uint8_t reg_size = reg_cursor[0];
+ uint8_t id = reg_cursor[1];
+ uint16_t val = little_endian_to_uint16(®_cursor[2]);
+
+ fprintf(stderr, "%02x:%04x ", id, val);
+
+ reg_cursor += reg_size + 1;
+ }
+
+ fprintf(stderr, "CLK:%08lx ", little_endian_to_uint64(®_cursor[0]));
+ reg_cursor += 8;
+
+ fprintf(stderr, "INST:%02x %02x %02x %02x\n", reg_cursor[1], reg_cursor[2], reg_cursor[3], reg_cursor[4]);
+
+ reg_cursor += reg_cursor[0] + 1;
+
+ cursor += item_size + 1;
+
+ CuAssertTrue(tc, cursor == reg_cursor);
+ }
+}
+
void registers_get_works(CuTest *tc) {
int length, count, i;
int assert_count = 0;
@@ -238,7 +303,7 @@
) {
++assert_count;
} else if(id == 0x38) {
- CuAssertIntEquals(tc, 0x17, val);
+ CuAssertIntEquals(tc, 23, val);
++assert_count;
}
@@ -1237,6 +1302,8 @@
{
CuSuite* suite = CuSuiteNew();
+ SUITE_ADD_TEST(suite, little_endian_to_uint64_works);
+
SUITE_ADD_TEST(suite, request_id_is_set);
SUITE_ADD_TEST(suite, checkpoint_set_works);
@@ -1271,6 +1338,7 @@
SUITE_ADD_TEST(suite, registers_available_works);
SUITE_ADD_TEST(suite, display_get_works);
SUITE_ADD_TEST(suite, vice_info_works);
+ SUITE_ADD_TEST(suite, cpuhistory_works);
SUITE_ADD_TEST(suite, palette_get_works);
Modified: testprogs/remotemonitor/binmontest/util.c
===================================================================
--- testprogs/remotemonitor/binmontest/util.c 2025-03-22 16:02:07 UTC (rev 45559)
+++ testprogs/remotemonitor/binmontest/util.c 2025-03-22 16:36:49 UTC (rev 45560)
@@ -24,8 +24,18 @@
*
*/
+#include "util.h"
+
#include <stdint.h>
+uint64_t little_endian_to_uint64(unsigned char *input) {
+ uint64_t sum = 0;
+ for (int i = 0 ; i < 8 ; i++) {
+ sum += ((uint64_t)input[i]) << (8 * i);
+ }
+ return sum;
+}
+
uint32_t little_endian_to_uint32(unsigned char *input) {
return (input[3] << 24) + (input[2] << 16) + (input[1] << 8) + input[0];
}
@@ -48,4 +58,24 @@
output[3] = (uint8_t)(input >> 24) & 0xFFu;
return output + 4;
-}
\ No newline at end of file
+}
+
+void little_endian_to_uint64_works(CuTest *tc) {
+ unsigned char max[] = {
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ };
+ unsigned char min[] = {
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ };
+ unsigned char asc[] = {
+ 0xf0, 0xde, 0xbc, 0x9a,
+ 0x78, 0x56, 0x34, 0x12,
+ };
+
+ CuAssertTrue(tc, 0 == little_endian_to_uint64(min));
+ CuAssertTrue(tc, 0xffffffffffffffff == little_endian_to_uint64(max));
+ CuAssertTrue(tc, 0x123456789abcdef0 == little_endian_to_uint64(asc));
+}
+
Modified: testprogs/remotemonitor/binmontest/util.h
===================================================================
--- testprogs/remotemonitor/binmontest/util.h 2025-03-22 16:02:07 UTC (rev 45559)
+++ testprogs/remotemonitor/binmontest/util.h 2025-03-22 16:36:49 UTC (rev 45560)
@@ -27,6 +27,10 @@
#ifndef BINMONTEST_UTIL_H
#define BINMONTEST_UTIL_H
+#include "CuTest.h"
+
+#include <stdint.h>
+
#define HEADER_LENGTH 12
#define RESPONSE_TYPE 6
#define RESPONSE_ERROR 7
@@ -37,9 +41,11 @@
#define COMMAND_LENGTH 2
#define API_VERSION 0x02
+void little_endian_to_uint64_works(CuTest *tc);
+uint64_t little_endian_to_uint64(unsigned char *input);
uint32_t little_endian_to_uint32(unsigned char *input);
uint16_t little_endian_to_uint16(unsigned char *input);
unsigned char *write_uint16(uint16_t input, unsigned char *output);
unsigned char *write_uint32(uint32_t input, unsigned char *output);
-#endif
\ No newline at end of file
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-22 16:02:16
|
Revision: 45559
http://sourceforge.net/p/vice-emu/code/45559
Author: compyx
Date: 2025-03-22 16:02:07 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
Merge trunk (r45543:HEAD) into branch
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/userport/userport_wic64.c
Modified: branches/compyx/joymap-001/vice/src/userport/userport_wic64.c
===================================================================
--- branches/compyx/joymap-001/vice/src/userport/userport_wic64.c 2025-03-22 15:55:20 UTC (rev 45558)
+++ branches/compyx/joymap-001/vice/src/userport/userport_wic64.c 2025-03-22 16:02:07 UTC (rev 45559)
@@ -1063,7 +1063,7 @@
} else {
/* firmeare handles codes: 301, 302, 307, 308 - check if needed with libcurl */
char m[64];
- snprintf(m, 64, "Unhandled http response %ld, received %"PRI_SIZE_T" bytes", response, httpbufferptr);
+ snprintf(m, 64, "Unhandled http response %ld, received %llu bytes", response, (unsigned long long)httpbufferptr);
wic64_log(LOG_COL_LRED, m);
if (httpbufferptr > 0) {
send_reply_revised(SUCCESS, "Success", httpbuffer,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-22 15:55:22
|
Revision: 45558
http://sourceforge.net/p/vice-emu/code/45558
Author: compyx
Date: 2025-03-22 15:55:20 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
"Fix" Windows size_t printing
Somehow mingw refuses to accept Iu, I64u, and even at some point suggested
I64llu, so just cast to `unsigned long long`, use %llu and fuck it.
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-03-22 08:53:03 UTC (rev 45557)
+++ trunk/vice/src/userport/userport_wic64.c 2025-03-22 15:55:20 UTC (rev 45558)
@@ -1063,7 +1063,7 @@
} else {
/* firmeare handles codes: 301, 302, 307, 308 - check if needed with libcurl */
char m[64];
- snprintf(m, 64, "Unhandled http response %ld, received %"PRI_SIZE_T" bytes", response, httpbufferptr);
+ snprintf(m, 64, "Unhandled http response %ld, received %llu bytes", response, (unsigned long long)httpbufferptr);
wic64_log(LOG_COL_LRED, m);
if (httpbufferptr > 0) {
send_reply_revised(SUCCESS, "Success", httpbuffer,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2025-03-22 08:53:07
|
Revision: 45557
http://sourceforge.net/p/vice-emu/code/45557
Author: compyx
Date: 2025-03-22 08:53:03 +0000 (Sat, 22 Mar 2025)
Log Message:
-----------
Joystick: Windows: implement `poll()` driver method
Implement polling for the DirectInput driver. Might require having the driver
keep a private 'prev' value to avoid unnecessary callbacks to `joy_*_event()`
in the common joystick system, DirectInput isn't event driven, so we get a lot
of (unchanged) data when polling each scanline.
Modified Paths:
--------------
branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
branches/compyx/joymap-001/vice/src/joyport/joystick.h
Modified: branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c
===================================================================
--- branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-22 04:39:53 UTC (rev 45556)
+++ branches/compyx/joymap-001/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-03-22 08:53:03 UTC (rev 45557)
@@ -440,7 +440,109 @@
static void win32_joy_poll(joystick_device_t *joydev)
{
- /* TODO */
+ joy_priv_t *priv;
+ DIJOYSTATE2 jstate;
+ /* map axis instance (dwType & 0xff) IDs to their position in the joystick
+ * state DIJOYSTATE2 struct: */
+ LONG *axis_map[] = {
+ &jstate.lX, &jstate.lY, &jstate.lZ,
+ &jstate.lRx, &jstate.lRy, &jstate.lRz,
+ &jstate.lVX, &jstate.lVY, &jstate.lVZ,
+ &jstate.lVRx, &jstate.lVRy, &jstate.lVRz,
+ &jstate.lAX, &jstate.lAY, &jstate.lAZ,
+ &jstate.lARx, &jstate.lARy, &jstate.lARz,
+ &jstate.lFX, &jstate.lFY, &jstate.lFZ,
+ &jstate.lFRx, &jstate.lFRy, &jstate.lFRz
+ };
+ int i;
+ HRESULT result;
+
+ /* poll device */
+ priv = joydev->priv;
+ result = IDirectInputDevice8_Poll(priv->didev);
+ if (result != DI_OK && result != DI_NOEFFECT) {
+ return;
+ }
+
+ /* get device state */
+ result = IDirectInputDevice8_GetDeviceState(priv->didev, sizeof(jstate), &jstate);
+ if (result != DI_OK) {
+ return;
+ }
+
+ /* handle buttons */
+ for (i = 0; i < joydev->num_buttons; i++) {
+ /* buttons are simply listed in sequence, starting at 0 */
+ joystick_button_t *button = joydev->buttons[i];
+ int32_t value = jstate.rgbButtons[i] & 0x80;
+
+ joy_button_event(joydev, button, value);
+ }
+
+ /* handle axes */
+ for (i = 0; i < joydev->num_axes; i++) {
+ joystick_axis_t *axis = joydev->axes[i];
+ uint32_t code = axis->code;
+
+ if (code < sizeof axis_map / sizeof axis_map[0]) {
+ int32_t minimum = axis->minimum;
+ int32_t maximum = axis->maximum;
+ int32_t range = maximum - minimum;
+ int32_t value = *(axis_map[code]);
+
+ //printf("axis %d raw value = %d\n", i, value);
+
+ if (value <= minimum + (range / 4)) {
+ joy_axis_event(joydev, axis, JOY_AXIS_NEGATIVE);
+ } else if (value >= maximum - (range / 4)) {
+ joy_axis_event(joydev, axis, JOY_AXIS_POSITIVE);
+ } else {
+ joy_axis_event(joydev, axis, JOY_AXIS_MIDDLE);
+ }
+ }
+ }
+
+ /* handle POVs */
+ for (i = 0; i < joydev->num_hats; i++) {
+ /* POVs are simply reported sequentially, so hat index is POV value index */
+ joystick_hat_t *hat = joydev->hats[i];
+ int32_t value = LOWORD(jstate.rgdwPOV[i]);
+ int32_t direction = JOYSTICK_DIRECTION_NONE; /* neutral */
+
+ /* POVs map to 360 degrees, in units of 1/100th of a degree, neutral
+ * is reported as -1 / 0xffffffff.
+ * Translate position on a circle to joystick directions, clockwise
+ * from North through to Northwest */
+ if (value < 0 || value >= 36000) {
+ /* invalid: report neutral position */
+ direction = JOYSTICK_DIRECTION_NONE;
+ } else if (value >= 33750 || value < 2250) {
+ /* North */
+ direction = JOYSTICK_DIRECTION_UP;
+ } else if (value >= 2250 && value < 6750) {
+ /* Northeast */
+ direction = JOYSTICK_DIRECTION_UP|JOYSTICK_DIRECTION_RIGHT;
+ } else if (value >= 6750 && value < 11250) {
+ /* East */
+ direction = JOYSTICK_DIRECTION_RIGHT;
+ } else if (value >= 11250 && value < 15750) {
+ /* Southeast */
+ direction = JOYSTICK_DIRECTION_DOWN|JOYSTICK_DIRECTION_RIGHT;
+ } else if (value >= 15750 && value < 20250) {
+ /* South */
+ direction = JOYSTICK_DIRECTION_DOWN;
+ } else if (value >= 20250 && value < 24750) {
+ /* Southwest */
+ direction = JOYSTICK_DIRECTION_DOWN|JOYSTICK_DIRECTION_LEFT;
+ } else if (value >= 24750 && value < 29250) {
+ /* West */
+ direction = JOYSTICK_DIRECTION_LEFT;
+ } else if (value >= 29250 && value < 33750) {
+ /* Northwest */
+ direction = JOYSTICK_DIRECTION_UP|JOYSTICK_DIRECTION_LEFT;
+ }
+ joy_hat_event(joydev, hat, direction);
+ }
}
/** \brief Close joystick device
@@ -521,13 +623,13 @@
axis = joystick_axis_new(lpddoi->tszName);
axis->code = DIDFT_GETINSTANCE(lpddoi->dwType);
- /* obtain logical range of axis */
+ /* obtain raw range of axis */
range.diph.dwSize = sizeof(DIPROPRANGE);
range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
range.diph.dwObj = lpddoi->dwType;
range.diph.dwHow = DIPH_BYID;
result = IDirectInputDevice8_GetProperty(priv->didev,
- DIPROP_LOGICALRANGE,
+ DIPROP_RANGE,
&range.diph);
if (SUCCEEDED(result)) {
axis->minimum = range.lMin;
Modified: branches/compyx/joymap-001/vice/src/joyport/joystick.h
===================================================================
--- branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-22 04:39:53 UTC (rev 45556)
+++ branches/compyx/joymap-001/vice/src/joyport/joystick.h 2025-03-22 08:53:03 UTC (rev 45557)
@@ -36,6 +36,7 @@
#include "lib.h"
+#define JOYSTICK_DIRECTION_NONE 0
#define JOYSTICK_DIRECTION_UP 1
#define JOYSTICK_DIRECTION_DOWN 2
#define JOYSTICK_DIRECTION_LEFT 4
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|