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

Minor optimizations #2

Open
wants to merge 1 commit into
base: sidecart-rtc
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 12 additions & 22 deletions src/rtc.s
Original file line number Diff line number Diff line change
Expand Up @@ -333,83 +333,73 @@ _start_async_code_in_stack:

; SEND PAYLOAD SIZE
move.l a0, d0 ; Address of the ROM3 in d0
or.w d1, d0 ; OR high and low words in d0
move.w d1, d0 ; OR high and low words in d0
move.l d0, a1 ; move to a1 ready to read from this address
move.b (a1), d0 ; Command payload size. d0 is a scratch register
tst.w d1
beq _no_more_payload_stack ; If the command does not have payload, we are done.

; SEND PAYLOAD
move.l a0, d0
or.w d2, d0
move.w d2, d0
move.l d0, a1
move.b (a1), d0 ; Command payload low d2
cmp.w #2, d1
beq _no_more_payload_stack

swap d2
move.l a0, d0
or.w d2, d0
move.w d2, d0
move.l d0, a1
move.b (a1), d0 ; Command payload high d2
cmp.w #4, d1
beq _no_more_payload_stack

move.l a0, d0
or.w d3, d0
move.w d3, d0
move.l d0, a1
move.b (a1), d0 ; Command payload low d3
cmp.w #6, d1
beq _no_more_payload_stack

swap d3
move.l a0, d0
or.w d3, d0
move.w d3, d0
move.l d0, a1
move.b (a1), d0 ; Command payload high d3
cmp.w #8, d1
beq _no_more_payload_stack

move.l a0, d0
or.w d4, d0
move.w d4, d0
move.l d0, a1
move.b (a1), d0 ; Command payload low d4
cmp.w #10, d1
beq _no_more_payload_stack

swap d4
move.l a0, d0
or.w d4, d0
move.w d4, d0
move.l d0, a1
move.b (a1), d0 ; Command payload high d4
cmp.w #12, d1
beq.s _no_more_payload_stack

move.l a0, d0
or.w d5, d0
move.w d5, d0
move.l d0, a1
move.b (a1), d0 ; Command payload low d5
cmp.w #14, d1
beq.s _no_more_payload_stack

swap d5
move.l a0, d0
or.w d5, d0
move.w d5, d0
move.l d0, a1
move.b (a1), d0 ; Command payload high d5
cmp.w #16, d1
beq.s _no_more_payload_stack

move.l a0, d0
or.w d6, d0
move.w d6, d0
move.l d0, a1
move.b (a1), d0 ; Command payload low d6
cmp.w #18, d1
beq.s _no_more_payload_stack

swap d6
move.l a0, d0
or.w d6, d0
move.w d6, d0
move.l d0, a1
move.b (a1), d0 ; Command payload high d6

Expand Down Expand Up @@ -479,4 +469,4 @@ ikbddate_test:
dc.b $1b,$23,$11,$09,$15,$55,$30,0

even
rom_function_end:
rom_function_end: