Count in octal: Difference between revisions
m
→{{header|6502 Assembly}}
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) |
||
Line 153:
INY
CPY #$40
BCC loop
BRK
foo:
sta temp ;store input temporarily
asl ;bit shift, this places the top bit of the right nibble in the bottom of the left nibble.
pha ;back this value up
lda temp
and #$07 ;take the original input and remove everything except the bottom 3 bits.
sta temp ;store it for later. What used to be stored here is no longer needed.
pla ;get the pushed value back.
and #$F0 ;clear the bottom 4 bits.
ora temp ;put the bottom 3 bits of the original input back.
and #$7F ;clear bit 7.
rts</lang>
|