| ??? 05/11/07 17:29 Read: times Msg Score: +1 +1 Informative |
#139072 - as a curiousity |
I had to write for debuuging purposes a C calleable routine to read the port latch. As a curiousity I post it here. NOTE: the 'funny names' are used to avoid any conflicts with whatever might be difined in a VERY large project. ;;////////////////////////////////////////////////////////////////////
;;
;; FILE: USP0FETCH.A51
;;
$NOMOD51
PUBLIC ReadP0
?PR?readP0?SAROUT SEGMENT CODE
sbit SAV0 = 0x80;
sbit SAV1 = 0x81;
sbit SAV2 = 0x82;
sbit SAV3 = 0x83;
sbit SAV4 = 0x84;
sbit SAV5 = 0x85;
sbit SAV6 = 0x86;
sbit SAV7 = 0x87;
sbit ABT0 = 0xE0;
sbit ABT1 = 0xE1;
sbit ABT2 = 0xE2;
sbit ABT3 = 0xE3;
sbit ABT4 = 0xE4;
sbit ABT5 = 0xE5;
sbit ABT6 = 0xE6;
sbit ABT7 = 0xE7;
sfr PAA =0x80
;;sfr acc =0xa0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;
;; FUNCTION U8 ReadP0 (void)
;;
;; crummy means of obtaining the PAA port latch
;;
RSEG ?PR?readP0?SAROUT
USING 0
ReadP0:
push acc
clr a
jbc SAV0,set0
sjmp go1
set0: setb ABT0
go1: jbc SAV1,set1
sjmp go2
set1: setb ABT1
go2: jbc SAV2,set2
sjmp go3
set2: setb ABT2
go3: jbc SAV3,set3
sjmp go4
set3: setb ABT3
go4: jbc SAV4,set4
sjmp go5
set4: setb ABT4
go5: jbc SAV5,set5
sjmp go6
set5: setb ABT5
go6: jbc SAV6,set6
sjmp go7
set6: setb ABT6
go7: jbc SAV7,set7
sjmp gone
set7: setb ABT7
gone: mov PAA,a
mov r7,a
pop acc
ret
Erik |
| Topic | Author | Date |
| as a curiousity | 01/01/70 00:00 | |
| Initial reaction | 01/01/70 00:00 | |
| I submit plenty of assembler and | 01/01/70 00:00 | |
| miscomm? | 01/01/70 00:00 | |
| Bob, clearly you need to read on port latches in t | 01/01/70 00:00 | |
| Alternative | 01/01/70 00:00 | |
| interesting, however | 01/01/70 00:00 | |
| Did you mean courtesy? | 01/01/70 00:00 | |
| I'm not corious | 01/01/70 00:00 | |
| this is why the \"adult\" ICEs are for... | 01/01/70 00:00 | |
| no ICE I know of can show the port LATCH | 01/01/70 00:00 | |
| Optimise? | 01/01/70 00:00 | |
| sure | 01/01/70 00:00 | |
| Now, as discussion of optimization started | 01/01/70 00:00 | |
| Addition to the 80C154 | 01/01/70 00:00 | |
| I would never ASS U ME | 01/01/70 00:00 | |
| that OKI part... | 01/01/70 00:00 | |
| It is a true 51 derivative, but | 01/01/70 00:00 | |
are you sure? | 01/01/70 00:00 |



