Motorola Axiom CMD11E1 Uživatelská příručka Strana 42

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 101
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 41
42 CHAPTER 3. FUNCTIONS AND BIT MANIPULATIONS
JSR CLRBIT4
LDAA $00
JSR PRBINARY *PRINT AFTER CLEAR
SWI
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Function: CLRBIT4
; Purpose: Clears bit #4 in memory location $00
; Registers modified none
;
CLRBIT4
PSHA
LDAA $00
ANDA #%11101111
STAA $00
PULA
RTS
;; INSERT THE CODE FOR FUNCTIONS SETBIT4 RAND AND PRBINARY HERE
ORG $D000
;; ALL THE DATA ITEMS GO HERE.$
;;;;;;;;;;;;;;;;;;;;;;;end of code ;;;;;;;;;;;;;;;;;;;;;;;;
3.8 Toggling bits
We will now write a function that will toggle (make it zero if it was a one; make
it one if it was a zero) a particular bit in some memory location. The function
should modify the value in the memory in such a way that it only affects the
specific bit without changing any other bit. For definiteness, we will toggle bit #4
in memory location $00. To toggle a bit, we use the eor instruction. Write the
following program, and test it by repeating the call to $C100 from the BUFFALO
prompt.
;;;;;;;;;;;;;;;;;;;;;;;start of code ;;;;;;;;;;;;;;;;;;;;;;;;
;; Insert standard buffalo equates here
Zobrazit stránku 41
1 2 ... 37 38 39 40 41 42 43 44 45 46 47 ... 100 101

Komentáře k této Příručce

Žádné komentáře