Home » Archimedes archive » Acorn User » AU 1997-10 A.adf » Regulars » RTR/Examples/Second
RTR/Examples/Second
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Acorn User » AU 1997-10 A.adf » Regulars |
Filename: | RTR/Examples/Second |
Read OK: | ✔ |
File size: | 049D bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
;If all bits of Port B are connected to an LED ;This will run one lit LED backwards and forwards LIST P=16C84 ; PORTB EQU 6 TRISB EQU 86H OPTREG EQU 81H STATUS EQU 3 CARRY EQU 0 RP0 EQU 5 MSB EQU 7 ;BIT POSITION OF LEFTMOST LED ; CLRF PORTB ;ALL LEDS OFF BSF STATUS,RP0 ;SELECT REGISTER BANK 1 CLRF TRISB^80H ;SET PORTB TO ALL OUTPUTS MOVLW 0AH MOVWF OPTREG^80H ;ASSIGN PRESCALER (1:4) TO WDT BCF STATUS,RP0 ;SELECT REGISTER BANK 0 INCF PORTB,F ;TURN ON RIGHTMOST LED BCF STATUS,CARRY ;CLEAR CARRY LEFT SLEEP ;WAIT FOR WDT TIMEOUT RLF PORTB,F ;TURN ON LED TO LEFT BTFSS PORTB,MSB ;REACHED LEFTMOST? GOTO LEFT ;LOOP IF NOT RIGHT SLEEP ;WAIT FOR WDT TIMEOUT RRF PORTB,F ;TURN ON LED TO RIGHT BTFSS PORTB,0 ;REACHED RIGHTMOST? GOTO RIGHT ;LOOP IF NOT GOTO LEFT ;START NEW CYCLE END
00000000 3b 49 66 20 61 6c 6c 20 62 69 74 73 20 6f 66 20 |;If all bits of | 00000010 50 6f 72 74 20 42 20 61 72 65 20 63 6f 6e 6e 65 |Port B are conne| 00000020 63 74 65 64 20 74 6f 20 61 6e 20 4c 45 44 0a 3b |cted to an LED.;| 00000030 54 68 69 73 20 77 69 6c 6c 20 72 75 6e 20 6f 6e |This will run on| 00000040 65 20 6c 69 74 20 4c 45 44 20 62 61 63 6b 77 61 |e lit LED backwa| 00000050 72 64 73 20 61 6e 64 20 66 6f 72 77 61 72 64 73 |rds and forwards| 00000060 0a 20 20 20 20 20 20 20 20 4c 49 53 54 20 50 3d |. LIST P=| 00000070 31 36 43 38 34 0a 20 20 20 3b 0a 20 50 4f 52 54 |16C84. ;. PORT| 00000080 42 20 20 20 45 51 55 20 20 20 20 20 36 20 0a 20 |B EQU 6 . | 00000090 54 52 49 53 42 20 20 20 45 51 55 20 20 20 20 20 |TRISB EQU | 000000a0 38 36 48 0a 20 4f 50 54 52 45 47 20 20 45 51 55 |86H. OPTREG EQU| 000000b0 20 20 20 20 20 38 31 48 0a 20 53 54 41 54 55 53 | 81H. STATUS| 000000c0 20 20 45 51 55 20 20 20 20 20 33 0a 20 43 41 52 | EQU 3. CAR| 000000d0 52 59 20 20 20 45 51 55 20 20 20 20 20 30 0a 20 |RY EQU 0. | 000000e0 52 50 30 20 20 20 20 20 45 51 55 20 20 20 20 20 |RP0 EQU | 000000f0 35 0a 20 4d 53 42 20 20 20 20 20 45 51 55 20 20 |5. MSB EQU | 00000100 20 20 20 37 20 20 20 20 20 20 20 20 20 20 20 20 | 7 | 00000110 20 20 20 3b 42 49 54 20 50 4f 53 49 54 49 4f 4e | ;BIT POSITION| 00000120 20 4f 46 20 4c 45 46 54 4d 4f 53 54 20 4c 45 44 | OF LEFTMOST LED| 00000130 0a 20 20 20 3b 0a 20 20 20 20 20 20 20 20 43 4c |. ;. CL| 00000140 52 46 20 20 20 20 50 4f 52 54 42 20 20 20 20 20 |RF PORTB | 00000150 20 20 20 20 20 20 3b 41 4c 4c 20 4c 45 44 53 20 | ;ALL LEDS | 00000160 4f 46 46 0a 20 20 20 20 20 20 20 20 42 53 46 20 |OFF. BSF | 00000170 20 20 20 20 53 54 41 54 55 53 2c 52 50 30 20 20 | STATUS,RP0 | 00000180 20 20 20 20 3b 53 45 4c 45 43 54 20 52 45 47 49 | ;SELECT REGI| 00000190 53 54 45 52 20 42 41 4e 4b 20 31 20 20 20 0a 20 |STER BANK 1 . | 000001a0 20 20 20 20 20 20 20 43 4c 52 46 20 20 20 20 54 | CLRF T| 000001b0 52 49 53 42 5e 38 30 48 20 20 20 20 20 20 20 3b |RISB^80H ;| 000001c0 53 45 54 20 50 4f 52 54 42 20 54 4f 20 41 4c 4c |SET PORTB TO ALL| 000001d0 20 4f 55 54 50 55 54 53 0a 20 20 20 20 20 20 20 | OUTPUTS. | 000001e0 20 4d 4f 56 4c 57 20 20 20 30 41 48 0a 20 20 20 | MOVLW 0AH. | 000001f0 20 20 20 20 20 4d 4f 56 57 46 20 20 20 4f 50 54 | MOVWF OPT| 00000200 52 45 47 5e 38 30 48 20 20 20 20 20 20 3b 41 53 |REG^80H ;AS| 00000210 53 49 47 4e 20 50 52 45 53 43 41 4c 45 52 20 28 |SIGN PRESCALER (| 00000220 31 3a 34 29 20 54 4f 20 57 44 54 0a 20 20 20 20 |1:4) TO WDT. | 00000230 20 20 20 20 42 43 46 20 20 20 20 20 53 54 41 54 | BCF STAT| 00000240 55 53 2c 52 50 30 20 20 20 20 20 20 3b 53 45 4c |US,RP0 ;SEL| 00000250 45 43 54 20 52 45 47 49 53 54 45 52 20 42 41 4e |ECT REGISTER BAN| 00000260 4b 20 30 0a 20 20 20 20 20 20 20 20 49 4e 43 46 |K 0. INCF| 00000270 20 20 20 20 50 4f 52 54 42 2c 46 20 20 20 20 20 | PORTB,F | 00000280 20 20 20 20 3b 54 55 52 4e 20 4f 4e 20 52 49 47 | ;TURN ON RIG| 00000290 48 54 4d 4f 53 54 20 4c 45 44 0a 20 20 20 20 20 |HTMOST LED. | 000002a0 20 20 20 42 43 46 20 20 20 20 20 53 54 41 54 55 | BCF STATU| 000002b0 53 2c 43 41 52 52 59 20 20 20 20 3b 43 4c 45 41 |S,CARRY ;CLEA| 000002c0 52 20 43 41 52 52 59 0a 4c 45 46 54 20 20 20 20 |R CARRY.LEFT | 000002d0 53 4c 45 45 50 20 20 20 20 20 20 20 20 20 20 20 |SLEEP | 000002e0 20 20 20 20 20 20 20 20 3b 57 41 49 54 20 46 4f | ;WAIT FO| 000002f0 52 20 57 44 54 20 54 49 4d 45 4f 55 54 0a 20 20 |R WDT TIMEOUT. | 00000300 20 20 20 20 20 20 52 4c 46 20 20 20 20 20 50 4f | RLF PO| 00000310 52 54 42 2c 46 20 20 20 20 20 20 20 20 20 3b 54 |RTB,F ;T| 00000320 55 52 4e 20 4f 4e 20 4c 45 44 20 54 4f 20 4c 45 |URN ON LED TO LE| 00000330 46 54 0a 20 20 20 20 20 20 20 20 42 54 46 53 53 |FT. BTFSS| 00000340 20 20 20 50 4f 52 54 42 2c 4d 53 42 20 20 20 20 | PORTB,MSB | 00000350 20 20 20 3b 52 45 41 43 48 45 44 20 4c 45 46 54 | ;REACHED LEFT| 00000360 4d 4f 53 54 3f 0a 20 20 20 20 20 20 20 20 47 4f |MOST?. GO| 00000370 54 4f 20 20 20 20 4c 45 46 54 20 20 20 20 20 20 |TO LEFT | 00000380 20 20 20 20 20 20 3b 4c 4f 4f 50 20 49 46 20 4e | ;LOOP IF N| 00000390 4f 54 0a 52 49 47 48 54 20 20 20 53 4c 45 45 50 |OT.RIGHT SLEEP| 000003a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000003b0 20 20 20 3b 57 41 49 54 20 46 4f 52 20 57 44 54 | ;WAIT FOR WDT| 000003c0 20 54 49 4d 45 4f 55 54 0a 20 20 20 20 20 20 20 | TIMEOUT. | 000003d0 20 52 52 46 20 20 20 20 20 50 4f 52 54 42 2c 46 | RRF PORTB,F| 000003e0 20 20 20 20 20 20 20 20 20 3b 54 55 52 4e 20 4f | ;TURN O| 000003f0 4e 20 4c 45 44 20 54 4f 20 52 49 47 48 54 0a 20 |N LED TO RIGHT. | 00000400 20 20 20 20 20 20 20 42 54 46 53 53 20 20 20 50 | BTFSS P| 00000410 4f 52 54 42 2c 30 20 20 20 20 20 20 20 20 20 3b |ORTB,0 ;| 00000420 52 45 41 43 48 45 44 20 52 49 47 48 54 4d 4f 53 |REACHED RIGHTMOS| 00000430 54 3f 0a 20 20 20 20 20 20 20 20 47 4f 54 4f 20 |T?. GOTO | 00000440 20 20 20 52 49 47 48 54 20 20 20 20 20 20 20 20 | RIGHT | 00000450 20 20 20 3b 4c 4f 4f 50 20 49 46 20 4e 4f 54 0a | ;LOOP IF NOT.| 00000460 20 20 20 20 20 20 20 20 47 4f 54 4f 20 20 20 20 | GOTO | 00000470 4c 45 46 54 20 20 20 20 20 20 20 20 20 20 20 20 |LEFT | 00000480 3b 53 54 41 52 54 20 4e 45 57 20 43 59 43 4c 45 |;START NEW CYCLE| 00000490 0a 20 20 20 20 20 20 20 20 45 4e 44 0a |. END.| 0000049d