tschak909 Posted November 18, 2022 Share Posted November 18, 2022 (edited) I almost have ready, a binding to call and utilize Diamond GOS 3.0 functions from the CC65 C compiler (and potentially others like llvm-mos, it is all pointer accesses.) You can get a copy here: https://github.com/tschak909/diamond-gos-cc65 I wanted to solve one particular issue that I haven't been able to fully extrapolate from existing code and the documentation: The EVENTTYPE structure. This is a very critical area of RAM where the most recent event winds up, to be decoded, and to make anything useful, it needs to be derived. Does anyone have any documentation on this, before I literally start disassembling the ROM? (such as @areeve?) Edited November 19, 2022 by tschak909 Edited to add Github link. Quote Link to comment Share on other sites More sharing options...
+MrFish Posted November 19, 2022 Share Posted November 19, 2022 (edited) All of Alan's source disks were dumped and uploaded long ago. I'm assuming you've already looked through the 3.0 Develop manual (which has some info about it) for what you need -- and the 3.0 Develop disks (I haven't looked in these yet). I guess I'd start here first, after that... EVENT.M65 Edited November 19, 2022 by MrFish Quote Link to comment Share on other sites More sharing options...
+MrFish Posted November 19, 2022 Share Posted November 19, 2022 Here's an ASCII text version of the file. Event.asm Quote Link to comment Share on other sites More sharing options...
tschak909 Posted November 19, 2022 Author Share Posted November 19, 2022 37 minutes ago, MrFish said: All of Alan's source disks were dumped and uploaded long ago. I'm assuming you've already looked through the 3.0 Develop manual (which has some info about it) for what you need -- and the 3.0 Develop disks (I haven't looked in these yet). I guess I'd start here first, after that... EVENT.M65 14.27 kB · 1 download Yes I have. -Thom Quote Link to comment Share on other sites More sharing options...
+MrFish Posted November 19, 2022 Share Posted November 19, 2022 6 minutes ago, tschak909 said: Yes I have. Do you have all the source disks? Quote Link to comment Share on other sites More sharing options...
tschak909 Posted November 19, 2022 Author Share Posted November 19, 2022 no. -Thom Quote Link to comment Share on other sites More sharing options...
+MrFish Posted November 19, 2022 Share Posted November 19, 2022 (edited) I should probably get these up on this page of my website sometime. Serious Computerist: Source Code Diamond Source & Masters.zip Edited November 19, 2022 by MrFish 1 Quote Link to comment Share on other sites More sharing options...
tschak909 Posted November 19, 2022 Author Share Posted November 19, 2022 11 minutes ago, MrFish said: I should probably get these up on this page of my website sometime. Serious Computerist: Source Code Diamond Source & Masters.zip 411.99 kB · 1 download The first thread has been updated with an upload of the C bindings. Quote Link to comment Share on other sites More sharing options...
tschak909 Posted November 19, 2022 Author Share Posted November 19, 2022 It works, just need to fully break the events down into a union of structures. Generated from the following code: /** * Create a single window */ #include <gos.h> void main(void) { gos_init(0); gos_windopen(SIZER|HORIZONTAL|VERTICAL|DRAG|FULLER, 0,8, 39,183, 0, "Hello World\xFF", "CC65 Bindings\xFF", 0,0,0); while (1) { gos_event(); if ( EVENTTYPE == 2 ) // window { if ( EVENTTYPE2 == 1 ) // closed { gos_windclose(); break; } } } gos_exit(); } 6 Quote Link to comment Share on other sites More sharing options...
tschak909 Posted November 19, 2022 Author Share Posted November 19, 2022 Desk accessory has been added, but it needs some debugging help, anyone want to peer into this? https://github.com/tschak909/diamond-gos-cc65/tree/main/helloacc -Thom Quote Link to comment Share on other sites More sharing options...
tschak909 Posted November 24, 2022 Author Share Posted November 24, 2022 By digging into the Diamond GOS source code, I was able to decode the event structure, and create a union structure that encapsulates the different event types and their parameters. /** * @var EVENTTYPE - Last Event */ typedef enum _event_type { EVENT_NOP, ICON, WINDOW, MENU, KEY, BACKGROUND } EventType; #define EVENTTYPE (*(EventType *)0x9A93) /** * @var The event structure */ typedef union _event { struct _Icon { unsigned char number; /* Icon Number 0-31 */ unsigned char rsvd1; /* not used */ unsigned char rsvd2; unsigned char rsvd3; unsigned char rsvd4; } Icon; struct _Window { enum _window_event_type { NONE, CLOSER, FULLER, DRAGGED, SIZED, SLIDE_X, SLIDE_Y, IN_WINDOW, NEW_WINDOW } type; unsigned char x; /* X (0-39) */ unsigned char y; /* Y (0-191) */ unsigned char rsvd1; unsigned char rsvd2; } Window; struct _Menu { unsigned char menu; /* Menu # */ unsigned char item; /* Item # */ unsigned char rsvd1; unsigned char rsvd2; } Menu; struct _Keypress { unsigned char key; /* key pressed # */ unsigned char rsvd1; unsigned char rsvd2; unsigned char rsvd3; } Keypress; struct _Background /* Background clicked */ { unsigned char x; unsigned char y; unsigned char rsvd1; unsigned char rsvd2; } Background; } Event; #define EVENT (*(Event *)0x9A94) This makes the example hello2 program, a lot more readable. /** * Create a single window */ #include <gos.h> void main(void) { gos_init(0); gos_windopen(ADD_SIZER|ADD_HORIZONTAL|ADD_VERTICAL|ADD_DRAG|ADD_FULLER, 0,8, 39,183, 0, "Hello World\xFF", "CC65 Bindings\xFF", 0,0,0); while (1) { gos_event(); if ( EVENTTYPE == WINDOW ) // window { if ( EVENT.Window.type == CLOSER ) // closed { gos_windclose(); break; } } } gos_exit(); } Everything checked into GitHub. With this, I can call the bindings done, and this can be used to write Diamond programs in C. Enjoy, -Thom 7 Quote Link to comment Share on other sites More sharing options...
_The Doctor__ Posted November 26, 2022 Share Posted November 26, 2022 on to GEOS? Quote Link to comment Share on other sites More sharing options...
tschak909 Posted November 26, 2022 Author Share Posted November 26, 2022 17 minutes ago, _The Doctor__ said: on to GEOS? A WHOLE lot needs to happen to GEOS before it's considered usable for application development on the Atari. e.g. right now, there is no I/O layer at all, no way to read/write to disk, or anything else than the screen. -Thom Quote Link to comment Share on other sites More sharing options...
_The Doctor__ Posted November 26, 2022 Share Posted November 26, 2022 (edited) I think it's already in a state that the fujinet stuff could be servicable... and since you are working on multiple platforms (Atari 8,Apple,C64, etc etc.....) geos could bridge the apple/atari/commodore fujinet space... Edited November 26, 2022 by _The Doctor__ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.