Page 2 of 2

Re: File Hex Editor for X16

Posted: Wed Oct 09, 2024 2:45 am
by voidstar
VIDEOMODE_80x30, etc. is defined in cx16.h (which is included with cc65, as part of supporting the X16 platform).
It should be the same constants passed into the SCREEN keyword in X16 BASIC.

/* Video modes for videomode() */
#define VIDEOMODE_80x60 0x00
#define VIDEOMODE_80x30 0x01
#define VIDEOMODE_40x60 0x02
#define VIDEOMODE_40x30 0x03
#define VIDEOMODE_40x15 0x04
#define VIDEOMODE_20x30 0x05
#define VIDEOMODE_20x15 0x06
#define VIDEOMODE_80COL VIDEOMODE_80x60
#define VIDEOMODE_40COL VIDEOMODE_40x30
#define VIDEOMODE_320x240 0x80
#define VIDEOMODE_SWAP (-1)


I like cc65, but I feel the bulk of expertise that can maintain it has moved on to other interest. Though I'm impressed it still works for the X16 at all, I don't think it's been updated (for the X16 target platform) since the R30's era (maybe 3+ years But if you're fluent with C already, it's a nice tool to prototype a project. It's worked well for me for PET and Apple2 projects though.

Forcing a toUpper I suppose is clever. When I started HXD, I'm not sure if I fully understood the differences between the keyboard scancodes and the current display codes (or plus however the system is "supposed to work" is complicated by whatever behind-the-scenes translation cx16.lib stuff might be doing for you, like in printf and scanf calls).

Tentatively, I'm wondering if some "application helper API" built into one of the ROM slots would be a good thing. For example, just being able to SYS into a ROM address to invoke a text-mode or graphic-mode file selector (with 8K ROM, should be room to fit both). The Melodius file selector is very robust (gamepad support, sorting, long filename support, etc). Sort of like the Microsoft API to invoke a standard "file open" dialog box (which then for free, you get the ability to sort by different criteria or open files across a network device, etc).


I'm very supportive of mid-day siesta's :) Actually, any-time-of-day siesta's (although I think its root was sexta IIRC, so the word is more intended for the 6th hour into the day, or mid-day-but-not-noonish).

Re: File Hex Editor for X16

Posted: Wed Oct 09, 2024 5:10 am
by Sarasaworks
It's funny, I was thinking how fun it would be to create a Raylib-esque API just before I saw your latest post. But yes, having built in API's would definitely make a difference. It would make rapid prototyping on the X16 a breeze and completely remove the need for a separate dev environment. An API cartridge would be a godsend, even if it's not necessarily free.

As far as cx65.h, it looks to have been updated as of R37, as VIDEOMODE_80x30 and VIDEOMODE_40x15 have been completely omitted:

Code: Select all

/* Video modes for videomode() */
#define VIDEOMODE_40x30         0x00
#define VIDEOMODE_80x60         0x02
#define VIDEOMODE_40COL         VIDEOMODE_40x30
#define VIDEOMODE_80COL         VIDEOMODE_80x60
#define VIDEOMODE_320x200       0x80
#define VIDEOMODE_SWAP          (-1)
Had to recreate the #defines in the main C file to get cc65 to stop whining. Finally just said to heck with it and decided to kick cx65.h to the curb. Still compiling with cc65, but now I'm digging into the nitty gritty of VERA and making my own header. Which is a lot more fun anyways. Even more fun when it works:

Code: Select all

#include <stdio.h>

typedef volatile unsigned char vu8;

#define ADDRx_L     (*(vu8*)0x9f20)
#define ADDRx_M     (*(vu8*)0x9f21)
#define ADDRx_H     (*(vu8*)0x9f22)
#define DATA_0      (*(vu8*)0x9f23)
#define DATA_1      (*(vu8*)0x9f24)
#define CTRL        (*(vu8*)0x9f25)
#define DC_HSCALE   (*(vu8*)0x9f2a)
#define DC_VSCALE   (*(vu8*)0x9f2b)


void main(void){
    DC_HSCALE = 0x40;
    DC_VSCALE = 0x40;

}
Change Resolution without cx16.h
Change Resolution without cx16.h
Sarasaworks_SamplePRG_ss0.png (784.87 KiB) Viewed 332 times
Maybe once I figure it all out, I'll come back to X16HxD and replace code that's header dependent. Might actually solve a lot of problems. Would certainly be better than switching to another code base.

Re: File Hex Editor for X16

Posted: Wed Oct 09, 2024 12:41 pm
by voidstar
I haven't tried cross-compiling HXD with KickC, which I think has recently improved its support for X16.

Re: File Hex Editor for X16

Posted: Wed Oct 09, 2024 6:47 pm
by Sarasaworks
KickC?

Fixed the BASIC font case problem though with the following function:

Code: Select all

void FixScreen(){
    asm("lda #$8f");
    asm("jsr $ffd2");
    asm("lda #$8e");
    asm("jsr $ffd2");
}

Re: File Hex Editor for X16

Posted: Thu Oct 10, 2024 5:42 am
by voidstar
https://gitlab.com/camelot/kickc/-/releases

But looks like not updated for a couple years. I was able to run it, and it does look like it as some standard library components. Even cc65 hasn't implemented all aspects of the standard library for CX16 platform.


And nice update, I can see how that would help.