-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Part 2 serial IO lesson #88
base: master
Are you sure you want to change the base?
Conversation
; :: / `--<[|]= |[ m ]|| :: | ||
; :: \ .______ | ```` || :: | ||
; :: / !| `````| | + oo|| :: | ||
; :: ( ||[ ^u^]| | .. #|| :: |
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 love this!
0352ed2
to
3a0e30d
Compare
3a0e30d
to
431baff
Compare
The code has been updated a bit. I updated the PR comment to reflect the changes. I'm not sure how this should be integrated with the unbricked code, or if I need to provide something more significant for testing purposes? I didn't want to add test code to this repo, so I've been working on the impl in a standalone project (https://github.com/quinnyo/gbserial). |
Not sure about more significant testing, but I'd start thinking about how to integrate it in Ubricked for the simple "share high scores" case (although I really like @eievui5 idea here, maybe for a further improvement). Maybe start the paragraph explaining sio.asm then hooking the "share high score" routine when e.g. pressing select on the game over screen? To be honest, I don't think having an independent, standalone ROM only to showcase the serial feature is a bad idea, so I'd merge that as well. |
- work-in-progress lesson text - most of core impl covered - sio.asm: anchors and minor changes for tutorial friendliness
…dged by ID. - errors: packet check failed, invalid message type - display error counts - tidier display layout
This is an early draft PR for the lesson/features discussed in #42. Currently this PR includes only the core serial implementation (
sio.asm
) and it is not integrated with any other code. There is no included way to build a demo/test here, but you can venture to my gbserial repo where I've been developing/testing this if you like. See comment below for more information on that.A few questions and things I'm not sure of:
About the implementation:
Sio (
sio.asm
) is a kind of multi-byte version of the underlying GB serial API.Buffers are provided for data in and out. Using
SioTransferStart
will transfer the whole buffer. Smaller batches are possible but don't have a nice way to start them.Each byte transfer after the first is started from the serial interrupt.
The clock provider's "catchup delay" is implemented as a simple "sleep" loop executed before every byte transfer. The duration of this can be tuned.
SioTick
is to be called regularly -- per-frame. This is most necessary to update the timeout timer for devices using the external clock source. The duration of the timeout is in "ticks" (calls toSioTick
).A simple data integrity test is implemented with the
SioPacket
functions. This takes the first two bytes of the buffer for a magic number and simple checksum. Sio itself doesn't do anything to handle the result of this test, it's expected that the controlling context (the app-specific protocol) will deal with it.