nurpax / petmate

PETSCII editor with Electron/React/Redux
MIT License
185 stars 14 forks source link

Display decimal value of a char in addition to hex #141

Closed Esshahn closed 5 years ago

Esshahn commented 5 years ago

This is a low hanging fruit that would have saved me hours when I was working on the "week in progress" demo:

Display the decimal value in addition to the hex value in these two places:

screenshot 2019-02-28 um 09 56 41 screenshot 2019-02-28 um 09 56 47

So instead of

$20

do

$20 / #32

Esshahn commented 5 years ago

Why this would be so helpful:

When exporting asm source with Petmate, decimal values are used instead of hex:

screen_001
!byte 14,6
!byte 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
!byte 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
!byte 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
!byte 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
!byte 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
!byte 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,160,32,32,32,32,32,32,32,32,32,32,32
!byte 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,160,32,32,32,32,32,32,32,32,32,32

But you never see these values in the editor ;) Therefore it would be more consistant.

I was using Petmate to create a background screen for my part in "week in progress"

screenshot 2019-02-28 um 10 01 15

This part uses a custom charset where the characters would not match the PETSCII's characters position.

screenshot 2019-02-28 um 10 02 46

I needed to replace a char codes in the export file with the matching ones in the charset and to get the right values to replace, I needed to convert the hex numbers in petmate to the decimal numbers in the export.

nurpax commented 5 years ago

Coming from a coder background, my initial reaction is to have hex only. Decimal feels like clutter. Charcodes are so commonly in hex. But may be as days pass by, I will change my mind. :)

What about switching .asm export to use hex? Or maybe use a slightly more expressive content pipeline? For example, when you include a petscii in your asm project, use something like macros to replace the chars. For example, here's what I did in one of my demos to fix some particular chars in the font (this is in c64jasm but a similar thing works in KA too)

!macro fix_architect_font(charset) {
    !for i in range(64) {
        !if (i == $20) {
            !fill 8, 0
        } elif (i == $2c) { ; ','
            !byte %00000000
            !byte %00000000
            !byte %00000000
            !byte %00000000
            !byte %00000000
            !byte %00110000
            !byte %01100000
            !byte %00000000
        } elif (i == $2e) { ; '.'
            !byte %00000000
            !byte %00000000
            !byte %00000000
            !byte %00000000
            !byte %00000000
            !byte %01100000
            !byte %01100000
            !byte %00000000
        } else {
            !byte charset.data[i]
        }
    }
    ; $40
    !fill 8, $ff
}

A similar thingie for petscii could be:

!macro fix_petscii(petmate) {
    !for i in range(1000) {
        !let sc = petmate.screen[i]
        !if (sc == $76) {
             !byte $31  ; replace 0x76 with 0x31
        } else {
             !byte sc
        }
    }
}

screencodes:
!fix_petscii(loadJson('foo.petmate'))
og2t commented 5 years ago

To add my two cents: there were times when I’d use char codes in Basic, and obviously they were decimal. So I see Ingo’s point. How about a setting hex/dec according to user’s preference? FastTracker2 had that feature, i.e. music timing makes more sense in hex for some people (coders) and in dec for ordinary musicians ;-) On Thu, 28 Feb 2019 at 20:46, Janne Hellsten notifications@github.com wrote:

Coming from a coder background, my initial reaction is to have hex only. Decimal feels like clutter. Charcodes are so commonly in hex. But may be as days pass by, I will change my mind. :)

What about switching .asm export to use hex? Or maybe use a slightly more expressive content pipeline? For example, when you include a petscii in your asm project, use something like macros to replace the chars. For example, here's what I did in one of my demos to fix some particular chars in the font (this is in c64jasm but a similar thing works in KA too)

!macro fix_architect_font(charset) { !for i in range(64) { !if (i == $20) { !fill 8, 0 } elif (i == $2c) { ; ',' !byte %00000000 !byte %00000000 !byte %00000000 !byte %00000000 !byte %00000000 !byte %00110000 !byte %01100000 !byte %00000000 } elif (i == $2e) { ; '.' !byte %00000000 !byte %00000000 !byte %00000000 !byte %00000000 !byte %00000000 !byte %01100000 !byte %01100000 !byte %00000000 } else { !byte charset.data[i] } } ; $40 !fill 8, $ff }

A similar thingie for petscii could be:

!macro fix_petscii(petmate) { !for i in range(1000) { !let sc = petmate.screen[i] !if (sc == $76) { !byte $31 ; replace 0x76 with 0x31 } else { !byte sc ; replace 0x76 with 0x31 } } }

screencodes: !fix_petscii(loadJson('foo.petmate'))

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nurpax/petmate/issues/141#issuecomment-468411510, or mute the thread https://github.com/notifications/unsubscribe-auth/AABwKOnooMgqIhr_WPEQ6PyDkDlXm0Mjks5vSDIxgaJpZM4bWUBn .

nurpax commented 5 years ago

In general, I prefer not to stick stuff into settings. So either it's just hex or hex and decimal. But it's two against one already, so maybe I'll just add the decimal in there.

I've wanted to be able to see the currently selected color indexed in this view (next to charcode). But adding decimal there too (so "C: $20/32 COL: $03/3") would take too much space and would clutter the view. Also the abbreviation "C:" for screenCode might not be the best. Would "SC:" or "S:" be better?

image

og2t commented 5 years ago

How about a double click or alt click to toggle dec/hex globally? I don’t see the point of polluting the space with hex and dec everywhere unless absolutely necessary and I like how Apple hides extra options it in this way. Pro tricks for pros :) COL is confusing: COLor or COLumn? I’d use ID for char code or SC for screen code. On Thu, 28 Feb 2019 at 21:07, Janne Hellsten notifications@github.com wrote:

In general, I prefer not to stick stuff into settings. So either it's just hex or hex and decimal. But it's two against one already, so maybe I'll just add the decimal in there.

I've wanted to be able to see the currently selected color indexed in this view (next to charcode). But adding decimal there too (so "C: $20/32 COL: $03/3") would take too much space and would clutter the view. Also the abbreviation "C:" for screenCode might not be the best. Would "SC:" or "S:" be better?

[image: image] https://user-images.githubusercontent.com/297823/53594999-cfe3d100-3ba4-11e9-9335-3730aca6deca.png

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/nurpax/petmate/issues/141#issuecomment-468418938, or mute the thread https://github.com/notifications/unsubscribe-auth/AABwKFss6xDFU-4clyEEgAv8GlHv1s2iks5vSDcUgaJpZM4bWUBn .

nurpax commented 5 years ago

Or hover on top of hex to see decimal in a tooltip?

Sorry if I'm being obtuse about layout and keeping the look simple, but IMO Petmate is in fact pretty simple and (I like to think) pretty because things like this have had a lot of thought go into them (quite often by @Esshahn).

og2t commented 5 years ago

I will let Ingo speak. Hover might be annoying to trigger. Toggle might be a better fit (but again, I am opinionated)

On Thu, 28 Feb 2019 at 21:15, Janne Hellsten notifications@github.com wrote:

Or hover on top of hex to see decimal too?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/nurpax/petmate/issues/141#issuecomment-468421478, or mute the thread https://github.com/notifications/unsubscribe-auth/AABwKC9q5ttbQe2nvrIjJVKS8BXUyUzFks5vSDjngaJpZM4bWUBn .