-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kbhit optimized for telestrat #1393
Conversation
Now that your original code is merged this pull request can't be applied as-is. Please update your repo and add a commit to this pull request. |
ldx #$00 | ||
bcs @no_char_action | ||
lda #$01 | ||
rts | ||
@no_char_action: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does A have a defined value at this point from BRK_TELEMON XRD0? If yes, it might be worth mentioning in a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It uses carry to set return value, but i have to look to source code to know what A returns. I try to have a look tonight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my comment above THAT useful. What I actually wanted to express and what I probably should have written is: "I consider your recent proposal broken. The only way it could potentially work is if BRK_TELEMON XRD0 would be well known to return a certain value in A that you only have to override if necessary. But I rather presume that this isn't the case." You see, I'm not actually interested in the fact what BRK_TELEMON XRD0 returns in A. There's no need that you try to find out. Rather just go ahead and write code here which works independently from BRK_TELEMON XRD0' setting of A.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, Oliver, I cannot follow you.
lda #$01 | ||
rts | ||
@no_char_action: | ||
lda #$00 | ||
tax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be "txa"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes good point. I will fix it tonight. Thanks for the point :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be "txa"
I don't agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure we're talking about the same code. This ias what you want to see? tax
replaced with txa
, right?
_kbhit:
BRK_TELEMON XRD0
ldx #$00
bcs @no_char_action
lda #$01
rts
@no_char_action:
lda #$00
txa
rts
My take is that the tax
shouldn't be replaced with txa
. Rather it should be removed altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about something like:
_kbhit:
BRK_TELEMON XRD0
ldx #$00
bcs @no_char_action
lda #$01 ; return one
rts
@no_char_action:
txa ; return zero
rts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that's not what you wrote above - or at least what I thought you wrote ;-) Anyhow, I guess the OP now has enough input on how to get it right...
Trying to bring this back on track... A simple, straight forward option to write this - as suggested in #1392 (comment) - is:
A "trying to be cool" option to write this is:
|
That's the best version IMO. Smaller and faster than the others. But, |
How embarrassing :-( I just directly pushed the fixed version: 8551431 |
Thanks. For information, XRD0 returns in A ascii code of the key pressed |
In that case, both
|
As we discuss, here is kbhit optimized