Skip to content

Commit 17787a8

Browse files
committed
Fixed getregs and setregs
1 parent 748b0d4 commit 17787a8

7 files changed

Lines changed: 1080 additions & 1057 deletions

File tree

Changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Version 7.6.3
22
- Added implementations of getregs and setregs
3+
- Added `%reg` as an alias for `__reg__` in Spin1
4+
- Fixed a bug in `reg[imm]` expressions
35

46
Version 7.6.2
57
- Added check for `NO_COLOR` environment variable (thanks to Ada)

sys/nucode_util.spin

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,20 @@ pri wordmove(dst, src, count) : origdst
250250
pri bytemove(dst, src, count)
251251
return __builtin_memmove(dst, src, count)
252252

253+
pri getregs(hubptr, cogptr, count)
254+
repeat while count > 0
255+
long[hubptr] := %reg[cogptr]
256+
hubptr += 4
257+
cogptr++
258+
--count
259+
260+
pri setregs(hubptr, cogptr, count)
261+
repeat while count > 0
262+
%reg[cogptr] := long[hubptr]
263+
hubptr += 4
264+
cogptr++
265+
--count
266+
253267
pri __builtin_memcpy(dst, src, count)
254268
return __builtin_memmove(dst, src, count)
255269

sys/nucode_util.spin.h

Lines changed: 502 additions & 479 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sys/p1_code.spin

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -362,28 +362,19 @@ pri wordfill(ptr, val, count)
362362
pri bytefill(ptr, val, count)
363363
__builtin_memset(ptr, val, count)
364364

365-
'' copy count longs from cogptr to hubptr
366365
pri getregs(hubptr, cogptr, count)
367-
if count==0
368-
return
369-
repeat count
370-
asm
371-
wrlong cogptr, hubptr
372-
add cogptr, #1
373-
add hubptr, #4
374-
endasm
366+
repeat while count > 0
367+
long[hubptr] := %reg[cogptr]
368+
hubptr += 4
369+
cogptr++
370+
--count
375371

376-
'' copy count longs to cogptr from hubptr
377372
pri setregs(hubptr, cogptr, count)
378-
if count==0
379-
return
380-
repeat count
381-
asm
382-
rdlong cogptr, hubptr
383-
add cogptr, #1
384-
add hubptr, #4
385-
endasm
386-
373+
repeat while count > 0
374+
%reg[cogptr] := long[hubptr]
375+
hubptr += 4
376+
cogptr++
377+
--count
387378

388379
'' create a method pointer
389380
'' for P1, addresses fit in 16 bits,

sys/p1_code.spin.h

Lines changed: 416 additions & 427 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sys/p2_code.spin

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ pri getregs(hubptr, cogptr, count)
671671
count--
672672
asm
673673
setq count
674-
wrlong cogptr, hubptr
674+
altd cogptr
675+
wrlong 0-0, hubptr
675676
endasm
676677

677678
'' copy count longs to cogptr from hubptr
@@ -681,7 +682,8 @@ pri setregs(hubptr, cogptr, count)
681682
count--
682683
asm
683684
setq count
684-
rdlong cogptr, hubptr
685+
altd cogptr
686+
rdlong 0-0, hubptr
685687
endasm
686688

687689
'' create a method pointer

sys/p2_code.spin.h

Lines changed: 132 additions & 130 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)