Harry Potter Posted June 1, 2021 Share Posted June 1, 2021 Uhh...do I read a line of input from the routine at $F63E? When I use this routine, the computer just stops. No input is written. Nothing is returned. Quote Link to comment Share on other sites More sharing options...
danwinslow Posted June 1, 2021 Share Posted June 1, 2021 Please show us some code and provide context. If you are using C, why are you jumping to what you think are input routines instead of just using the C functionality? Never jump to 'the OS routine at $xxxx'. If you want to do low level IO functionality you must read about and learn to use the Atari CIO system. Everything is done through handlers on the Atari - jumping directly to OS locations is not done. https://www.atariarchives.org/dere/ 1 Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted June 1, 2021 Author Share Posted June 1, 2021 I attached the file in question. It accepts a pointer to the buffer to which it returns the input and returns the length of the line returned by the user. It is meant to be called from C and is defined as __fastcall__. getline.s Quote Link to comment Share on other sites More sharing options...
danwinslow Posted June 1, 2021 Share Posted June 1, 2021 (edited) That routine is designed to be called from a handler, not directly from a user routine. See what I mentioned in my post above. Why is it crashing? I don't know, but you could put your emulator into debug and figure it out yourself (especially if using Altirra). Anyway, it's probably a bad idea, you should be using CIO to open the K: handler. It's not impossible to do things with direct calls, but it's generally not a good idea. You could also use one of the the getch() functions of conio.h or stdio.h. From mapping the atari, see the red underlined part: 62436-65535 F3E4-FFFF KBDORG Routines for the display and keyboard handler. The display handler beqins at 62454 ($F3F6) and the keyboard handler begins at 63197 ($F6DD), below. 63038 F63E EGETCH Like the BASIC INPUT command, EGETCH gets a line from the screen and keyboard, but only one character at a time. You must do a JSR $F63E for each character input. This is also the address of the beginning of the screen editor routines. 63140 F6A4 EOUTCH This routine puts the character currently in the accumulator onto the screen in the next print location. Similar to the BASIC PUT command. Edited June 1, 2021 by danwinslow 1 Quote Link to comment Share on other sites More sharing options...
danwinslow Posted June 1, 2021 Share Posted June 1, 2021 (edited) Also, looking at code, it seems you are looking for a #13 as a keycode...thinking that is a CR possibly? It's not - atari uses ATASCII, not ASCII and besides you may be getting an internal keycode here and not an ATASCII CR ( which is 155). Then it looks like you try to zero terminate the buffer (although if you've fallen through due to the bne @lp not branching then Y will be a zero when you try to zero terminate the buffer). Not super great at reading assembler off the cuff nowadays but those are some possible problems I noticed. Edited June 1, 2021 by danwinslow Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted June 1, 2021 Author Share Posted June 1, 2021 You're right. I should change the CR. Now, I could simply remove the getline() function. I have an alternate function to handle keyboard input. I can use that instead. 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.