Skip to content
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

[atari] Optimize findfreeiocb #337

Merged
merged 1 commit into from
Jun 14, 2024
Merged

Conversation

pfusik
Copy link
Contributor

@pfusik pfusik commented Jun 14, 2024

No description provided.

bcc loop
inx ; return ZF cleared
adc #$10 ; C = 0
bpl loop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a comment explaining why bpl gives the loop termination condition, now that it's no longer an explicit compare against #$80.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's your point? Checking the N flag is the 6502's idiomatic way to determine $00-$7F vs $80-$FF. It's the cmp #$80 that looked strange.
Also, all Atari programmers should be aware that there are 8 IOCBs.
I'm okay with adding a comment, but I don't know what should it explain?

Copy link
Member

@mysterymath mysterymath Jun 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The significance of 0x80. It's looping through the IOCBs, each of which are 0x10 bytes long, and there are 8 of them. I've done some Atari programming, but I didn't have either of those two facts memorized.

Copy link
Member

@mysterymath mysterymath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mysterymath mysterymath merged commit 0278320 into llvm-mos:main Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants