Addressing Modes, Branches and Loops



6502 Addressing Modes



More 6502 Addressing Modes



6800 and 8085 Addressing Modes



x86 Addressing Modes



Unconditional Branches



Conditional Branches



Compare, Test and Set



6502 Example

What does this program do? (5 minutes, groups of 2-4)
start:  LDX #00
        LDA #00
loop:   INX
        CMP $03A0, X
        BNE loop
done:   DEX
        STX $03A0
        BRK
Write your answer on a slip of paper, then pass it to the instructor at the end of the exercise.



6800 Example

What does this program do? (5 minutes, groups of 2-4)
start:  LDX #0000
        STX $0180
        LDX #0064
        STX $0182
loop:   LDX $0180
        LDAA $01A0,X
	INX
        STX $0180
        LDX $0182
        STAA $029F,X
        DEX
        STX $0182
        BNE loop
done:   WAI



8080/8085 Example

What does this program do? (5 minutes, groups of 2-3)
start:  LXI SP, 2000H
        MVI C, 14H
        LXI HL, 1234H
loop1:  MOV A, M
        PUSH PSW
        INX H
        DCR C
        JNZ loop1
        MVI C, 14H
        LXI HL, 1234H
loop2:  POP PSW
	MOV M, A
        INX H
        DCR C
        JNZ loop2



x86 Example

What does this program do? (5 minutes, groups of 2-3)
start:  CLD
        MOV SI, A000H
        MOV DI, B000H
        MOV CX, 0010H
        REP LODSB