SainT Posted December 22, 2014 Author Share Posted December 22, 2014 (edited) Here we go. The code is marked with "THIS WORKS" and "THIS FAILS". I've never used 6502, and it's rather limited to compared to the assembly I'm used to, so it's not that easy for me to debug. Any thoughts appreciated! typedef struct { char szFilename[13]; u8 bDirectory; } SDirEntry; ; --------------------------------------------------------------- ; void __near__ strcpy (__near__ unsigned char*, __near__ const unsigned char*) ; --------------------------------------------------------------- .segment "CODE" .proc _strcpy: near .segment "BSS" L007C: .res 1,$00 .segment "CODE" ; ; c = *p2++; ; L007D: ldy #$01 jsr ldaxysp sta regsave stx regsave+1 ina bne L0082 inx L0082: ldy #$00 jsr staxysp lda regsave ldx regsave+1 ldy #$00 jsr ldauidx sta L007C ; ; *p1++ = c; ; ldy #$03 jsr ldaxysp sta regsave stx regsave+1 ina bne L0084 inx L0084: ldy #$02 jsr staxysp lda regsave ldx regsave+1 jsr pushax ldx #$00 lda L007C ldy #$00 jsr staspidx ; ; } while (c != 0); ; ldx #$00 lda L007C cmp #$00 jsr boolne jne L007D ; ; } ; jsr incsp4 rts .endproc ; --------------------------------------------------------------- ; void __near__ AddDirEntry (__near__ const unsigned char*, unsigned char) ; --------------------------------------------------------------- .segment "CODE" .proc _AddDirEntry: near .segment "BSS" L0088: .res 1,$00 .segment "CODE" ; ; u8 nEntry = 0; ; ldx #$00 lda #$00 sta L0088 ; ; gsDirEntry[0].szFilename[0] = 'a'; ; ldx #$00 lda #$61 sta _gsDirEntry ; THIS WORKS ; ; gsDirEntry[0].szFilename[1] = 0; ; ldx #$00 lda #$00 sta _gsDirEntry+1 ; THIS WORKS ; ; strcpy(gsDirEntry[0].szFilename, pIn); ; lda #<(_gsDirEntry) ldx #>(_gsDirEntry) jsr pushax ldy #$04 jsr ldaxysp jsr _strcpy ; THIS FAILS ; ; ganDirOrder[nEntry] = gnNumDirEntries; ; lda #<(_ganDirOrder) ldx #>(_ganDirOrder) clc adc L0088 bcc L0098 inx L0098: jsr pushax ldx #$00 lda _gnNumDirEntries ldy #$00 jsr staspidx ; ; gnNumDirEntries++; ; ldx #$00 lda _gnNumDirEntries pha ina sta _gnNumDirEntries pla ; ; } ; jsr incsp3 rts .endproc Edited December 22, 2014 by SainT Quote Link to comment Share on other sites More sharing options...
SainT Posted December 22, 2014 Author Share Posted December 22, 2014 Ok, figured it out. The code generated is for __fastcall__ parameter passing, but the functions are not declared as __fastcall__, so it's all ballsed up. If you mark all functions which take parameters as __fastcall__ then all is good! This seems like a fairly major bug to me, I'm amazed this hasn't been spotted before? 2 Quote Link to comment Share on other sites More sharing options...
+karri Posted December 23, 2014 Share Posted December 23, 2014 If you include <string.h> then you don't have a problem. -- Karri Quote Link to comment Share on other sites More sharing options...
SainT Posted December 23, 2014 Author Share Posted December 23, 2014 If you include <string.h> then you don't have a problem. -- Karri Cheers Karri, I'll have a look at that later on -- do you mean because the functions in the standard libs are declared with fastcall? Or is there some pragma in there which sets fastcall to default? The biggest issue for me is that using this c compiler as you would any other currently results in broken code. If you happen to miss the fastcall declaration off a function with parameters the code generated is just broken... Not a problem for a tiny project like the menu, but I quite fancied writing some games for the Lynx should I ever get time. And confidence in the tool chain is a must! Quote Link to comment Share on other sites More sharing options...
+karri Posted December 23, 2014 Share Posted December 23, 2014 The standard header files are different - not broken. I am not sure how __fastcall__ started. It saves a few pushes and pops from the stack on every call. The parameters are in registers instead of on the stack. The functions are declared correctly in the appropriate header files. So you should just avoid doing your own extern int somefunction(); and use the definitions provided by the cc65/include directory. This is a small inconvenience that results in faster and smaller code. Unfortunately it is not possible to get rid of __fastcall__ anymore as most asm code relies on this. And almost all cc65 code uses the __fastcall__ syntax today. Sorry about this. -- Karri Quote Link to comment Share on other sites More sharing options...
Shawn Jefferson Posted December 23, 2014 Share Posted December 23, 2014 It is well known on the cc65 side... I guess mostly people use the provided header files with function declarations and don't provide their own usually. I remember having this issue a long time ago myself, due to not having the function declaration for some system function (I think cgetc). As Karri said, the __fastcall__ syntax is a cc65 addition that makes for smaller and faster code. Glad you got it figured out! Check out this page for other tips on using cc65: http://cc65.github.io/doc/coding.html Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted January 16, 2015 Share Posted January 16, 2015 No news on this? Quote Link to comment Share on other sites More sharing options...
SainT Posted January 16, 2015 Author Share Posted January 16, 2015 Sadly nothing much to report. I've been really busy at work (end of a project) and no spare time, but the hardware seems to be working, just needs the software side sorting! Things should calm down soon. 3 Quote Link to comment Share on other sites More sharing options...
sn8k Posted January 28, 2015 Share Posted January 28, 2015 I absolutely want this. Been holding out on a Lynx for this reason. Quote Link to comment Share on other sites More sharing options...
vectrexroli Posted January 28, 2015 Share Posted January 28, 2015 Now as the phantastic McWill Display replacement mod for the Atari Lynx is out, such a multicart would make so much sense now. That´s now the only thing still missing for a 100% perfect Lynx setup. 2 Quote Link to comment Share on other sites More sharing options...
SainT Posted January 29, 2015 Author Share Posted January 29, 2015 There's not much work left to do, but it's stupidly busy at work still, so I've still not been able to build up the enthusiasm to get stuck into it again yet. Will be busy for another four weeks or so I'd guess, we're nearly at gold master, so super bug fixing time. Quote Link to comment Share on other sites More sharing options...
SainT Posted January 30, 2015 Author Share Posted January 30, 2015 Ok, found some time to have a play. I have it working now -- got a directory browser written which will then launch LNX ROM images. There's a couple of weird things still to iron out -- writing to the cart seems a bit flaky. I've managed to get it working with a massive delay loop, just need to figure out what the actual problem is. Seems to be some noise on the data lines, perhaps caused by polling the AUDIN pin? Not sure. The other odd thing is that some games have no audio when launched from the file menu, but are just fine when launched directly. I assume I'm going to have to try and reset all the hardware to a power-on state before jumping to the boot ROM... 11 Quote Link to comment Share on other sites More sharing options...
Tempest Posted February 25, 2015 Share Posted February 25, 2015 Looking forward to this. Quote Link to comment Share on other sites More sharing options...
gladders Posted March 3, 2015 Share Posted March 3, 2015 I've registered specifically to say I'd love one too. Ordered a Lynx Model 1 yesterday Quote Link to comment Share on other sites More sharing options...
Orange-Phantom Posted March 6, 2015 Share Posted March 6, 2015 After reading this topic I have to say it's a pretty exciting time to be a Lynx enthusiast! I'd absolutely love one of these! Amazing stuff! Quote Link to comment Share on other sites More sharing options...
mjsaville Posted March 18, 2015 Share Posted March 18, 2015 Mark me down for 1 of these also, just fitted the lcd screen replacement mod and the Lynx is now my favourite hand held. ? 1 Quote Link to comment Share on other sites More sharing options...
+Stephen Posted March 20, 2015 Share Posted March 20, 2015 Mark me down for 1 of these also, just fitted the lcd screen replacement mod and the Lynx is now my favourite hand held. Definitely - I fitted the LCD replacement in prep for this cart Quote Link to comment Share on other sites More sharing options...
Zoyx Posted March 20, 2015 Share Posted March 20, 2015 Where do you get the mod kit for the LCD replacement? Quote Link to comment Share on other sites More sharing options...
mjsaville Posted March 20, 2015 Share Posted March 20, 2015 McWill replacement lcd - http://atariage.com/forums/topic/233632-lynx-lcd-replacementvga-out-by-mcwill/page-5?do=findComment&comment=3179769 Quote Link to comment Share on other sites More sharing options...
Zoyx Posted March 20, 2015 Share Posted March 20, 2015 (edited) Thanks, that got me in the general location. It is actually this post. Now I gotta figure out if I have a Lynx II or not. Edited March 20, 2015 by Zoyx Quote Link to comment Share on other sites More sharing options...
Gaztee Posted March 21, 2015 Share Posted March 21, 2015 Thanks, that got me in the general location. It is actually this post. Now I gotta figure out if I have a Lynx II or not. I wouldn't worry sounds like he's going to have the Lynx 1 screen sorted too soon Quote Link to comment Share on other sites More sharing options...
vectrexroli Posted March 21, 2015 Share Posted March 21, 2015 The McWill mod is phantastic, I can strongly recommend getting one. That´s also the main reason why I want also a proper multicart for my Lynx now. http://youtu.be/-NQaoRDVGms 2 Quote Link to comment Share on other sites More sharing options...
Bodyshots Posted March 22, 2015 Share Posted March 22, 2015 I've never gave the Lynx handheld a serious look until I saw this Video by Roli. The fact it can now be used on a larger screen is extremely appealing to me. I will be purchasing the mod now thanks to this video, but I had a question unrelated to the Multi Cart. How will the model 2 Atari Lynx Handheld work with the mod installed on one lynx model 2 handheld on a big screen, if I was to use a second model 2 Lynx handheld with the LINK CABLE installed for '2 players' on a big screen? (If at all) Is this possible? And if it is possible, then I'd obviously research on what games were compatible for 2 or more players…. I'm assuming the mod would display that of one handheld only, but since I've not owned a Lynx before, I feel the question has to be asked. Quote Link to comment Share on other sites More sharing options...
vectrexroli Posted March 22, 2015 Share Posted March 22, 2015 (edited) I've never gave the Lynx handheld a serious look until I saw this Video by Roli. The fact it can now be used on a larger screen is extremely appealing to me. I will be purchasing the mod now thanks to this video, but I had a question unrelated to the Multi Cart. How will the model 2 Atari Lynx Handheld work with the mod installed on one lynx model 2 handheld on a big screen, if I was to use a second model 2 Lynx handheld with the LINK CABLE installed for '2 players' on a big screen? (If at all) Is this possible? And if it is possible, then I'd obviously research on what games were compatible for 2 or more players…. I'm assuming the mod would display that of one handheld only, but since I've not owned a Lynx before, I feel the question has to be asked. I don´t kow if I understood your question right, but for a 2nd Lynx you would need a 2nd monitor, but keep in mind that the low Lynx resolution does not look that great on a huge VGA monitor. I think for questions regarding the mod we better should use that existing thread: http://atariage.com/forums/topic/233632-lynx-lcd-replacementvga-out-by-mcwill/ I hope that the Lynx multicart will be finalized soon and as I show all kinds of multicarts and flashcarts on my Youtube channel, i would like to show also that one of course. Edited March 22, 2015 by vectrexroli 1 Quote Link to comment Share on other sites More sharing options...
7800fan Posted March 23, 2015 Share Posted March 23, 2015 AFAIK none of the Lynx comlinked game shares one display. Each player has their own display. So you will need LCD mod for each Lynx and separate VGA monitor each. There is one theoretical possibility: if you know of a video multiplexor that takes multiple video input and display them on one screen it could be used for Lynx. Those are commonly used for CCTV to show multiple security camera onto one display for easier monitoring. I don't know if there are VGA muxer or if you would need multiple VGA to composite converter for each Lynx. Get a nice 100" LCD display and a 9-ways muxer and everyone can see up to 8 players at once (most are 2-4 players, one can do 8 players but theoretically Lynx can have unlimited players due to design of the cable but realistically the lag will kill massive multi-Lynx network) 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.