vice-emu-commit Mailing List for VICE (Page 30)
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
(28) |
Nov
|
Dec
|
|
From: <tl...@us...> - 2024-04-04 19:55:33
|
Revision: 45075
http://sourceforge.net/p/vice-emu/code/45075
Author: tlr
Date: 2024-04-04 19:55:30 +0000 (Thu, 04 Apr 2024)
Log Message:
-----------
refactored
Modified Paths:
--------------
testprogs/C64/carts/rr-freeze/rr-freeze.asm
Modified: testprogs/C64/carts/rr-freeze/rr-freeze.asm
===================================================================
--- testprogs/C64/carts/rr-freeze/rr-freeze.asm 2024-04-04 19:43:55 UTC (rev 45074)
+++ testprogs/C64/carts/rr-freeze/rr-freeze.asm 2024-04-04 19:55:30 UTC (rev 45075)
@@ -110,9 +110,15 @@
org $0e00
code_area:
- ds.b $0200
+ ds.b RAM_CODE_LEN
+code_area_end:
+ if code_area_end > $1000
+ echo "ERROR: ram_code exceeds ultimax available ram", code_area_end
+ err
+ endif
+
seg code
org $8000
;**************************************************************************
@@ -278,6 +284,10 @@
lda ram_code_st+$0100,x
sta ram_code+$0100,x
endif
+ if RAM_CODE_LEN > $0200
+ lda ram_code_st+$0200,x
+ sta ram_code+$0200,x
+ endif
inx
bne ic_lp1
@@ -325,6 +335,10 @@
prc_lp2:
sta $9e00,x
sta $9f00,x
+ sta $be00,x
+ sta $de00,x
+ sta $df00,x
+ sta $fe00,x
inx
bne prc_lp2
@@ -388,10 +402,12 @@
;* tag data
tag:
dc.b "BANK"
+TAG_HD_LEN equ .-tag
tag_page:
- dc.b $9e ; page
+ dc.b 0 ; page
tag_bank:
dc.b 0 ; bank
+tag_flag:
dc.b 0 ; flags
TAG_LEN equ .-tag
@@ -424,7 +440,7 @@
ldy #0
vs_lp1:
lda (ptr_zp),y
- cpy #4
+ cpy #TAG_HD_LEN
bcs vs_skp1
cmp tag,y
bne vs_fl1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tl...@us...> - 2024-04-04 19:43:56
|
Revision: 45074
http://sourceforge.net/p/vice-emu/code/45074
Author: tlr
Date: 2024-04-04 19:43:55 +0000 (Thu, 04 Apr 2024)
Log Message:
-----------
refactored
Modified Paths:
--------------
testprogs/C64/carts/rr-freeze/rr-freeze.asm
Modified: testprogs/C64/carts/rr-freeze/rr-freeze.asm
===================================================================
--- testprogs/C64/carts/rr-freeze/rr-freeze.asm 2024-04-04 19:37:24 UTC (rev 45073)
+++ testprogs/C64/carts/rr-freeze/rr-freeze.asm 2024-04-04 19:43:55 UTC (rev 45074)
@@ -20,12 +20,14 @@
dc.b "BANK"
dc.b {1} ; page
dc.b {2} ; bank
- dc.b {3} ; is_rom?
+ dc.b {3} ; flags
dc.b "B"^"A"^"N"^"K"^{1}^{2}^{3}^CHK_MAGIC ; checksum
endm
FLAG_IS_ROM equ %10000000
FLAG_WRITABLE equ %01000000
+FLAGS_MISMATCH equ $fe
+FLAGS_NOCART equ $ff
seg.u zp
;**************************************************************************
@@ -44,7 +46,7 @@
ds.b 1
bank_zp:
ds.b 1
-wr_zp:
+flags_zp:
ds.b 1
banks_zp:
ds.b 5
@@ -390,7 +392,7 @@
dc.b $9e ; page
tag_bank:
dc.b 0 ; bank
- dc.b 0 ; is_rom?
+ dc.b 0 ; flags
TAG_LEN equ .-tag
@@ -415,7 +417,7 @@
sta ptr_zp
lda #0
- sta wr_zp
+ sta flags_zp
lda #CHK_MAGIC
sta chk_zp
@@ -446,32 +448,30 @@
cmp (ptr_zp),y
bne vs_skp2
lda #FLAG_WRITABLE
- ora wr_zp
- sta wr_zp
+ ora flags_zp
+ sta flags_zp
vs_skp2:
ldy #4
- lda (ptr_zp),y
+ lda (ptr_zp),y ; page
sta page_zp
eor ptr_zp+1
and #$1f
bne vs_fl2
iny
- lda (ptr_zp),y
- sta bank_zp
+ lda (ptr_zp),y ; bank
iny
- lda (ptr_zp),y
- ora wr_zp
- ora bank_zp
+ ora (ptr_zp),y ; flags
+ ora flags_zp
sta bank_zp
clc
rts
vs_fl2:
- lda #$fe
+ lda #FLAGS_MISMATCH
dc.b $2c
vs_fl1:
- lda #$ff
+ lda #FLAGS_NOCART
sta bank_zp
sec
rts
@@ -946,9 +946,9 @@
tay
jsr print_space ; place holder for the char to be printed
tya
- cmp #$fe
+ cmp #FLAGS_MISMATCH
beq ptg_fl1
- cmp #$ff
+ cmp #FLAGS_NOCART
beq ptg_fl2
sta tmp_zp
tay
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tl...@us...> - 2024-04-04 19:37:25
|
Revision: 45073
http://sourceforge.net/p/vice-emu/code/45073
Author: tlr
Date: 2024-04-04 19:37:24 +0000 (Thu, 04 Apr 2024)
Log Message:
-----------
cleaned up tagging
Modified Paths:
--------------
testprogs/C64/carts/rr-freeze/rr-freeze.asm
Modified: testprogs/C64/carts/rr-freeze/rr-freeze.asm
===================================================================
--- testprogs/C64/carts/rr-freeze/rr-freeze.asm 2024-04-04 19:24:51 UTC (rev 45072)
+++ testprogs/C64/carts/rr-freeze/rr-freeze.asm 2024-04-04 19:37:24 UTC (rev 45073)
@@ -1,7 +1,7 @@
;**************************************************************************
;*
;* FILE rr-freeze.asm
-;* Copyright (c) 2016 Daniel Kahlin <da...@ka...>
+;* Copyright (c) 2016, 2024 Daniel Kahlin <da...@ka...>
;* Written by Daniel Kahlin <da...@ka...>
;*
;* DESCRIPTION
@@ -10,7 +10,7 @@
;******
processor 6502
-TEST_REVISION eqm "R05"
+TEST_REVISION eqm "R06"
FORMAT_REVISION equ 0
;******
@@ -24,6 +24,8 @@
dc.b "B"^"A"^"N"^"K"^{1}^{2}^{3}^CHK_MAGIC ; checksum
endm
+FLAG_IS_ROM equ %10000000
+FLAG_WRITABLE equ %01000000
seg.u zp
;**************************************************************************
@@ -412,6 +414,9 @@
lda #$80
sta ptr_zp
+ lda #0
+ sta wr_zp
+
lda #CHK_MAGIC
sta chk_zp
ldy #0
@@ -431,9 +436,7 @@
bne vs_fl1
; check if writable
- iny
- lda #0
- sta wr_zp
+ ldy #8
lda #$aa
sta (ptr_zp),y
cmp (ptr_zp),y
@@ -442,7 +445,9 @@
sta (ptr_zp),y
cmp (ptr_zp),y
bne vs_skp2
- inc wr_zp
+ lda #FLAG_WRITABLE
+ ora wr_zp
+ sta wr_zp
vs_skp2:
ldy #4
@@ -456,9 +461,7 @@
sta bank_zp
iny
lda (ptr_zp),y
- lsr wr_zp
- ror
- ror
+ ora wr_zp
ora bank_zp
sta bank_zp
clc
@@ -1253,12 +1256,12 @@
;******
;* $9e00 Tag for bank 0
ds.b $9e80-.,$ff
- BANK_TAG $9e,0,1
+ BANK_TAG $9e,0,FLAG_IS_ROM
;******
;* $9f00 Tag for bank 0
ds.b $9f80-.,$ff
- BANK_TAG $9f,0,1
+ BANK_TAG $9f,0,FLAG_IS_ROM
ds.b $9ffa-.,$ff
dc.w freeze_entry ; nmi vector
@@ -1271,9 +1274,9 @@
repeat 7
rorg $8000
ds.b $9e80-.,$ff
- BANK_TAG $9e,bank,1
+ BANK_TAG $9e,bank,FLAG_IS_ROM
ds.b $9f80-.,$ff
- BANK_TAG $9f,bank,1
+ BANK_TAG $9f,bank,FLAG_IS_ROM
ds.b $a000-.,$ff
rend
bank set bank+1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tl...@us...> - 2024-04-04 19:24:53
|
Revision: 45072
http://sourceforge.net/p/vice-emu/code/45072
Author: tlr
Date: 2024-04-04 19:24:51 +0000 (Thu, 04 Apr 2024)
Log Message:
-----------
refactored raw output, added legend based on selection.
Modified Paths:
--------------
testprogs/C64/carts/rr-freeze/analyze.c
Modified: testprogs/C64/carts/rr-freeze/analyze.c
===================================================================
--- testprogs/C64/carts/rr-freeze/analyze.c 2024-04-04 18:56:28 UTC (rev 45071)
+++ testprogs/C64/carts/rr-freeze/analyze.c 2024-04-04 19:24:51 UTC (rev 45072)
@@ -141,18 +141,38 @@
}
+static void v_to_str_raw(char *str, uint8_t v)
+{
+ switch (v) {
+ case 0xfe:
+ sprintf(str, "? ");
+ break;
+ case 0xff:
+ sprintf(str, "- ");
+ break;
+ default:
+ sprintf(str, "%02x", v);
+ break;
+ }
+}
+
+
char vmap[256][4];
-static void setup_vmap(void)
+static void setup_vmap(int raw_hex)
{
int v;
for (v = 0; v < 0x100; v++) {
- v_to_str(vmap[v], v);
+ if (!raw_hex) {
+ v_to_str(vmap[v], v);
+ } else {
+ v_to_str_raw(vmap[v], v);
+ }
}
}
-static void print_dump(Dump *d, char *str, int raw_hex)
+static void print_dump(Dump *d, char *str)
{
int i, j, k;
@@ -183,41 +203,13 @@
/* RAM */
for (j = 0; j < 8; j++) {
uint8_t v = d->mode[k].ram.v[i][j];
- if (!raw_hex) {
- printf("%s ", vmap[v]);
- } else {
- switch (v) {
- case 0xfe:
- printf("? ");
- break;
- case 0xff:
- printf("- ");
- break;
- default:
- printf("%02x ", v);
- break;
- }
- }
+ printf("%s ", vmap[v]);
}
printf(" ");
/* ROM */
for (j = 0; j < 8; j++) {
uint8_t v = d->mode[k].rom.v[i][j];
- if (!raw_hex) {
- printf("%s ", vmap[v]);
- } else {
- switch (v) {
- case 0xfe:
- printf("? ");
- break;
- case 0xff:
- printf("- ");
- break;
- default:
- printf("%02x ", v);
- break;
- }
- }
+ printf("%s ", vmap[v]);
}
printf("\n");
}
@@ -308,13 +300,13 @@
- setup_vmap();
+ setup_vmap(raw_hex);
read_dump(infile);
printf("analyzing file: %s\n", argv[1]);
printf(" program: %s, format: %d\n", ident, format_rev);
printf("\n<RESET>\n");
- print_dump(&rst, "RST", raw_hex);
+ print_dump(&rst, "RST");
printf("\n$%02X -> $DE01 (REU-Comp=%c, NoFreeze=%c, AllowBank=%c)\n",
de01_conf,
(de01_conf & 0x40) ? '1':'0',
@@ -321,18 +313,34 @@
(de01_conf & 0x04) ? '1':'0',
(de01_conf & 0x02) ? '1':'0'
);
- print_dump(&cnfd, "CNFD", raw_hex);
+ print_dump(&cnfd, "CNFD");
printf("\n$88 -> $DE00 (\"random\" mapping, bank 5 in ROM)\n$8C -> $DE00 (kill)\n");
printf("\n<FREEZE>\n");
- print_dump(&frz, "FRZ", raw_hex);
+ print_dump(&frz, "FRZ");
printf("\n$60 -> $DE00 (ACK)\n$20 -> $DE00\n");
- print_dump(&ackd, "ACKD", raw_hex);
+ print_dump(&ackd, "ACKD");
printf(
"\n\n"
"LEGEND:\n"
+ );
+ if (!raw_hex) {
+ printf(
" 0-7 -> RAM banks 0-7, an '*' means read only.\n"
" A-H -> ROM banks 0-7, should have an '*', otherwise it is writable (!)\n"
+ );
+ } else {
+ if (format_rev == 1) {
+ printf(
+" RWTS0BBB (R=ROM, W=RW, T=WriteC64, S=Switch01, B=bank)\n"
+ );
+ } else {
+ printf(
+" RW000BBB (R=ROM, W=RW, B=bank)\n"
+ );
+ }
+ }
+ printf(
" - -> no cart detected\n"
" ? -> mapping mismatch (e.g $de not mapped to $9e and similar)\n"
"\n"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tl...@us...> - 2024-04-04 18:56:29
|
Revision: 45071
http://sourceforge.net/p/vice-emu/code/45071
Author: tlr
Date: 2024-04-04 18:56:28 +0000 (Thu, 04 Apr 2024)
Log Message:
-----------
added support for raw hex output
Modified Paths:
--------------
testprogs/C64/carts/rr-freeze/analyze.c
Modified: testprogs/C64/carts/rr-freeze/analyze.c
===================================================================
--- testprogs/C64/carts/rr-freeze/analyze.c 2024-04-04 18:48:57 UTC (rev 45070)
+++ testprogs/C64/carts/rr-freeze/analyze.c 2024-04-04 18:56:28 UTC (rev 45071)
@@ -152,7 +152,7 @@
}
-static void print_dump(Dump *d, char *str)
+static void print_dump(Dump *d, char *str, int raw_hex)
{
int i, j, k;
@@ -183,13 +183,41 @@
/* RAM */
for (j = 0; j < 8; j++) {
uint8_t v = d->mode[k].ram.v[i][j];
- printf("%s ", vmap[v]);
+ if (!raw_hex) {
+ printf("%s ", vmap[v]);
+ } else {
+ switch (v) {
+ case 0xfe:
+ printf("? ");
+ break;
+ case 0xff:
+ printf("- ");
+ break;
+ default:
+ printf("%02x ", v);
+ break;
+ }
+ }
}
printf(" ");
/* ROM */
for (j = 0; j < 8; j++) {
uint8_t v = d->mode[k].rom.v[i][j];
- printf("%s ", vmap[v]);
+ if (!raw_hex) {
+ printf("%s ", vmap[v]);
+ } else {
+ switch (v) {
+ case 0xfe:
+ printf("? ");
+ break;
+ case 0xff:
+ printf("- ");
+ break;
+ default:
+ printf("%02x ", v);
+ break;
+ }
+ }
}
printf("\n");
}
@@ -204,15 +232,17 @@
{
int c;
char *infile;
+ int raw_hex;
/* defaults */
verbose_g = 0;
debug_g = 0;
+ raw_hex = 0;
/*
* scan for valid options
*/
- while (EOF != (c = getopt(argc, argv, "f:o:vdVh"))) {
+ while (EOF != (c = getopt(argc, argv, "rvdVh"))) {
switch (c) {
/* a missing parameter */
@@ -243,9 +273,10 @@
"Copyright (c) 2016, 2024 Daniel Kahlin <da...@ka...>\n"
"Written by Daniel Kahlin <da...@ka...>\n"
"\n"
-"usage: " PROGRAM " [-v][-d][-h][-V] <file>\n"
+"usage: " PROGRAM " [-r][-v][-d][-h][-V] <file>\n"
"\n"
"Valid options:\n"
+" -r raw hex output\n"
" -v be verbose\n"
" -d display debug information\n"
" -h displays this help text\n"
@@ -253,6 +284,11 @@
);
exit(0);
+ /* raw hex mode */
+ case 'r':
+ raw_hex = 1;
+ break;
+
/* default behavior */
default:
break;
@@ -278,7 +314,7 @@
printf(" program: %s, format: %d\n", ident, format_rev);
printf("\n<RESET>\n");
- print_dump(&rst, "RST");
+ print_dump(&rst, "RST", raw_hex);
printf("\n$%02X -> $DE01 (REU-Comp=%c, NoFreeze=%c, AllowBank=%c)\n",
de01_conf,
(de01_conf & 0x40) ? '1':'0',
@@ -285,12 +321,12 @@
(de01_conf & 0x04) ? '1':'0',
(de01_conf & 0x02) ? '1':'0'
);
- print_dump(&cnfd, "CNFD");
+ print_dump(&cnfd, "CNFD", raw_hex);
printf("\n$88 -> $DE00 (\"random\" mapping, bank 5 in ROM)\n$8C -> $DE00 (kill)\n");
printf("\n<FREEZE>\n");
- print_dump(&frz, "FRZ");
+ print_dump(&frz, "FRZ", raw_hex);
printf("\n$60 -> $DE00 (ACK)\n$20 -> $DE00\n");
- print_dump(&ackd, "ACKD");
+ print_dump(&ackd, "ACKD", raw_hex);
printf(
"\n\n"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tl...@us...> - 2024-04-04 18:48:58
|
Revision: 45070
http://sourceforge.net/p/vice-emu/code/45070
Author: tlr
Date: 2024-04-04 18:48:57 +0000 (Thu, 04 Apr 2024)
Log Message:
-----------
refactored, added support for command line arguments.
Modified Paths:
--------------
testprogs/C64/carts/rr-freeze/analyze.c
Modified: testprogs/C64/carts/rr-freeze/analyze.c
===================================================================
--- testprogs/C64/carts/rr-freeze/analyze.c 2024-04-04 09:51:03 UTC (rev 45069)
+++ testprogs/C64/carts/rr-freeze/analyze.c 2024-04-04 18:48:57 UTC (rev 45070)
@@ -1,20 +1,43 @@
-/*
+/**************************************************************************
+ *
* FILE analyze.c
*
- * Copyright (c) 2016 Daniel Kahlin <da...@ka...>
+ * Copyright (c) 2016, 2024 Daniel Kahlin <da...@ka...>
* Written by Daniel Kahlin <da...@ka...>
*
* DESCRIPTION
* analysis of rr-freeze.crt dumps.
*
- */
-
+ ******/
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
+#include <unistd.h>
+#define PROGRAM "analyze"
+#define VERSION "0.2"
+
+/* global variables */
+int verbose_g;
+int debug_g;
+
+
+void panic(const char *str, ...)
+{
+ va_list args;
+
+ fprintf(stderr, "%s: ", PROGRAM);
+ va_start(args, str);
+ vfprintf(stderr, str, args);
+ va_end(args);
+ fputc('\n', stderr);
+ exit(1);
+}
+
+
uint8_t areas[] = { 0x9e, 0xbe, 0xde, 0xdf, 0xfe };
typedef struct {
@@ -53,8 +76,7 @@
{
FILE *fp = fopen(name, "rb");
if (!fp) {
- fprintf(stderr, "couldn't open file\n");
- exit(-1);
+ panic("couldn't open file");
}
/* skip header */
@@ -65,12 +87,10 @@
format_rev = fgetc(fp);
if (memcmp(IDENT_STR, ident, strlen(IDENT_STR)) != 0) {
- fprintf(stderr, "unsupported file format!\n");
- exit(-1);
+ panic("unsupported file format!");
}
if (format_rev != 0) {
- fprintf(stderr, "unsupported format revision (%d)!\n", format_rev);
- exit(-1);
+ panic("unsupported format revision (%d)!", format_rev);
}
/* $DE01 configuration */
@@ -162,12 +182,14 @@
printf(" %02X: ", areas[i]);
/* RAM */
for (j = 0; j < 8; j++) {
- printf("%s ", vmap[d->mode[k].ram.v[i][j]]);
+ uint8_t v = d->mode[k].ram.v[i][j];
+ printf("%s ", vmap[v]);
}
printf(" ");
/* ROM */
for (j = 0; j < 8; j++) {
- printf("%s ", vmap[d->mode[k].rom.v[i][j]]);
+ uint8_t v = d->mode[k].rom.v[i][j];
+ printf("%s ", vmap[v]);
}
printf("\n");
}
@@ -180,9 +202,78 @@
int main(int argc, char *argv[])
{
+ int c;
+ char *infile;
+ /* defaults */
+ verbose_g = 0;
+ debug_g = 0;
+
+ /*
+ * scan for valid options
+ */
+ while (EOF != (c = getopt(argc, argv, "f:o:vdVh"))) {
+ switch (c) {
+
+ /* a missing parameter */
+ case ':':
+ /* an illegal option */
+ case '?':
+ exit(1);
+
+ /* set verbose mode */
+ case 'v':
+ verbose_g = 1;
+ break;
+
+ /* set debug mode */
+ case 'd':
+ debug_g = 1;
+ break;
+
+ /* print version */
+ case 'V':
+ fprintf(stdout, PROGRAM " " VERSION "\n");
+ exit(0);
+
+ /* print help */
+ case 'h':
+ fprintf(stderr,
+PROGRAM " " VERSION ": rr-freeze.crt dump analyzer\n"
+"Copyright (c) 2016, 2024 Daniel Kahlin <da...@ka...>\n"
+"Written by Daniel Kahlin <da...@ka...>\n"
+"\n"
+"usage: " PROGRAM " [-v][-d][-h][-V] <file>\n"
+"\n"
+"Valid options:\n"
+" -v be verbose\n"
+" -d display debug information\n"
+" -h displays this help text\n"
+" -V output program version\n"
+ );
+ exit(0);
+
+ /* default behavior */
+ default:
+ break;
+ }
+ }
+
+ /* optind now points at the first non option argument */
+ argc -= optind;
+ argv += optind;
+
+ /* expect one more argument */
+ if (argc < 1)
+ panic("too few arguments");
+ if (argc > 1)
+ panic("too many arguments");
+ infile = argv[0];
+
+
+
setup_vmap();
- read_dump(argv[1]);
+ read_dump(infile);
printf("analyzing file: %s\n", argv[1]);
printf(" program: %s, format: %d\n", ident, format_rev);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2024-04-04 09:51:05
|
Revision: 45069
http://sourceforge.net/p/vice-emu/code/45069
Author: compyx
Date: 2024-04-04 09:51:03 +0000 (Thu, 04 Apr 2024)
Log Message:
-----------
Gtk3: show only monospace fonts in the monitor font selection dialog
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/widgets/settings_monitor.c
Modified: trunk/vice/src/arch/gtk3/widgets/settings_monitor.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_monitor.c 2024-04-04 08:27:23 UTC (rev 45068)
+++ trunk/vice/src/arch/gtk3/widgets/settings_monitor.c 2024-04-04 09:51:03 UTC (rev 45069)
@@ -101,7 +101,23 @@
}
}
+/** \brief Filter function for font selection dialog
+ *
+ * \param[in] family font family
+ * \param[in] face font face (unused)
+ * \param[in] data optional user data (unused)
+ *
+ * \return \c TRUE if font is monospace and should be shown in the dialog
+ */
+static gboolean font_button_filter(const PangoFontFamily *family,
+ const PangoFontFace *face,
+ gpointer data)
+{
+ /* we have to cast away const due to shitty API */
+ return pango_font_family_is_monospace((PangoFontFamily*)family);
+}
+
/** \brief Create widget to control monitor resources
*
* \param[in] parent parent widget (unused)
@@ -231,6 +247,10 @@
/* create button that pops up a font selector */
font_button = gtk_font_button_new();
+ gtk_font_chooser_set_filter_func(GTK_FONT_CHOOSER(font_button),
+ font_button_filter,
+ NULL, /* extra data */
+ NULL /* destroy callback for extra data */);
gtk_font_button_set_use_font(GTK_FONT_BUTTON(font_button), TRUE);
if (font_name != NULL) {
gtk_font_chooser_set_font(GTK_FONT_CHOOSER(font_button), font_name);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2024-04-04 08:27:25
|
Revision: 45068
http://sourceforge.net/p/vice-emu/code/45068
Author: compyx
Date: 2024-04-04 08:27:23 +0000 (Thu, 04 Apr 2024)
Log Message:
-----------
Unix: register PetMe fonts along with C64 Pro Mono
Modified Paths:
--------------
trunk/vice/src/arch/shared/archdep_cbmfont.c
Modified: trunk/vice/src/arch/shared/archdep_cbmfont.c
===================================================================
--- trunk/vice/src/arch/shared/archdep_cbmfont.c 2024-04-04 08:07:06 UTC (rev 45067)
+++ trunk/vice/src/arch/shared/archdep_cbmfont.c 2024-04-04 08:27:23 UTC (rev 45068)
@@ -43,7 +43,19 @@
*/
#define VICE_CBM_FONT_TTF "C64_Pro_Mono-STYLE.ttf"
+/** \brief List of fonts to register with the OS */
+static const char *font_files[] = {
+ "C64_Pro_Mono-STYLE.ttf",
+ "PetMe1282Y.ttf",
+ "PetMe128.ttf",
+ "PetMe2X.ttf",
+ "PetMe2Y.ttf",
+ "PetMe642Y.ttf",
+ "PetMe64.ttf",
+ "PetMe.ttf"
+};
+
/** \fn int archdep_register_cbmfont(void)
* \brief Try to register the CBM font with the OS
*
@@ -100,8 +112,8 @@
int archdep_register_cbmfont(void)
{
FcConfig *fc_config;
- int result;
- char *path;
+ char *path;
+ size_t i;
if (!FcInit()) {
return 0;
@@ -108,14 +120,24 @@
}
fc_config = FcConfigGetCurrent();
- if (sysfile_locate(VICE_CBM_FONT_TTF, "common", &path) < 0) {
- log_error(LOG_ERR, "failed to find resource data '%s'.",
- VICE_CBM_FONT_TTF);
- return 0;
+
+ for (i = 0; i < sizeof font_files / sizeof font_files[0]; i++) {
+ if (sysfile_locate(font_files[i], "common", &path) < 0) {
+ log_error(LOG_ERR,
+ "failed to find resource data '%s'.",
+ font_files[i]);
+ return 0;
+ }
+ if (!FcConfigAppFontAddFile(fc_config, (FcChar8 *)path)) {
+ lib_free(path);
+ return 0;
+ } else {
+ log_message(LOG_DEFAULT, "registered font '%s'.", path);
+ lib_free(path);
+ }
}
- result = FcConfigAppFontAddFile(fc_config, (FcChar8 *)path) ? 1 : 0;
- lib_free(path);
- return result;
+
+ return 1;
}
# else /* HAVE_FONTCONFIG */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <co...@us...> - 2024-04-04 08:07:08
|
Revision: 45067
http://sourceforge.net/p/vice-emu/code/45067
Author: compyx
Date: 2024-04-04 08:07:06 +0000 (Thu, 04 Apr 2024)
Log Message:
-----------
Add PetMe font by KreativeKorp (https://www.kreativekorp.com/software/fonts/c64/)
Add CBM fonts, including double wide and double tall variants for use in the
monitor and perhaps the directory dialogs.
Modified Paths:
--------------
trunk/vice/data/common/Makefile.am
Added Paths:
-----------
trunk/vice/data/common/PetMe-FreeLicense.txt
trunk/vice/data/common/PetMe.ttf
trunk/vice/data/common/PetMe128.ttf
trunk/vice/data/common/PetMe1282Y.ttf
trunk/vice/data/common/PetMe2X.ttf
trunk/vice/data/common/PetMe2Y.ttf
trunk/vice/data/common/PetMe64.ttf
trunk/vice/data/common/PetMe642Y.ttf
Modified: trunk/vice/data/common/Makefile.am
===================================================================
--- trunk/vice/data/common/Makefile.am 2024-04-03 23:20:47 UTC (rev 45066)
+++ trunk/vice/data/common/Makefile.am 2024-04-04 08:07:06 UTC (rev 45067)
@@ -73,7 +73,14 @@
logo_files = CBM_Logo.svg \
vice-logo-black.svg
-font_files = C64_Pro_Mono-STYLE.ttf
+font_files = C64_Pro_Mono-STYLE.ttf \
+ PetMe1282Y.ttf \
+ PetMe128.ttf \
+ PetMe2X.ttf \
+ PetMe2Y.ttf \
+ PetMe642Y.ttf \
+ PetMe64.ttf \
+ PetMe.ttf
common_DATA = $(icon_files) \
$(logo_files) \
@@ -82,6 +89,7 @@
EXTRA_DIST = $(icon_files) \
$(logo_files) \
$(font_files) \
+ PetMe-FreeLicense.txt \
x64.rc \
x64sc.rc \
x64dtv.rc \
Added: trunk/vice/data/common/PetMe-FreeLicense.txt
===================================================================
--- trunk/vice/data/common/PetMe-FreeLicense.txt (rev 0)
+++ trunk/vice/data/common/PetMe-FreeLicense.txt 2024-04-04 08:07:06 UTC (rev 45067)
@@ -0,0 +1,20 @@
+KREATIVE SOFTWARE RELAY FONTS FREE USE LICENSE
+version 1.2f
+
+Permission is hereby granted, free of charge, to any person or entity (the "User") obtaining a copy of the included font files (the "Software") produced by Kreative Software, to utilize, display, embed, or redistribute the Software, subject to the following conditions:
+
+1. The User may not sell copies of the Software for a fee.
+
+1a. The User may give away copies of the Software free of charge provided this license and any documentation is included verbatim and credit is given to Kreative Korporation or Kreative Software.
+
+2. The User may not modify, reverse-engineer, or create any derivative works of the Software.
+
+3. Any Software carrying the following font names or variations thereof is not covered by this license and may not be used under the terms of this license: Jewel Hill, Miss Diode n Friends, This is Beckie's font!
+
+3a. Any Software carrying a font name ending with the string "Pro CE" is not covered by this license and may not be used under the terms of this license.
+
+4. This license becomes null and void if any of the above conditions are not met.
+
+5. Kreative Software reserves the right to change this license at any time without notice.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE SOFTWARE OR FROM OTHER DEALINGS IN THE SOFTWARE.
Added: trunk/vice/data/common/PetMe.ttf
===================================================================
(Binary files differ)
Index: trunk/vice/data/common/PetMe.ttf
===================================================================
--- trunk/vice/data/common/PetMe.ttf 2024-04-03 23:20:47 UTC (rev 45066)
+++ trunk/vice/data/common/PetMe.ttf 2024-04-04 08:07:06 UTC (rev 45067)
Property changes on: trunk/vice/data/common/PetMe.ttf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/vice/data/common/PetMe128.ttf
===================================================================
(Binary files differ)
Index: trunk/vice/data/common/PetMe128.ttf
===================================================================
--- trunk/vice/data/common/PetMe128.ttf 2024-04-03 23:20:47 UTC (rev 45066)
+++ trunk/vice/data/common/PetMe128.ttf 2024-04-04 08:07:06 UTC (rev 45067)
Property changes on: trunk/vice/data/common/PetMe128.ttf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/vice/data/common/PetMe1282Y.ttf
===================================================================
(Binary files differ)
Index: trunk/vice/data/common/PetMe1282Y.ttf
===================================================================
--- trunk/vice/data/common/PetMe1282Y.ttf 2024-04-03 23:20:47 UTC (rev 45066)
+++ trunk/vice/data/common/PetMe1282Y.ttf 2024-04-04 08:07:06 UTC (rev 45067)
Property changes on: trunk/vice/data/common/PetMe1282Y.ttf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/vice/data/common/PetMe2X.ttf
===================================================================
(Binary files differ)
Index: trunk/vice/data/common/PetMe2X.ttf
===================================================================
--- trunk/vice/data/common/PetMe2X.ttf 2024-04-03 23:20:47 UTC (rev 45066)
+++ trunk/vice/data/common/PetMe2X.ttf 2024-04-04 08:07:06 UTC (rev 45067)
Property changes on: trunk/vice/data/common/PetMe2X.ttf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/vice/data/common/PetMe2Y.ttf
===================================================================
(Binary files differ)
Index: trunk/vice/data/common/PetMe2Y.ttf
===================================================================
--- trunk/vice/data/common/PetMe2Y.ttf 2024-04-03 23:20:47 UTC (rev 45066)
+++ trunk/vice/data/common/PetMe2Y.ttf 2024-04-04 08:07:06 UTC (rev 45067)
Property changes on: trunk/vice/data/common/PetMe2Y.ttf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/vice/data/common/PetMe64.ttf
===================================================================
(Binary files differ)
Index: trunk/vice/data/common/PetMe64.ttf
===================================================================
--- trunk/vice/data/common/PetMe64.ttf 2024-04-03 23:20:47 UTC (rev 45066)
+++ trunk/vice/data/common/PetMe64.ttf 2024-04-04 08:07:06 UTC (rev 45067)
Property changes on: trunk/vice/data/common/PetMe64.ttf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/vice/data/common/PetMe642Y.ttf
===================================================================
(Binary files differ)
Index: trunk/vice/data/common/PetMe642Y.ttf
===================================================================
--- trunk/vice/data/common/PetMe642Y.ttf 2024-04-03 23:20:47 UTC (rev 45066)
+++ trunk/vice/data/common/PetMe642Y.ttf 2024-04-04 08:07:06 UTC (rev 45067)
Property changes on: trunk/vice/data/common/PetMe642Y.ttf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-04-03 23:20:49
|
Revision: 45066
http://sourceforge.net/p/vice-emu/code/45066
Author: gpz
Date: 2024-04-03 23:20:47 +0000 (Wed, 03 Apr 2024)
Log Message:
-----------
Hidden feature for the 'set to default' button for the CRT sliders: hold shift or control, or click with right button, to reset to neutral setting instead of whatever tweaks the defaults are. Allows to quickly switch to a setting that reproduces a loaded palette 100%
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.c
trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.h
Modified: trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.c 2024-04-03 20:00:43 UTC (rev 45065)
+++ trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.c 2024-04-03 23:20:47 UTC (rev 45066)
@@ -191,6 +191,7 @@
bool ntsc; /**< resource is valid for NTSC */
int low; /**< lowest value for resource */
int high; /**< highest value for resource */
+ int neutral; /**< neutral value for resource */
int step; /**< stepping for the spin button */
double disp_low; /**< display low */
double disp_high; /**< display high */
@@ -215,15 +216,15 @@
/** \brief List of CRT emulation resources
*/
static const crt_control_info_t control_info[RESOURCE_COUNT] = {
- { "Brightness", "ColorBrightness", true, 0, 2000, 100, 0.0, 200.0, 0.1, "%5.1f%%", VICE_MACHINE_ALL },
- { "Contrast", "ColorContrast", true, 0, 2000, 100, 0.0, 200.0, 0.1, "%5.1f%%", VICE_MACHINE_ALL },
- { "Saturation", "ColorSaturation", true, 0, 2000, 100, 0.0, 200.0, 0.1, "%5.1f%%", VICE_MACHINE_ALL },
- { "Tint", "ColorTint", true, 0, 2000, 100, -25.0, 25.0, 0.1, "%+5.1f%%", VICE_MACHINE_ALL },
- { "Gamma", "ColorGamma", true, 0, 4000, 200, 0.0, 4.0, 0.01, "%6.2f", VICE_MACHINE_ALL },
- { "Blur", "PALBlur", true, 0, 1000, 50, 0.0, 100.0, 0.1, "%5.1f%%", VICE_MACHINE_ALL },
- { "Scanline shade", "PALScanLineShade", true, 0, 1000, 50, 0.0, 100.0, 0.1, "%5.1f%%", VICE_MACHINE_ALL },
- { "Oddline phase", "PALOddLinePhase", false, 0, 2000, 100, -25.0, 25.0, 0.1, "%+5.1f\u00b0", VICE_MACHINE_ALL^VICE_MACHINE_CBM6x0^VICE_MACHINE_PET },
- { "Oddline offset", "PALOddLineOffset", false, 0, 2000, 100, -50.0, 50.0, 0.1, "%+4.1f%%", VICE_MACHINE_ALL^VICE_MACHINE_CBM6x0^VICE_MACHINE_PET }
+ { "Brightness", "ColorBrightness", true, 0, 2000, 1000, 100, 0.0, 200.0, 0.1, "%5.1f%%", VICE_MACHINE_ALL },
+ { "Contrast", "ColorContrast", true, 0, 2000, 1000, 100, 0.0, 200.0, 0.1, "%5.1f%%", VICE_MACHINE_ALL },
+ { "Saturation", "ColorSaturation", true, 0, 2000, 1000, 100, 0.0, 200.0, 0.1, "%5.1f%%", VICE_MACHINE_ALL },
+ { "Tint", "ColorTint", true, 0, 2000, 1000, 100, -25.0, 25.0, 0.1, "%+5.1f%%", VICE_MACHINE_ALL },
+ { "Gamma", "ColorGamma", true, 0, 4000, 1000, 200, 0.0, 4.0, 0.01, "%6.2f", VICE_MACHINE_ALL },
+ { "Blur", "PALBlur", true, 0, 1000, 0, 50, 0.0, 100.0, 0.1, "%5.1f%%", VICE_MACHINE_ALL },
+ { "Scanline shade", "PALScanLineShade", true, 0, 1000, 1000, 50, 0.0, 100.0, 0.1, "%5.1f%%", VICE_MACHINE_ALL },
+ { "Oddline phase", "PALOddLinePhase", false, 0, 2000, 1000, 100, -25.0, 25.0, 0.1, "%+5.1f\u00b0", VICE_MACHINE_ALL^VICE_MACHINE_CBM6x0^VICE_MACHINE_PET },
+ { "Oddline offset", "PALOddLineOffset", false, 0, 2000, 1000, 100, -50.0, 50.0, 0.1, "%+4.1f%%", VICE_MACHINE_ALL^VICE_MACHINE_CBM6x0^VICE_MACHINE_PET }
};
@@ -281,6 +282,22 @@
}
}
+/** \brief Reset all sliders to their neutral value
+ *
+ * \param[in] data crt control data
+ */
+static void reset_sliders_neutral(crt_control_data_t *data)
+{
+ int i;
+
+ for (i = 0; i < RESOURCE_COUNT; i++) {
+ GtkWidget *scale = data->scales[i];
+ if (scale != NULL) {
+ vice_gtk3_resource_scale_custom_set(scale, control_info[i].neutral);
+ }
+ }
+}
+
/** \brief Reset all sliders to their factory value
*
* \param[in] button reset button
@@ -291,6 +308,18 @@
reset_sliders(data);
}
+static gboolean on_reset_right_clicked (GtkWidget* self, GdkEventButton *event, gpointer data) {
+ guint button = event->button;
+ GdkModifierType state = event->state;
+ if ((button == 3) || (state & GDK_BUTTON3_MASK) ||
+ (state & GDK_SHIFT_MASK) || (state & GDK_CONTROL_MASK)) {
+ /* right button, or click+shift/control */
+ reset_sliders_neutral(data);
+ return TRUE;
+ }
+ return FALSE; /* propagate further, on_reset_clicked() handles regular left clicks */
+}
+
/** \brief Clean up memory used by the internal state of \a widget
*
* \param[in] widget widget
@@ -598,6 +627,10 @@
"clicked",
G_CALLBACK(on_reset_clicked),
(gpointer)data);
+ g_signal_connect(button,
+ "button-release-event",
+ G_CALLBACK(on_reset_right_clicked),
+ (gpointer)data);
gtk_grid_attach(GTK_GRID(grid), label, 0, 0, 1, 1);
gtk_grid_attach(GTK_GRID(grid), button, 1, 0, 1, 1);
@@ -678,24 +711,6 @@
}
-/** \brief Custom callback for the resource widget manager
- *
- * This calls the reset methods on the various CRT sliders.
- *
- * \param[in] widget CRT control widget
- *
- * \return bool
- */
-gboolean crt_control_widget_reset(GtkWidget *widget)
-{
- crt_control_data_t *data;
-
- data = g_object_get_data(G_OBJECT(widget), "InternalState");
- reset_sliders(data);
- return TRUE;
-}
-
-
/** \brief Free memory used by CSS providers for the sliders
*
* Call this function on UI shutdown.
Modified: trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.h
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.h 2024-04-03 20:00:43 UTC (rev 45065)
+++ trunk/vice/src/arch/gtk3/widgets/crtcontrolwidget.h 2024-04-03 23:20:47 UTC (rev 45066)
@@ -35,8 +35,6 @@
const char *chip,
gboolean minimal);
-gboolean crt_control_widget_reset(GtkWidget *widget);
-
void crt_control_widget_shutdown(void);
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-04-03 20:00:46
|
Revision: 45065
http://sourceforge.net/p/vice-emu/code/45065
Author: gpz
Date: 2024-04-03 20:00:43 +0000 (Wed, 03 Apr 2024)
Log Message:
-----------
Make some carts that have enable switches, but require a ROM image, fail to enable when no suitable ROM was attached before. This makes the respective commandline switch fail when no rom image was specified first, and allows the UI to show a message. Update the docs accordingly. Also adjust some GUI things and make more clear what are RAM images.
Modified Paths:
--------------
trunk/vice/doc/vice.texi
trunk/vice/src/arch/gtk3/widgets/settings_dqbb.c
trunk/vice/src/arch/gtk3/widgets/settings_expert.c
trunk/vice/src/arch/gtk3/widgets/settings_georam.c
trunk/vice/src/arch/gtk3/widgets/settings_ieee488.c
trunk/vice/src/arch/gtk3/widgets/settings_ieeeflash64.c
trunk/vice/src/arch/gtk3/widgets/settings_isepic.c
trunk/vice/src/arch/gtk3/widgets/settings_ramcart.c
trunk/vice/src/arch/gtk3/widgets/settings_ramlink.c
trunk/vice/src/arch/gtk3/widgets/settings_reu.c
trunk/vice/src/arch/gtk3/widgets/settings_rexramfloppy.c
trunk/vice/src/c64/cart/c64carthooks.c
trunk/vice/src/c64/cart/c64tpi.c
trunk/vice/src/c64/cart/ieeeflash64.c
trunk/vice/src/c64/cart/magicvoice.c
trunk/vice/src/c64/cart/ramlink.c
trunk/vice/src/vic20/cart/vic20cart.c
Modified: trunk/vice/doc/vice.texi
===================================================================
--- trunk/vice/doc/vice.texi 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/doc/vice.texi 2024-04-03 20:00:43 UTC (rev 45065)
@@ -10836,23 +10836,25 @@
@findex -ieee488, +ieee488
@item -ieee488
@itemx +ieee488
-Enable/disable emulation of the IEEE488 interface
+Enable/disable emulation of the IEEE488 interface.
+Remember to attach a suitable ROM image before enabling the module.
(@code{IEEE488=1}, @code{IEEE488=0}).
@findex -ieee488image
@item -ieee488image <name>
-Set IEEE488 interface image name
+Set IEEE488 interface ROM image name
(@code{IEEE488Image}).
@findex -ieeeflash64, +ieeeflash64
@item -ieeeflash64
@itemx +ieeeflash64
-Enable/disable IEEE Flash! 64 interface
+Enable/disable IEEE Flash! 64 interface.
+Remember to attach a suitable ROM image before enabling the module.
(@code{IEEEFlash64}).
@findex -ieeeflash64image
@item -ieeeflash64image
-Set IEEE Flash! 64 ROM image name
+Set IEEE Flash! 64 ROM image name.
(@code{IEEEFlash64Image}).
@findex -ieeeflash64dev8, +ieeeflash64dev8
@@ -11103,7 +11105,8 @@
@findex -magicvoice, +magicvoice
@item -magicvoice
@itemx +magicvoice
-Enable/disable Magic Voice cartridge
+Enable/disable Magic Voice cartridge.
+Remember to attach a suitable Magic Voice ROM image before enabling the module.
(@code{MagicVoiceCartridgeEnabled=1}, @code{MagicVoiceCartridgeEnabled=0}).
@findex -cartocean
@@ -11163,7 +11166,8 @@
@item -ramlink
@itemx +ramlink
Enable/disable emulation of the RAMLink module. This option emulates the
-behavior of the enable/disable switch on the unit
+behavior of the enable/disable switch on the unit.
+Remember to attach a suitable BIOS image before enabling the module.
(@code{RAMLINK=1}, @code{RAMLINK=0}).
@findex -cartramlink
@@ -11175,25 +11179,20 @@
Specify name of RAMLink BIOS image
(@code{RAMLINKBIOSfilename}).
-@findex -ramlinkbios
-@item -ramlinkbios <name>
-Specify name of RAMLink BIOS image
-(@code{RAMLINKBIOSfilename}).
-
@findex -ramlinkimage
@item -ramlinkimage <name>
-Specify name of RAMLink RAMCard image
+Specify name of RAMLink RAM image
(@code{RAMLINKfilename}).
@findex -ramlinkimagerw, +ramlinkimagerw
@item -ramlinkimagerw
@itemx +ramlinkimagerw
-Allow/disallow writing to RAMCard image on detach
+Allow/disallow writing to RAMLink RAM image on detach
(@code{RAMLINKImageWrite=1}, @code{RAMLINKImageWrite=0}).
@findex -ramlinksize
@item -ramlinksize <size in MiB>
-Size of the RAMCard unit
+Size of the RAMLink RAM
(@code{RAMLINKsize}).
(0..16; default is 0)
Modified: trunk/vice/src/arch/gtk3/widgets/settings_dqbb.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_dqbb.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/arch/gtk3/widgets/settings_dqbb.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -51,7 +51,7 @@
image = cart_image_widget_new(CARTRIDGE_DQBB,
CARTRIDGE_NAME_DQBB,
CART_IMAGE_PRIMARY,
- "cartridge",
+ "RAM",
"DQBBfilename",
TRUE,
TRUE);
Modified: trunk/vice/src/arch/gtk3/widgets/settings_expert.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_expert.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/arch/gtk3/widgets/settings_expert.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -91,7 +91,7 @@
image = cart_image_widget_new(CARTRIDGE_EXPERT,
CARTRIDGE_NAME_EXPERT,
CART_IMAGE_PRIMARY,
- NULL,
+ "RAM",
"Expertfilename",
TRUE,
TRUE);
Modified: trunk/vice/src/arch/gtk3/widgets/settings_georam.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_georam.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/arch/gtk3/widgets/settings_georam.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -81,7 +81,7 @@
image = cart_image_widget_new(CARTRIDGE_GEORAM,
CARTRIDGE_NAME_GEORAM,
CART_IMAGE_PRIMARY,
- "cartridge",
+ "RAM",
"GEORAMfilename",
TRUE,
TRUE);
Modified: trunk/vice/src/arch/gtk3/widgets/settings_ieee488.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_ieee488.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/arch/gtk3/widgets/settings_ieee488.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -73,6 +73,7 @@
if (state) {
if (cartridge_enable(CARTRIDGE_IEEE488) < 0) {
log_error(LOG_ERR, "failed to enable " CARTRIDGE_NAME_IEEE488 ".");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), FALSE);
}
} else {
if (cartridge_disable(CARTRIDGE_IEEE488) < 0) {
Modified: trunk/vice/src/arch/gtk3/widgets/settings_ieeeflash64.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_ieeeflash64.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/arch/gtk3/widgets/settings_ieeeflash64.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -77,6 +77,7 @@
if (state) {
if (cartridge_enable(CARTRIDGE_IEEEFLASH64) < 0) {
log_error(LOG_ERR, "failed to enable " CARTRIDGE_NAME_IEEEFLASH64 ".");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), FALSE);
}
} else {
if (cartridge_disable(CARTRIDGE_IEEEFLASH64) < 0) {
@@ -125,7 +126,7 @@
G_CALLBACK(on_enable_toggled),
NULL);
- chlabel = gtk_label_new(CARTRIDGE_NAME_IEEEFLASH64 " KERNAL ROM Image");
+ chlabel = gtk_label_new(CARTRIDGE_NAME_IEEEFLASH64 " ROM Image");
gtk_widget_set_halign(chlabel, GTK_ALIGN_START);
chooser = vice_gtk3_resource_filechooser_new("IEEEFlash64Image",
GTK_FILE_CHOOSER_ACTION_OPEN);
Modified: trunk/vice/src/arch/gtk3/widgets/settings_isepic.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_isepic.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/arch/gtk3/widgets/settings_isepic.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -76,7 +76,7 @@
image = cart_image_widget_new(CARTRIDGE_ISEPIC,
CARTRIDGE_NAME_ISEPIC,
CART_IMAGE_PRIMARY,
- "cartridge",
+ "RAM",
"Isepicfilename",
TRUE,
TRUE);
Modified: trunk/vice/src/arch/gtk3/widgets/settings_ramcart.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_ramcart.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/arch/gtk3/widgets/settings_ramcart.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -82,7 +82,7 @@
image = cart_image_widget_new(CARTRIDGE_RAMCART,
CARTRIDGE_NAME_RAMCART,
CART_IMAGE_PRIMARY,
- "cartridge",
+ "RAM",
"RAMCARTfilename",
TRUE,
TRUE);
Modified: trunk/vice/src/arch/gtk3/widgets/settings_ramlink.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_ramlink.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/arch/gtk3/widgets/settings_ramlink.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -40,6 +40,7 @@
#include "carthelpers.h"
#include "cartridge.h"
#include "debug_gtk3.h"
+#include "log.h"
#include "ramlink.h"
#include "resources.h"
#include "vice_gtk3.h"
@@ -71,6 +72,47 @@
return label;
}
+/** \brief Handler for the 'toggled' event of the 'enable' check button
+ *
+ * Toggles the 'enabled' state of the RAMlink adapter/cart, but only if a
+ * ROM image has been specified, otherwise when trying to set the check
+ * button to 'true', an error message is displayed and the check button is
+ * reverted to 'off'.
+ *
+ * \param[in,out] widget check button
+ * \param[in] data unused
+ */
+static void on_enable_toggled(GtkWidget *widget, gpointer data)
+{
+ gboolean state;
+
+ state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ if (state) {
+ const char *image = NULL;
+
+ resources_get_string("RAMLINKBIOSfilename", &image);
+ if (image == NULL || *image == '\0') {
+ /* no image */
+ vice_gtk3_message_error(CARTRIDGE_NAME_RAMLINK " Error",
+ "Cannot enable " CARTRIDGE_NAME_RAMLINK ","
+ " no BIOS image has been selected.");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), FALSE);
+ state = FALSE;
+ }
+ }
+
+ if (state) {
+ if (cartridge_enable(CARTRIDGE_RAMLINK) < 0) {
+ log_error(LOG_ERR, "failed to enable " CARTRIDGE_NAME_RAMLINK ".");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), FALSE);
+ }
+ } else {
+ if (cartridge_disable(CARTRIDGE_RAMLINK) < 0) {
+ log_error(LOG_ERR, "failed to disable " CARTRIDGE_NAME_RAMLINK ".");
+ }
+ }
+}
+
/** \brief Create RAMLink BIOS image widget
*
* \return GtkGrid
@@ -126,14 +168,29 @@
GtkWidget *size;
GtkWidget *wrapper;
int row = 0;
+ const char *image = NULL;
+ int cart_enabled;
+ resources_get_string("RAMLINKfilename", &image);
+ cart_enabled = cartridge_type_enabled(CARTRIDGE_RAMLINK);
+
grid = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(grid), 16);
/* create 'enable ramlink' checkbox */
- enable = vice_gtk3_resource_check_button_new("RAMLINK",
- "Enable " CARTRIDGE_NAME_RAMLINK
- " emulation");
+ /* we can't use a `resource_check_button` here, since toggling the resource
+ * depends on whether an image file is specified
+ */
+ enable = gtk_check_button_new_with_label("Enable " CARTRIDGE_NAME_RAMLINK " emulation");
+ /* only set state to true if both the state is true and an image is given */
+ if (cart_enabled && (image != NULL && *image != '\0')) {
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable), TRUE);
+ }
+ g_signal_connect(enable,
+ "toggled",
+ G_CALLBACK(on_enable_toggled),
+ NULL);
+
primary = create_primary_image_widget();
secondary = create_secondary_image_widget();
Modified: trunk/vice/src/arch/gtk3/widgets/settings_reu.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_reu.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/arch/gtk3/widgets/settings_reu.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -67,7 +67,7 @@
image = cart_image_widget_new(CARTRIDGE_REU,
CARTRIDGE_NAME_REU,
CART_IMAGE_PRIMARY,
- "cartridge",
+ "RAM",
"REUfilename",
TRUE,
TRUE);
Modified: trunk/vice/src/arch/gtk3/widgets/settings_rexramfloppy.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_rexramfloppy.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/arch/gtk3/widgets/settings_rexramfloppy.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -43,14 +43,14 @@
*
* \return GtkGrid
*/
-static GtkWidget *create_primary_image_widget(void)
+static GtkWidget *create_secondary_image_widget(void)
{
GtkWidget *image;
image = cart_image_widget_new(CARTRIDGE_REX_RAMFLOPPY,
CARTRIDGE_NAME_REX_RAMFLOPPY,
- CART_IMAGE_PRIMARY,
- "cartridge",
+ CART_IMAGE_SECONDARY,
+ "RAM",
"RRFfilename",
TRUE,
TRUE);
@@ -71,7 +71,7 @@
{
GtkWidget *primary;
- primary = create_primary_image_widget();
+ primary = create_secondary_image_widget();
gtk_widget_show_all(primary);
return primary;
}
Modified: trunk/vice/src/c64/cart/c64carthooks.c
===================================================================
--- trunk/vice/src/c64/cart/c64carthooks.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/c64/cart/c64carthooks.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -1483,7 +1483,7 @@
if (cart_type_enabled(type)) {
return 0;
}
- log_error(LOG_ERR, "Failed to enable cartridge with ID %d.\n", type);
+ log_error(LOG_ERR, "Failed to enable cartridge with ID %d.", type);
return -1;
}
Modified: trunk/vice/src/c64/cart/c64tpi.c
===================================================================
--- trunk/vice/src/c64/cart/c64tpi.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/c64/cart/c64tpi.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -455,20 +455,20 @@
}
if (param) {
/* if the param is != NULL, then we should load the default image file */
- if (ieee488_filename) {
- if (*ieee488_filename) {
- DBG(("IEEE: attach default image\n"));
- /* try crt first, then binary */
- if ((cartridge_attach_image(CARTRIDGE_CRT, ieee488_filename) < 0) &&
- (cartridge_attach_image(CARTRIDGE_IEEE488, ieee488_filename) < 0)) {
- DBG(("IEEE: set_enabled did not register\n"));
- lib_free(tpi_rom);
- tpi_rom = NULL;
- return -1;
- }
- /* ieee488_enabled = 1; */ /* cartridge_attach_image will end up calling set_ieee488_enabled again */
- return 0;
+ if ((ieee488_filename != NULL) && (*ieee488_filename != 0)) {
+ DBG(("IEEE: attach default image\n"));
+ /* try crt first, then binary */
+ if ((cartridge_attach_image(CARTRIDGE_CRT, ieee488_filename) < 0) &&
+ (cartridge_attach_image(CARTRIDGE_IEEE488, ieee488_filename) < 0)) {
+ DBG(("IEEE: set_enabled did not register\n"));
+ lib_free(tpi_rom);
+ tpi_rom = NULL;
+ return -1; /* loading the default was requested, but file could not be loaded */
}
+ /* ieee488_enabled = 1; */ /* cartridge_attach_image will end up calling set_ieee488_enabled again */
+ return 0;
+ } else {
+ return -1; /* loading the default was requested, but no filename was set */
}
} else {
cart_power_off();
Modified: trunk/vice/src/c64/cart/ieeeflash64.c
===================================================================
--- trunk/vice/src/c64/cart/ieeeflash64.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/c64/cart/ieeeflash64.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -475,21 +475,21 @@
}
if (param) {
/* if the param is != NULL, then we should load the default image file */
- if (ieeeflash64_filename) {
- if (*ieeeflash64_filename) {
- DBG(("IEEEFlash64: attach default image\n"));
- /* try .crt first */
- if ((cartridge_attach_image(CARTRIDGE_CRT, ieeeflash64_filename) < 0) &&
- (cartridge_attach_image(CARTRIDGE_IEEEFLASH64, ieeeflash64_filename) < 0)) {
- DBG(("IEEEFlash64: set_enabled did not register (attach image failed)\n"));
- lib_free(ieeeflash64_rom);
- ieeeflash64_rom = NULL;
- return -1;
- }
- /* ieeeflash64_enabled = 1; */ /* cartridge_attach_image will end up calling set_ieeeflash64_enabled again */
- DBG(("IEEEFlash64: attach succeeded\n"));
- return 0;
+ if ((ieeeflash64_filename != NULL) && (*ieeeflash64_filename != 0)) {
+ DBG(("IEEEFlash64: attach default image\n"));
+ /* try .crt first */
+ if ((cartridge_attach_image(CARTRIDGE_CRT, ieeeflash64_filename) < 0) &&
+ (cartridge_attach_image(CARTRIDGE_IEEEFLASH64, ieeeflash64_filename) < 0)) {
+ DBG(("IEEEFlash64: set_enabled did not register (attach image failed)\n"));
+ lib_free(ieeeflash64_rom);
+ ieeeflash64_rom = NULL;
+ return -1; /* loading the default was requested, but file could not be loaded */
}
+ /* ieeeflash64_enabled = 1; */ /* cartridge_attach_image will end up calling set_ieeeflash64_enabled again */
+ DBG(("IEEEFlash64: attach succeeded\n"));
+ return 0;
+ } else {
+ return -1; /* loading the default was requested, but no filename was set */
}
} else {
cart_power_off();
Modified: trunk/vice/src/c64/cart/magicvoice.c
===================================================================
--- trunk/vice/src/c64/cart/magicvoice.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/c64/cart/magicvoice.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -1113,16 +1113,16 @@
} else if (!magicvoice_sound_chip.chip_enabled && val) {
if (param) {
/* if the param is != NULL, then we should load the default image file */
- if (magicvoice_filename) {
- if (*magicvoice_filename) {
- if ((cartridge_attach_image(CARTRIDGE_CRT, magicvoice_filename) < 0) &&
- (cartridge_attach_image(CARTRIDGE_MAGIC_VOICE, magicvoice_filename) < 0)) {
- DBG(("MV: set_enabled did not register\n"));
- return -1;
- }
- /* magicvoice_sound_chip.chip_enabled = 1; */ /* cartridge_attach_image will end up calling set_magicvoice_enabled again */
- return 0;
+ if ((magicvoice_filename != NULL) && (*magicvoice_filename != 0)) {
+ if ((cartridge_attach_image(CARTRIDGE_CRT, magicvoice_filename) < 0) &&
+ (cartridge_attach_image(CARTRIDGE_MAGIC_VOICE, magicvoice_filename) < 0)) {
+ DBG(("MV: set_enabled did not register\n"));
+ return -1; /* loading the default was requested, but file could not be loaded */
}
+ /* magicvoice_sound_chip.chip_enabled = 1; */ /* cartridge_attach_image will end up calling set_magicvoice_enabled again */
+ return 0;
+ } else {
+ return -1; /* loading the default was requested, but no filename was set */
}
} else {
cart_power_off();
Modified: trunk/vice/src/c64/cart/ramlink.c
===================================================================
--- trunk/vice/src/c64/cart/ramlink.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/c64/cart/ramlink.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -752,7 +752,7 @@
}
/* save RAMCard image file if set to by resource */
-static int ramlink_save_image(void)
+static int ramlink_save_ram_image(void)
{
if (rl_write_image) {
return ramlink_flush_ram_image();
@@ -761,8 +761,8 @@
return 0;
}
-/* load RAMCard image file */
-static int ramlink_load_image(void)
+/* load RAMLINK RAM image file */
+static int ramlink_load_ram_image(void)
{
if (rl_card == NULL) {
return -1;
@@ -835,7 +835,7 @@
LOG1((LOG, "RAMLINK: %dMiB unit installed.", rl_cardsizemb));
- return ramlink_load_image();
+ return ramlink_load_ram_image();
}
static int ramlink_deactivate(void)
@@ -851,7 +851,7 @@
return 0;
}
- res = ramlink_save_image();
+ res = ramlink_save_ram_image();
lib_free(rl_card);
rl_card = NULL;
@@ -879,17 +879,17 @@
if (param) {
/* if the param is != NULL, then we should load the default image file */
LOG1((LOG, "RAMLINK: set_enabled(1) '%s'", rl_bios_filename));
- if (rl_bios_filename) {
- if (*rl_bios_filename) {
- /* try .crt image first */
- if ((cartridge_attach_image(CARTRIDGE_CRT, rl_bios_filename) < 0) &&
- (cartridge_attach_image(CARTRIDGE_RAMLINK, rl_bios_filename) < 0)) {
- LOG1((LOG, "RAMLINK: set_enabled(1) did not register"));
- return -1;
- }
- /* rl_enabled = 1; */ /* cartridge_attach_image will end up calling set_enabled again */
- return 0;
+ if ((rl_bios_filename != NULL) && (*rl_bios_filename != 0)) {
+ /* try .crt image first */
+ if ((cartridge_attach_image(CARTRIDGE_CRT, rl_bios_filename) < 0) &&
+ (cartridge_attach_image(CARTRIDGE_RAMLINK, rl_bios_filename) < 0)) {
+ LOG1((LOG, "RAMLINK: set_enabled(1) did not register"));
+ return -1; /* loading the default was requested, file coult not be loaded */
}
+ /* rl_enabled = 1; */ /* cartridge_attach_image will end up calling set_enabled again */
+ return 0;
+ } else {
+ return -1; /* loading the default was requested, but no filename was set */
}
} else {
cart_power_off();
@@ -969,6 +969,7 @@
util_string_set(&rl_bios_filename, name);
resources_get_int("RAMLINK", &enabled);
+ /* if we are enabled, this will reload the BIOS */
if (set_enabled(enabled, (void*)1) < 0) {
lib_free(rl_bios_filename);
rl_bios_filename = NULL;
@@ -1992,6 +1993,7 @@
int ramlink_enable(void)
{
+ /* this will reload the BIOS */
return set_enabled(1, (void*)1);
}
Modified: trunk/vice/src/vic20/cart/vic20cart.c
===================================================================
--- trunk/vice/src/vic20/cart/vic20cart.c 2024-04-03 16:48:40 UTC (rev 45064)
+++ trunk/vice/src/vic20/cart/vic20cart.c 2024-04-03 20:00:43 UTC (rev 45065)
@@ -658,7 +658,7 @@
if (cart_type_enabled(type)) {
return 0;
}
- log_error(LOG_ERR, "Failed to enable cartridge with ID %d.\n", type);
+ log_error(LOG_ERR, "Failed to enable cartridge with ID %d.", type);
return -1;
#endif
return 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tl...@us...> - 2024-04-03 16:48:41
|
Revision: 45064
http://sourceforge.net/p/vice-emu/code/45064
Author: tlr
Date: 2024-04-03 16:48:40 +0000 (Wed, 03 Apr 2024)
Log Message:
-----------
added guard against unsupported file format.
Modified Paths:
--------------
testprogs/C64/carts/rr-freeze/Makefile
testprogs/C64/carts/rr-freeze/analyze.c
testprogs/C64/carts/rr-freeze/nr-freeze.crt
testprogs/C64/carts/rr-freeze/rr-freeze.crt
Modified: testprogs/C64/carts/rr-freeze/Makefile
===================================================================
--- testprogs/C64/carts/rr-freeze/Makefile 2024-04-03 14:51:21 UTC (rev 45063)
+++ testprogs/C64/carts/rr-freeze/Makefile 2024-04-03 16:48:40 UTC (rev 45064)
@@ -20,8 +20,10 @@
nr-freeze.crt: rr-freeze.prg
cartconv -i $< -o $@ -t rr -s 1
+CC=gcc
+CFLAGS=-Wall -Wextra -Wno-unused-parameter
analyze: analyze.c
- gcc -Wall -o$@ $^
+ $(CC) $(CFLAGS) -o$@ $^
# clean out old targets
clean::
Modified: testprogs/C64/carts/rr-freeze/analyze.c
===================================================================
--- testprogs/C64/carts/rr-freeze/analyze.c 2024-04-03 14:51:21 UTC (rev 45063)
+++ testprogs/C64/carts/rr-freeze/analyze.c 2024-04-03 16:48:40 UTC (rev 45064)
@@ -12,6 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
+#include <string.h>
uint8_t areas[] = { 0x9e, 0xbe, 0xde, 0xdf, 0xfe };
@@ -36,7 +37,9 @@
} Dump;
-uint8_t ident[16];
+#define IDENT_STR "RR-FREEZE"
+uint8_t ident[15];
+uint8_t format_rev;
uint8_t de01_conf;
@@ -56,8 +59,21 @@
/* skip header */
fseek(fp, 0x2, SEEK_CUR);
+
+ /* check file format */
fread(&ident, 1, sizeof(ident), fp);
+ format_rev = fgetc(fp);
+ if (memcmp(IDENT_STR, ident, strlen(IDENT_STR)) != 0) {
+ fprintf(stderr, "unsupported file format!\n");
+ exit(-1);
+ }
+ if (format_rev != 0) {
+ fprintf(stderr, "unsupported format revision (%d)!\n", format_rev);
+ exit(-1);
+ }
+
+ /* $DE01 configuration */
de01_conf = fgetc(fp);
/* load dumps */
@@ -168,7 +184,7 @@
setup_vmap();
read_dump(argv[1]);
printf("analyzing file: %s\n", argv[1]);
- printf(" program: %s, format: %d\n", ident, ident[15]);
+ printf(" program: %s, format: %d\n", ident, format_rev);
printf("\n<RESET>\n");
print_dump(&rst, "RST");
Modified: testprogs/C64/carts/rr-freeze/nr-freeze.crt
===================================================================
(Binary files differ)
Modified: testprogs/C64/carts/rr-freeze/rr-freeze.crt
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tl...@us...> - 2024-04-03 14:51:24
|
Revision: 45063
http://sourceforge.net/p/vice-emu/code/45063
Author: tlr
Date: 2024-04-03 14:51:21 +0000 (Wed, 03 Apr 2024)
Log Message:
-----------
got rid of trailing white space.
Modified Paths:
--------------
testprogs/C64/carts/rr-freeze/rr-freeze.asm
Modified: testprogs/C64/carts/rr-freeze/rr-freeze.asm
===================================================================
--- testprogs/C64/carts/rr-freeze/rr-freeze.asm 2024-04-02 01:19:33 UTC (rev 45062)
+++ testprogs/C64/carts/rr-freeze/rr-freeze.asm 2024-04-03 14:51:21 UTC (rev 45063)
@@ -178,8 +178,8 @@
re_done:
jmp perform_test
-
+
greet_msg:
dc.b 147,"RR-FREEZE ",TEST_REVISION," / TLR",13,13
dc.b "THIS PROGRAM VERIFIES THE CART STATE",13
@@ -202,7 +202,7 @@
dc.b %00000110 ; REU-Comp=0, NoFreeze=1, AllowBank=1
-
+
;**************************************************************************
;*
;* NAME prefill_ram
@@ -326,7 +326,7 @@
lda #$37
sta $01
-
+
lda #%00000000
sta $de00
rts
@@ -555,7 +555,7 @@
plp
rts
-
+
scan_banks_int:
sta mode_zp
ldx #0
@@ -567,7 +567,7 @@
txa
pha
jsr scan_areas_int
-
+
ldy #0
ldx #0
sca_lp2:
@@ -580,7 +580,7 @@
inx
cpx #NUM_AREAS
bne sca_lp2
-
+
pla
tax
@@ -623,7 +623,7 @@
wf_lp1:
jmp wf_lp1
-
+
;**************************************************************************
;*
;* NAME freeze_entry
@@ -675,12 +675,12 @@
lda #%00000000 ; Normal conf, RR-ROM at $8000
sta $de00
jmp continue_test
-
+
rend
RAM_CODE_LEN equ .-ram_code_st
-
+
;**************************************************************************
;*
;* NAME perform_test, continue_test
@@ -739,11 +739,11 @@
jsr print_banks
cli
-
+
lda #<freeze_msg
ldy #>freeze_msg
jsr print_str
-
+
; cursor on
lda #0
sta $cc
@@ -771,12 +771,12 @@
iny
sty $d3 ; x-pos
sty $cf ; cursor not in the inverted state
-
+
if 0
lda #145 ; cursor up
jsr $ffd2
endif
-
+
; present state
lda #<frz_msg
ldy #>frz_msg
@@ -797,7 +797,7 @@
ldx #<banks_post_ack
ldy #>banks_post_ack
jsr print_banks
-
+
lda de00_pre
jsr print_hex
jsr print_space
@@ -862,7 +862,7 @@
jsr print_tag
pla
tay
-
+
jsr print_space
iny
cpy #NUM_AREAS
@@ -921,7 +921,7 @@
pbs_skp2:
jsr print_cr
pbs_skp3:
-
+
inx
cpx #NUM_AREAS
bne pbs_lp1
@@ -975,7 +975,7 @@
sta ($d1),y
rts
-
+
;**************************************************************************
;*
;* NAME clone_ff87
@@ -1259,7 +1259,7 @@
;* $9f00 Tag for bank 0
ds.b $9f80-.,$ff
BANK_TAG $9f,0,1
-
+
ds.b $9ffa-.,$ff
dc.w freeze_entry ; nmi vector
dc.w freeze_entry ; reset vector
@@ -1278,7 +1278,7 @@
rend
bank set bank+1
repend
-
-
+
+
; eof
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-04-02 01:19:35
|
Revision: 45062
http://sourceforge.net/p/vice-emu/code/45062
Author: gpz
Date: 2024-04-02 01:19:33 +0000 (Tue, 02 Apr 2024)
Log Message:
-----------
oops :)
Modified Paths:
--------------
trunk/vice/src/arch/sdl/uiimagefilereq.c
Modified: trunk/vice/src/arch/sdl/uiimagefilereq.c
===================================================================
--- trunk/vice/src/arch/sdl/uiimagefilereq.c 2024-04-02 00:57:53 UTC (rev 45061)
+++ trunk/vice/src/arch/sdl/uiimagefilereq.c 2024-04-02 01:19:33 UTC (rev 45062)
@@ -51,8 +51,8 @@
/* in the actual charset, the places that would cover the alternative petscii
positions are used by something else, so replace them by the regular codes.
FIXME: this seems a bit ugly, perhaps a separate print function for petscii
- can be made, which deals with this internally */
- */
+ can be made, which deals with this internally.
+*/
static void petscii_replace_alternatives(unsigned char *b) {
while (*b) {
if ((*b >= 0xc0) && (*b <= 0xdf)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-04-02 00:57:56
|
Revision: 45061
http://sourceforge.net/p/vice-emu/code/45061
Author: gpz
Date: 2024-04-02 00:57:53 +0000 (Tue, 02 Apr 2024)
Log Message:
-----------
some SDL font related tweaks
Modified Paths:
--------------
trunk/vice/src/arch/sdl/uiimagefilereq.c
trunk/vice/src/arch/sdl/uimenu.c
trunk/vice/src/arch/sdl/uimon.c
trunk/vice/src/monitor/monitor.c
Modified: trunk/vice/src/arch/sdl/uiimagefilereq.c
===================================================================
--- trunk/vice/src/arch/sdl/uiimagefilereq.c 2024-04-01 23:03:15 UTC (rev 45060)
+++ trunk/vice/src/arch/sdl/uiimagefilereq.c 2024-04-02 00:57:53 UTC (rev 45061)
@@ -48,6 +48,20 @@
static menu_draw_t *menu_draw;
+/* in the actual charset, the places that would cover the alternative petscii
+ positions are used by something else, so replace them by the regular codes.
+ FIXME: this seems a bit ugly, perhaps a separate print function for petscii
+ can be made, which deals with this internally */
+ */
+static void petscii_replace_alternatives(unsigned char *b) {
+ while (*b) {
+ if ((*b >= 0xc0) && (*b <= 0xdf)) {
+ *b = (*b - 0xc0) + 0x60;
+ };
+ b++;
+ }
+}
+
static void sdl_ui_image_file_selector_redraw(image_contents_t *contents, const char *title, int offset, int num_items, int more, ui_menu_filereq_mode_t mode, int cur_offset)
{
int i, j;
@@ -73,6 +87,7 @@
j = MENU_FIRST_X;
name = image_contents_file_to_string(entry, IMAGE_CONTENTS_STRING_PETSCII);
+ petscii_replace_alternatives(name);
j += sdl_ui_print(name, j, i + IMAGE_FIRST_Y + SDL_FILEREQ_META_NUM);
if (i == cur_offset) {
@@ -104,6 +119,7 @@
}
j = MENU_FIRST_X;
name = image_contents_file_to_string(entry, IMAGE_CONTENTS_STRING_PETSCII);
+ petscii_replace_alternatives(name);
j += sdl_ui_print(name, j, i + IMAGE_FIRST_Y + SDL_FILEREQ_META_NUM);
sdl_ui_print_eol(j, i + IMAGE_FIRST_Y + SDL_FILEREQ_META_NUM);
Modified: trunk/vice/src/arch/sdl/uimenu.c
===================================================================
--- trunk/vice/src/arch/sdl/uimenu.c 2024-04-01 23:03:15 UTC (rev 45060)
+++ trunk/vice/src/arch/sdl/uimenu.c 2024-04-02 00:57:53 UTC (rev 45061)
@@ -175,13 +175,13 @@
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- /* c0-cf @ABCDEFGHIJKLMNO (shifted) alternatives */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- /* d0-df PQRSTUVWXYZ[\]^_ (shifted) alternatives */
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ /* c0-df -> a0..bf (was c0-df @ABCDEFGHIJKLMNO, PQRSTUVWXYZ[\]^_ (shifted) alternatives) */
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x5e
+ /* e0-ff -> e0..ff (was 60..7e,5e) */
+ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
};
/* charset #3 - lowercase petscii. this is used by the monitor and virtual keyboard */
@@ -213,11 +213,11 @@
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- /* c0-df */
+ /* c0-df -> a0..bf (was c0-df @ABCDEFGHIJKLMNO, PQRSTUVWXYZ[\]^_ (shifted) alternatives) */
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- /* e0-ff */
+ /* e0-ff -> e0..ff (was 60..7e,5e) */
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
};
Modified: trunk/vice/src/arch/sdl/uimon.c
===================================================================
--- trunk/vice/src/arch/sdl/uimon.c 2024-04-01 23:03:15 UTC (rev 45060)
+++ trunk/vice/src/arch/sdl/uimon.c 2024-04-02 00:57:53 UTC (rev 45061)
@@ -216,8 +216,10 @@
} else if ((c >= 0xc0) && (c <= 0xdf)) {
c -= 0x60;
/* e0-ff -> a0 -> 60-7f gfx chars */
- } else if ((c >= 0xe0) /*&& (c <= 0xff)*/) {
+ } else if ((c >= 0xe0) && (c <= 0xfe)) {
c -= 0x40;
+ } else if (c == 0xff) {
+ c = 0x7e;
}
sdl_ui_putchar(c, x_pos, y);
++x_pos;
@@ -262,8 +264,10 @@
} else if ((c >= 0xc0) && (c <= 0xdf)) {
c -= 0x60;
/* e0-ff -> a0 -> 60-7f gfx chars */
- } else if ((c >= 0xe0) /*&& (c <= 0xff)*/) {
+ } else if ((c >= 0xe0) && (c <= 0xfe)) {
c -= 0x40;
+ } else if (c == 0xff) {
+ c = 0x7e;
}
sdl_ui_putchar(c, x_pos, y);
++x_pos;
Modified: trunk/vice/src/monitor/monitor.c
===================================================================
--- trunk/vice/src/monitor/monitor.c 2024-04-01 23:03:15 UTC (rev 45060)
+++ trunk/vice/src/monitor/monitor.c 2024-04-02 00:57:53 UTC (rev 45061)
@@ -3147,30 +3147,30 @@
/* FIXME: the first time the console opens the font might not be initialized
correctly, so close and repopen the monitor once */
{
- int i;
+ int ch;
char str[2] = { 0, 0 };
mon_out("petscii:\n");
- for (i = 0; i < 0x100; i++) {
- if ((i && !(i & 0x0f))) { mon_out("\n"); }
- str[0] = i;
+ for (ch = 0; ch < 0x100; ch++) {
+ if ((ch && !(ch & 0x0f))) { mon_out("\n"); }
+ str[0] = ch;
mon_petscii_out(1, "%s", str);
}
mon_out("\n\npetscii (upper):\n");
- for (i = 0; i < 0x100; i++) {
- if ((i && !(i & 0x0f))) { mon_out("\n"); }
- str[0] = i;
+ for (ch = 0; ch < 0x100; ch++) {
+ if ((ch && !(ch & 0x0f))) { mon_out("\n"); }
+ str[0] = ch;
mon_petscii_upper_out(1, "%s", str);
}
mon_out("\n\nscrcode:\n");
- for (i = 0; i < 0x100; i++) {
- if ((i && !(i & 0x0f))) { mon_out("\n"); }
- str[0] = i;
+ for (ch = 0; ch < 0x100; ch++) {
+ if ((ch && !(ch & 0x0f))) { mon_out("\n"); }
+ str[0] = ch;
mon_scrcode_out(1, "%s", str);
}
mon_out("\n\nscrcode (upper):\n");
- for (i = 0; i < 0x100; i++) {
- if ((i && !(i & 0x0f))) { mon_out("\n"); }
- str[0] = i;
+ for (ch = 0; ch < 0x100; ch++) {
+ if ((ch && !(ch & 0x0f))) { mon_out("\n"); }
+ str[0] = ch;
mon_scrcode_upper_out(1, "%s", str);
}
mon_out("\n");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-04-01 23:03:17
|
Revision: 45060
http://sourceforge.net/p/vice-emu/code/45060
Author: gpz
Date: 2024-04-01 23:03:15 +0000 (Mon, 01 Apr 2024)
Log Message:
-----------
provide new function also for SDL and headless :)
Modified Paths:
--------------
trunk/vice/src/arch/headless/uimon.c
trunk/vice/src/arch/sdl/uimon.c
Modified: trunk/vice/src/arch/headless/uimon.c
===================================================================
--- trunk/vice/src/arch/headless/uimon.c 2024-04-01 22:56:53 UTC (rev 45059)
+++ trunk/vice/src/arch/headless/uimon.c 2024-04-01 23:03:15 UTC (rev 45060)
@@ -92,6 +92,15 @@
return 0;
}
+int uimon_scrcode_upper_out(const char *buffer, int num)
+{
+ /* printf("%s\n", __func__); */
+
+ log_message(LOG_DEFAULT, "Monitor (SCRCODE): %s", buffer);
+
+ return 0;
+}
+
void uimon_window_close(void)
{
/* printf("%s\n", __func__); */
Modified: trunk/vice/src/arch/sdl/uimon.c
===================================================================
--- trunk/vice/src/arch/sdl/uimon.c 2024-04-01 22:56:53 UTC (rev 45059)
+++ trunk/vice/src/arch/sdl/uimon.c 2024-04-01 23:03:15 UTC (rev 45060)
@@ -352,6 +352,58 @@
return rc;
}
+int uimon_scrcode_upper_out(const char *buffer, int num)
+{
+ int rc = 0;
+
+ if (using_ui_monitor) {
+ int y = menu_draw->max_text_y - 1;
+ const char *p = buffer;
+ int i = 0;
+ uint8_t c;
+
+ sdl_ui_set_active_font(MENU_FONT_IMAGES);
+
+ /* CAUTION: there is another level of indirection going on in uimenu.c */
+ while (i < num) {
+ c = p[i];
+ /* 00-1f -> 40-5f */
+ if (/*(c >= 0x00) &&*/ (c <= 0x1f)) {
+ c += 0x40;
+ /* 20-3f -> 20-3f */
+ /* 40-5f -> 60-7f */
+ } else if ((c >= 0x40) && (c <= 0x5f)) {
+ c += 0x20;
+ /* 60-7f -> a0-bf */
+ } else if ((c >= 0x60) && (c <= 0x7f)) {
+ c += 0x40;
+ /* 80-9f -> 00-1f */
+ } else if ((c >= 0x80) && (c <= 0x9f)) {
+ c -= 0x80;
+ /* a0-bf -> c0-df */
+ } else if ((c >= 0xa0) && (c <= 0xbf)) {
+ c += 0x20;
+ /* c0-df -> 80-9f */
+ } else if ((c >= 0xc0) && (c <= 0xdf)) {
+ c -= 0x40;
+ }
+ /* e0-ff -> e0-ff */
+ sdl_ui_putchar(c, x_pos, y);
+ ++x_pos;
+ ++i;
+ }
+
+ sdl_ui_set_active_font(MENU_FONT_ASCII);
+
+ } else {
+ if (console_log_local) {
+ rc = native_console_scrcode_out(num, console_log_local, "%s", buffer);
+ }
+ }
+
+ return rc;
+}
+
char *uimon_get_in(char **ppchCommandLine, const char *prompt)
{
if (using_ui_monitor) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-04-01 22:56:56
|
Revision: 45059
http://sourceforge.net/p/vice-emu/code/45059
Author: gpz
Date: 2024-04-01 22:56:53 +0000 (Mon, 01 Apr 2024)
Log Message:
-----------
more refactoring of the font/utf8 related stuff, added support for the regular 'pet me' font as well.
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/novte/vte.cc
trunk/vice/src/arch/gtk3/uimon.c
trunk/vice/src/arch/gtk3/widgets/base/Makefile.am
trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.c
trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.h
trunk/vice/src/arch/gtk3/widgets/contentpreviewwidget.c
trunk/vice/src/arch/gtk3/widgets/dirmenupopup.c
trunk/vice/src/monitor/mon_util.c
trunk/vice/src/monitor/monitor.c
trunk/vice/src/monitor.h
trunk/vice/src/uimon.h
Added Paths:
-----------
trunk/vice/src/arch/gtk3/widgets/base/unicodehelpers.c
trunk/vice/src/arch/gtk3/widgets/base/unicodehelpers.h
Modified: trunk/vice/src/arch/gtk3/novte/vte.cc
===================================================================
--- trunk/vice/src/arch/gtk3/novte/vte.cc 2024-03-31 23:47:57 UTC (rev 45058)
+++ trunk/vice/src/arch/gtk3/novte/vte.cc 2024-04-01 22:56:53 UTC (rev 45059)
@@ -4704,6 +4704,270 @@
/* Find streches with equal attributes. Newlines are treated specially,
* so that the <span> do not cover multiple lines.
*/
+
+ if (!strncasecmp("c64 pro", pango_font_description_get_family(m_fontdesc), 7)) {
+ /* C64 Pro codepoints:
+
+ 0xe000-0xe0ff codepoints cover the regular, uppercase, petscii codes
+ in ranges 0x20-0x7f and 0xa0-0xff
+ 0xe100-0xe1ff codepoints cover the regular, lowercase, petscii codes
+ in ranges 0x20-0x7f and 0xa0-0xff
+ 0xe200-0xe2ff codepoints cover the same characters, but contain the
+ respective inverted glyphs.
+ 0xe300-0xe3ff codepoints cover the same characters, but contain the
+ respective inverted lowercase glyphs. */
+
+ from = to = 0;
+ while (text[from] != '\0') {
+ g_assert(from == to);
+ /* attr = char_to_cell_attr(&g_array_index(attrs, VteCharAttributes, from)); */
+ ch = text[from];
+
+ if (ch & 0x100) {
+ unsigned int ch2 = text[from + 1] & 0xff;
+ unsigned int ch3 = text[from + 2] & 0xff;
+ ch = ch & 0xff;
+ /*printf("(%02x)", ch);*/
+ if (ch == 0xee) {
+ int codepoint = ((ch2 & 0x3f) << 6) | (ch3 & 0x3f);
+ int codeh = codepoint >> 8;
+ int codel = codepoint & 0xff;
+ printf("[A:%04x]", codepoint);
+ switch (codeh) {
+ case 0: /* uppercase, petscii codes in ranges 0x20-0x7f and 0xa0-0xff */
+ /* simple petscii -> ascii conversion */
+ if ((codel >= 0x20) && (codel <= 0x3f)) {
+ ch = codel;
+ } else if (codel == 0x40) {
+ ch = '@';
+ } else if ((codel >= 0x41) && (codel <= 0x5a)) {
+ ch = codel + 0x20; /* upper */
+ } else if ((codel >= 0x5b) && (codel <= 0x5f)) {
+ /*ch = codel + 0x20;*/
+ ch = codel;
+ } else {
+ ch = '.';
+ }
+ break;
+ case 1: /* lowercase, petscii codes in ranges 0x20-0x7f and 0xa0-0xff */
+ /* simple petscii -> ascii conversion */
+ if ((codel >= 0x20) && (codel <= 0x3f)) {
+ ch = codel;
+ } else if (codel == 0x40) {
+ ch = '@';
+ } else if ((codel >= 0x41) && (codel <= 0x5a)) {
+ ch = codel + 0x20; /* upper */
+ } else if ((codel >= 0x5b) && (codel <= 0x5f)) {
+ ch = codel;
+ } else if ((codel >= 0x61) && (codel <= 0x7a)) {
+ ch = codel - 0x20; /* upper */
+ } else if ((codel >= 0xc1) && (codel <= 0xda)) {
+ ch = codel - 0x80; /* upper */
+ } else {
+ ch = '.';
+ }
+ break;
+ case 2: /* inverted uppercase, petscii codes in ranges 0x20-0x7f and 0xa0-0xff */
+ ch = '.';
+ break;
+ case 3: /* inverted lowercase, petscii codes in ranges 0x20-0x7f and 0xa0-0xff */
+ ch = '.';
+ break;
+ default:
+ ch = '.';
+ break;
+ }
+ } else {
+ ch = '.';
+ }
+ to++;
+ to++;
+ }
+ printf("%c", ch);
+ g_string_append_c(string, ch);
+ from = ++to;
+ }
+
+ } else if (!strncasecmp("pet me 64", pango_font_description_get_family(m_fontdesc), 9) ||
+ !strncasecmp("pet me 128", pango_font_description_get_family(m_fontdesc), 10)) {
+ /*
+ Pet Me 64, Pet Me 64 2Y, Pet Me 128, and Pet Me 128 2Y, code points:
+ 0xE000-0xE1FF encode the complete Commodore 64 character set.
+ 0xE200-0xE3FF encode the complete Commodore 128 English character set
+ 0xE400-0xE5FF encode the complete Commodore 128 Swedish character set.
+ */
+
+ from = to = 0;
+ while (text[from] != '\0') {
+ g_assert(from == to);
+ /* attr = char_to_cell_attr(&g_array_index(attrs, VteCharAttributes, from)); */
+ ch = text[from];
+
+ if (ch & 0x100) {
+ unsigned int ch2 = text[from + 1] & 0xff;
+ unsigned int ch3 = text[from + 2] & 0xff;
+ ch = ch & 0xff;
+ /*printf("(%02x)", ch);*/
+ if (ch == 0xee) {
+ int codepoint = ((ch2 & 0x3f) << 6) | (ch3 & 0x3f);
+ int codeh = codepoint >> 8;
+ int codel = codepoint & 0xff;
+ /*printf("[B:%04x]", codepoint);*/
+ switch (codeh) {
+ case 0: /* uppercase */
+ /* simple screencode -> ascii conversion */
+ if (codel == 0) {
+ ch = '@';
+ } else if ((codel >= 0x01) && (codel <= 0x1a)) {
+ ch = codel + 0x60; /* upper */
+ } else if (codel == 0x1b) {
+ ch = '[';
+ } else if (codel == 0x1c) {
+ ch = '\\'; /* pound */
+ } else if (codel == 0x1d) {
+ ch = ']';
+ } else if (codel == 0x1e) {
+ ch = '^';
+ } else if (codel == 0x1f) {
+ ch = '_';
+ } else if ((codel >= 0x20) && (codel <= 0x3f)) {
+ ch = codel;
+ } else if ((codel >= 0x41) && (codel <= 0x5a)) {
+ ch = codel;
+ } else {
+ ch = '.';
+ }
+ break;
+ case 1: /* lowercase */
+ /* simple screencode -> ascii conversion */
+ if (codel == 0) {
+ ch = '@';
+ } else if ((codel >= 0x01) && (codel <= 0x1a)) {
+ ch = codel + 0x60; /* upper */
+ } else if (codel == 0x1b) {
+ ch = '[';
+ } else if (codel == 0x1c) {
+ ch = '\\'; /* pound */
+ } else if (codel == 0x1d) {
+ ch = ']';
+ } else if (codel == 0x1e) {
+ ch = '^';
+ } else if (codel == 0x1f) {
+ ch = '_';
+ } else if ((codel >= 0x20) && (codel <= 0x3f)) {
+ ch = codel;
+ } else if ((codel >= 0x41) && (codel <= 0x5a)) {
+ ch = codel;
+ } else {
+ ch = '.';
+ }
+ break;
+ default:
+ ch = '.';
+ break;
+ }
+ } else {
+ ch = '.';
+ }
+ to++;
+ to++;
+ }
+ /*printf("%c", ch);*/
+ g_string_append_c(string, ch);
+ from = ++to;
+ }
+
+ } else if (!strncasecmp("pet me", pango_font_description_get_family(m_fontdesc), 6)) {
+ /*
+ In Pet Me, Pet Me 2X, and Pet Me 2Y, code points
+ 0xE000-0xE0FF encode the complete Commodore PET English character set
+ 0xE100-0xE1FF encode the complete Commodore PET German character set.
+ 0xE200-0xE3FF encode the complete Commodore VIC-20 character set.
+ 0xE400-0xE5FF encode the complete Commodore 128 German character set
+ 0xE600-0xE7FF encode the complete Commodore 128 French character set.
+ 0xE800-0xE8FF encode the complete CBM2 character set.
+ */
+ from = to = 0;
+ while (text[from] != '\0') {
+ g_assert(from == to);
+ /* attr = char_to_cell_attr(&g_array_index(attrs, VteCharAttributes, from)); */
+ ch = text[from];
+
+ if (ch & 0x100) {
+ unsigned int ch2 = text[from + 1] & 0xff;
+ unsigned int ch3 = text[from + 2] & 0xff;
+ ch = ch & 0xff;
+ /*printf("(%02x)", ch);*/
+ if (ch == 0xee) {
+ int codepoint = ((ch2 & 0x3f) << 6) | (ch3 & 0x3f);
+ int codeh = codepoint >> 8;
+ int codel = codepoint & 0xff;
+ /*printf("[B:%04x]", codepoint);*/
+ switch (codeh) {
+ case 2: /* uppercase */
+ /* simple screencode -> ascii conversion */
+ if (codel == 0) {
+ ch = '@';
+ } else if ((codel >= 0x01) && (codel <= 0x1a)) {
+ ch = codel + 0x60; /* upper */
+ } else if (codel == 0x1b) {
+ ch = '[';
+ } else if (codel == 0x1c) {
+ ch = '\\'; /* pound */
+ } else if (codel == 0x1d) {
+ ch = ']';
+ } else if (codel == 0x1e) {
+ ch = '^';
+ } else if (codel == 0x1f) {
+ ch = '_';
+ } else if ((codel >= 0x20) && (codel <= 0x3f)) {
+ ch = codel;
+ } else if ((codel >= 0x41) && (codel <= 0x5a)) {
+ ch = codel;
+ } else {
+ ch = '.';
+ }
+ break;
+ case 3: /* lowercase */
+ /* simple screencode -> ascii conversion */
+ if (codel == 0) {
+ ch = '@';
+ } else if ((codel >= 0x01) && (codel <= 0x1a)) {
+ ch = codel + 0x60; /* upper */
+ } else if (codel == 0x1b) {
+ ch = '[';
+ } else if (codel == 0x1c) {
+ ch = '\\'; /* pound */
+ } else if (codel == 0x1d) {
+ ch = ']';
+ } else if (codel == 0x1e) {
+ ch = '^';
+ } else if (codel == 0x1f) {
+ ch = '_';
+ } else if ((codel >= 0x20) && (codel <= 0x3f)) {
+ ch = codel;
+ } else if ((codel >= 0x41) && (codel <= 0x5a)) {
+ ch = codel;
+ } else {
+ ch = '.';
+ }
+ break;
+ default:
+ ch = '.';
+ break;
+ }
+ } else {
+ ch = '.';
+ }
+ to++;
+ to++;
+ }
+ /*printf("%c", ch);*/
+ g_string_append_c(string, ch);
+ from = ++to;
+ }
+ }
+#if 0
from = to = 0;
while (text[from] != '\0') {
g_assert(from == to);
@@ -4838,7 +5102,7 @@
g_string_append_c(string, ch);
from = ++to;
}
-
+#endif
return string;
}
Modified: trunk/vice/src/arch/gtk3/uimon.c
===================================================================
--- trunk/vice/src/arch/gtk3/uimon.c 2024-03-31 23:47:57 UTC (rev 45058)
+++ trunk/vice/src/arch/gtk3/uimon.c 2024-04-01 22:56:53 UTC (rev 45059)
@@ -72,6 +72,7 @@
#include "log.h"
#include "ui.h"
#include "linenoise.h"
+#include "unicodehelpers.h"
#include "uimon.h"
#include "uimon-fallback.h"
#include "mon_command.h"
@@ -108,6 +109,7 @@
#define FONT_TYPE_ASCII 0
#define FONT_TYPE_C64PRO 1
#define FONT_TYPE_PETME 2 /* https://www.kreativekorp.com/software/fonts/c64/ */
+#define FONT_TYPE_PETME64 3 /* https://www.kreativekorp.com/software/fonts/c64/ */
static int font_type = FONT_TYPE_ASCII;
/* FIXME: this should perhaps be done using some function from archdep */
@@ -236,60 +238,7 @@
c = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
} else if (font_type == FONT_TYPE_C64PRO) {
/* regular PETSCII capable ("C64 Pro") font */
-
- /* 00-1f control codes 00-1f (shown as inverted 40-5f) */
- if (/* (c >= 0x00) && */ (c <= 0x1f)) {
- b = c + 0x40; /* lower */
- utf = vice_gtk3_petscii_to_utf8(&b, true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* 20-3f !"#...=>? */
- } else if ((c >= 0x20) && (c <= 0x3f)) {
- /* 40-5f @ab...\] */
- } else if ((c >= 0x40) && (c <= 0x5f)) {
- if (c == 0x40) {
- c = '@';
- } else if (c == 0x5b) {
- c = '[';
- } else if (c == 0x5c) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b, false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0x5d) {
- c = ']';
- } else if (c == 0x5e) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b, false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0x5f) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b, false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- c += 0x20; /* lower */
- }
- /* 60-7f AB...|}~ */
- } else if ((c >= 0x60) && (c <= 0x7f)) {
- if (c == 0x60) {
- b = '@' + 0x40; /* upper */
- utf = vice_gtk3_petscii_to_utf8(&b, true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if ((c >= 0x7b) && (c <= 0x7f)) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b, false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- c -= 0x20; /* upper */
- }
- /* 80-9f control codes 80-9f (shown as inverted 60-7f) */
- } else if ((c >= 0x80) && (c <= 0x9f)) {
- b = c - 0x20; /* upper */
- utf = vice_gtk3_petscii_to_utf8(&b, true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* a0-bf gfx chars */
- } else if ((c >= 0xa0) && (c <= 0xbf)) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b, false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+#if 0
/* c0-df AB...|}~ */
} else if ((c >= 0xc0) && (c <= 0xdf)) {
if (c == 0xc0) {
@@ -296,32 +245,43 @@
c = '@';
} else if (c == 0xdb) {
c = '[';
- } else if (c == 0xdc) {
- b = c - 0x80;
- utf = vice_gtk3_petscii_to_utf8(&b, false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else if (c == 0xdd) {
c = ']';
- } else if (c == 0xde) {
- b = c - 0x80;
- utf = vice_gtk3_petscii_to_utf8(&b, false, true);
+#endif
+ /* 20-3f !"#...=>? */
+ if (((c >= 0x20) && (c <= 0x2f)) ||
+ ((c >= 0x30) && (c <= 0x3f))
+ ) {
+ /* exclude some ranges from utf conversion */
+ /* 40-5a @ab... */
+ } else if (c == 0x40) {
+ c = '@';
+ } else if ((c >= 0x41) && (c <= 0x5a)) {
+ c += 0x20;
+ } else if (c == 0x5b) {
+ c = '[';
+ } else if (c == 0x5d) {
+ c = ']';
+ /* 60-7f AB...|}~ */
+ } else if ((c >= 0x61) && (c <= 0x7a)) {
+ c -= 0x20;
+ } else {
+ /* convert the rest to utf8 */
+ if (c == 0) {
+ /* 0 is a petscii control code, which we display as inverted @ */
+ c = '@';
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b, true, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0xdf) {
- b = c - 0x80;
+ } else {
+ b = c;
utf = vice_gtk3_petscii_to_utf8(&b, false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- c -= 0x60;
}
- /* e0-ff -> a0 -> 60-7f gfx chars */
- } else if ((c >= 0xe0) /* && (c <= 0xff) */) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b, false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
} else if (font_type == FONT_TYPE_PETME) {
- /* FIXME */
if (c == 0) {
+ /* 0 is a petscii control code, which we display as inverted @ */
c = '@';
b = c;
utf = vice_gtk3_petscii_to_utf8_petme(&b, true, true);
@@ -331,6 +291,18 @@
utf = vice_gtk3_petscii_to_utf8_petme(&b, false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
+ } else if (font_type == FONT_TYPE_PETME64) {
+ if (c == 0) {
+ /* 0 is a petscii control code, which we display as inverted @ */
+ c = '@';
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8_petme64(&b, true, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8_petme64(&b, false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ }
}
if (utf) {
@@ -363,7 +335,7 @@
/* regular ASCII font */
c = buffer[n];
if ((c >= 0x01) && (c <= 0x1a)) {
- c += 0x60; /* upper */
+ c += 0x60; /* lower */
} else if ((c >= 0x41) && (c <= 0x5a)) {
c += 0x20; /* upper */
}
@@ -371,93 +343,61 @@
} else if (font_type == FONT_TYPE_C64PRO) {
/* regular PETSCII capable ("C64 Pro") font */
- /* 00-1f control codes 00-1f (shown as inverted 40-5f) */
- if (/* (c >= 0x00) && */ (c <= 0x1f)) {
- b = c + 0x40; /* lower */
- utf = vice_gtk3_petscii_to_utf8(&b ,true, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
/* 20-3f !"#...=>? */
- } else if ((c >= 0x20) && (c <= 0x2f)) {
- } else if ((c >= 0x30) && (c <= 0x3f)) {
- /* 40-5f @ab...\] */
- } else if ((c >= 0x40) && (c <= 0x5f)) {
- if (c == 0x40) {
+ if (((c >= 0x20) && (c <= 0x2f)) ||
+ ((c >= 0x30) && (c <= 0x3f))
+ ) {
+ /* exclude some ranges from utf conversion */
+ /* 40-5a @ab... */
+ } else if (c == 0x40) {
+ c = '@';
+ } else if ((c >= 0x41) && (c <= 0x5a)) {
+ c += 0x20;
+ } else if (c == 0x5b) {
+ c = '[';
+ } else if (c == 0x5d) {
+ c = ']';
+ /* 51-7a AB... */
+ } else if ((c >= 0x61) && (c <= 0x7a)) {
+ c -= 0x20;
+ } else {
+ /* convert the rest to utf8 */
+ if (c == 0) {
+ /* 0 is a petscii control code, which we display as inverted @ */
c = '@';
- }
- else if (c == 0x5b) {
- c = '[';
- } else if (c == 0x5c) {
b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ utf = vice_gtk3_petscii_upper_to_utf8(&b, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0x5d) {
- c = ']';
- } else if (c == 0x5e) {
+ } else {
b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ utf = vice_gtk3_petscii_upper_to_utf8(&b, false);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0x5f) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- /* upper */
}
- /* 60-7f AB...|}~ */
- } else if ((c >= 0x60) && (c <= 0x7f)) {
- /* 80-9f control codes 80-9f (shown as inverted 60-7f) */
- } else if ((c >= 0x80) && (c <= 0x9f)) {
- b = c - 0x20; /* upper */
- utf = vice_gtk3_petscii_to_utf8(&b ,true, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* a0-bf gfx chars */
- } else if ((c >= 0xa0) && (c <= 0xbf)) {
+ }
+ } else if (font_type == FONT_TYPE_PETME) {
+ /* FIXME */
+ if (c == 0) {
+ /* 0 is a petscii control code, which we display as inverted @ */
+ c = '@';
b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ utf = vice_gtk3_petscii_upper_to_utf8_petme(&b, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* c0-df AB...|}~ */
- } else if ((c >= 0xc0) && (c <= 0xdf)) {
- if (c == 0xc0) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0xdc) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0xdd) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0xde) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0xdf) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- b = c - 0x60;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- }
- /* e0-ff -> a0 -> 60-7f gfx chars */
- } else if ((c >= 0xe0) /* && (c <= 0xff) */) {
+ } else {
b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ utf = vice_gtk3_petscii_upper_to_utf8_petme(&b, false);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
- } else if (font_type == FONT_TYPE_PETME) {
+ } else if (font_type == FONT_TYPE_PETME64) {
/* FIXME */
if (c == 0) {
+ /* 0 is a petscii control code, which we display as inverted @ */
c = '@';
b = c;
- utf = vice_gtk3_petscii_to_utf8_petme(&b, true, false);
+ utf = vice_gtk3_petscii_upper_to_utf8_petme64(&b, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else {
b = c;
- utf = vice_gtk3_petscii_to_utf8_petme(&b, false, false);
+ utf = vice_gtk3_petscii_upper_to_utf8_petme64(&b, false);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
}
@@ -495,16 +435,13 @@
c = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
} else if (font_type == FONT_TYPE_C64PRO) {
/* regular PETSCII capable ("C64 Pro") font */
- if ((c >= 0x60) && (c <= 0x7f)) {
- b = c + 0x40;
- } else if ((c >= 0xe0) && (c <= 0xfe)) {
- b = c;
- } else if ((c == 0xff) /*&& (c <= 0xff) */) {
- b = 0xbf;
+ b = c;
+ if (c == 0x00) {
+ b = '@'; /* Hack, this way we sneak the 0 in there */
+ utf = vice_gtk3_petscii_to_utf8(&b, c & 0x80 ? true : false, true);
} else {
- b = charset_screencode_to_petscii(c);
+ utf = vice_gtk3_scrcode_to_utf8(&b, c & 0x80 ? true : false, true);
}
- utf = vice_gtk3_petscii_to_utf8(&b, c & 0x80 ? true : false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else if (font_type == FONT_TYPE_PETME) {
/* FIXME: regular PETSCII capable ("PET Me") font */
@@ -511,10 +448,23 @@
int ch = c & 0x7f;
b = ch;
if (ch == 0x00) {
- b = '@';
+ b = '@'; /* Hack, this way we sneak the 0 in there */
+ utf = vice_gtk3_petscii_to_utf8_petme(&b, c & 0x80 ? true : false, true);
+ } else {
+ utf = vice_gtk3_scrcode_to_utf8_petme(&b, c & 0x80 ? true : false, true);
}
- utf = vice_gtk3_scrcode_to_utf8_petme(&b, c & 0x80 ? true : false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (font_type == FONT_TYPE_PETME64) {
+ /* FIXME: regular PETSCII capable ("PET Me") font */
+ int ch = c & 0x7f;
+ b = ch;
+ if (ch == 0x00) {
+ b = '@'; /* Hack, this way we sneak the 0 in there */
+ utf = vice_gtk3_petscii_to_utf8_petme64(&b, c & 0x80 ? true : false, true);
+ } else {
+ utf = vice_gtk3_scrcode_to_utf8_petme64(&b, c & 0x80 ? true : false, true);
+ }
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
if (utf) {
@@ -528,7 +478,70 @@
return 0;
}
+/* output screencode, uppercase */
+int uimon_scrcode_upper_out(const char *buffer, int len)
+{
+ int n = 0;
+ unsigned char *utf = NULL;
+ uint8_t b;
+ uint8_t c;
+ if (native_monitor()) {
+ return uimonfb_scrcode_out(buffer, len);
+ }
+
+ while (n < len) {
+ c = buffer[n];
+
+ if (font_type == FONT_TYPE_ASCII) {
+ /* regular ASCII font */
+ c = charset_screencode_to_petscii(c);
+ c = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
+ } else if (font_type == FONT_TYPE_C64PRO) {
+ /* regular PETSCII capable ("C64 Pro") font */
+ b = c;
+ if (c == 0x00) {
+ b = '@'; /* Hack, this way we sneak the 0 in there */
+ utf = vice_gtk3_petscii_upper_to_utf8(&b, c & 0x80 ? true : false);
+ } else {
+ utf = vice_gtk3_scrcode_upper_to_utf8(&b, c & 0x80 ? true : false);
+ }
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (font_type == FONT_TYPE_PETME) {
+ /* FIXME: regular PETSCII capable ("PET Me") font */
+ int ch = c & 0x7f;
+ b = ch;
+ if (ch == 0x00) {
+ b = '@'; /* Hack, this way we sneak the 0 in there */
+ utf = vice_gtk3_petscii_upper_to_utf8_petme(&b, c & 0x80 ? true : false);
+ } else {
+ utf = vice_gtk3_scrcode_upper_to_utf8_petme(&b, c & 0x80 ? true : false);
+ }
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (font_type == FONT_TYPE_PETME64) {
+ /* FIXME: regular PETSCII capable ("PET Me") font */
+ int ch = c & 0x7f;
+ b = ch;
+ if (ch == 0x00) {
+ b = '@'; /* Hack, this way we sneak the 0 in there */
+ utf = vice_gtk3_petscii_upper_to_utf8_petme64(&b, c & 0x80 ? true : false);
+ } else {
+ utf = vice_gtk3_scrcode_upper_to_utf8_petme64(&b, c & 0x80 ? true : false);
+ }
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ }
+
+ if (utf) {
+ lib_free(utf);
+ utf = NULL;
+ } else {
+ uimon_write_to_terminal(&fixed, (const char*)&c, 1);
+ }
+ n++;
+ }
+ return 0;
+}
+
int uimon_get_columns(struct console_private_s *t)
{
if(t->term) {
@@ -981,7 +994,7 @@
/* mouse wheel scrolls the terminal (scrollback) forth/back */
GtkAdjustment* vadj = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(fixed.term));
gdouble value = gtk_adjustment_get_value(vadj);
- value += scrollevent.delta_y * 3;
+ value += scrollevent.delta_y * 1;
gtk_adjustment_set_value(vadj, value);
gtk_scrollable_set_vadjustment(GTK_SCROLLABLE(fixed.term), vadj);
@@ -1151,6 +1164,10 @@
if(!strncasecmp("c64 pro", using_font, 7)) {
log_message(LOG_DEFAULT, "'C64 Pro*' font found, enabling PETSCII output.");
font_type = FONT_TYPE_C64PRO;
+ } else if(!strncasecmp("pet me 64", using_font, 9) ||
+ !strncasecmp("pet me 128", using_font, 10)) {
+ log_message(LOG_DEFAULT, "'PET Me 64/128*' font found, enabling PETSCII output.");
+ font_type = FONT_TYPE_PETME64;
} else if(!strncasecmp("pet me", using_font, 6)) {
log_message(LOG_DEFAULT, "'PET Me*' font found, enabling PETSCII output.");
font_type = FONT_TYPE_PETME;
Modified: trunk/vice/src/arch/gtk3/widgets/base/Makefile.am
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/Makefile.am 2024-03-31 23:47:57 UTC (rev 45058)
+++ trunk/vice/src/arch/gtk3/widgets/base/Makefile.am 2024-04-01 22:56:53 UTC (rev 45059)
@@ -60,6 +60,7 @@
resourcewidgetmediator.c \
savefiledialog.c \
selectdirectorydialog.c \
+ unicodehelpers.c \
uiactionbutton.c \
widgethelpers.c
@@ -90,6 +91,7 @@
resourcewidgetmediator.h \
savefiledialog.h \
selectdirectorydialog.h \
+ unicodehelpers.h \
uiactionbutton.h \
vice_gtk3.h \
vice_gtk3_settings.h \
Added: trunk/vice/src/arch/gtk3/widgets/base/unicodehelpers.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/unicodehelpers.c (rev 0)
+++ trunk/vice/src/arch/gtk3/widgets/base/unicodehelpers.c 2024-04-01 22:56:53 UTC (rev 45059)
@@ -0,0 +1,471 @@
+/** \file unicodehelpers.c
+ * \brief Helpers for unicode
+ *
+ * \author Groepaz
+ *
+ */
+
+/*
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ *
+*/
+
+
+#include "vice.h"
+
+#include <gtk/gtk.h>
+#include <string.h>
+#include <stdbool.h>
+
+#include "charset.h"
+#include "lib.h"
+#include "resources.h"
+
+#include "vice_gtk3_settings.h"
+#include "debug_gtk3.h"
+
+#include "unicodehelpers.h"
+
+/*
+ * "C64 Pro"
+ */
+
+/** \brief Convert petscii encoded string to utf8 string we can show using the CBM font
+ *
+ * this function handles all characters that may appear in a directory listing,
+ * including "non printable" control characters, which appear as inverted characters
+ * in so called "quote mode".
+ *
+ * \param[in] s PETSCII string to convert to UTF-8
+ * \param[in] inverted use inverted mode
+ * \param[in] lowercase use the lowercase chargen
+ *
+ * \return heap-allocated UTF-8 string, free with lib_free()
+ *
+ * \note only valid for the "C64_Pro_Mono-STYLE.ttf" font, not the old
+ * "CBM.ttf" font.
+ *
+ * \note Somehow the inverted space has a line on top on at least Linux,
+ * the codepoint seems fine though, so perhaps a bug in Pango?
+ */
+unsigned char *vice_gtk3_petscii_to_utf8(unsigned char *s,
+ bool inverted,
+ bool lowercase)
+{
+ unsigned char *d, *r;
+ unsigned int codepoint;
+
+ r = d = lib_malloc((size_t)(strlen((char *)s) * 3 + 1));
+
+ while (*s) {
+
+ /* 0xe000-0xe0ff codepoints cover the regular, uppercase, petscii codes
+ in ranges 0x20-0x7f and 0xa0-0xff
+ 0xe100-0xe1ff codepoints cover the regular, lowercase, petscii codes
+ in ranges 0x20-0x7f and 0xa0-0xff
+ 0xe200-0xe2ff codepoints cover the same characters, but contain the
+ respective inverted glyphs.
+ 0xe300-0xe3ff codepoints cover the same characters, but contain the
+ respective inverted lowercase glyphs.
+
+ regular valid petscii codes are converted as is, petscii control
+ codes will produce the glyph that the petscii code would produce
+ in so called "quote mode".
+ */
+
+ /* first convert petscii to utf8 codepoint */
+ if (*s < 0x20) {
+ /* petscii 0x00-0x1f control codes (inverted @ABC..etc) */
+ codepoint = *s + 0xe240; /* 0xe240-0xe25f */
+ } else if (*s < 0x80) {
+ /* petscii 0x20-0x7f printable petscii codes */
+ codepoint = *s + 0xe000; /* 0xe020-0xe07f */
+ } else if (*s < 0xa0) {
+ /* petscii 0x80-0x9f control codes (inverted SH...@AB...) */
+ codepoint = (*s - 0x80) + 0xe260; /* 0xe260-0xe27f */
+ } else {
+ /* petscii 0xa0-0xff printable petscii codes */
+ codepoint = *s + 0xe000; /* 0xe0a0-0xe0ff */
+ }
+ if (inverted) {
+ codepoint ^= 0x0200; /* 0xe0XX <-> 0xe2XX */
+ }
+ /* switch to lower case if requested */
+ if (lowercase) {
+ codepoint ^= 0x0100;
+ }
+ s++;
+
+ /* now copy to the destination string and convert to utf8 */
+ /* we can get away with just this, because all codepoints are > 4095 */
+ /* three byte form - 1110xxxx 10xxxxxx 10xxxxxx */
+ *d++ = 0xe0 | ((codepoint >> 12) & 0x0f);
+ *d++ = 0x80 | ((codepoint >> (6)) & 0x3f);
+ *d = 0x80 | ((codepoint >> (0)) & 0x3f);
+ d++;
+ }
+ *d = '\0';
+
+ return r;
+}
+
+unsigned char *vice_gtk3_petscii_upper_to_utf8(unsigned char *s, bool inverted)
+{
+ return vice_gtk3_petscii_to_utf8(s, inverted, false);
+}
+
+unsigned char *vice_gtk3_scrcode_to_utf8(unsigned char *s,
+ bool inverted,
+ bool lowercase)
+{
+ unsigned char *d, *r;
+ unsigned int codepoint;
+
+ r = d = lib_malloc((size_t)(strlen((char *)s) * 3 + 1));
+
+ while (*s) {
+
+ /* 0xe000-0xe0ff codepoints cover the regular, uppercase, petscii codes
+ in ranges 0x20-0x7f and 0xa0-0xff
+ 0xe100-0xe1ff codepoints cover the regular, lowercase, petscii codes
+ in ranges 0x20-0x7f and 0xa0-0xff
+ 0xe200-0xe2ff codepoints cover the same characters, but contain the
+ respective inverted glyphs.
+ 0xe300-0xe3ff codepoints cover the same characters, but contain the
+ respective inverted lowercase glyphs.
+
+ regular valid petscii codes are converted as is, petscii control
+ codes will produce the glyph that the petscii code would produce
+ in so called "quote mode".
+ */
+
+ /* scrcode -> petscii */
+ if ((*s >= 0x60) && (*s <= 0x7f)) {
+ *s = *s + 0x40;
+ } else if ((*s >= 0xe0) && (*s <= 0xfe)) {
+ *s = *s;
+ } else if ((*s == 0xff) /*&& (*s <= 0xff) */) {
+ *s = 0xbf;
+ } else {
+ *s = charset_screencode_to_petscii(*s);
+ }
+
+ /* first convert petscii to utf8 codepoint */
+ if (*s < 0x20) {
+ /* petscii 0x00-0x1f control codes (inverted @ABC..etc) */
+ codepoint = *s + 0xe240; /* 0xe240-0xe25f */
+ } else if (*s < 0x80) {
+ /* petscii 0x20-0x7f printable petscii codes */
+ codepoint = *s + 0xe000; /* 0xe020-0xe07f */
+ } else if (*s < 0xa0) {
+ /* petscii 0x80-0x9f control codes (inverted SH...@AB...) */
+ codepoint = (*s - 0x80) + 0xe260; /* 0xe260-0xe27f */
+ } else {
+ /* petscii 0xa0-0xff printable petscii codes */
+ codepoint = *s + 0xe000; /* 0xe0a0-0xe0ff */
+ }
+
+ if (inverted) {
+ codepoint ^= 0x0200; /* 0xe0XX <-> 0xe2XX */
+ }
+ /* switch to lower case if requested */
+ if (lowercase) {
+ codepoint ^= 0x0100;
+ }
+ s++;
+
+ /* now copy to the destination string and convert to utf8 */
+ /* we can get away with just this, because all codepoints are > 4095 */
+ /* three byte form - 1110xxxx 10xxxxxx 10xxxxxx */
+ *d++ = 0xe0 | ((codepoint >> 12) & 0x0f);
+ *d++ = 0x80 | ((codepoint >> (6)) & 0x3f);
+ *d = 0x80 | ((codepoint >> (0)) & 0x3f);
+ d++;
+ }
+ *d = '\0';
+
+ return r;
+}
+
+unsigned char *vice_gtk3_scrcode_upper_to_utf8(unsigned char *s, bool inverted)
+{
+ return vice_gtk3_scrcode_to_utf8(s, inverted, false);
+}
+
+/*
+ * "Pet Me"
+ */
+
+/** \brief Convert petscii encoded string to utf8 string we can show using a CBM font
+ *
+ * this function handles all "printable" PETSCII characters,
+ * including "non printable" control characters, which appear as inverted characters
+ * in so called "quote mode".
+ *
+ * \param[in] s PETSCII string to convert to UTF-8
+ * \param[in] inverted use inverted mode
+ * \param[in] lowercase use the lowercase chargen
+ *
+ * \return heap-allocated UTF-8 string, free with lib_free()
+ *
+ * \note only valid for the "PetMe.ttf" font
+ */
+unsigned char *vice_gtk3_petscii_to_utf8_petme(unsigned char *s,
+ bool inverted,
+ bool lowercase)
+{
+ unsigned char *d, *r;
+ unsigned int codepoint;
+ int ch;
+
+ r = d = lib_malloc((size_t)(strlen((char *)s) * 3 + 1));
+
+ while (*s) {
+ /*
+ In Pet Me, Pet Me 2X, and Pet Me 2Y, code points
+ 0xE000-0xE0FF encode the complete Commodore PET English character set
+ 0xE100-0xE1FF encode the complete Commodore PET German character set.
+ 0xE200-0xE3FF encode the complete Commodore VIC-20 character set.
+ 0xE400-0xE5FF encode the complete Commodore 128 German character set
+ 0xE600-0xE7FF encode the complete Commodore 128 French character set.
+ 0xE800-0xE8FF encode the complete CBM2 character set.
+ */
+
+ if (*s < 0x20) {
+ /* petscii 0x00-0x1f control codes (inverted @ABC..etc) */
+ ch = *s;
+ inverted ^= 0x80;
+ } else if ((*s >= 0x80) && (*s <= 0x9f)) {
+ /* petscii 0x80-0x9f control codes (inverted SH...@AB...) */
+ ch = (*s - 0x80) + 0x60;
+ ch = charset_petscii_to_screencode(ch, false);
+ inverted ^= 0x80;
+ } else {
+ ch = charset_petscii_to_screencode(*s, false);
+ inverted ^= ch & 0x80;
+ ch = ch & 0x7f;
+ }
+
+ codepoint = ch + 0xe200;
+
+ if (inverted) {
+ codepoint ^= 0x0080; /* 0xe0XX <-> 0xe2XX */
+ }
+ /* switch to lower case if requested */
+ if (lowercase) {
+ codepoint ^= 0x0100;
+ }
+ s++;
+
+ /* now copy to the destination string and convert to utf8 */
+ /* we can get away with just this, because all codepoints are > 4095 */
+ /* three byte form - 1110xxxx 10xxxxxx 10xxxxxx */
+ *d++ = 0xe0 | ((codepoint >> 12) & 0x0f);
+ *d++ = 0x80 | ((codepoint >> (6)) & 0x3f);
+ *d = 0x80 | ((codepoint >> (0)) & 0x3f);
+ d++;
+ }
+ *d = '\0';
+
+ return r;
+}
+
+unsigned char *vice_gtk3_petscii_upper_to_utf8_petme(unsigned char *s, bool inverted)
+{
+ return vice_gtk3_petscii_to_utf8_petme(s, inverted, false);
+}
+
+unsigned char *vice_gtk3_scrcode_to_utf8_petme(unsigned char *s,
+ bool inverted,
+ bool lowercase)
+{
+ unsigned char *d, *r;
+ unsigned int codepoint;
+ int ch;
+
+ r = d = lib_malloc((size_t)(strlen((char *)s) * 3 + 1));
+
+ while (*s) {
+ /*
+ In Pet Me, Pet Me 2X, and Pet Me 2Y, code points
+ 0xE000-0xE0FF encode the complete Commodore PET English character set
+ 0xE100-0xE1FF encode the complete Commodore PET German character set.
+ 0xE200-0xE3FF encode the complete Commodore VIC-20 character set.
+ 0xE400-0xE5FF encode the complete Commodore 128 German character set
+ 0xE600-0xE7FF encode the complete Commodore 128 French character set.
+ 0xE800-0xE8FF encode the complete CBM2 character set.
+ */
+
+ ch = *s & 0x7f;
+ codepoint = ch + 0xe200;
+
+ if (inverted) {
+ codepoint ^= 0x0080; /* 0xe0XX <-> 0xe2XX */
+ }
+ /* switch to lower case if requested */
+ if (lowercase) {
+ codepoint ^= 0x0100;
+ }
+ s++;
+
+ /* now copy to the destination string and convert to utf8 */
+ /* we can get away with just this, because all codepoints are > 4095 */
+ /* three byte form - 1110xxxx 10xxxxxx 10xxxxxx */
+ *d++ = 0xe0 | ((codepoint >> 12) & 0x0f);
+ *d++ = 0x80 | ((codepoint >> (6)) & 0x3f);
+ *d = 0x80 | ((codepoint >> (0)) & 0x3f);
+ d++;
+ }
+ *d = '\0';
+
+ return r;
+}
+
+unsigned char *vice_gtk3_scrcode_upper_to_utf8_petme(unsigned char *s, bool inverted)
+{
+ return vice_gtk3_scrcode_to_utf8_petme64(s, inverted, false);
+}
+
+/*
+ * "Pet Me 64"
+ */
+
+/** \brief Convert petscii encoded string to utf8 string we can show using a CBM font
+ *
+ * this function handles all "printable" PETSCII characters,
+ * including "non printable" control characters, which appear as inverted characters
+ * in so called "quote mode".
+ *
+ * \param[in] s PETSCII string to convert to UTF-8
+ * \param[in] inverted use inverted mode
+ * \param[in] lowercase use the lowercase chargen
+ *
+ * \return heap-allocated UTF-8 string, free with lib_free()
+ *
+ * \note only valid for the "PetMe64.ttf" font
+ */
+unsigned char *vice_gtk3_petscii_to_utf8_petme64(unsigned char *s,
+ bool inverted,
+ bool lowercase)
+{
+ unsigned char *d, *r;
+ unsigned int codepoint;
+ int ch;
+
+ r = d = lib_malloc((size_t)(strlen((char *)s) * 3 + 1));
+
+ while (*s) {
+ /*
+ In Pet Me 64, Pet Me 64 2Y, Pet Me 128, and Pet Me 128 2Y, code points
+ 0xE000-0xE1FF encode the complete Commodore 64 character set.
+ 0xE200-0xE3FF encode the complete Commodore 128 English character set
+ 0xE400-0xE5FF encode the complete Commodore 128 Swedish character set.
+ */
+
+ if (*s < 0x20) {
+ /* petscii 0x00-0x1f control codes (inverted @ABC..etc) */
+ ch = *s;
+ inverted ^= 0x80;
+ } else if ((*s >= 0x80) && (*s <= 0x9f)) {
+ /* petscii 0x80-0x9f control codes (inverted SH...@AB...) */
+ ch = (*s - 0x80) + 0x60;
+ ch = charset_petscii_to_screencode(ch, false);
+ inverted ^= 0x80;
+ } else {
+ ch = charset_petscii_to_screencode(*s, false);
+ inverted ^= ch & 0x80;
+ ch = ch & 0x7f;
+ }
+
+ codepoint = ch + 0xe000;
+
+ if (inverted) {
+ codepoint ^= 0x0080; /* 0xe0XX <-> 0xe2XX */
+ }
+ /* switch to lower case if requested */
+ if (lowercase) {
+ codepoint ^= 0x0100;
+ }
+ s++;
+
+ /* now copy to the destination string and convert to utf8 */
+ /* we can get away with just this, because all codepoints are > 4095 */
+ /* three byte form - 1110xxxx 10xxxxxx 10xxxxxx */
+ *d++ = 0xe0 | ((codepoint >> 12) & 0x0f);
+ *d++ = 0x80 | ((codepoint >> (6)) & 0x3f);
+ *d = 0x80 | ((codepoint >> (0)) & 0x3f);
+ d++;
+ }
+ *d = '\0';
+
+ return r;
+}
+
+unsigned char *vice_gtk3_petscii_upper_to_utf8_petme64(unsigned char *s, bool inverted)
+{
+ return vice_gtk3_petscii_to_utf8_petme64(s, inverted, false);
+}
+
+unsigned char *vice_gtk3_scrcode_to_utf8_petme64(unsigned char *s,
+ bool inverted,
+ bool lowercase)
+{
+ unsigned char *d, *r;
+ unsigned int codepoint;
+ int ch;
+
+ r = d = lib_malloc((size_t)(strlen((char *)s) * 3 + 1));
+
+ while (*s) {
+ /*
+ In Pet Me 64, Pet Me 64 2Y, Pet Me 128, and Pet Me 128 2Y, code points
+ 0xE000-0xE1FF encode the complete Commodore 64 character set.
+ 0xE200-0xE3FF encode the complete Commodore 128 English character set
+ 0xE400-0xE5FF encode the complete Commodore 128 Swedish character set.
+ */
+
+ ch = *s & 0x7f;
+ codepoint = ch + 0xe000;
+
+ if (inverted) {
+ codepoint ^= 0x0080; /* 0xe0XX <-> 0xe2XX */
+ }
+ /* switch to lower case if requested */
+ if (lowercase) {
+ codepoint ^= 0x0100;
+ }
+ s++;
+
+ /* now copy to the destination string and convert to utf8 */
+ /* we can get away with just this, because all codepoints are > 4095 */
+ /* three byte form - 1110xxxx 10xxxxxx 10xxxxxx */
+ *d++ = 0xe0 | ((codepoint >> 12) & 0x0f);
+ *d++ = 0x80 | ((codepoint >> (6)) & 0x3f);
+ *d = 0x80 | ((codepoint >> (0)) & 0x3f);
+ d++;
+ }
+ *d = '\0';
+
+ return r;
+}
+
+unsigned char *vice_gtk3_scrcode_upper_to_utf8_petme64(unsigned char *s, bool inverted)
+{
+ return vice_gtk3_scrcode_to_utf8_petme64(s, inverted, false);
+}
Added: trunk/vice/src/arch/gtk3/widgets/base/unicodehelpers.h
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/unicodehelpers.h (rev 0)
+++ trunk/vice/src/arch/gtk3/widgets/base/unicodehelpers.h 2024-04-01 22:56:53 UTC (rev 45059)
@@ -0,0 +1,49 @@
+/** \file unicodehelpers.h
+ * \brief GTK3 helper functions for unicode - header
+ *
+ * \author Groepaz
+ */
+
+/*
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ */
+
+#ifndef VICE_UNICODEHELPERS_H
+#define VICE_UNICODEHELPERS_H
+
+/* FIXME: since these functions work on strings, they can't convert the 0 character correctly -
+ we should provide additional functions that convert as single character (which can
+ always work) and/or alternative functions that take a buffer length */
+
+unsigned char *vice_gtk3_petscii_to_utf8(unsigned char *s, bool inverted, bool lowercase);
+unsigned char *vice_gtk3_scrcode_to_utf8(unsigned char *s, bool inverted, bool lowercase);
+unsigned char *vice_gtk3_petscii_upper_to_utf8(unsigned char *s, bool inverted);
+unsigned char *vice_gtk3_scrcode_upper_to_utf8(unsigned char *s, bool inverted);
+
+unsigned char *vice_gtk3_petscii_to_utf8_petme(unsigned char *s, bool inverted, bool lowercase);
+unsigned char *vice_gtk3_scrcode_to_utf8_petme(unsigned char *s, bool inverted, bool lowercase);
+unsigned char *vice_gtk3_petscii_upper_to_utf8_petme(unsigned char *s, bool inverted);
+unsigned char *vice_gtk3_scrcode_upper_to_utf8_petme(unsigned char *s, bool inverted);
+
+unsigned char *vice_gtk3_petscii_to_utf8_petme64(unsigned char *s, bool inverted, bool lowercase);
+unsigned char *vice_gtk3_scrcode_to_utf8_petme64(unsigned char *s, bool inverted, bool lowercase);
+unsigned char *vice_gtk3_petscii_upper_to_utf8_petme64(unsigned char *s, bool inverted);
+unsigned char *vice_gtk3_scrcode_upper_to_utf8_petme64(unsigned char *s, bool inverted);
+
+#endif
Modified: trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.c 2024-03-31 23:47:57 UTC (rev 45058)
+++ trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.c 2024-04-01 22:56:53 UTC (rev 45059)
@@ -41,7 +41,6 @@
#include <string.h>
#include <stdbool.h>
-#include "charset.h"
#include "lib.h"
#include "resources.h"
@@ -51,7 +50,6 @@
#include "widgethelpers.h"
-
/** \brief Get index of \a value in \a list
*
* Get the index in \a list for \a value. This function is required for custom
@@ -236,260 +234,3 @@
}
}
-
-/** \brief Convert petscii encoded string to utf8 string we can show using the CBM font
- *
- * this function handles all characters that may appear in a directory listing,
- * including "non printable" control characters, which appear as inverted characters
- * in so called "quote mode".
- *
- * \param[in] s PETSCII string to convert to UTF-8
- * \param[in] inverted use inverted mode
- * \param[in] lowercase use the lowercase chargen
- *
- * \return heap-allocated UTF-8 string, free with lib_free()
- *
- * \note only valid for the "C64_Pro_Mono-STYLE.ttf" font, not the old
- * "CBM.ttf" font.
- *
- * \note Somehow the inverted space has a line on top on at least Linux,
- * the codepoint seems fine though, so perhaps a bug in Pango?
- */
-unsigned char *vice_gtk3_petscii_to_utf8(unsigned char *s,
- bool inverted,
- bool lowercase)
-{
- unsigned char *d, *r;
- unsigned int codepoint;
-
- r = d = lib_malloc((size_t)(strlen((char *)s) * 3 + 1));
-#if 0
- debug_gtk3("Input: '%s'", s);
-#ifdef HAVE_DEBUG_GTK3UI
- unsigned char *t = s;
- while (*t) {
- printf(" %02x", *t++);
- }
- putchar('\n');
-#endif
-#endif
- while (*s) {
-
- /* 0xe000-0xe0ff codepoints cover the regular, uppercase, petscii codes
- in ranges 0x20-0x7f and 0xa0-0xff
- 0xe100-0xe1ff codepoints cover the regular, lowercase, petscii codes
- in ranges 0x20-0x7f and 0xa0-0xff
- 0xe200-0xe2ff codepoints cover the same characters, but contain the
- respective inverted glyphs.
- 0xe300-0xe3ff codepoints cover the same characters, but contain the
- respective inverted lowercase glyphs.
-
- regular valid petscii codes are converted as is, petscii control
- codes will produce the glyph that the petscii code would produce
- in so called "quote mode".
- */
-
- /* first convert petscii to utf8 codepoint */
- if (*s < 0x20) {
- /* petscii 0x00-0x1f control codes (inverted @ABC..etc) */
- codepoint = *s + 0xe240; /* 0xe240-0xe25f */
- } else if (*s < 0x80) {
- /* petscii 0x20-0x7f printable petscii codes */
- codepoint = *s + 0xe000; /* 0xe020-0xe07f */
- } else if (*s < 0xa0) {
- /* petscii 0x80-0x9f control codes (inverted SH...@AB...) */
- codepoint = (*s - 0x80) + 0xe260; /* 0xe260-0xe27f */
- } else {
- /* petscii 0xa0-0xff printable petscii codes */
- codepoint = *s + 0xe000; /* 0xe0a0-0xe0ff */
- }
- if (inverted) {
- codepoint ^= 0x0200; /* 0xe0XX <-> 0xe2XX */
- }
- /* switch to lower case if requested */
- if (lowercase) {
- codepoint ^= 0x0100;
- }
- s++;
-
-#if 0
- if (codepoint == 0xe220) {
- codepoint = 0xeee4;
- }
-#endif
- /* now copy to the destination string and convert to utf8 */
- /* we can get away with just this, because all codepoints are > 4095 */
- /* three byte form - 1110xxxx 10xxxxxx 10xxxxxx */
- *d++ = 0xe0 | ((codepoint >> 12) & 0x0f);
- *d++ = 0x80 | ((codepoint >> (6)) & 0x3f);
- *d = 0x80 | ((codepoint >> (0)) & 0x3f);
- d++;
- }
- *d = '\0';
-#if 0
- debug_gtk3("Result: ");
-#ifdef HAVE_DEBUG_GTK3UI
- t = r;
- while (*t) {
- printf(" %02x", *t++);
- }
- putchar('\n');
-#endif
-#endif
- return r;
-}
-
-/** \brief Convert petscii encoded string to utf8 string we can show using the CBM font
- *
- * this function handles all characters that may appear in a directory listing,
- * including "non printable" control characters, which appear as inverted characters
- * in so called "quote mode".
- *
- * \param[in] s PETSCII string to convert to UTF-8
- * \param[in] inverted use inverted mode
- * \param[in] lowercase use the lowercase chargen
- *
- * \return heap-allocated UTF-8 string, free with lib_free()
- *
- * \note only valid for the "C64_Pro_Mono-STYLE.ttf" font, not the old
- * "CBM.ttf" font.
- *
- * \note Somehow the inverted space has a line on top on at least Linux,
- * the codepoint seems fine though, so perhaps a bug in Pango?
- */
-unsigned char *vice_gtk3_petscii_to_utf8_petme(unsigned char *s,
- bool inverted,
- bool lowercase)
-{
- unsigned char *d, *r;
- unsigned int codepoint;
- int ch;
-
- r = d = lib_malloc((size_t)(strlen((char *)s) * 3 + 1));
-#if 0
- debug_gtk3("Input: '%s'", s);
-#ifdef HAVE_DEBUG_GTK3UI
- unsigned char *t = s;
- while (*t) {
- printf(" %02x", *t++);
- }
- putchar('\n');
-#endif
-#endif
- while (*s) {
- /*
- In Pet Me 64, Pet Me 64 2Y, Pet Me 128, and Pet Me 128 2Y, code points
- 0xE000-0xE1FF encode the complete Commodore 64 character set.
- 0xE200-0xE3FF encode the complete Commodore 128 English character set
- 0xE400-0xE5FF encode the complete Commodore 128 Swedish character set.
- */
-
- if (*s < 0x20) {
- /* petscii 0x00-0x1f control codes (inverted @ABC..etc) */
- ch = *s;
- inverted ^= 0x80;
- } else if ((*s >= 0x80) && (*s <= 0x9f)) {
- /* petscii 0x80-0x9f control codes (inverted SH...@AB...) */
- ch = (*s - 0x80) + 0x60;
- ch = charset_petscii_to_screencode(ch, false);
- ...
[truncated message content] |
|
From: <old...@us...> - 2024-03-31 23:48:00
|
Revision: 45058
http://sourceforge.net/p/vice-emu/code/45058
Author: oldwoman37
Date: 2024-03-31 23:47:57 +0000 (Sun, 31 Mar 2024)
Log Message:
-----------
More changes for bug #1979: Corrected more z80 timing issues
Modified Paths:
--------------
trunk/vice/src/z80core.c
Modified: trunk/vice/src/z80core.c
===================================================================
--- trunk/vice/src/z80core.c 2024-03-31 23:11:14 UTC (rev 45057)
+++ trunk/vice/src/z80core.c 2024-03-31 23:47:57 UTC (rev 45058)
@@ -616,7 +616,7 @@
\
dest_addr = z80_reg_pc + pc_inc + (signed char)(value); \
z80_reg_pc = dest_addr & 0xffff; \
- CLK_ADD(CLK, 7); \
+ CLK_ADD(CLK, 12); \
} else { \
CLK_ADD(CLK, 7); \
INC_PC(pc_inc); \
@@ -761,6 +761,7 @@
#define DJNZ(value, pc_inc) \
do { \
reg_b--; \
+ CLK_ADD(CLK, 1); \
BRANCH(reg_b, value, pc_inc); \
} while (0)
@@ -1281,7 +1282,7 @@
reg_sp += 2; \
iff1 = iff2; \
JUMP(tmp); \
- CLK_ADD(CLK, 2); \
+ CLK_ADD(CLK, 6); \
} while (0)
#define RL(reg_val) \
@@ -3962,6 +3963,12 @@
NEG();
break;
case 0x45: /* RETN */
+ case 0x55: /* undoc RETN */
+ case 0x5d: /* undoc RETN */
+ case 0x65: /* undoc RETN */
+ case 0x6d: /* undoc RETN */
+ case 0x75: /* undoc RETN */
+ case 0x7d: /* undoc RETN */
RETNI();
break;
case 0x46: /* IM0 */
@@ -6093,7 +6100,7 @@
CP(reg_a, 0, 4, 1);
break;
case 0xc0: /* RET NZ */
- RET_COND(!LOCAL_ZERO(), 4, 4, 2, 5, 1);
+ RET_COND(!LOCAL_ZERO(), 5, 3, 3, 5, 1);
break;
case 0xc1: /* POP BC */
POP(reg_b, reg_c, 1);
@@ -6105,7 +6112,7 @@
JMP(p12, 10);
break;
case 0xc4: /* CALL NZ */
- CALL_COND(p12, !LOCAL_ZERO(), 3, 3, 4, 10, 3);
+ CALL_COND(p12, !LOCAL_ZERO(), 3, 3, 11, 10, 3);
break;
case 0xc5: /* PUSH BC */
PUSH(reg_b, reg_c, 1);
@@ -6117,7 +6124,7 @@
CALL(0x00, 3, 3, 5, 1);
break;
case 0xc8: /* RET Z */
- RET_COND(LOCAL_ZERO(), 4, 4, 2, 5, 1);
+ RET_COND(LOCAL_ZERO(), 5, 3, 3, 5, 1);
break;
case 0xc9: /* RET */
RET(4, 4, 2);
@@ -6129,7 +6136,7 @@
opcode_cb((uint8_t)p1, (uint8_t)p2, (uint8_t)p3, (uint16_t)p12, (uint16_t)p23);
break;
case 0xcc: /* CALL Z */
- CALL_COND(p12, LOCAL_ZERO(), 3, 3, 4, 10, 3);
+ CALL_COND(p12, LOCAL_ZERO(), 3, 3, 11, 10, 3);
break;
case 0xcd: /* CALL */
CALL(p12, 3, 3, 11, 3);
@@ -6141,7 +6148,7 @@
CALL(0x08, 3, 3, 5, 1);
break;
case 0xd0: /* RET NC */
- RET_COND(!LOCAL_CARRY(), 4, 4, 2, 5, 1);
+ RET_COND(!LOCAL_CARRY(), 5, 3, 3, 5, 1);
break;
case 0xd1: /* POP DE */
POP(reg_d, reg_e, 1);
@@ -6153,7 +6160,7 @@
OUTA(p1, 4, 7, 2);
break;
case 0xd4: /* CALL NC */
- CALL_COND(p12, !LOCAL_CARRY(), 3, 3, 4, 10, 3);
+ CALL_COND(p12, !LOCAL_CARRY(), 3, 3, 11, 10, 3);
break;
case 0xd5: /* PUSH DE */
PUSH(reg_d, reg_e, 1);
@@ -6165,7 +6172,7 @@
CALL(0x10, 3, 3, 5, 1);
break;
case 0xd8: /* RET C */
- RET_COND(LOCAL_CARRY(), 4, 4, 2, 5, 1);
+ RET_COND(LOCAL_CARRY(), 5, 3, 3, 5, 1);
break;
case 0xd9: /* EXX */
EXX(4, 1);
@@ -6177,7 +6184,7 @@
INA(p1, 4, 7, 2);
break;
case 0xdc: /* CALL C */
- CALL_COND(p12, LOCAL_CARRY(), 3, 3, 4, 10, 3);
+ CALL_COND(p12, LOCAL_CARRY(), 3, 3, 11, 10, 3);
break;
case 0xdd: /* OPCODE DD */
opcode_dd((uint8_t)p1, (uint8_t)p2, (uint8_t)p3, (uint16_t)p12, (uint16_t)p23);
@@ -6189,7 +6196,7 @@
CALL(0x18, 3, 3, 5, 1);
break;
case 0xe0: /* RET PO */
- RET_COND(!LOCAL_PARITY(), 4, 4, 2, 5, 1);
+ RET_COND(!LOCAL_PARITY(), 5, 3, 3, 5, 1);
break;
case 0xe1: /* POP HL */
POP(reg_h, reg_l, 1);
@@ -6201,7 +6208,7 @@
EXXXSP(reg_h, reg_l, 4, 4, 4, 4, 3, 1);
break;
case 0xe4: /* CALL PO */
- CALL_COND(p12, !LOCAL_PARITY(), 3, 3, 4, 10, 3);
+ CALL_COND(p12, !LOCAL_PARITY(), 3, 3, 11, 10, 3);
break;
case 0xe5: /* PUSH HL */
PUSH(reg_h, reg_l, 1);
@@ -6213,7 +6220,7 @@
CALL(0x20, 3, 3, 5, 1);
break;
case 0xe8: /* RET PE */
- RET_COND(LOCAL_PARITY(), 4, 4, 2, 5, 1);
+ RET_COND(LOCAL_PARITY(), 5, 3, 3, 5, 1);
break;
case 0xe9: /* LD PC HL */
JMP((HL_WORD()), 4);
@@ -6225,7 +6232,7 @@
EXDEHL(4, 1);
break;
case 0xec: /* CALL PE */
- CALL_COND(p12, LOCAL_PARITY(), 3, 3, 4, 10, 3);
+ CALL_COND(p12, LOCAL_PARITY(), 3, 3, 11, 10, 3);
break;
case 0xed: /* OPCODE ED */
opcode_ed((uint8_t)p1, (uint8_t)p2, (uint8_t)p3, (uint16_t)p12, (uint16_t)p23);
@@ -6237,7 +6244,7 @@
CALL(0x28, 3, 3, 5, 1);
break;
case 0xf0: /* RET P */
- RET_COND(!LOCAL_SIGN(), 4, 4, 2, 5, 1);
+ RET_COND(!LOCAL_SIGN(), 5, 3, 3, 5, 1);
break;
case 0xf1: /* POP AF */
POP(reg_a, reg_f, 1);
@@ -6249,7 +6256,7 @@
DI(4, 1);
break;
case 0xf4: /* CALL P */
- CALL_COND(p12, !LOCAL_SIGN(), 3, 3, 4, 10, 3);
+ CALL_COND(p12, !LOCAL_SIGN(), 3, 3, 11, 10, 3);
break;
case 0xf5: /* PUSH AF */
PUSH(reg_a, reg_f, 1);
@@ -6261,7 +6268,7 @@
CALL(0x30, 3, 3, 5, 1);
break;
case 0xf8: /* RET M */
- RET_COND(LOCAL_SIGN(), 4, 4, 2, 5, 1);
+ RET_COND(LOCAL_SIGN(), 5, 3, 3, 5, 1);
break;
case 0xf9: /* LD SP HL */
LDSP(HL_WORD(), 4, 2, 1);
@@ -6273,7 +6280,7 @@
EI(4, 1);
break;
case 0xfc: /* CALL M */
- CALL_COND(p12, LOCAL_SIGN(), 3, 3, 4, 10, 3);
+ CALL_COND(p12, LOCAL_SIGN(), 3, 3, 11, 10, 3);
break;
case 0xfd: /* OPCODE FD */
opcode_fd((uint8_t)p1, (uint8_t)p2, (uint8_t)p3, (uint16_t)p12, (uint16_t)p23);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-03-31 23:11:16
|
Revision: 45057
http://sourceforge.net/p/vice-emu/code/45057
Author: gpz
Date: 2024-03-31 23:11:14 +0000 (Sun, 31 Mar 2024)
Log Message:
-----------
Added nww "copy" target type (VTE_FORMAT_ASCII) in the novte lib to force converting UTF8 encoded PETSCII to ASCII when copypasting (fixes #2007). Original behaviour is preserved and available via shift+ctrl+c. Added support for the "Pet Me 64" font. Some refactoring to deal with different fonts. Have fun :)
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/novte/vte.cc
trunk/vice/src/arch/gtk3/novte/vteenums.h
trunk/vice/src/arch/gtk3/novte/vtegtk.cc
trunk/vice/src/arch/gtk3/novte/vteinternal.hh
trunk/vice/src/arch/gtk3/uimon.c
trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.c
trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.h
trunk/vice/src/arch/shared/console_unix.c
trunk/vice/src/charset.c
trunk/vice/src/charset.h
trunk/vice/src/clipboard.c
trunk/vice/src/kbdbuf.c
trunk/vice/src/monitor/mon_file.c
trunk/vice/src/monitor/mon_util.c
trunk/vice/src/monitor/monitor.c
trunk/vice/src/userport/userport_wic64.c
Modified: trunk/vice/src/arch/gtk3/novte/vte.cc
===================================================================
--- trunk/vice/src/arch/gtk3/novte/vte.cc 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/arch/gtk3/novte/vte.cc 2024-03-31 23:11:14 UTC (rev 45057)
@@ -4673,6 +4673,175 @@
return string;
}
+/*
+ * VteTerminalPrivate::attributes_to_ascii:
+ * @text: A string as returned by the vte_terminal_get_* family of functions.
+ * @attrs: (array) (element-type Vte.CharAttributes): text attributes, as created by vte_terminal_get_*
+ *
+ * Converts the given text into ASCII (only).
+ *
+ * This is the function to fix/update when something is wrong with what characters are being copied
+ * into the clipboard :) Specific support for every font must be added here!
+ *
+ * Returns: (transfer full): a newly allocated text string, or %NULL.
+ */
+GString* VteTerminalPrivate::attributes_to_ascii(GString* text_string, GArray* attrs)
+{
+ GString *string;
+ guint from,to;
+ /* const VteCellAttr *attr; */
+ unsigned int ch;
+
+ char const* text = text_string->str;
+ auto len = text_string->len;
+ g_assert_cmpuint(len, ==, attrs->len);
+
+ /* Initial size fits perfectly if the text has no attributes and no
+ * characters that need to be escaped
+ */
+ string = g_string_sized_new (len + 11);
+
+ /* Find streches with equal attributes. Newlines are treated specially,
+ * so that the <span> do not cover multiple lines.
+ */
+ from = to = 0;
+ while (text[from] != '\0') {
+ g_assert(from == to);
+ /* attr = char_to_cell_attr(&g_array_index(attrs, VteCharAttributes, from)); */
+ ch = text[from];
+
+ if (ch & 0x100) {
+ unsigned int ch2 = text[from + 1] & 0xff;
+ unsigned int ch3 = text[from + 2] & 0xff;
+ ch = ch & 0xff;
+ /*printf("(%02x)", ch);*/
+ if (ch == 0xee) {
+ int codepoint = ((ch2 & 0x3f) << 6) | (ch3 & 0x3f);
+ int codeh = codepoint >> 8;
+ int codel = codepoint & 0xff;
+ if (!strncasecmp("c64 pro", pango_font_description_get_family(m_fontdesc), 7)) {
+ /*printf("[A:%04x]", codepoint);*/
+ /* C64 Pro codepoints:
+
+ 0xe000-0xe0ff codepoints cover the regular, uppercase, petscii codes
+ in ranges 0x20-0x7f and 0xa0-0xff
+ 0xe100-0xe1ff codepoints cover the regular, lowercase, petscii codes
+ in ranges 0x20-0x7f and 0xa0-0xff
+ 0xe200-0xe2ff codepoints cover the same characters, but contain the
+ respective inverted glyphs.
+ 0xe300-0xe3ff codepoints cover the same characters, but contain the
+ respective inverted lowercase glyphs. */
+ switch (codeh) {
+ case 0: /* uppercase, petscii codes in ranges 0x20-0x7f and 0xa0-0xff */
+ /* simple petscii -> ascii conversion */
+ if ((codel >= 0x20) && (codel <= 0x3f)) {
+ ch = codel;
+ } else if (codel == 0x40) {
+ ch = '@';
+ } else if ((codel >= 0x41) && (codel <= 0x5a)) {
+ ch = codel + 0x20; /* upper */
+ } else if ((codel >= 0x5b) && (codel <= 0x5f)) {
+ ch = codel + 0x20;
+ } else {
+ ch = '.';
+ }
+ break;
+ case 1: /* lowercase, petscii codes in ranges 0x20-0x7f and 0xa0-0xff */
+ /* simple petscii -> ascii conversion */
+ if ((codel >= 0x20) && (codel <= 0x3f)) {
+ ch = codel;
+ } else if (codel == 0x40) {
+ ch = '@';
+ } else if ((codel >= 0x41) && (codel <= 0x5a)) {
+ ch = codel + 0x20; /* upper */
+ } else if ((codel >= 0x5b) && (codel <= 0x5f)) {
+ ch = codel;
+ } else if ((codel >= 0x61) && (codel <= 0x7a)) {
+ ch = codel - 0x20; /* upper */
+ } else {
+ ch = '.';
+ }
+ break;
+ case 2: /* inverted uppercase, petscii codes in ranges 0x20-0x7f and 0xa0-0xff */
+ ch = '.';
+ break;
+ case 3: /* inverted lowercase, petscii codes in ranges 0x20-0x7f and 0xa0-0xff */
+ ch = '.';
+ break;
+ }
+ } else if (!strncasecmp("pet me", pango_font_description_get_family(m_fontdesc), 6)) {
+ /*printf("[B:%04x]", codepoint);*/
+ /*
+ Pet Me 64, Pet Me 64 2Y, Pet Me 128, and Pet Me 128 2Y, code points:
+ 0xE000-0xE1FF encode the complete Commodore 64 character set.
+ 0xE200-0xE3FF encode the complete Commodore 128 English character set
+ 0xE400-0xE5FF encode the complete Commodore 128 Swedish character set.
+ */
+ switch (codeh) {
+ case 0: /* uppercase */
+ /* simple screencode -> ascii conversion */
+ if (codel == 0) {
+ ch = '@';
+ } else if ((codel >= 0x01) && (codel <= 0x1a)) {
+ ch = codel + 0x60; /* upper */
+ } else if (codel == 0x1b) {
+ ch = '[';
+ } else if (codel == 0x1c) {
+ ch = '\\'; /* pound */
+ } else if (codel == 0x1d) {
+ ch = ']';
+ } else if (codel == 0x1e) {
+ ch = '^';
+ } else if (codel == 0x1f) {
+ ch = '_';
+ } else if ((codel >= 0x20) && (codel <= 0x3f)) {
+ ch = codel;
+ } else if ((codel >= 0x41) && (codel <= 0x5a)) {
+ ch = codel;
+ } else {
+ ch = '.';
+ }
+ break;
+ case 1: /* lowercase */
+ /* simple screencode -> ascii conversion */
+ if (codel == 0) {
+ ch = '@';
+ } else if ((codel >= 0x01) && (codel <= 0x1a)) {
+ ch = codel + 0x60; /* upper */
+ } else if (codel == 0x1b) {
+ ch = '[';
+ } else if (codel == 0x1c) {
+ ch = '\\'; /* pound */
+ } else if (codel == 0x1d) {
+ ch = ']';
+ } else if (codel == 0x1e) {
+ ch = '^';
+ } else if (codel == 0x1f) {
+ ch = '_';
+ } else if ((codel >= 0x20) && (codel <= 0x3f)) {
+ ch = codel;
+ } else if ((codel >= 0x41) && (codel <= 0x5a)) {
+ ch = codel;
+ } else {
+ ch = '.';
+ }
+ break;
+ }
+ }
+ } else {
+ ch = '.';
+ }
+ to++;
+ to++;
+ }
+ /*printf("%c", ch);*/
+ g_string_append_c(string, ch);
+ from = ++to;
+ }
+
+ return string;
+}
+
static GtkTargetEntry* targets_for_format(VteFormat format, int *n_targets)
{
switch (format) {
@@ -4723,7 +4892,7 @@
void VteTerminalPrivate::widget_copy(VteSelection sel, VteFormat format)
{
/* Only put HTML on the CLIPBOARD, not PRIMARY */
- g_assert(sel == VTE_SELECTION_CLIPBOARD || format == VTE_FORMAT_TEXT);
+ g_assert(sel == VTE_SELECTION_CLIPBOARD || format != VTE_FORMAT_HTML);
/* Chuck old selected text and retrieve the newly-selected text. */
GArray *attributes = g_array_new(FALSE, TRUE, sizeof(struct _VteCharAttributes));
@@ -4744,6 +4913,10 @@
if (format == VTE_FORMAT_HTML) {
m_selection[sel] = attributes_to_html(selection, attributes);
g_string_free(selection, TRUE);
+ } else if (format == VTE_FORMAT_ASCII) {
+ m_selection[sel] = attributes_to_ascii(selection, attributes);
+ g_string_free(selection, TRUE);
+ format = VTE_FORMAT_TEXT;
} else {
m_selection[sel] = selection;
}
Modified: trunk/vice/src/arch/gtk3/novte/vteenums.h
===================================================================
--- trunk/vice/src/arch/gtk3/novte/vteenums.h 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/arch/gtk3/novte/vteenums.h 2024-03-31 23:11:14 UTC (rev 45057)
@@ -106,8 +106,9 @@
/**
* VteFormat:
- * @VTE_FORMAT_TEXT: Export as plain text
+ * @VTE_FORMAT_TEXT: Export as plain text (utf8)
* @VTE_FORMAT_HTML: Export as HTML formatted text
+ * @VTE_FORMAT_ASCII: Export as ASCII text
*
* An enumeratio type that can be used to specify the format the selection
* should be copied to the clipboard in.
@@ -116,7 +117,8 @@
*/
typedef enum {
VTE_FORMAT_TEXT = 1,
- VTE_FORMAT_HTML = 2
+ VTE_FORMAT_HTML = 2,
+ VTE_FORMAT_ASCII = 3
} VteFormat;
G_END_DECLS
Modified: trunk/vice/src/arch/gtk3/novte/vtegtk.cc
===================================================================
--- trunk/vice/src/arch/gtk3/novte/vtegtk.cc 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/arch/gtk3/novte/vtegtk.cc 2024-03-31 23:11:14 UTC (rev 45057)
@@ -1723,7 +1723,7 @@
VteFormat format)
{
g_return_if_fail(VTE_IS_TERMINAL(terminal));
- g_return_if_fail(format == VTE_FORMAT_TEXT || format == VTE_FORMAT_HTML);
+ g_return_if_fail(format == VTE_FORMAT_TEXT || format == VTE_FORMAT_ASCII || format == VTE_FORMAT_HTML);
IMPL(terminal)->widget_copy(VTE_SELECTION_CLIPBOARD, format);
}
Modified: trunk/vice/src/arch/gtk3/novte/vteinternal.hh
===================================================================
--- trunk/vice/src/arch/gtk3/novte/vteinternal.hh 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/arch/gtk3/novte/vteinternal.hh 2024-03-31 23:11:14 UTC (rev 45057)
@@ -915,6 +915,7 @@
VteCellAttr const* char_to_cell_attr(VteCharAttributes const* attr) const;
GString* attributes_to_html(GString* text_string, GArray* attrs);
+ GString* attributes_to_ascii(GString* text_string, GArray* attrs);
void start_selection(long x, long y, enum vte_selection_type selection_type);
bool maybe_end_selection();
Modified: trunk/vice/src/arch/gtk3/uimon.c
===================================================================
--- trunk/vice/src/arch/gtk3/uimon.c 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/arch/gtk3/uimon.c 2024-03-31 23:11:14 UTC (rev 45057)
@@ -105,7 +105,10 @@
static linenoiseCompletions command_lc = {0, NULL};
static linenoiseCompletions need_filename_lc = {0, NULL};
-static bool font_is_c64_pro = false;
+#define FONT_TYPE_ASCII 0
+#define FONT_TYPE_C64PRO 1
+#define FONT_TYPE_PETME 2 /* https://www.kreativekorp.com/software/fonts/c64/ */
+static int font_type = FONT_TYPE_ASCII;
/* FIXME: this should perhaps be done using some function from archdep */
static int is_dir(struct dirent *de)
@@ -228,16 +231,16 @@
while (n < len) {
c = buffer[n];
- if (!font_is_c64_pro) {
+ if (font_type == FONT_TYPE_ASCII) {
/* regular ASCII font */
c = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
- } else {
+ } else if (font_type == FONT_TYPE_C64PRO) {
/* regular PETSCII capable ("C64 Pro") font */
/* 00-1f control codes 00-1f (shown as inverted 40-5f) */
if (/* (c >= 0x00) && */ (c <= 0x1f)) {
b = c + 0x40; /* lower */
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, true, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
/* 20-3f !"#...=>? */
} else if ((c >= 0x20) && (c <= 0x3f)) {
@@ -249,17 +252,17 @@
c = '[';
} else if (c == 0x5c) {
b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else if (c == 0x5d) {
c = ']';
} else if (c == 0x5e) {
b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else if (c == 0x5f) {
b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else {
c += 0x20; /* lower */
@@ -268,11 +271,11 @@
} else if ((c >= 0x60) && (c <= 0x7f)) {
if (c == 0x60) {
b = '@' + 0x40; /* upper */
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, true, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else if ((c >= 0x7b) && (c <= 0x7f)) {
b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else {
c -= 0x20; /* upper */
@@ -280,12 +283,12 @@
/* 80-9f control codes 80-9f (shown as inverted 60-7f) */
} else if ((c >= 0x80) && (c <= 0x9f)) {
b = c - 0x20; /* upper */
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, true, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
/* a0-bf gfx chars */
} else if ((c >= 0xa0) && (c <= 0xbf)) {
b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
/* c0-df AB...|}~ */
} else if ((c >= 0xc0) && (c <= 0xdf)) {
@@ -295,17 +298,17 @@
c = '[';
} else if (c == 0xdc) {
b = c - 0x80;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else if (c == 0xdd) {
c = ']';
} else if (c == 0xde) {
b = c - 0x80;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else if (c == 0xdf) {
b = c - 0x80;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else {
c -= 0x60;
@@ -313,9 +316,21 @@
/* e0-ff -> a0 -> 60-7f gfx chars */
} else if ((c >= 0xe0) /* && (c <= 0xff) */) {
b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ utf = vice_gtk3_petscii_to_utf8(&b, false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
+ } else if (font_type == FONT_TYPE_PETME) {
+ /* FIXME */
+ if (c == 0) {
+ c = '@';
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8_petme(&b, true, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8_petme(&b, false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ }
}
if (utf) {
@@ -344,7 +359,7 @@
while (n < len) {
c = buffer[n];
- if (!font_is_c64_pro) {
+ if (font_type == FONT_TYPE_ASCII) {
/* regular ASCII font */
c = buffer[n];
if ((c >= 0x01) && (c <= 0x1a)) {
@@ -353,7 +368,7 @@
c += 0x20; /* upper */
}
c = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
- } else {
+ } else if (font_type == FONT_TYPE_C64PRO) {
/* regular PETSCII capable ("C64 Pro") font */
/* 00-1f control codes 00-1f (shown as inverted 40-5f) */
@@ -433,6 +448,18 @@
utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
+ } else if (font_type == FONT_TYPE_PETME) {
+ /* FIXME */
+ if (c == 0) {
+ c = '@';
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8_petme(&b, true, false);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8_petme(&b, false, false);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ }
}
if (utf) {
@@ -447,7 +474,7 @@
return 0;
}
-
+/* output screencode, lowercase */
int uimon_scrcode_out(const char *buffer, int len)
{
int n = 0;
@@ -462,63 +489,32 @@
while (n < len) {
c = buffer[n];
- if (!font_is_c64_pro) {
+ if (font_type == FONT_TYPE_ASCII) {
/* regular ASCII font */
- c = charset_screencode_to_petcii(c);
+ c = charset_screencode_to_petscii(c);
c = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
- } else {
+ } else if (font_type == FONT_TYPE_C64PRO) {
/* regular PETSCII capable ("C64 Pro") font */
-
- /* 00-1f -> 40-5f */
- if (/*(c >= 0x00) && */ (c <= 0x1f)) {
- if (c == 0) {
- c = '@';
- } else if ((c >= 0x1b) && ( c <= 0x1f)) {
- b = c + 0x40;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- c += 0x60; /* lower */
- }
- /* 20-3f -> 20-3f */
- /* 40-5f -> 60-7f */
- } else if ((c >= 0x40) && (c <= 0x5f)) {
- if ((c >= 0x5b) && ( c <= 0x5f)) {
- b = c + 0x20;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- }
-
- /* 60-7f -> a0-bf */
- } else if ((c >= 0x60) && (c <= 0x7f)) {
- b = c + 0x40; /* lower */
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* 80-9f -> 80-9f */
- } else if ((c >= 0x80) && (c <= 0x9f)) {
- b = c - 0x40; /* lower */
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* a0-bf -> c0-df */
- } else if ((c >= 0xa0) && (c <= 0xbf)) {
- b = c - 0x80;
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* c0-df -> 80-9f */
- } else if ((c >= 0xc0) && (c <= 0xdf)) {
- b = c - 0x60; /* upper */
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* e0-ff -> e0-ff */
+ if ((c >= 0x60) && (c <= 0x7f)) {
+ b = c + 0x40;
} else if ((c >= 0xe0) && (c <= 0xfe)) {
b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
} else if ((c == 0xff) /*&& (c <= 0xff) */) {
b = 0xbf;
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else {
+ b = charset_screencode_to_petscii(c);
}
+ utf = vice_gtk3_petscii_to_utf8(&b, c & 0x80 ? true : false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (font_type == FONT_TYPE_PETME) {
+ /* FIXME: regular PETSCII capable ("PET Me") font */
+ int ch = c & 0x7f;
+ b = ch;
+ if (ch == 0x00) {
+ b = '@';
+ }
+ utf = vice_gtk3_scrcode_to_utf8_petme(&b, c & 0x80 ? true : false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
if (utf) {
@@ -725,6 +721,8 @@
return TRUE;
#ifndef MACOS_COMPILE
case GDK_KEY_c:
+ vte_terminal_copy_clipboard_format(VTE_TERMINAL(terminal), VTE_FORMAT_ASCII);
+ return TRUE;
case GDK_KEY_C:
vte_terminal_copy_clipboard_format(VTE_TERMINAL(terminal), VTE_FORMAT_TEXT);
return TRUE;
@@ -745,6 +743,8 @@
default:
return FALSE;
case GDK_KEY_c:
+ vte_terminal_copy_clipboard_format(VTE_TERMINAL(terminal), VTE_FORMAT_ASCII);
+ return TRUE;
case GDK_KEY_C:
vte_terminal_copy_clipboard_format(VTE_TERMINAL(terminal), VTE_FORMAT_TEXT);
return TRUE;
@@ -904,7 +904,7 @@
pango_font_description_get_family(desc),
pango_font_description_get_size(desc) / PANGO_SCALE,
variations ? variations : "-",
- font_is_c64_pro ? "yes" : "no",
+ font_type != FONT_TYPE_ASCII ? "yes" : "no",
vte_terminal_get_font_scale(VTE_TERMINAL(fixed.term)));
}
@@ -1110,7 +1110,7 @@
const char *fg;
GdkRGBA color;
- font_is_c64_pro = false;
+ font_type = FONT_TYPE_ASCII;
if (resources_get_string("MonitorFont", &monitor_font) < 0) {
log_error(LOG_ERR, "Failed to read 'MonitorFont' resource.");
@@ -1150,7 +1150,10 @@
using_font = pango_font_description_to_string(desc_tmp);
if(!strncasecmp("c64 pro", using_font, 7)) {
log_message(LOG_DEFAULT, "'C64 Pro*' font found, enabling PETSCII output.");
- font_is_c64_pro = true;
+ font_type = FONT_TYPE_C64PRO;
+ } else if(!strncasecmp("pet me", using_font, 6)) {
+ log_message(LOG_DEFAULT, "'PET Me*' font found, enabling PETSCII output.");
+ font_type = FONT_TYPE_PETME;
}
scale_terminal_set(1.0f);
printfontinfo(desc_tmp, using_font);
Modified: trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.c 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.c 2024-03-31 23:11:14 UTC (rev 45057)
@@ -41,6 +41,7 @@
#include <string.h>
#include <stdbool.h>
+#include "charset.h"
#include "lib.h"
#include "resources.h"
@@ -276,8 +277,12 @@
/* 0xe000-0xe0ff codepoints cover the regular, uppercase, petscii codes
in ranges 0x20-0x7f and 0xa0-0xff
+ 0xe100-0xe1ff codepoints cover the regular, lowercase, petscii codes
+ in ranges 0x20-0x7f and 0xa0-0xff
0xe200-0xe2ff codepoints cover the same characters, but contain the
respective inverted glyphs.
+ 0xe300-0xe3ff codepoints cover the same characters, but contain the
+ respective inverted lowercase glyphs.
regular valid petscii codes are converted as is, petscii control
codes will produce the glyph that the petscii code would produce
@@ -334,3 +339,157 @@
return r;
}
+/** \brief Convert petscii encoded string to utf8 string we can show using the CBM font
+ *
+ * this function handles all characters that may appear in a directory listing,
+ * including "non printable" control characters, which appear as inverted characters
+ * in so called "quote mode".
+ *
+ * \param[in] s PETSCII string to convert to UTF-8
+ * \param[in] inverted use inverted mode
+ * \param[in] lowercase use the lowercase chargen
+ *
+ * \return heap-allocated UTF-8 string, free with lib_free()
+ *
+ * \note only valid for the "C64_Pro_Mono-STYLE.ttf" font, not the old
+ * "CBM.ttf" font.
+ *
+ * \note Somehow the inverted space has a line on top on at least Linux,
+ * the codepoint seems fine though, so perhaps a bug in Pango?
+ */
+unsigned char *vice_gtk3_petscii_to_utf8_petme(unsigned char *s,
+ bool inverted,
+ bool lowercase)
+{
+ unsigned char *d, *r;
+ unsigned int codepoint;
+ int ch;
+
+ r = d = lib_malloc((size_t)(strlen((char *)s) * 3 + 1));
+#if 0
+ debug_gtk3("Input: '%s'", s);
+#ifdef HAVE_DEBUG_GTK3UI
+ unsigned char *t = s;
+ while (*t) {
+ printf(" %02x", *t++);
+ }
+ putchar('\n');
+#endif
+#endif
+ while (*s) {
+ /*
+ In Pet Me 64, Pet Me 64 2Y, Pet Me 128, and Pet Me 128 2Y, code points
+ 0xE000-0xE1FF encode the complete Commodore 64 character set.
+ 0xE200-0xE3FF encode the complete Commodore 128 English character set
+ 0xE400-0xE5FF encode the complete Commodore 128 Swedish character set.
+ */
+
+ if (*s < 0x20) {
+ /* petscii 0x00-0x1f control codes (inverted @ABC..etc) */
+ ch = *s;
+ inverted ^= 0x80;
+ } else if ((*s >= 0x80) && (*s <= 0x9f)) {
+ /* petscii 0x80-0x9f control codes (inverted SH...@AB...) */
+ ch = (*s - 0x80) + 0x60;
+ ch = charset_petscii_to_screencode(ch, false);
+ inverted ^= 0x80;
+ } else {
+ ch = charset_petscii_to_screencode(*s, false);
+ inverted ^= ch & 0x80;
+ ch = ch & 0x7f;
+ }
+
+ codepoint = ch + 0xe000;
+
+ if (inverted) {
+ codepoint ^= 0x0080; /* 0xe0XX <-> 0xe2XX */
+ }
+ /* switch to lower case if requested */
+ if (lowercase) {
+ codepoint ^= 0x0100;
+ }
+ s++;
+
+ /* now copy to the destination string and convert to utf8 */
+ /* we can get away with just this, because all codepoints are > 4095 */
+ /* three byte form - 1110xxxx 10xxxxxx 10xxxxxx */
+ *d++ = 0xe0 | ((codepoint >> 12) & 0x0f);
+ *d++ = 0x80 | ((codepoint >> (6)) & 0x3f);
+ *d = 0x80 | ((codepoint >> (0)) & 0x3f);
+ d++;
+ }
+ *d = '\0';
+#if 0
+ debug_gtk3("Result: ");
+#ifdef HAVE_DEBUG_GTK3UI
+ t = r;
+ while (*t) {
+ printf(" %02x", *t++);
+ }
+ putchar('\n');
+#endif
+#endif
+ return r;
+}
+
+unsigned char *vice_gtk3_scrcode_to_utf8_petme(unsigned char *s,
+ bool inverted,
+ bool lowercase)
+{
+ unsigned char *d, *r;
+ unsigned int codepoint;
+ int ch;
+
+ r = d = lib_malloc((size_t)(strlen((char *)s) * 3 + 1));
+#if 0
+ debug_gtk3("Input: '%s'", s);
+#ifdef HAVE_DEBUG_GTK3UI
+ unsigned char *t = s;
+ while (*t) {
+ printf(" %02x", *t++);
+ }
+ putchar('\n');
+#endif
+#endif
+ while (*s) {
+ /*
+ In Pet Me 64, Pet Me 64 2Y, Pet Me 128, and Pet Me 128 2Y, code points
+ 0xE000-0xE1FF encode the complete Commodore 64 character set.
+ 0xE200-0xE3FF encode the complete Commodore 128 English character set
+ 0xE400-0xE5FF encode the complete Commodore 128 Swedish character set.
+ */
+
+ ch = *s & 0x7f;
+ codepoint = ch + 0xe000;
+
+ if (inverted) {
+ codepoint ^= 0x0080; /* 0xe0XX <-> 0xe2XX */
+ }
+ /* switch to lower case if requested */
+ if (lowercase) {
+ codepoint ^= 0x0100;
+ }
+ s++;
+
+ /* now copy to the destination string and convert to utf8 */
+ /* we can get away with just this, because all codepoints are > 4095 */
+ /* three byte form - 1110xxxx 10xxxxxx 10xxxxxx */
+ *d++ = 0xe0 | ((codepoint >> 12) & 0x0f);
+ *d++ = 0x80 | ((codepoint >> (6)) & 0x3f);
+ *d = 0x80 | ((codepoint >> (0)) & 0x3f);
+ d++;
+ }
+ *d = '\0';
+#if 0
+ debug_gtk3("Result: ");
+#ifdef HAVE_DEBUG_GTK3UI
+ t = r;
+ while (*t) {
+ printf(" %02x", *t++);
+ }
+ putchar('\n');
+#endif
+#endif
+ return r;
+}
+
Modified: trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.h
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.h 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/arch/gtk3/widgets/base/widgethelpers.h 2024-03-31 23:11:14 UTC (rev 45057)
@@ -90,4 +90,11 @@
bool inverted,
bool lowercase);
+unsigned char *vice_gtk3_petscii_to_utf8_petme(unsigned char *s,
+ bool inverted,
+ bool lowercase);
+unsigned char *vice_gtk3_scrcode_to_utf8_petme(unsigned char *s,
+ bool inverted,
+ bool lowercase);
+
#endif
Modified: trunk/vice/src/arch/shared/console_unix.c
===================================================================
--- trunk/vice/src/arch/shared/console_unix.c 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/arch/shared/console_unix.c 2024-03-31 23:11:14 UTC (rev 45057)
@@ -213,7 +213,7 @@
if (buf) {
for (i = 0; i < maxlen; i++) {
c = buf[i];
- c = charset_screencode_to_petcii(c);
+ c = charset_screencode_to_petscii(c);
if ((c == '\t') || (c == '\r') || (c == '\n')){
c = '.';
} else if (c == 0) {
Modified: trunk/vice/src/charset.c
===================================================================
--- trunk/vice/src/charset.c 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/charset.c 2024-03-31 23:11:14 UTC (rev 45057)
@@ -73,7 +73,7 @@
*d++ = 0x0d; /* petscii CR */
s += ch;
} else {
- *d++ = charset_p_topetcii(*s);
+ *d++ = charset_p_topetscii(*s);
s++;
}
}
@@ -171,7 +171,7 @@
/* #define PETSCII_UNMAPPED 0x2e */ /* petscii "." */
#define PETSCII_UNMAPPED 0x3f /* petscii "?" */
-uint8_t charset_p_topetcii(uint8_t c)
+uint8_t charset_p_topetscii(uint8_t c)
{
/* map ascii to petscii */
if (c == '\n') {
@@ -199,7 +199,7 @@
return petcii_fix_dupes(c);
}
-uint8_t charset_screencode_to_petcii(uint8_t code)
+uint8_t charset_screencode_to_petscii(uint8_t code)
{
code &= 0x7f; /* mask inverse bit */
if (code <= 0x1f) {
@@ -210,7 +210,7 @@
return code;
}
-uint8_t charset_petcii_to_screencode(uint8_t code, unsigned int reverse_mode)
+uint8_t charset_petscii_to_screencode(uint8_t code, unsigned int reverse_mode)
{
uint8_t rev = (reverse_mode ? 0x80 : 0x00);
@@ -228,7 +228,7 @@
return code | rev;
}
-void charset_petcii_to_screencode_line(const uint8_t *line, uint8_t **buf,
+void charset_petscii_to_screencode_line(const uint8_t *line, uint8_t **buf,
unsigned int *len)
{
size_t linelen, i;
@@ -237,7 +237,7 @@
*buf = lib_malloc(linelen);
for (i = 0; i < linelen; i++) {
- (*buf)[i] = charset_petcii_to_screencode(line[i], 0);
+ (*buf)[i] = charset_petscii_to_screencode(line[i], 0);
}
*len = (unsigned int)linelen;
}
@@ -328,7 +328,7 @@
*d++ = 0x0d; /* PETSCII CR */
s += ch;
} else {
- *d++ = charset_p_topetcii(*s);
+ *d++ = charset_p_topetscii(*s);
s++;
}
}
Modified: trunk/vice/src/charset.h
===================================================================
--- trunk/vice/src/charset.h 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/charset.h 2024-03-31 23:11:14 UTC (rev 45057)
@@ -46,12 +46,12 @@
uint8_t *charset_petconvstring(uint8_t *c, int mode);
uint8_t charset_p_toascii(uint8_t c, int mode);
-uint8_t charset_p_topetcii(uint8_t c);
+uint8_t charset_p_topetscii(uint8_t c);
-uint8_t charset_screencode_to_petcii(uint8_t code);
+uint8_t charset_screencode_to_petscii(uint8_t code);
-uint8_t charset_petcii_to_screencode(uint8_t code, unsigned int reverse_mode);
-void charset_petcii_to_screencode_line(const uint8_t *line, uint8_t **buf,
+uint8_t charset_petscii_to_screencode(uint8_t code, unsigned int reverse_mode);
+void charset_petscii_to_screencode_line(const uint8_t *line, uint8_t **buf,
unsigned int *len);
int charset_petscii_to_ucs(uint8_t c);
Modified: trunk/vice/src/clipboard.c
===================================================================
--- trunk/vice/src/clipboard.c 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/clipboard.c 2024-03-31 23:11:14 UTC (rev 45057)
@@ -70,7 +70,7 @@
uint8_t data;
data = mem_bank_peek(bank, base++, NULL);
- data = charset_p_toascii(charset_screencode_to_petcii(data), CONVERT_WITH_CTRLCODES);
+ data = charset_p_toascii(charset_screencode_to_petscii(data), CONVERT_WITH_CTRLCODES);
if (data != ' ') {
last_non_whitespace = p;
Modified: trunk/vice/src/kbdbuf.c
===================================================================
--- trunk/vice/src/kbdbuf.c 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/kbdbuf.c 2024-03-31 23:11:14 UTC (rev 45057)
@@ -153,12 +153,12 @@
/* printf("esc:%s\n", &string[i]); */
if((i < (len - 1)) && (string[i + 1] == '\\')) {
/* escaped backslash "\\" */
- kbd_buf_string[j] = charset_p_topetcii('\\');
+ kbd_buf_string[j] = charset_p_topetscii('\\');
i += 1;
j++;
} else if((i < (len - 1)) && (string[i + 1] == 'n')) {
/* escaped line ending "\n" */
- kbd_buf_string[j] = charset_p_topetcii('\n');
+ kbd_buf_string[j] = charset_p_topetscii('\n');
i += 1;
j++;
} else if((i < (len - 3)) && (string[i + 1] == 'x') && isxdigit((unsigned char)string[i + 2]) && isxdigit((unsigned char)string[i + 3])) {
@@ -176,7 +176,7 @@
} else {
/* printf("chr:%s\n", &string[i]); */
/* regular character, convert to petscii */
- kbd_buf_string[j] = charset_p_topetcii(string[i]);
+ kbd_buf_string[j] = charset_p_topetscii(string[i]);
j++;
}
}
Modified: trunk/vice/src/monitor/mon_file.c
===================================================================
--- trunk/vice/src/monitor/mon_file.c 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/monitor/mon_file.c 2024-03-31 23:11:14 UTC (rev 45057)
@@ -102,7 +102,7 @@
/* convert filename to petscii */
s = filename;
for (i = 0; (i < 16) && (*s); ++i) {
- pname[i] = charset_p_topetcii(*s);
+ pname[i] = charset_p_topetscii(*s);
++s;
}
pname[i] = 0;
Modified: trunk/vice/src/monitor/mon_util.c
===================================================================
--- trunk/vice/src/monitor/mon_util.c 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/monitor/mon_util.c 2024-03-31 23:11:14 UTC (rev 45057)
@@ -341,7 +341,7 @@
if (monitor_is_remote()) {
int n, c;
for (n = 0; n < maxlen; n++) {
- c = charset_screencode_to_petcii(buffer[n]);
+ c = charset_screencode_to_petscii(buffer[n]);
buffer[n] = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
}
rc = monitor_network_transmit(buffer, maxlen);
Modified: trunk/vice/src/monitor/monitor.c
===================================================================
--- trunk/vice/src/monitor/monitor.c 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/monitor/monitor.c 2024-03-31 23:11:14 UTC (rev 45057)
@@ -3142,6 +3142,34 @@
mon_interfaces[default_memspace]->current_bank = monbank; /* restore value used in monitor */
disassemble_on_entry = 0;
}
+
+#if 0
+ /* FIXME: the first time the console opens the font might not be initialized
+ correctly, so close and repopen the monitor once */
+ {
+ int i;
+ char str[2] = { 0, 0 };
+ mon_out("petscii:\n");
+ for (i = 0; i < 0x100; i++) {
+ if ((i && !(i & 0x0f))) { mon_out("\n"); }
+ str[0] = i;
+ mon_petscii_out(1, "%s", str);
+ }
+ mon_out("\n\npetscii (upper):\n");
+ for (i = 0; i < 0x100; i++) {
+ if ((i && !(i & 0x0f))) { mon_out("\n"); }
+ str[0] = i;
+ mon_petscii_upper_out(1, "%s", str);
+ }
+ mon_out("\n\nscrcode:\n");
+ for (i = 0; i < 0x100; i++) {
+ if ((i && !(i & 0x0f))) { mon_out("\n"); }
+ str[0] = i;
+ mon_scrcode_out(1, "%s", str);
+ }
+ mon_out("\n");
+ }
+#endif
}
static int monitor_process(char *cmd)
Modified: trunk/vice/src/userport/userport_wic64.c
===================================================================
--- trunk/vice/src/userport/userport_wic64.c 2024-03-30 17:22:25 UTC (rev 45056)
+++ trunk/vice/src/userport/userport_wic64.c 2024-03-31 23:11:14 UTC (rev 45057)
@@ -1968,7 +1968,7 @@
for (i = 0; wic64_last_status[i]; i++) {
t[i] = upcase ? toupper((unsigned char)wic64_last_status[i]) : wic64_last_status[i];
- t[i] = charset_p_topetcii(t[i]);
+ t[i] = charset_p_topetscii(t[i]);
}
t[i] = '\0';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-03-30 17:22:30
|
Revision: 45056
http://sourceforge.net/p/vice-emu/code/45056
Author: gpz
Date: 2024-03-30 17:22:25 +0000 (Sat, 30 Mar 2024)
Log Message:
-----------
When no c64 font is detected in the monitor, use the regular ascii mapping. This keeps other fonts working (fix #2008) and can serve as a workaround for copy-pasting (#2007) for the time being
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/ui.c
trunk/vice/src/arch/gtk3/uimon.c
Modified: trunk/vice/src/arch/gtk3/ui.c
===================================================================
--- trunk/vice/src/arch/gtk3/ui.c 2024-03-30 02:01:16 UTC (rev 45055)
+++ trunk/vice/src/arch/gtk3/ui.c 2024-03-30 17:22:25 UTC (rev 45056)
@@ -262,8 +262,8 @@
*/
static const resource_string_t resources_string[] = {
/* VTE-monitor font */
- /* { "MonitorFont", "monospace 11", RES_EVENT_NO, NULL, */
- { "MonitorFont", "C64 Pro Mono Regular 11", RES_EVENT_NO, NULL,
+ /* { "MonitorFont", "Mono 11", RES_EVENT_NO, NULL, */
+ { "MonitorFont", "C64 Pro Mono Regular 9", RES_EVENT_NO, NULL,
&ui_resources.monitor_font, set_monitor_font, NULL },
{ "MonitorFG", "#ffffff", RES_EVENT_NO, NULL,
&ui_resources.monitor_fg, set_monitor_fg, NULL },
Modified: trunk/vice/src/arch/gtk3/uimon.c
===================================================================
--- trunk/vice/src/arch/gtk3/uimon.c 2024-03-30 02:01:16 UTC (rev 45055)
+++ trunk/vice/src/arch/gtk3/uimon.c 2024-03-30 17:22:25 UTC (rev 45056)
@@ -61,6 +61,7 @@
#endif
#include "archdep.h"
+#include "charset.h"
#include "console.h"
#include "debug_gtk3.h"
#include "machine.h"
@@ -104,6 +105,7 @@
static linenoiseCompletions command_lc = {0, NULL};
static linenoiseCompletions need_filename_lc = {0, NULL};
+static bool font_is_c64_pro = false;
/* FIXME: this should perhaps be done using some function from archdep */
static int is_dir(struct dirent *de)
@@ -226,87 +228,94 @@
while (n < len) {
c = buffer[n];
- /* 00-1f control codes 00-1f (shown as inverted 40-5f) */
- if (/* (c >= 0x00) && */ (c <= 0x1f)) {
- b = c + 0x40; // lower
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* 20-3f !"#...=>? */
- } else if ((c >= 0x20) && (c <= 0x3f)) {
- /* 40-5f @ab...\] */
- } else if ((c >= 0x40) && (c <= 0x5f)) {
- if (c == 0x40) {
- c = '@';
- } else if (c == 0x5b) {
- c = '[';
- } else if (c == 0x5c) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ if (!font_is_c64_pro) {
+ /* regular ASCII font */
+ c = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
+ } else {
+ /* regular PETSCII capable ("C64 Pro") font */
+
+ /* 00-1f control codes 00-1f (shown as inverted 40-5f) */
+ if (/* (c >= 0x00) && */ (c <= 0x1f)) {
+ b = c + 0x40; /* lower */
+ utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0x5d) {
- c = ']';
- } else if (c == 0x5e) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ /* 20-3f !"#...=>? */
+ } else if ((c >= 0x20) && (c <= 0x3f)) {
+ /* 40-5f @ab...\] */
+ } else if ((c >= 0x40) && (c <= 0x5f)) {
+ if (c == 0x40) {
+ c = '@';
+ } else if (c == 0x5b) {
+ c = '[';
+ } else if (c == 0x5c) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (c == 0x5d) {
+ c = ']';
+ } else if (c == 0x5e) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (c == 0x5f) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else {
+ c += 0x20; /* lower */
+ }
+ /* 60-7f AB...|}~ */
+ } else if ((c >= 0x60) && (c <= 0x7f)) {
+ if (c == 0x60) {
+ b = '@' + 0x40; /* upper */
+ utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if ((c >= 0x7b) && (c <= 0x7f)) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else {
+ c -= 0x20; /* upper */
+ }
+ /* 80-9f control codes 80-9f (shown as inverted 60-7f) */
+ } else if ((c >= 0x80) && (c <= 0x9f)) {
+ b = c - 0x20; /* upper */
+ utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0x5f) {
+ /* a0-bf gfx chars */
+ } else if ((c >= 0xa0) && (c <= 0xbf)) {
b = c;
utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- c += 0x20; // lower
- }
- /* 60-7f AB...|}~ */
- } else if ((c >= 0x60) && (c <= 0x7f)) {
- if (c == 0x60) {
- b = '@' + 0x40; // upper
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if ((c >= 0x7b) && (c <= 0x7f)) {
+ /* c0-df AB...|}~ */
+ } else if ((c >= 0xc0) && (c <= 0xdf)) {
+ if (c == 0xc0) {
+ c = '@';
+ } else if (c == 0xdb) {
+ c = '[';
+ } else if (c == 0xdc) {
+ b = c - 0x80;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (c == 0xdd) {
+ c = ']';
+ } else if (c == 0xde) {
+ b = c - 0x80;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (c == 0xdf) {
+ b = c - 0x80;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else {
+ c -= 0x60;
+ }
+ /* e0-ff -> a0 -> 60-7f gfx chars */
+ } else if ((c >= 0xe0) /* && (c <= 0xff) */) {
b = c;
utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- c -= 0x20; // upper
}
- /* 80-9f control codes 80-9f (shown as inverted 60-7f) */
- } else if ((c >= 0x80) && (c <= 0x9f)) {
- b = c - 0x20; // upper
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* a0-bf gfx chars */
- } else if ((c >= 0xa0) && (c <= 0xbf)) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* c0-df AB...|}~ */
- } else if ((c >= 0xc0) && (c <= 0xdf)) {
- if (c == 0xc0) {
- c = '@';
- } else if (c == 0xdb) {
- c = '[';
- } else if (c == 0xdc) {
- b = c - 0x80;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0xdd) {
- c = ']';
- } else if (c == 0xde) {
- b = c - 0x80;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0xdf) {
- b = c - 0x80;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- c -= 0x60;
- }
- /* e0-ff -> a0 -> 60-7f gfx chars */
- } else if ((c >= 0xe0) /* && (c <= 0xff) */) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
if (utf) {
@@ -335,82 +344,95 @@
while (n < len) {
c = buffer[n];
- /* 00-1f control codes 00-1f (shown as inverted 40-5f) */
- if (/* (c >= 0x00) && */ (c <= 0x1f)) {
- b = c + 0x40; // lower
- utf = vice_gtk3_petscii_to_utf8(&b ,true, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* 20-3f !"#...=>? */
- } else if ((c >= 0x20) && (c <= 0x2f)) {
- } else if ((c >= 0x30) && (c <= 0x3f)) {
- /* 40-5f @ab...\] */
- } else if ((c >= 0x40) && (c <= 0x5f)) {
- if (c == 0x40) {
- c = '@';
+ if (!font_is_c64_pro) {
+ /* regular ASCII font */
+ c = buffer[n];
+ if ((c >= 0x01) && (c <= 0x1a)) {
+ c += 0x60; /* upper */
+ } else if ((c >= 0x41) && (c <= 0x5a)) {
+ c += 0x20; /* upper */
}
- else if (c == 0x5b) {
- c = '[';
- } else if (c == 0x5c) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ c = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
+ } else {
+ /* regular PETSCII capable ("C64 Pro") font */
+
+ /* 00-1f control codes 00-1f (shown as inverted 40-5f) */
+ if (/* (c >= 0x00) && */ (c <= 0x1f)) {
+ b = c + 0x40; /* lower */
+ utf = vice_gtk3_petscii_to_utf8(&b ,true, false);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0x5d) {
- c = ']';
- } else if (c == 0x5e) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ /* 20-3f !"#...=>? */
+ } else if ((c >= 0x20) && (c <= 0x2f)) {
+ } else if ((c >= 0x30) && (c <= 0x3f)) {
+ /* 40-5f @ab...\] */
+ } else if ((c >= 0x40) && (c <= 0x5f)) {
+ if (c == 0x40) {
+ c = '@';
+ }
+ else if (c == 0x5b) {
+ c = '[';
+ } else if (c == 0x5c) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (c == 0x5d) {
+ c = ']';
+ } else if (c == 0x5e) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (c == 0x5f) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else {
+ /* upper */
+ }
+ /* 60-7f AB...|}~ */
+ } else if ((c >= 0x60) && (c <= 0x7f)) {
+ /* 80-9f control codes 80-9f (shown as inverted 60-7f) */
+ } else if ((c >= 0x80) && (c <= 0x9f)) {
+ b = c - 0x20; /* upper */
+ utf = vice_gtk3_petscii_to_utf8(&b ,true, false);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0x5f) {
+ /* a0-bf gfx chars */
+ } else if ((c >= 0xa0) && (c <= 0xbf)) {
b = c;
utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- // upper
- }
- /* 60-7f AB...|}~ */
- } else if ((c >= 0x60) && (c <= 0x7f)) {
- /* 80-9f control codes 80-9f (shown as inverted 60-7f) */
- } else if ((c >= 0x80) && (c <= 0x9f)) {
- b = c - 0x20; // upper
- utf = vice_gtk3_petscii_to_utf8(&b ,true, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* a0-bf gfx chars */
- } else if ((c >= 0xa0) && (c <= 0xbf)) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* c0-df AB...|}~ */
- } else if ((c >= 0xc0) && (c <= 0xdf)) {
- if (c == 0xc0) {
+ /* c0-df AB...|}~ */
+ } else if ((c >= 0xc0) && (c <= 0xdf)) {
+ if (c == 0xc0) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (c == 0xdc) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (c == 0xdd) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (c == 0xde) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if (c == 0xdf) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else {
+ b = c - 0x60;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ }
+ /* e0-ff -> a0 -> 60-7f gfx chars */
+ } else if ((c >= 0xe0) /* && (c <= 0xff) */) {
b = c;
utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0xdc) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0xdd) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0xde) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if (c == 0xdf) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- b = c - 0x60;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
- /* e0-ff -> a0 -> 60-7f gfx chars */
- } else if ((c >= 0xe0) /* && (c <= 0xff) */) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, false);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
if (utf) {
@@ -440,55 +462,63 @@
while (n < len) {
c = buffer[n];
- /* 00-1f -> 40-5f */
- if (/*(c >= 0x00) && */ (c <= 0x1f)) {
- if (c == 0) {
- c = '@';
- } else if ((c >= 0x1b) && ( c <= 0x1f)) {
- b = c + 0x40;
+ if (!font_is_c64_pro) {
+ /* regular ASCII font */
+ c = charset_screencode_to_petcii(c);
+ c = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
+ } else {
+ /* regular PETSCII capable ("C64 Pro") font */
+
+ /* 00-1f -> 40-5f */
+ if (/*(c >= 0x00) && */ (c <= 0x1f)) {
+ if (c == 0) {
+ c = '@';
+ } else if ((c >= 0x1b) && ( c <= 0x1f)) {
+ b = c + 0x40;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else {
+ c += 0x60; /* lower */
+ }
+ /* 20-3f -> 20-3f */
+ /* 40-5f -> 60-7f */
+ } else if ((c >= 0x40) && (c <= 0x5f)) {
+ if ((c >= 0x5b) && ( c <= 0x5f)) {
+ b = c + 0x20;
+ utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ }
+
+ /* 60-7f -> a0-bf */
+ } else if ((c >= 0x60) && (c <= 0x7f)) {
+ b = c + 0x40; /* lower */
utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else {
- c += 0x60; // lower
- }
- /* 20-3f -> 20-3f */
- /* 40-5f -> 60-7f */
- } else if ((c >= 0x40) && (c <= 0x5f)) {
- if ((c >= 0x5b) && ( c <= 0x5f)) {
- b = c + 0x20;
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
+ /* 80-9f -> 80-9f */
+ } else if ((c >= 0x80) && (c <= 0x9f)) {
+ b = c - 0x40; /* lower */
+ utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ /* a0-bf -> c0-df */
+ } else if ((c >= 0xa0) && (c <= 0xbf)) {
+ b = c - 0x80;
+ utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ /* c0-df -> 80-9f */
+ } else if ((c >= 0xc0) && (c <= 0xdf)) {
+ b = c - 0x60; /* upper */
+ utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ /* e0-ff -> e0-ff */
+ } else if ((c >= 0xe0) && (c <= 0xfe)) {
+ b = c;
+ utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
+ } else if ((c == 0xff) /*&& (c <= 0xff) */) {
+ b = 0xbf;
+ utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
+ uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
-
- /* 60-7f -> a0-bf */
- } else if ((c >= 0x60) && (c <= 0x7f)) {
- b = c + 0x40; // lower
- utf = vice_gtk3_petscii_to_utf8(&b ,false, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* 80-9f -> 80-9f */
- } else if ((c >= 0x80) && (c <= 0x9f)) {
- b = c - 0x40; // lower
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* a0-bf -> c0-df */
- } else if ((c >= 0xa0) && (c <= 0xbf)) {
- b = c - 0x80;
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* c0-df -> 80-9f */
- } else if ((c >= 0xc0) && (c <= 0xdf)) {
- b = c - 0x60; // upper
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- /* e0-ff -> e0-ff */
- } else if ((c >= 0xe0) && (c <= 0xfe)) {
- b = c;
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
- } else if ((c == 0xff) /*&& (c <= 0xff) */) {
- b = 0xbf;
- utf = vice_gtk3_petscii_to_utf8(&b ,true, true);
- uimon_write_to_terminal(&fixed, (const char*)&utf[0], 3);
}
if (utf) {
@@ -866,17 +896,65 @@
*height = vte_terminal_get_row_count(terminal);
}
-static void printfontinfo(PangoFontDescription* desc, char *name, gfloat scale)
+static void printfontinfo(const PangoFontDescription* desc, const char *name)
{
const char *variations = pango_font_description_get_variations(desc);
- log_message(LOG_DEFAULT, "Monitor: using font '%s' (Family:%s, Size:%d, Variations:%s) Scale:%f",
+ log_message(LOG_DEFAULT, "Monitor: using font '%s' (Family:%s, Size:%d, Variations:%s) PETSCII:%s Terminal Scale:%f",
name,
pango_font_description_get_family(desc),
pango_font_description_get_size(desc) / PANGO_SCALE,
variations ? variations : "-",
- scale);
+ font_is_c64_pro ? "yes" : "no",
+ vte_terminal_get_font_scale(VTE_TERMINAL(fixed.term)));
}
+static void scale_terminal_set(gdouble scale)
+{
+ /* use vte scaling */
+ if (scale < ((3 * 100.0f) / PANGO_SCALE)) {
+ scale = ((3 * 100.0f) / PANGO_SCALE);
+ } else if (scale > ((100 * 100.0f) / PANGO_SCALE)) {
+ scale = ((100 * 100.0f) / PANGO_SCALE);
+ }
+ vte_terminal_set_font_scale(VTE_TERMINAL(fixed.term), scale);
+}
+
+static void scale_terminal(gdouble delta)
+{
+ gdouble curr_scaling = vte_terminal_get_font_scale(VTE_TERMINAL(fixed.term));
+#if 0
+ /* change the font size */
+ static int size = -1;
+ desc_tmp = vte_terminal_get_font(VTE_TERMINAL(fixed.term));
+ desc = pango_font_description_copy_static(desc_tmp);
+ if (size == -1) {
+ size = (pango_font_description_get_size(desc) / PANGO_SCALE);
+ if (size <= 0) {
+ size = 11; /* default fallback size */
+ }
+ }
+
+ size -= scrollevent.delta_y;
+ if (size < 3) {
+ size = 3;
+ } else if (size > 100) {
+ size = 100;
+ }
+
+ pango_font_description_set_size(desc, size * PANGO_SCALE);
+ vte_terminal_set_font(VTE_TERMINAL(fixed.term), desc);
+#else
+ /* use vte scaling */
+ curr_scaling -= delta;
+ if (curr_scaling < ((3 * 100.0f) / PANGO_SCALE)) {
+ curr_scaling = ((3 * 100.0f) / PANGO_SCALE);
+ } else if (curr_scaling > ((100 * 100.0f) / PANGO_SCALE)) {
+ curr_scaling = ((100 * 100.0f) / PANGO_SCALE);
+ }
+ vte_terminal_set_font_scale(VTE_TERMINAL(fixed.term), curr_scaling);
+#endif
+}
+
static gboolean on_term_scrolled(VteTerminal *terminal, GdkEvent *event,
gpointer user_data)
{
@@ -889,43 +967,14 @@
if (scrollevent.state & GDK_CONTROL_MASK) {
/* with control pressed, mouse wheel will scale the terminal/font */
- gdouble scale = vte_terminal_get_font_scale(VTE_TERMINAL(fixed.term));
-#if 0
- /* change the font size */
- static int size = -1;
+ scale_terminal((scrollevent.delta_y * (100.0f / 3.0f)) / PANGO_SCALE);
+
desc_tmp = vte_terminal_get_font(VTE_TERMINAL(fixed.term));
desc = pango_font_description_copy_static(desc_tmp);
- if (size == -1) {
- size = (pango_font_description_get_size(desc) / PANGO_SCALE);
- if (size <= 0) {
- size = 11; /* default fallback size */
- }
- }
- size -= scrollevent.delta_y;
- if (size < 3) {
- size = 3;
- } else if (size > 100) {
- size = 100;
- }
+ using_font = pango_font_description_to_string(desc);
+ printfontinfo(desc, using_font);
- pango_font_description_set_size(desc, size * PANGO_SCALE);
- vte_terminal_set_font(VTE_TERMINAL(fixed.term), desc);
-#else
- /* use vte scaling */
- scale -= ((scrollevent.delta_y * 50.0f) / PANGO_SCALE);
- if (scale < ((3 * 100.0f) / PANGO_SCALE)) {
- scale = ((3 * 100.0f) / PANGO_SCALE);
- } else if (scale > ((100 * 100.0f) / PANGO_SCALE)) {
- scale = ((100 * 100.0f) / PANGO_SCALE);
- }
- vte_terminal_set_font_scale(VTE_TERMINAL(fixed.term), scale);
-
- desc_tmp = vte_terminal_get_font(VTE_TERMINAL(fixed.term));
- desc = pango_font_description_copy_static(desc_tmp);
-#endif
- using_font = pango_font_description_to_string(desc);
- printfontinfo(desc, using_font, scale);
g_free(using_font);
return FALSE;
} else {
@@ -935,6 +984,7 @@
value += scrollevent.delta_y * 3;
gtk_adjustment_set_value(vadj, value);
gtk_scrollable_set_vadjustment(GTK_SCROLLABLE(fixed.term), vadj);
+
return FALSE;
}
@@ -1060,6 +1110,8 @@
const char *fg;
GdkRGBA color;
+ font_is_c64_pro = false;
+
if (resources_get_string("MonitorFont", &monitor_font) < 0) {
log_error(LOG_ERR, "Failed to read 'MonitorFont' resource.");
return false;
@@ -1080,23 +1132,36 @@
/* fall back */
/* if we didn't try to set the default C64 font, try it now */
- if (!strcmp("C64 Pro Mono Regular 11", monitor_font)) {
- desc = getfontdesc("C64 Pro Regular 11");
+ if (!strcmp("C64 Pro", monitor_font)) {
+ desc = getfontdesc("C64 Pro Mono Regular 9");
}
if (desc == NULL) {
- /* last resort, monospace 11 */
+ /* last resort, some Monospace 11pt */
desc_tmp = vte_terminal_get_font(VTE_TERMINAL(fixed.term));
desc = pango_font_description_copy_static(desc_tmp);
- pango_font_description_set_family(desc, "Console,monospace");
+ pango_font_description_set_family(desc, "Mono");
pango_font_description_set_size(desc, 11 * PANGO_SCALE);
}
}
vte_terminal_set_font(VTE_TERMINAL(fixed.term), desc);
- using_font = pango_font_description_to_string(desc);
- printfontinfo(desc, using_font, 1.0f);
+ desc_tmp = vte_terminal_get_font(VTE_TERMINAL(fixed.term));
+ using_font = pango_font_description_to_string(desc_tmp);
+ if(!strncasecmp("c64 pro", using_font, 7)) {
+ log_message(LOG_DEFAULT, "'C64 Pro*' font found, enabling PETSCII output.");
+ font_is_c64_pro = true;
+ }
+ scale_terminal_set(1.0f);
+ printfontinfo(desc_tmp, using_font);
+
+ if (resources_set_string("MonitorFont", using_font) < 0) {
+ log_error(LOG_ERR, "Failed to set 'MonitorFont' resource.");
+ return false;
+ }
+
g_free(using_font);
+
pango_font_description_free(desc);
/* try background color */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <old...@us...> - 2024-03-30 02:01:19
|
Revision: 45055
http://sourceforge.net/p/vice-emu/code/45055
Author: oldwoman37
Date: 2024-03-30 02:01:16 +0000 (Sat, 30 Mar 2024)
Log Message:
-----------
More changes for bug #1979: Aligned IO read/write operations to 1MHz
Modified Paths:
--------------
trunk/vice/src/z80core.c
Modified: trunk/vice/src/z80core.c
===================================================================
--- trunk/vice/src/z80core.c 2024-03-29 22:42:31 UTC (rev 45054)
+++ trunk/vice/src/z80core.c 2024-03-30 02:01:16 UTC (rev 45055)
@@ -890,8 +890,19 @@
INC_PC(pc_inc); \
} while (0)
+#ifdef Z80_4MHZ
#define INBC(reg_val, clk_inc1, clk_inc2, pc_inc) \
do { \
+ uint8_t tmp = z80_half_cycle; \
+ CLK_ADD(CLK, (clk_inc1 + tmp) ); \
+ reg_val = IN(BC_WORD()); \
+ reg_f = SZP[reg_val & 0xffu] | LOCAL_CARRY(); \
+ CLK_ADD(CLK, (clk_inc2 - tmp) ); \
+ INC_PC(pc_inc); \
+ } while (0)
+#else
+#define INBC(reg_val, clk_inc1, clk_inc2, pc_inc) \
+ do { \
CLK_ADD(CLK, clk_inc1); \
reg_val = IN(BC_WORD()); \
reg_f = SZP[reg_val & 0xffu] | LOCAL_CARRY(); \
@@ -898,6 +909,7 @@
CLK_ADD(CLK, clk_inc2); \
INC_PC(pc_inc); \
} while (0)
+#endif
#define INBC0(clk_inc1, clk_inc2, pc_inc) \
do { \
@@ -1122,6 +1134,16 @@
INC_PC(pc_inc); \
} while (0)
+#ifdef Z80_4MHZ
+#define OUTBC(value, clk_inc1, clk_inc2, pc_inc) \
+ do { \
+ uint8_t tmp = z80_half_cycle; \
+ CLK_ADD(CLK, (clk_inc1 + tmp) ); \
+ OUT(BC_WORD(), value); \
+ CLK_ADD(CLK, (clk_inc2 - tmp) ); \
+ INC_PC(pc_inc); \
+ } while (0)
+#else
#define OUTBC(value, clk_inc1, clk_inc2, pc_inc) \
do { \
CLK_ADD(CLK, clk_inc1); \
@@ -1129,6 +1151,7 @@
CLK_ADD(CLK, clk_inc2); \
INC_PC(pc_inc); \
} while (0)
+#endif
#define OUTDI(HL_FUNC) \
do { \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-03-29 22:42:33
|
Revision: 45054
http://sourceforge.net/p/vice-emu/code/45054
Author: gpz
Date: 2024-03-29 22:42:31 +0000 (Fri, 29 Mar 2024)
Log Message:
-----------
limit the output of i and ii commands to a power of two, if the output would be smaller than a full screen width
Modified Paths:
--------------
trunk/vice/src/monitor/mon_memory.c
Modified: trunk/vice/src/monitor/mon_memory.c
===================================================================
--- trunk/vice/src/monitor/mon_memory.c 2024-03-29 21:36:07 UTC (rev 45053)
+++ trunk/vice/src/monitor/mon_memory.c 2024-03-29 22:42:31 UTC (rev 45054)
@@ -283,14 +283,21 @@
mem_get_screen_parameter(&base, &rows, &screen_width, &bank);
max_width = screen_width;
- if (max_width > (last_known_xres - (8 + 2))) {
- max_width = (last_known_xres - (8 + 2));
+ if (max_width > (last_known_xres - (7 + 2))) {
+ max_width = (last_known_xres - (7 + 2));
+ /* to make the output easier to read, make sure the number of items
+ each line equals a power of two */
+ m = 1;
+ while ((m * 2) <= max_width) {
+ m *= 2;
+ }
+ max_width = m;
} else {
/* NOTE: show N multiples of screens width, disable this again if it
turns out thats not what we want */
#if 1
/* FIXME: limit width vs console width */
- while ((8 + 2) + (max_width * 2) + (((max_width * 2) + (screen_width - 1)) / screen_width) <= last_known_xres) {
+ while ((7 + 2) + (max_width * 2) + (((max_width * 2) + (screen_width - 1)) / screen_width) <= last_known_xres) {
max_width *= 2;
}
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-03-29 21:36:08
|
Revision: 45053
http://sourceforge.net/p/vice-emu/code/45053
Author: gpz
Date: 2024-03-29 21:36:07 +0000 (Fri, 29 Mar 2024)
Log Message:
-----------
typo
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/novte/vteterminal.h
Modified: trunk/vice/src/arch/gtk3/novte/vteterminal.h
===================================================================
--- trunk/vice/src/arch/gtk3/novte/vteterminal.h 2024-03-29 21:34:38 UTC (rev 45052)
+++ trunk/vice/src/arch/gtk3/novte/vteterminal.h 2024-03-29 21:36:07 UTC (rev 45053)
@@ -90,7 +90,7 @@
void (*resize_window)(VteTerminal* terminal, guint width, guint height);
void (*move_window)(VteTerminal* terminal, guint x, guint y);
- /* FIXME: should these return gboolean and have defaul thandlers
+ /* FIXME: should these return gboolean and have default handlers
* settings the "scale" property?
*/
void (*increase_font_size)(VteTerminal* terminal);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-03-29 21:34:41
|
Revision: 45052
http://sourceforge.net/p/vice-emu/code/45052
Author: gpz
Date: 2024-03-29 21:34:38 +0000 (Fri, 29 Mar 2024)
Log Message:
-----------
use scroll-wheel to scroll terminal window forth/back, ctrl+scroll wheel to zoom
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/novte/vtegtk.cc
trunk/vice/src/arch/gtk3/uimon.c
Modified: trunk/vice/src/arch/gtk3/novte/vtegtk.cc
===================================================================
--- trunk/vice/src/arch/gtk3/novte/vtegtk.cc 2024-03-29 19:00:56 UTC (rev 45051)
+++ trunk/vice/src/arch/gtk3/novte/vtegtk.cc 2024-03-29 21:34:38 UTC (rev 45052)
@@ -1719,7 +1719,7 @@
*
* Since: 0.50
*/
-void vte_terminal_copy_clipboard_format(NoVteTerminal *terminal,
+void novte_terminal_copy_clipboard_format(NoVteTerminal *terminal,
VteFormat format)
{
g_return_if_fail(VTE_IS_TERMINAL(terminal));
Modified: trunk/vice/src/arch/gtk3/uimon.c
===================================================================
--- trunk/vice/src/arch/gtk3/uimon.c 2024-03-29 19:00:56 UTC (rev 45051)
+++ trunk/vice/src/arch/gtk3/uimon.c 2024-03-29 21:34:38 UTC (rev 45052)
@@ -43,6 +43,7 @@
#define vte_terminal_feed novte_terminal_feed
#define vte_terminal_get_column_count novte_terminal_get_column_count
#define vte_terminal_copy_clipboard novte_terminal_copy_clipboard
+#define vte_terminal_copy_clipboard_format novte_terminal_copy_clipboard_format
#define vte_terminal_get_row_count novte_terminal_get_row_count
#define vte_terminal_set_scrollback_lines novte_terminal_set_scrollback_lines
#define vte_terminal_set_scroll_on_output novte_terminal_set_scroll_on_output
@@ -695,9 +696,7 @@
#ifndef MACOS_COMPILE
case GDK_KEY_c:
case GDK_KEY_C:
- vte_terminal_copy_clipboard(VTE_TERMINAL(terminal));
- /* _format only exists in bleeding edge VTE 0.50 */
- /* vte_terminal_copy_clipboard_format(VTE_TERMINAL(terminal), VTE_FORMAT_TEXT); */
+ vte_terminal_copy_clipboard_format(VTE_TERMINAL(terminal), VTE_FORMAT_TEXT);
return TRUE;
case GDK_KEY_v:
case GDK_KEY_V:
@@ -717,9 +716,7 @@
return FALSE;
case GDK_KEY_c:
case GDK_KEY_C:
- vte_terminal_copy_clipboard(VTE_TERMINAL(terminal));
- /* _format only exists in bleeding edge VTE 0.50 */
- /* vte_terminal_copy_clipboard_format(VTE_TERMINAL(terminal), VTE_FORMAT_TEXT); */
+ vte_terminal_copy_clipboard_format(VTE_TERMINAL(terminal), VTE_FORMAT_TEXT);
return TRUE;
case GDK_KEY_v:
case GDK_KEY_V:
@@ -869,6 +866,81 @@
*height = vte_terminal_get_row_count(terminal);
}
+static void printfontinfo(PangoFontDescription* desc, char *name, gfloat scale)
+{
+ const char *variations = pango_font_description_get_variations(desc);
+ log_message(LOG_DEFAULT, "Monitor: using font '%s' (Family:%s, Size:%d, Variations:%s) Scale:%f",
+ name,
+ pango_font_description_get_family(desc),
+ pango_font_description_get_size(desc) / PANGO_SCALE,
+ variations ? variations : "-",
+ scale);
+}
+
+static gboolean on_term_scrolled(VteTerminal *terminal, GdkEvent *event,
+ gpointer user_data)
+{
+
+
+ const PangoFontDescription *desc_tmp;
+ PangoFontDescription* desc;
+ char *using_font = NULL;
+ GdkEventScroll scrollevent = *((GdkEventScroll*)event);
+
+ if (scrollevent.state & GDK_CONTROL_MASK) {
+ /* with control pressed, mouse wheel will scale the terminal/font */
+ gdouble scale = vte_terminal_get_font_scale(VTE_TERMINAL(fixed.term));
+#if 0
+ /* change the font size */
+ static int size = -1;
+ desc_tmp = vte_terminal_get_font(VTE_TERMINAL(fixed.term));
+ desc = pango_font_description_copy_static(desc_tmp);
+ if (size == -1) {
+ size = (pango_font_description_get_size(desc) / PANGO_SCALE);
+ if (size <= 0) {
+ size = 11; /* default fallback size */
+ }
+ }
+
+ size -= scrollevent.delta_y;
+ if (size < 3) {
+ size = 3;
+ } else if (size > 100) {
+ size = 100;
+ }
+
+ pango_font_description_set_size(desc, size * PANGO_SCALE);
+ vte_terminal_set_font(VTE_TERMINAL(fixed.term), desc);
+#else
+ /* use vte scaling */
+ scale -= ((scrollevent.delta_y * 50.0f) / PANGO_SCALE);
+ if (scale < ((3 * 100.0f) / PANGO_SCALE)) {
+ scale = ((3 * 100.0f) / PANGO_SCALE);
+ } else if (scale > ((100 * 100.0f) / PANGO_SCALE)) {
+ scale = ((100 * 100.0f) / PANGO_SCALE);
+ }
+ vte_terminal_set_font_scale(VTE_TERMINAL(fixed.term), scale);
+
+ desc_tmp = vte_terminal_get_font(VTE_TERMINAL(fixed.term));
+ desc = pango_font_description_copy_static(desc_tmp);
+#endif
+ using_font = pango_font_description_to_string(desc);
+ printfontinfo(desc, using_font, scale);
+ g_free(using_font);
+ return FALSE;
+ } else {
+ /* mouse wheel scrolls the terminal (scrollback) forth/back */
+ GtkAdjustment* vadj = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(fixed.term));
+ gdouble value = gtk_adjustment_get_value(vadj);
+ value += scrollevent.delta_y * 3;
+ gtk_adjustment_set_value(vadj, value);
+ gtk_scrollable_set_vadjustment(GTK_SCROLLABLE(fixed.term), vadj);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/** \brief Handler for the 'text-modified event of the VTE terminal
*
* \param[in] terminal VTE terminal
@@ -964,15 +1036,6 @@
* \return boolean
*/
-static void printfontinfo(PangoFontDescription* desc, char *name)
-{
- log_message(LOG_DEFAULT, "Monitor: using font '%s' (Family:%s, Size:%d, Variations:%s)",
- name,
- pango_font_description_get_family(desc),
- pango_font_description_get_size(desc),
- pango_font_description_get_variations(desc));
-}
-
static PangoFontDescription* getfontdesc(const char *name)
{
PangoFontDescription* desc = pango_font_description_from_string(name);
@@ -1025,7 +1088,7 @@
/* last resort, monospace 11 */
desc_tmp = vte_terminal_get_font(VTE_TERMINAL(fixed.term));
desc = pango_font_description_copy_static(desc_tmp);
- pango_font_description_set_family(desc, "Consolas,monospace");
+ pango_font_description_set_family(desc, "Console,monospace");
pango_font_description_set_size(desc, 11 * PANGO_SCALE);
}
}
@@ -1032,7 +1095,7 @@
vte_terminal_set_font(VTE_TERMINAL(fixed.term), desc);
using_font = pango_font_description_to_string(desc);
- printfontinfo(desc, using_font);
+ printfontinfo(desc, using_font, 1.0f);
g_free(using_font);
pango_font_description_free(desc);
@@ -1202,6 +1265,11 @@
G_CALLBACK(on_term_text_modified),
NULL);
+ g_signal_connect_unlocked(G_OBJECT(fixed.term),
+ "scroll-event",
+ G_CALLBACK(on_term_scrolled),
+ NULL);
+
/* can this actually be connected unlocked, we're setting resources here? */
g_signal_connect_unlocked(G_OBJECT(fixed.window),
"configure-event",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gp...@us...> - 2024-03-29 19:00:57
|
Revision: 45051
http://sourceforge.net/p/vice-emu/code/45051
Author: gpz
Date: 2024-03-29 19:00:56 +0000 (Fri, 29 Mar 2024)
Log Message:
-----------
fix FIXMEs: convert to ascii before sending to remote monitor. fixes #2006
Modified Paths:
--------------
trunk/vice/src/monitor/mon_util.c
Modified: trunk/vice/src/monitor/mon_util.c
===================================================================
--- trunk/vice/src/monitor/mon_util.c 2024-03-29 18:11:58 UTC (rev 45050)
+++ trunk/vice/src/monitor/mon_util.c 2024-03-29 19:00:56 UTC (rev 45051)
@@ -35,6 +35,7 @@
#include "ui.h"
#include "archdep.h"
+#include "charset.h"
#include "console.h"
#include "lib.h"
#include "mem.h"
@@ -264,7 +265,10 @@
#ifdef HAVE_NETWORK
if (monitor_is_remote()) {
- /* FIXME: convert to ASCII before transferring */
+ int n;
+ for (n = 0; n < maxlen; n++) {
+ buffer[n] = charset_p_toascii(buffer[n], CONVERT_WITH_CTRLCODES);
+ }
rc = monitor_network_transmit(buffer, maxlen);
} else {
#endif
@@ -295,7 +299,16 @@
#ifdef HAVE_NETWORK
if (monitor_is_remote()) {
- /* FIXME: convert to ASCII before transferring */
+ int n, c;
+ for (n = 0; n < maxlen; n++) {
+ c = buffer[n];
+ if ((c >= 0x01) && (c <= 0x1a)) {
+ c += 0x60; /* upper */
+ } else if ((c >= 0x41) && (c <= 0x5a)) {
+ c += 0x20; /* upper */
+ }
+ buffer[n] = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
+ }
rc = monitor_network_transmit(buffer, maxlen);
} else {
#endif
@@ -326,7 +339,11 @@
#ifdef HAVE_NETWORK
if (monitor_is_remote()) {
- /* FIXME: convert to ASCII before transferring */
+ int n, c;
+ for (n = 0; n < maxlen; n++) {
+ c = charset_screencode_to_petcii(buffer[n]);
+ buffer[n] = charset_p_toascii(c, CONVERT_WITH_CTRLCODES);
+ }
rc = monitor_network_transmit(buffer, maxlen);
} else {
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|