Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #5990 > unrolled thread
| Started by | Colin Leroy-Mira <colin@colino.net> |
|---|---|
| First post | 2023-01-06 00:42 +0100 |
| Last post | 2023-01-09 16:36 +0100 |
| Articles | 15 — 4 participants |
Back to article view | Back to comp.sys.apple2.programmer
Possibly stupid question about cc65 and the Language Card Colin Leroy-Mira <colin@colino.net> - 2023-01-06 00:42 +0100
Re: Possibly stupid question about cc65 and the Language Card Oliver Schmidt <ol.sc@web.de> - 2023-01-06 01:18 +0000
Re: Possibly stupid question about cc65 and the Language Card Colin Leroy-Mira <colin@colino.net> - 2023-01-06 18:05 +0100
Re: Possibly stupid question about cc65 and the Language Card Oliver Schmidt <ol.sc@web.de> - 2023-01-07 09:39 +0000
Re: Possibly stupid question about cc65 and the Language Card Colin Leroy-Mira <colin@colino.net> - 2023-08-15 17:03 +0200
Re: Possibly stupid question about cc65 and the Language Card Colin Leroy-Mira <colin@colino.net> - 2023-08-15 22:28 +0200
Re: Possibly stupid question about cc65 and the Language Card qkumba <peter.ferrie@gmail.com> - 2023-08-15 15:21 -0700
Re: Possibly stupid question about cc65 and the Language Card Colin Leroy-Mira <colin@colino.net> - 2023-08-16 04:29 +0200
Re: Possibly stupid question about cc65 and the Language Card fadden <fadden@fadden.com> - 2023-01-07 08:25 -0800
Re: Possibly stupid question about cc65 and the Language Card Colin Leroy-Mira <colin@colino.net> - 2023-01-07 18:25 +0100
Re: Possibly stupid question about cc65 and the Language Card Colin Leroy-Mira <colin@colino.net> - 2023-01-07 19:15 +0100
Re: Possibly stupid question about cc65 and the Language Card qkumba <peter.ferrie@gmail.com> - 2023-01-07 19:32 -0800
Re: Possibly stupid question about cc65 and the Language Card Colin Leroy-Mira <colin@colino.net> - 2023-01-08 11:41 +0100
Re: Possibly stupid question about cc65 and the Language Card qkumba <peter.ferrie@gmail.com> - 2023-01-09 07:30 -0800
Re: Possibly stupid question about cc65 and the Language Card Colin Leroy-Mira <colin@colino.net> - 2023-01-09 16:36 +0100
| From | Colin Leroy-Mira <colin@colino.net> |
|---|---|
| Date | 2023-01-06 00:42 +0100 |
| Subject | Possibly stupid question about cc65 and the Language Card |
| Message-ID | <20230106004202.19966041@SGX-CMP-480> |
Hi, I'm experimenting with pushing parts of programs to the language card, using #pragma code-name (push, "LC") with cc65. This gives good results on my Apple //c. I get ~3k more heap available, and everything seems fine. But the same programs crashes hard when emulated on MAME. I noticed that the `mame apple2c -listslots` does not list a language card (contrary to `mame apple2 -listslots`. Is this wrong, or am I wrong? Is there a way to verify the presence of that card in my Apple //c? Thanks in advance, -- Colin Leroy-Mira
[toc] | [next] | [standalone]
| From | Oliver Schmidt <ol.sc@web.de> |
|---|---|
| Date | 2023-01-06 01:18 +0000 |
| Message-ID | <tp7ss9$ojis$1@solani.org> |
| In reply to | #5990 |
Hi Colin, > I'm experimenting with pushing parts of programs to the language card, > using #pragma code-name (push, "LC") with cc65. :-) > This gives good results on my Apple //c. I get ~3k more heap available, > and everything seems fine. :-)) > But the same programs crashes hard when emulated on MAME. :-( > I noticed > that the `mame apple2c -listslots` does not list a language card > (contrary to `mame apple2 -listslots`. > > Is this wrong, or am I wrong? Is there a way to verify the presence of > that card in my Apple //c? The 16kB Language Card upgraded an Apple ][ from 48kB to 64kB. All later Apple II came with at least 64kB - meaning that they all contain a "logic" Language Card. The Apple //c came even with 128kB - meaning that it always contains two "logic" Language Cards. Apart from that: ProDOS uses 13kB of the 16kB Language Card. So if there's no "logic" Language Card, ProDOS won't boot at all. Regards, Oliver
[toc] | [prev] | [next] | [standalone]
| From | Colin Leroy-Mira <colin@colino.net> |
|---|---|
| Date | 2023-01-06 18:05 +0100 |
| Message-ID | <20230106180515.3617a49b@SGX-CMP-480> |
| In reply to | #5991 |
Hi, > > This gives good results on my Apple //c. I get ~3k more heap > > available, and everything seems fine. > > :-)) > > > But the same programs crashes hard when emulated on MAME. > > :-( Well. In fact, I also have crashes on the real hardware when pushing to LC. They don't always happen, but I am quite sure there is something fishy going on even if there's no dropping to the Apple 2's monitor. Sadly I'm very much not good enough at assembler to figure out if that's something in my code, or something related to pushing code to the language card. At the very least, cc65's .s generated files are exactly the same, with offsets being just one or two off, when using code-name LC and not. The vast majority of my code runs with absolutely no errors in its libc/x86-64 form under Valgrind, but I also know that it doesn't make sure there isn't some stupidity in the rare #ifdef __CC65__ parts, *or* an integer/signed-unsigned overflow issue somewhere. I probably have an issue, and it's probably just more visible with code in $D400-DFFF. I've looked a lot at internet resources to figure out if I could somehow get some higher level of debugging that I could handle, but didn't find anything :/ Maybe my only choice is to try to build my program for c64 and check with vice? > > I noticed > > that the `mame apple2c -listslots` does not list a language card > > (contrary to `mame apple2 -listslots`. > > > > Is this wrong, or am I wrong? Is there a way to verify the presence > > of that card in my Apple //c? > > The 16kB Language Card upgraded an Apple ][ from 48kB to 64kB. All > later Apple II came with at least 64kB - meaning that they all > contain a "logic" Language Card. Thanks for confirming that :) -- Colin Leroy-Mira
[toc] | [prev] | [next] | [standalone]
| From | Oliver Schmidt <ol.sc@web.de> |
|---|---|
| Date | 2023-01-07 09:39 +0000 |
| Message-ID | <tpbekr$q9to$1@solani.org> |
| In reply to | #5992 |
Hi Colin, > Well. In fact, I also have crashes on the real hardware when pushing to > LC. [...] I can't solve your issue but I can say, that I'm using the LC in that way in most of my cc65 projects. At least some of my projects are somewhat popular and I never got any feedback that there would be an issue with that LC usage. So in contrast to e.g. the serial driver ;-) that LC usage is a well tested feature. BTW: Beside the usual optimization related compiler flags you certainly should consider the --static-locals flag. It makes (non reentrant) code usually both faster and smaller. The latter may be relevant to if have space issues. Regards, Oliver
[toc] | [prev] | [next] | [standalone]
| From | Colin Leroy-Mira <colin@colino.net> |
|---|---|
| Date | 2023-08-15 17:03 +0200 |
| Message-ID | <20230815170329.53a2f2c4@laptop-sigfox> |
| In reply to | #5993 |
Hi, >> Well. In fact, I also have crashes on the real hardware when pushing >> to LC. [...] > >I can't solve your issue but I can say, that I'm using the LC in that >way in most of my cc65 projects. At least some of my projects are >somewhat popular and I never got any feedback that there would be an >issue with that LC usage. So in contrast to e.g. the serial driver ;-) >that LC usage is a well tested feature. Holy hell I have figured that out after 48 hours of diving into assembly!! I'm so proud of myself. I'll file a bug report to cc65 when I'm rested a bit ! :-) -- Colin https://www.colino.net/
[toc] | [prev] | [next] | [standalone]
| From | Colin Leroy-Mira <colin@colino.net> |
|---|---|
| Date | 2023-08-15 22:28 +0200 |
| Message-ID | <20230815222850.033e37a7@laptop-sigfox> |
| In reply to | #6070 |
Hi, >Holy hell I have figured that out after 48 hours of diving into >assembly!! I'm so proud of myself. > >I'll file a bug report to cc65 when I'm rested a bit ! :-) Oliver, if you want the details, I wrote about this investigation in https://www.colino.net/wordpress/archives/2023/08/15/tracking-and-killing-a-cc65-corruption-bug/ and I opened a pull request at https://github.com/cc65/cc65/pull/2160 In the hope the resource can help other people debugging for the Apple II, and also not to forget how I did for the next time I have to do such a exhausting (for me) debugging session :) In fact I'd love if you would give a look at the PR, I *think* this is the correct fix, but I'm not a hundred percent sure. -- Colin https://www.colino.net/
[toc] | [prev] | [next] | [standalone]
| From | qkumba <peter.ferrie@gmail.com> |
|---|---|
| Date | 2023-08-15 15:21 -0700 |
| Message-ID | <c6dc4494-18e1-4f6d-bf90-2102564bc537n@googlegroups.com> |
| In reply to | #6071 |
Very nice!
[toc] | [prev] | [next] | [standalone]
| From | Colin Leroy-Mira <colin@colino.net> |
|---|---|
| Date | 2023-08-16 04:29 +0200 |
| Message-ID | <20230816042946.04f92f8b@laptop-sigfox> |
| In reply to | #6072 |
Hi, >Very nice! Thanks :) -- Colin https://www.colino.net/
[toc] | [prev] | [next] | [standalone]
| From | fadden <fadden@fadden.com> |
|---|---|
| Date | 2023-01-07 08:25 -0800 |
| Message-ID | <6aa3fa25-8629-4d49-bb47-31c751bfd779n@googlegroups.com> |
| In reply to | #5992 |
On Friday, January 6, 2023 at 9:05:20 AM UTC-8, Colin Leroy-Mira wrote: > > > But the same programs crashes hard when emulated on MAME. > I've looked a lot at internet resources to figure out if I could > somehow get some higher level of debugging that I could handle, but > didn't find anything :/ Maybe my only choice is to try to build my > program for c64 and check with vice? Both MAME and AppleWin provide debuggers. You can find a couple of "cheat sheets" here: https://6502disassembly.com/applewin-dbg.html https://6502disassembly.com/mame-dbg.html I'm not sure how they compare to VICE.
[toc] | [prev] | [next] | [standalone]
| From | Colin Leroy-Mira <colin@colino.net> |
|---|---|
| Date | 2023-01-07 18:25 +0100 |
| Message-ID | <20230107182519.04915d11@SGX-CMP-480> |
| In reply to | #5994 |
Hi, fadden said: > Both MAME and AppleWin provide debuggers. You can find a couple of > "cheat sheets" here: https://6502disassembly.com/applewin-dbg.html > https://6502disassembly.com/mame-dbg.html Thanks, I've started diving into mame and its debugger. I must say it's quite complicated for me, as I don't know 65C02 assembly - but well, maybe I'll get somewhere, I may not be too old to learn new stuff! Oliver said: > I can't solve your issue but I can say, that I'm using the LC in that > way in most of my cc65 projects. At least some of my projects are > somewhat popular and I never got any feedback that there would be an > issue with that LC usage. So in contrast to e.g. the serial driver > ;-) that LC usage is a well tested feature. Yes, actually, maybe my problem comes from the use of both LC and the "less-well-tested" serial driver: I seem to have noticed that there are memory writes to the D400-DFFF region when using the serial driver? If this is possible? But I'm not even sure of my finding, and even then, I don't know why that would crash, as according to my map file, my code doesn't go as far (D400-D8ED according to the map file) as where those writes happen (DFB7-DFC8 according to MAME). I've uploaded a minimal reproducer in case you'd like to look at it and tell me how I'm wrong - because I probably am, but don't feel any pressure, I'll figure something out :) https://colino.net/a2dbg/a2-min.c #for the Apple2 https://colino.net/a2dbg/pc-min.c #for the PC https://colino.net/a2dbg/mame-log.txt #my debugger experiments. I set the watchpoint when the Apple2 test program has output "any key to install". The writes happen after receiving a character from the PC. If the PC doesn't reply, or sleeps a few dozens milliseconds before answering, no write happen to $DFB7-DFC8). But at some point with my real program, they happen, even with liberal use of usleep() before replying. Thanks for reading me anyway, and I'll tell you guys if I make some progress. I miss valgrind a lot, haha ! -- Colin
[toc] | [prev] | [next] | [standalone]
| From | Colin Leroy-Mira <colin@colino.net> |
|---|---|
| Date | 2023-01-07 19:15 +0100 |
| Message-ID | <20230107191503.08c1398a@SGX-CMP-480> |
| In reply to | #5995 |
Replying to myself... > Yes, actually, maybe my problem comes from the use of both LC and the > "less-well-tested" serial driver: Mmmh, I just moved the ser_install/ser_apple2_slot/ser_open calls out of the LC code, and it seems to work perfectly now (both on real hardware and MAME emulation). Did I just hide my problem again or could it make some sense ? -- Colin
[toc] | [prev] | [next] | [standalone]
| From | qkumba <peter.ferrie@gmail.com> |
|---|---|
| Date | 2023-01-07 19:32 -0800 |
| Message-ID | <2aafcc02-0582-43b8-8750-465015a03202n@googlegroups.com> |
| In reply to | #5996 |
If you want to share the code, I'd be happy to investigate.
[toc] | [prev] | [next] | [standalone]
| From | Colin Leroy-Mira <colin@colino.net> |
|---|---|
| Date | 2023-01-08 11:41 +0100 |
| Message-ID | <20230108114146.746fba77@SGX-CMP-480> |
| In reply to | #5997 |
Hi, >If you want to share the code, I'd be happy to investigate. This is very nice of you! The code is published on my repo at https://github.com/colinleroy/a2tools It may be a little annoying to setup, but if you got questions, I can answer them. I'm doing a little project of a serial/network proxy for my Apple //c. There's the server part, that runs on the PC (I'm coding on Linux, I hope it's portable), in src/surl-server. You start it with export A2_TTY=/dev/ttyUSB0 export A2_TTY_SPEED=9600 export A2_TTY_HW_HANDSHAKE=1 ./src/surl-server (use A2_TTY_HW_HANDSHAKE=0 if your serial cable only has TX/RX, or when emulating, depending on your emulator - using MAME, ser2net and a TCP socket bitbanger, I have to set it to 0.). And the client part is in src/stp/. Problems arise very quickly if you put the simple_serial_open() function of src/lib/simple_serial.c inside the #pragma code-name(push,"LC"). If it's too much of a bother to test, I'll totally understand :) -- Colin https://www.colino.net/
[toc] | [prev] | [next] | [standalone]
| From | qkumba <peter.ferrie@gmail.com> |
|---|---|
| Date | 2023-01-09 07:30 -0800 |
| Message-ID | <823f889b-8c60-4bbf-a2eb-13c3d3fe68dcn@googlegroups.com> |
| In reply to | #5998 |
Does it still have the crashing problem, though? My message might have been too late if you've solved it already. :-)
[toc] | [prev] | [next] | [standalone]
| From | Colin Leroy-Mira <colin@colino.net> |
|---|---|
| Date | 2023-01-09 16:36 +0100 |
| Message-ID | <20230109163625.468d23b8@SGX-CMP-480> |
| In reply to | #5999 |
Hi, >Does it still have the crashing problem, though? My message might >have been too late if you've solved it already. :-) As long as you add -DSERIAL_TO_LANGCARD in src/stp/Makefile's CLCFLAGS, yes :) -- Colin https://www.colino.net/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.apple2.programmer
csiph-web