sanny Posted May 26, 2022 Share Posted May 26, 2022 You mean this (unsigned char *) makes the difference? Use cc65 to create assembly output and show the different invocations of memset. regards, chris Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted May 26, 2022 Share Posted May 26, 2022 I just tried a compile using both with and without a cast to memset() and the output is identical. Must have been something else causing the problem. 000083r 1 AD rr rr lda L0030 000086r 1 85 rr sta ptr1 000088r 1 A0 4F ldy #$4F 00008Ar 1 A9 AA lda #$AA 00008Cr 1 91 rr L0035: sta (ptr1),y 00008Er 1 88 dey 00008Fr 1 10 FB bpl L0035 Quote Link to comment Share on other sites More sharing options...
stepho Posted May 27, 2022 Share Posted May 27, 2022 I had a quick look at your code and couldn't find PST . But I did find your definition of SAVMSC . #define SAVMSC *((word *) 0x0058) I guess you wanted to do something like SAVMSC=0xff at some point. The leftmost * in the define makes SAVMSC equivalent to an integer variable (not a pointer), so this works. But it doesn't work for memset(), which expects a pointer. #define SAVMSC *((word *) 0x0058) SAVMSC = 0xff; // saves 0xff to SAVMSC, ie *(0x58) = 0xff memset( SAVMSC, 0, 1); // writes 0 to whatever is at address 0xff, ie reads SAVMSC and uses that as the address to write 0xff to memset( (byte*)SAVMSC, 0, 1); // writes 0 to whatever is at address 0xff Instead try either of the following techniques: #define SAVMSC *((word *) 0x0058) SAVMSC = 0xff; // saves 0xff to SAVMSC, ie *(0x58) = 0xff memset( &SAVMSC, 0, 1); // writes 0 to address 0x58 Or #define SAVMSC ((word *) 0x0058) *SAVMSC = 0xff; // saves 0xff to SAVMSC, ie *(0x58) = 0xff memset( SAVMSC, 0, 1); // writes 0 address 0x58 Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted May 27, 2022 Share Posted May 27, 2022 I would really recommend switching to use stdint.h which defines: typedef signed char int8_t; typedef int int16_t; typedef long int32_t; typedef unsigned char uint8_t; typedef unsigned uint16_t; typedef unsigned long uint32_t; Quote Link to comment Share on other sites More sharing options...
atarixle Posted May 27, 2022 Share Posted May 27, 2022 21 hours ago, TGB1718 said: You shouldn't need the cast as long as PST has been defined as char *PST Also all pointers are unsigned, they are purely 16 bit addresses so "unsigned" is also not needed. I think that definition may have somehow confused the compiler That is a quite good idea, but PST is #defined as PEEKW(88). I guess I will have to create a definition that works without the use of the PEEK statements. Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted May 27, 2022 Share Posted May 27, 2022 Still can still use PEEKW, just change the code to something like this. int *PST; PST=(int *)PEEKW(88); or even char *PST; PST=(char *)PEEKW(88) a char pointer is still 2 bytes, so will act just the same as the int pointer, you can still use POKEW to a char pointer or even something like char *PST; PST=(char *)PEEKW(88); *PST=0xaa55; // still pokes 2 bytes Quote Link to comment Share on other sites More sharing options...
ClausB Posted May 27, 2022 Share Posted May 27, 2022 On 5/23/2022 at 9:57 PM, damosan said: the fastest I've managed (~332 pixels / jiffy) on an NTSC machine FS1 manages 400-500 pixels per frame (1/60 sec - I think that's what you're calling a jiffy). 1 Quote Link to comment Share on other sites More sharing options...
atarixle Posted May 28, 2022 Share Posted May 28, 2022 PST is not an assignment, it's a definition. So or so it results in a casted thing that somehow breaks in cc65-master. 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.