Jump to content

c3po

New Members
  • Posts

    4
  • Joined

  • Last visited

Profile Information

  • Location
    Tatooine

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

c3po's Achievements

Combat Commando

Combat Commando (1/9)

5

Reputation

  1. If you need to do a modulo operation where the divisor is a power of two, you can use AND: M mod N = M AND (N-1). ; M mod 8 (8 is a power of 2...) LDA M AND #7 ; 8-1
  2. I like it. You can still do a normal "A minus R" then complement it SEC SBC R EOR #$FF CLC ADC #01 simplified to: CLC SBC R EOR #$FF which is useful if the carry is known to be cleared already.
  3. Well, for the sake of hacks, I think in any long program it's a useful commodity to have a table like this: NumTab ; values 0-255 byte 0, 1, 2, 3, 4, 5, 6, 7 byte 8, 9, 10, 11, 12, 13, 14, 15 ... byte 248, 249, 250, 251, 252, 253, 254, 255 This allows some interesting "new instructions": AND NumTab,X ; A AND X ORA NumTab,X ; A OR X EOR NumTab,X ; A XOR X CMP NumTab,X ; CMP A with X CLC ADC NumTab,X ; A + X SEC SBC NumTab,X ; A - X LDY NumTab,X ; TXY LDX NumTab,Y ; TYX
  4. In (timely) response to the initial post... lda work ; or ldy work clc ; iny adc #1 ; tya eor work and #$0f eor work sta work and if you want any subset of contiguous bits you can do like that: lda work clc adc #4 ; value of the lsb of the increment group eor work and #%00011100 ; 3 bits (2...4) eor work sta work this will cycle bits 2...4
×
×
  • Create New...