Jump to content
IGNORED

Getting line input from cc65 program in assembler?


Recommended Posts

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/

 

 

  • Like 1
Link to comment
Share on other sites

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 by danwinslow
  • Like 1
Link to comment
Share on other sites

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 by danwinslow
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...