You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here are some extension I found really useful for speeding up my code. ]C@L is really good for reading hardware registers. They might be worth including in the library?
: ]C@ \ like "[ a ] LITERAL C@" for first 256 bytes of RAM
POSTPONE [
$C6 C, , \ LD A,a
$5A C, \ DECW X
$7F C, \ clear high byte
$5A C, \ DECW X
$F7 C, ] \ LD (X),A
; IMMEDIATE
: ]C@L \ like "[ a ] LITERAL C@" for longmem
POSTPONE [
$5A C, \ DECW X
$C6 C, , \ LD A,longmem
$F7 C, \ LD (X),A
$5A C, \ DECW X
$7F C, \ clear high byte
]
; IMMEDIATE
I also use the following occasionally which may be useful:
: RCF $98 C, ; IMMEDIATE \ reset carry flag
: SCF $99 C, ; IMMEDIATE \ set carry flag
: CLR_A $4F C, ; IMMEDIATE \ clear accum
: ]LDA ( c -- ) $B6 C, C, ] ; IMMEDIATE \ load byte @ c into accum
: ]ADC ( c -- ) $B9 C, C, ] ; IMMEDIATE \ add byte at c to accumulator
: ]LDA>M ( c -- ) $B7 C, C, ] ; IMMEDIATE \ save A to memory
\ rotate byte logical left/right through carry
: ]RLC ( c -- ) $39 C, C, ] ; IMMEDIATE
: ]RRC ( c -- ) $36 C, C, ] ; IMMEDIATE
: ]INC ( A -- ) $3C C, C, ] ; IMMEDIATE \ Fastest way to add 1 to MSB of VARIABLE
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Here are some extension I found really useful for speeding up my code. ]C@L is really good for reading hardware registers. They might be worth including in the library?
I also use the following occasionally which may be useful:
Beta Was this translation helpful? Give feedback.
All reactions