Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <conio.h>
- #include <peekpoke.h>
- extern void logRegisterA( void );
- void main()
- {
- char hello[] = "Hello, world!";
- char i;
- static char hello_static[] = "Hello, world!";
- static char i_static;
- static char len_static = 13;
- goto skip_the_broken_stuff_that_makes_an_endless_loop;
- // This block, using a normal local variable, does not work.
- // I have tried many variations, and come to these conclusions:
- // - assignments to / incrementing 'i' seems to have no effect; it is always zero.
- // - hello's address is near the end of ZP ($00F2). Everything that deep in the ZP is zeroed.
- // - strlen(hello) returns 0, which is unsurprising given the above.
- __AX__ = strlen(hello);
- logRegisterA(); // This is an asm routine that executes a custom opcode that logs A to the emulator's logfile.
- for( i=0; i<strlen(hello); ++i )
- {
- POKE( 0x310+i, hello[i] );
- //cputc( hello[i] );
- __AX__ = hello[i];
- logRegisterA();
- }
- skip_the_broken_stuff_that_makes_an_endless_loop:
- // This block, using all static variables, /does/ work.
- for( i_static=0; i_static<len_static; ++i_static )
- {
- POKE( 0x310+i_static, hello_static[i_static] );
- //cputc( hello_static[i] );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement