home *** CD-ROM | disk | FTP | other *** search
/ TAP YIPL / TAP_and_YIPL_Collection_CD.iso / PHREAK / GENERAL / TELECARD.ZIP / TELECRD2.LST < prev   
File List  |  1994-09-16  |  30KB  |  508 lines

  1. MPASM 01.02 Released  TELECRD2.ASM   9-16-1994  10:19:25                 PAGE  1
  2. ISO 7816 Synchronous Memory Card Emulator
  3.  
  4. LOC  OBJECT CODE     LINE SOURCE TEXT
  5.   VALUE
  6.  
  7.                      0001  
  8.                      0002         TITLE   "ISO 7816 Synchronous Memory Card Emulator" 
  9.                      0003         LIST    P=PIC16C84, R=HEX 
  10.                      0004     INCLUDE "PICREG.EQU" 
  11.                      0001 ; PIC16Cxx Microcontroller Include File 
  12.                      0002  
  13.   01FF               0003 PIC54           equ     0x1ff   ; PIC16C54 Reset Vector 
  14.   01FF               0004 PIC55           equ     0x1ff   ; PIC16C55 Reset Vector 
  15.   03FF               0005 PIC56           equ     0x3ff   ; PIC16C56 Reset Vector 
  16.   07FF               0006 PIC57           equ     0x7ff   ; PIC16C57 Reset Vector 
  17.   0000               0007 PIC71           equ     0x000   ; PIC16C71 Reset Vector 
  18.   0000               0008 PIC84           equ     0x000   ; PIC16C84 Reset Vector 
  19.   0004               0009 INTVEC          equ     0x004   ; PIC16C71/84 Interupt Vector 
  20.                      0010  
  21.   0000               0011 INDIR           equ     0x000   ; Indirect File Reg Address Register 
  22.   0001               0012 RTCC            equ     0x001   ; Real Time Clock Counter 
  23.   0002               0013 PCL             equ     0x002   ; Program Counter Low Byte 
  24.   0003               0014 STATUS          equ     0x003   ; Status Register 
  25.   0004               0015 FSR             equ     0x004   ; File Select Register 
  26.   0005               0016 PORTA           equ     0x005   ; Port A I/O Register 
  27.   0006               0017 PORTB           equ     0x006   ; Port B I/O Register 
  28.   0007               0018 PORTC           equ     0x007   ; Port C I/O Register 
  29.   0008               0019 ADCON0          equ     0x008   ; PIC16C71 A/D Control Reg 0 
  30.   0009               0020 ADRES           equ     0x009   ; PIC16C71 A/D Converter Result Register 
  31.   0008               0021 EEDATA          equ     0x008   ; PIC16C84 EEPROM Data Register 
  32.   0009               0022 EEADR           equ     0x009   ; PIC16C84 EEPROM Address Register 
  33.   000A               0023 PCLATH          equ     0x00a   ; Program Counter High Bits 
  34.   000B               0024 INTCON          equ     0x00b   ; Interrupt Control Register 
  35.   0005               0025 TRISA           equ     0x005   ; Port A I/O Direction Register 
  36.   0006               0026 TRISB           equ     0x006   ; Port B I/O Direction Register 
  37.   0007               0027 TRISC           equ     0x007   ; Port C I/O Direction Register 
  38.   0008               0028 ADCON1          equ     0x008   ; PIC16C71 A/D Control Reg 1 
  39.   0008               0029 EECON1          equ     0x008   ; PIC16C84 EEPROM Control Reg. 1 
  40.   0009               0030 EECON2          equ     0x009   ; PIC16C84 EEPROM Control Reg. 2 
  41.   0001               0031 OPTION          equ     0x001   ; Option Register 
  42.                      0032  
  43.   0007               0033 MSB             equ     0x007   ; Most-Significant Bit 
  44.   0000               0034 LSB             equ     0x000   ; Least-Significant Bit 
  45.   0001               0035 TRUE            equ     1 
  46.   0001               0036 YES             equ     1 
  47.   0000               0037 FALSE           equ     0 
  48.   0000               0038 NO              equ     0 
  49.                      0039  
  50.                      0040 ; Status Register (f03) Bits 
  51.                      0041  
  52.   0000               0042 CARRY           equ     0x000   ; Carry Bit 
  53.   0000               0043 C               equ     0x000   ; Carry Bit 
  54.   0001               0044 DCARRY          equ     0x001   ; Digit Carry Bit 
  55.   0001               0045 DC              equ     0x001   ; Digit Carry Bit 
  56.   0002               0046 Z_BIT           equ     0x002   ; Zero Bit 
  57.   0002               0047 Z               equ     0x002   ; Zero Bit 
  58.   0003               0048 P_DOWN          equ     0x003   ; Power Down Bit 
  59.   0003               0049 PD              equ     0x003   ; Power Down Bit 
  60. MPASM 01.02 Released  TELECRD2.ASM   9-16-1994  10:19:25                 PAGE  2
  61. ISO 7816 Synchronous Memory Card Emulator
  62.  
  63. LOC  OBJECT CODE     LINE SOURCE TEXT
  64.   VALUE
  65.  
  66.   0004               0050 T_OUT           equ     0x004   ; Watchdog Time-Out Bit 
  67.   0004               0051 TO              equ     0x004   ; Watchdog Time-Out Bit 
  68.   0005               0052 RP0             equ     0x005   ; Register Page Select 0 
  69.   0006               0053 RP1             equ     0x006   ; Register Page Select 1 
  70.   0007               0054 IRP             equ     0x007   ; Indirect Addressing Reg. Page Sel. 
  71.                      0055  
  72.                      0056 ; INTCON Register (f0b) Bits 
  73.                      0057  
  74.   0000               0058 RBIF            equ     0x000   ; RB Port change interrupt flag 
  75.   0001               0059 INTF            equ     0x001   ; INT Interrupt Flag 
  76.   0002               0060 RTIF            equ     0x002   ; RTCC Overflow Interupt Flag 
  77.   0003               0061 RBIE            equ     0x003   ; RB Port Ch. Interupt Enable 
  78.   0004               0062 INTE            equ     0x004   ; INT Interupt Enable 
  79.   0005               0063 RTIE            equ     0x005   ; RTCC Overflow Int. Enable 
  80.   0006               0064 ADIE            equ     0x006   ; PIC16C71 A/D Int. Enable 
  81.   0006               0065 EEIE            equ     0x006   ; PIC16C84 EEPROM Write Int. Enable 
  82.   0007               0066 GIE             equ     0x007   ; Global Interupt Enable 
  83.                      0067  
  84.                      0068 ; OPTION Register (f81) Bits 
  85.                      0069  
  86.   0000               0070 PS0             equ     0x000   ; Prescaler Bit 0 
  87.   0001               0071 PS1             equ     0x001   ; Prescaler Bit 1 
  88.   0002               0072 PS2             equ     0x002   ; Prescaler Bit 2 
  89.   0003               0073 PSA             equ     0x003   ; Prescaler Assignment Bit 
  90.   0004               0074 RTE             equ     0x004   ; RTCC Signal Edge Select 
  91.   0005               0075 RTS             equ     0x005   ; RTCC Signal Source Select 
  92.   0006               0076 INTEDG          equ     0x006   ; Interupt Edge Select 
  93.   0007               0077 RBPU            equ     0x007   ; Port B Pull-up Enable 
  94.                      0078  
  95.                      0079 ; ADCON0 Register (f08) Bits 
  96.                      0080  
  97.   0000               0081 ADON            equ     0x000   ; A/D Converter Power Switch 
  98.   0001               0082 ADIF            equ     0x001   ; A/D Conversion Interupt Flag 
  99.   0002               0083 ADGO            equ     0x002   ; A/D Conversion Start Flag 
  100.   0003               0084 CHS0            equ     0x003   ; A/D Converter Channel Select 0 
  101.   0004               0085 CHS1            equ     0x004   ; A/D Converter Channel Select 1 
  102.   0006               0086 ADCS0           equ     0x006   ; A/D Conversion Clock Select 0 
  103.   0007               0087 ADCS1           equ     0x007   ; A/D Conversion Clock Select 0 
  104.                      0088  
  105.                      0089 ; ADCON1 Register (f88) Bits 
  106.                      0090  
  107.   0000               0091 PCFG0           equ     0x000   ; RA0-RA3 Configuration Bit 0 
  108.   0001               0092 PCFG1           equ     0x001   ; RA0-RA3 Configuration Bit 0 
  109.                      0093  
  110.                      0094 ; EECON1 Register (f88) Bits 
  111.                      0095  
  112.   0000               0096 RD              equ     0x000   ; PIC16C84 EEPROM Read Data Flag 
  113.   0001               0097 WR              equ     0x001   ; PIC16C84 EEPROM Write Data Flag 
  114.   0002               0098 WREN            equ     0x002   ; PIC16C84 EEPROM Write Enable Flag 
  115.   0003               0099 WRERR           equ     0x003   ; PIC16C84 EEPROM Write Error Flag 
  116.   0004               0100 EEIF            equ     0x004   ; PIC16C84 EEPROM Interupt Flag 
  117.                      0101  
  118.                      0102 ; Some useful macros... 
  119. MPASM 01.02 Released  TELECRD2.ASM   9-16-1994  10:19:25                 PAGE  3
  120. ISO 7816 Synchronous Memory Card Emulator
  121.  
  122. LOC  OBJECT CODE     LINE SOURCE TEXT
  123.   VALUE
  124.  
  125.                      0103  
  126.                      0104 PUSH    macro 
  127.                      0105     movwf   TEMP_W 
  128.                      0106     swapf   STATUS,W 
  129.                      0107     movwf   TEMP_S 
  130.                      0108     endm 
  131.                      0109  
  132.                      0110 POP     macro 
  133.                      0111     swapf   TEMP_S,W 
  134.                      0112     movwf   STATUS 
  135.                      0113     swapf   TEMP_W 
  136.                      0114     swapf   TEMP_W,W 
  137.                      0115     endm 
  138.                      0116  
  139.                      0117         END 
  140.                      0004  
  141.                      0005  
  142.                      0006 ; PIC16C84 I/O Pin Assignment List 
  143.                      0007  
  144.   0000               0008 CRD_CLK         equ     0       ; RB0 + RA4 = Card Clock 
  145.   0000               0009 CRD_DTA         equ     0       ; RA0 = Card Data Output 
  146.   0001               0010 CRD_RST         equ     1       ; RB1 = Card Reset, Low-Active 
  147.   0007               0011 CRD_WE          equ     7       ; RB7 = Card Write-Enable, Hi-Active 
  148.                      0012  
  149.                      0013 ; PIC16C84 RAM Register Assignments 
  150.                      0014  
  151.   000C               0015 CRD_ID          equ     0x00c   ; Smartcard ID, 12 bytes 
  152.   0018               0016 FUSCNT          equ     0x018   ; Fused units counter 
  153.   0019               0017 BITCNT          equ     0x019   ; Bitcounter 
  154.   001A               0018 LOOPCNT         equ     0x01a   ; Loop Counter 
  155.   001B               0019 EE_FLAG         equ     0x01b   ; EEPROM Write Flag 
  156.   001C               0020 TEMP1           equ     0x01c   ; Temporary Storage #1 
  157.   001D               0021 TEMP2           equ     0x01d   ; Temporary Storage #2 
  158.   001E               0022 TEMP3           equ     0x01e   ; Temporary Storage #3 
  159.   001F               0023 TEMP4           equ     0x01f   ; Temporary Storage #4 
  160.   002E               0024 TEMP_W          equ     0x02e   ; Temporary W Save Address 
  161.   002F               0025 TEMP_S          equ     0x02f   ; Temporary STATUS Save Address 
  162.                      0026  
  163.                      0027         org     0x2000          ; Chip ID Data 
  164. Warning: Address exceeds maximum range for this processor
  165. Warning: Address exceeds maximum range for this processor
  166. Warning: Address exceeds maximum range for this processor
  167. 2000 0042 0042 0042  0028         dw      042,042,042,042 
  168. Warning: Address exceeds maximum range for this processor
  169. 2003 0042            0028  
  170.                      0029  
  171.                      0030         org     0x2007          ; Configuration Fuses 
  172. Warning: Address exceeds maximum range for this processor
  173. 2007 0001            0031         dw      B'00000001' 
  174.                      0032  
  175.                      0033         org     0x2100          ; Internal Data EEPROM Memory (Card ID Data!) 
  176. Warning: Address exceeds maximum range for this processor
  177. Warning: Address exceeds maximum range for this processor
  178. MPASM 01.02 Released  TELECRD2.ASM   9-16-1994  10:19:25                 PAGE  4
  179. ISO 7816 Synchronous Memory Card Emulator
  180.  
  181. LOC  OBJECT CODE     LINE SOURCE TEXT
  182.   VALUE
  183.  
  184. Warning: Address exceeds maximum range for this processor
  185. 2100 8142 0011 2233  0034         db      0x081,0x042,0x000,0x011,0x022,0x033 
  186.                      0034  
  187. Warning: Address exceeds maximum range for this processor
  188. Warning: Address exceeds maximum range for this processor
  189. Warning: Address exceeds maximum range for this processor
  190. 2103 4455 6677 1184  0035         db      0x044,0x055,0x066,0x077,0x011,0x084 
  191.                      0035  
  192. Warning: Address exceeds maximum range for this processor
  193. 2106 0200            0036         db      0x002           ; Fresh Card Fused Units Count 
  194.                      0037  
  195.                      0038         org     PIC84           ; Reset-vector 
  196. 0000 2810            0039         goto    INIT            ; Jump to initialization routine 
  197.                      0040  
  198.                      0041         org     INTVEC          ; Interupt-vector 
  199.                      0042     push                    ; Save registers 
  200. 0004 00AE               M         movwf   TEMP_W 
  201. 0005 0E03               M         swapf   STATUS,W 
  202. 0006 00AF               M         movwf   TEMP_S 
  203. 0007 2048            0043         call    INTMAIN         ; Call main interupt routine 
  204.                      0044     pop                     ; Restore registers 
  205. 0008 0E2F               M         swapf   TEMP_S,W 
  206. 0009 0083               M         movwf   STATUS 
  207. 000A 0EAE               M         swapf   TEMP_W 
  208. 000B 0E2E               M         swapf   TEMP_W,W 
  209. 000C 0009            0045         retfie                  ; return from interupt & clear flag 
  210.                      0046  
  211.                      0047         org     0x010           ; Start address for init rout. 
  212. 0010 1683            0048 INIT    bsf     STATUS,RP0      ; Access register bank 1 
  213. 0011 0064            0049         clrwdt                  ; Clear watchdog timer 
  214. 0012 30E8            0050         movlw   B'11101000'     ; OPTION reg. settings 
  215. 0013 0081            0051         movwf   OPTION          ; Store in OPTION register 
  216. 0014 30FE            0052         movlw   B'11111110'     ; Set PORT A Tristate Latches 
  217. 0015 0085            0053         movwf   TRISA           ; Store in PORT A tristate register 
  218. 0016 30FF            0054         movlw   B'11111111'     ; Set PORT B Tristate Latches 
  219. 0017 0086            0055         movwf   TRISB           ; Store in PORT B tristate register 
  220. 0018 1283            0056         bcf     STATUS,RP0      ; Access register bank 0 
  221. 0019 0181            0057         clrf    RTCC            ; Clear RTCC 
  222. 001A 0185            0058         clrf    PORTA           ; Clear PORTA 
  223. 001B 0186            0059         clrf    PORTB           ; Clear PORTB 
  224. 001C 300D            0060         movlw   0d              ; 13 bytes to copy 
  225. 001D 009A            0061         movwf   LOOPCNT         ; Store in LOOPCNT 
  226. 001E 300C            0062         movlw   0c              ; Start storing at $0c in RAM 
  227. 001F 0084            0063         movwf   FSR             ; Store in FSR 
  228. 0020 0189            0064         clrf    EEADR           ; Start at EEPROM Address 0 
  229. 0021                 0065 EECOPY   
  230. 0021 1683            0066         bsf     STATUS,RP0      ; Access register bank 1 
  231. 0022 1408            0067         bsf     EECON1,RD       ; Set EECON1 Read Data Flag 
  232. 0023 1283            0068         bcf     STATUS,RP0      ; Access register bank 0 
  233. 0024 0808            0069         movfw   EEDATA          ; Read one byte of EEPROM Data 
  234. 0025 0080            0070         movwf   INDIR           ; Store in RAM pointed at by FSR 
  235. MPASM 01.02 Released  TELECRD2.ASM   9-16-1994  10:19:25                 PAGE  5
  236. ISO 7816 Synchronous Memory Card Emulator
  237.  
  238. LOC  OBJECT CODE     LINE SOURCE TEXT
  239.   VALUE
  240.  
  241. 0026 0A84            0071         incf    FSR             ; Increase FSR pointer 
  242. 0027 0A89            0072         incf    EEADR           ; Increase EEPROM Address Pointer 
  243. 0028 0B9A            0073         decfsz  LOOPCNT,1       ; Decrease LOOPCNT until it's 0 
  244. 0029 2821            0074         goto    EECOPY          ; Go and get some more bytes! 
  245. 002A 1683            0075         bsf     STATUS,RP0      ; Access register bank 1 
  246. 002B 1208            0076         bcf     EECON1,EEIF     ; Clear EEPROM Write Int. Flag 
  247. 002C 1108            0077         bcf     EECON1,WREN     ; EEPROM Write Disable 
  248. 002D 1283            0078         bcf     STATUS,RP0      ; Access register bank 0 
  249. 002E 3090            0079         movlw   B'10010000'     ; Enable INT Interupt 
  250. 002F 008B            0080         movwf   INTCON          ; Store in INTCON 
  251.                      0081  
  252. 0030 1683            0082 MAIN    bsf     STATUS,RP0      ; Access register bank 1 
  253. 0031 1888            0083         btfsc   EECON1,WR       ; Check if EEPROM Write Flag Set 
  254. 0032 2830            0084         goto    MAIN            ; Skip if EEPROM Write is Completed 
  255. 0033 1208            0085         bcf     EECON1,EEIF     ; Reset Write Completion Flag 
  256. 0034 1108            0086         bcf     EECON1,WREN     ; EEPROM Write Disable 
  257. 0035 1283            0087         bcf     STATUS,RP0      ; Access register bank 0 
  258. 0036 1C1B            0088         btfss   EE_FLAG,LSB     ; Check for EEPROM Write Flag 
  259. 0037 2830            0089         goto    MAIN            ; If not set, jump back and wait some more 
  260. 0038 019B            0090         clrf    EE_FLAG         ; Clear EEPROM Write Flag 
  261. 0039 300C            0091         movlw   0c              ; Units is stored in byte $0c 
  262. 003A 0089            0092         movwf   EEADR           ; Store in EEPROM Address Counter 
  263. 003B 0818            0093         movfw   FUSCNT          ; Get fused units counter 
  264. 003C 0088            0094         movwf   EEDATA          ; Store in EEDATA 
  265. 003D 1683            0095         bsf     STATUS,RP0      ; Access register bank 1 
  266. 003E 1508            0096         bsf     EECON1,WREN     ; EEPROM Write Enable 
  267. 003F 138B            0097         bcf     INTCON,GIE      ; Disable all interupts 
  268. 0040 3055            0098         movlw   055             ; Magic Number #1 for EEPROM Write 
  269. 0041 0089            0099         movwf   EECON2          ; Store in EECON2 
  270. 0042 30AA            0100         movlw   0aa             ; Magic Number #2 for EEPROM Write 
  271. 0043 0089            0101         movwf   EECON2          ; Store in EECON2 
  272. 0044 1488            0102         bsf     EECON1,WR       ; Execute EEPROM Write 
  273. 0045 178B            0103         bsf     INTCON,GIE      ; Enable all interupts again! 
  274. 0046 1283            0104         bcf     STATUS,RP0      ; Access register bank 0 
  275. 0047 2830            0105         goto    MAIN            ; Program main loop! 
  276.                      0106  
  277. 0048 188B            0107 INTMAIN btfsc   INTCON,INTF     ; Check for INT Interupt 
  278. 0049 284D            0108         goto    INTMAIN2        ; If set, jump to INTMAIN2 
  279. 004A 3010            0109         movlw   B'00010000'     ; Enable INT Interupt 
  280. 004B 008B            0110         movwf   INTCON          ; Store in INTCON 
  281. 004C 0008            0111         return 
  282.                      0112  
  283. 004D                 0113 INTMAIN2 
  284. 004D 1283            0114         bcf     STATUS,RP0      ; Access register bank 0 
  285. 004E 1405            0115         bsf     PORTA,CRD_DTA   ; Set Data Output High 
  286. 004F 1886            0116         btfsc   PORTB,CRD_RST   ; Check if reset is low 
  287. 0050 285D            0117         goto    NO_RST          ; If not, skip reset sequence 
  288. 0051 0801            0118         movfw   RTCC            ; Get RTCC Value 
  289. 0052 009F            0119         movwf   TEMP4           ; Store in TEMP4 
  290. 0053 0181            0120         clrf    RTCC            ; Clear RTCC 
  291. 0054 3055            0121         movlw   055             ; Subtract $55 from TEMP4 
  292. 0055 021F            0122         subwf   TEMP4,0         ; to check for card reset.... 
  293. 0056 1D03 285B       0123         bnz     NO_RST2         ; If not zero, jump to NO_RST 
  294. MPASM 01.02 Released  TELECRD2.ASM   9-16-1994  10:19:25                 PAGE  6
  295. ISO 7816 Synchronous Memory Card Emulator
  296.  
  297. LOC  OBJECT CODE     LINE SOURCE TEXT
  298.   VALUE
  299.  
  300. 0058 3002            0124         movlw   02              ; Unused one has $02 in FUSCNT 
  301. 0059 0098            0125         movwf   FUSCNT          ; Store full value in FUSCNT 
  302. 005A 141B            0126         bsf     EE_FLAG,LSB     ; Set EEPROM Write Flag 
  303. 005B 108B            0127 NO_RST2 bcf     INTCON,INTF     ; Clear INT Interupt Flag 
  304. 005C 0008            0128         return                  ; Mission Accomplished, return to sender 
  305.                      0129  
  306. 005D 0801            0130 NO_RST  movfw   RTCC            ; Get RTCC Value 
  307. 005E 0099            0131         movwf   BITCNT          ; Copy it to BITCNT 
  308. 005F 009C            0132         movwf   TEMP1           ; Copy it to TEMP1 
  309. 0060 009D            0133         movwf   TEMP2           ; Copy it to TEMP2 
  310. 0061 3060            0134         movlw   060             ; Load W with $60 
  311. 0062 021C            0135         subwf   TEMP1,0         ; Subtract $60 from TEMP1 
  312. 0063 1903 287C       0136         bz      CREDIT          ; If it is equal to $60 
  313. 0065 1803 287C       0137         bc      CREDIT          ; or greater, then skip to units area 
  314. 0067 0C9D            0138         rrf     TEMP2           ; Rotate TEMP2 one step right 
  315. 0068 0C9D            0139         rrf     TEMP2           ; Rotate TEMP2 one step right 
  316. 0069 0C9D            0140         rrf     TEMP2           ; Rotate TEMP2 one step right 
  317. 006A 300F            0141         movlw   0f              ; Load W with $f 
  318. 006B 059D            0142         andwf   TEMP2,1         ; And TEMP2 with W register 
  319. 006C 081D            0143         movfw   TEMP2           ; Load W with TEMP2 
  320. 006D 3E0C            0144         addlw   0c              ; Add W with $0c 
  321. 006E 0084            0145         movwf   FSR             ; Store data address in FSR 
  322. 006F 0800            0146         movfw   INDIR           ; Get databyte pointed at by FSR 
  323. 0070 009E            0147         movwf   TEMP3           ; Store it in TEMP3 
  324. 0071 3007            0148         movlw   07              ; Load W with $07 
  325. 0072 059C            0149         andwf   TEMP1,1         ; And TEMP1 with $07 
  326. 0073 1903 2878       0150         bz      NO_ROT          ; If result is zero, skip shift loop 
  327. 0075 0D9E            0151 ROTLOOP rlf     TEMP3           ; Shift TEMP3 one step left 
  328. 0076 0B9C            0152         decfsz  TEMP1,1         ; Decrement TEMP1 until zero 
  329. 0077 2875            0153         goto    ROTLOOP         ; If not zero, repeat until it is! 
  330. 0078 1F9E            0154 NO_ROT  btfss   TEMP3,MSB       ; Check if MSB of TEMP3 is set 
  331. 0079 1005            0155         bcf     PORTA,CRD_DTA   ; Clear Data Output 
  332. 007A 108B            0156         bcf     INTCON,INTF     ; Clear INT Interupt Flag 
  333. 007B 0008            0157         return                  ; Mission Accomplished, return to sender 
  334.                      0158  
  335. 007C 1F86            0159 CREDIT  btfss   PORTB,CRD_WE    ; Check if Card Write Enable is High 
  336. 007D 2884            0160         goto    NO_WRT          ; Abort write operation if not... 
  337. 007E 1C86            0161         btfss   PORTB,CRD_RST   ; Check if Card Reset is High 
  338. 007F 2884            0162         goto    NO_WRT          ; Abort write operation if not... 
  339. 0080 0A98            0163         incf    FUSCNT          ; Increase used-up units counter 
  340. 0081 141B            0164         bsf     EE_FLAG,LSB     ; Set EEPROM Write-Flag 
  341. 0082 108B            0165         bcf     INTCON,INTF     ; Clear INT Interupt Flag 
  342. 0083 0008            0166         return                  ; Mission Accomplished, return to sender 
  343.                      0167  
  344. 0084 3060            0168 NO_WRT  movlw   060             ; Load W with $60 
  345. 0085 0299            0169         subwf   BITCNT,1        ; Subtract $60 from BITCNT 
  346. 0086 0818            0170         movfw   FUSCNT          ; Load W with FUSCNT 
  347. 0087 0299            0171         subwf   BITCNT,1        ; Subtract FUSCNT from BITCNT 
  348. 0088 1C03 288B       0172         bnc     FUSED           ; If result is negative, unit is fused 
  349. 008A 1005            0173         bcf     PORTA,CRD_DTA   ; Clear Data Output 
  350. 008B 108B            0174 FUSED   bcf     INTCON,INTF     ; Clear INT Interupt Flag 
  351. 008C 0008            0175         return                  ; Mission Accomplished, return to sender 
  352.                      0176      
  353. MPASM 01.02 Released  TELECRD2.ASM   9-16-1994  10:19:25                 PAGE  7
  354. ISO 7816 Synchronous Memory Card Emulator
  355.  
  356. LOC  OBJECT CODE     LINE SOURCE TEXT
  357.   VALUE
  358.  
  359.                      0177         END 
  360.                      0178  
  361. MPASM 01.02 Released  TELECRD2.ASM   9-16-1994  10:19:25                 PAGE  8
  362. ISO 7816 Synchronous Memory Card Emulator
  363.  
  364. SYMBOL TABLE
  365.  
  366. LABEL                            VALUE
  367.  
  368. ADCON0                            0008 
  369. ADCON1                            0008 
  370. ADCS0                             0006 
  371. ADCS1                             0007 
  372. ADGO                              0002 
  373. ADIE                              0006 
  374. ADIF                              0001 
  375. ADON                              0000 
  376. ADRES                             0009 
  377. BITCNT                            0019 
  378. C                                 0000 
  379. CARRY                             0000 
  380. CHS0                              0003 
  381. CHS1                              0004 
  382. CRD_CLK                           0000 
  383. CRD_DTA                           0000 
  384. CRD_ID                            000C 
  385. CRD_RST                           0001 
  386. CRD_WE                            0007 
  387. CREDIT                            007C 
  388. DC                                0001 
  389. DCARRY                            0001 
  390. EEADR                             0009 
  391. EECON1                            0008 
  392. EECON2                            0009 
  393. EECOPY                            0021 
  394. EEDATA                            0008 
  395. EEIE                              0006 
  396. EEIF                              0004 
  397. EE_FLAG                           001B 
  398. FALSE                             0000 
  399. FSR                               0004 
  400. FUSCNT                            0018 
  401. FUSED                             008B 
  402. GIE                               0007 
  403. INDIR                             0000 
  404. INIT                              0010 
  405. INTCON                            000B 
  406. INTE                              0004 
  407. INTEDG                            0006 
  408. INTF                              0001 
  409. INTMAIN                           0048 
  410. INTMAIN2                          004D 
  411. INTVEC                            0004 
  412. IRP                               0007 
  413. LOOPCNT                           001A 
  414. LSB                               0000 
  415. MAIN                              0030 
  416. MSB                               0007 
  417. NO                                0000 
  418. NO_ROT                            0078 
  419. NO_RST                            005D  MPASM 01.02 Released  TELECRD2.ASM   9-16-1994  10:19:25                 PAGE  9
  420. ISO 7816 Synchronous Memory Card Emulator
  421.  
  422. SYMBOL TABLE - Continued
  423.  
  424. LABEL                            VALUE
  425.  
  426. NO_RST2                           005B 
  427. NO_WRT                            0084 
  428. OPTION                            0001 
  429. PCFG0                             0000 
  430. PCFG1                             0001 
  431. PCL                               0002 
  432. PCLATH                            000A 
  433. PD                                0003 
  434. PIC54                             01FF 
  435. PIC55                             01FF 
  436. PIC56                             03FF 
  437. PIC57                             07FF 
  438. PIC71                             0000 
  439. PIC84                             0000 
  440. PORTA                             0005 
  441. PORTB                             0006 
  442. PORTC                             0007 
  443. PS0                               0000 
  444. PS1                               0001 
  445. PS2                               0002 
  446. PSA                               0003 
  447. P_DOWN                            0003 
  448. RBIE                              0003 
  449. RBIF                              0000 
  450. RBPU                              0007 
  451. RD                                0000 
  452. ROTLOOP                           0075 
  453. RP0                               0005 
  454. RP1                               0006 
  455. RTCC                              0001 
  456. RTE                               0004 
  457. RTIE                              0005 
  458. RTIF                              0002 
  459. RTS                               0005 
  460. STATUS                            0003 
  461. TEMP1                             001C 
  462. TEMP2                             001D 
  463. TEMP3                             001E 
  464. TEMP4                             001F 
  465. TEMP_S                            002F 
  466. TEMP_W                            002E 
  467. TO                                0004 
  468. TRISA                             0005 
  469. TRISB                             0006 
  470. TRISC                             0007 
  471. TRUE                              0001 
  472. T_OUT                             0004 
  473. WR                                0001 
  474. WREN                              0002 
  475. WRERR                             0003 
  476. YES                               0001 
  477. Z                                 0002  MPASM 01.02 Released  TELECRD2.ASM   9-16-1994  10:19:25                 PAGE 10
  478. ISO 7816 Synchronous Memory Card Emulator
  479.  
  480. SYMBOL TABLE - Continued
  481.  
  482. LABEL                            VALUE
  483.  
  484. Z_BIT                             0002 
  485.  
  486.  
  487. MEMORY USAGE MAP ('X' = Used,  '-' = Unused)
  488.  
  489. 0000 : X---XXXXXXXXX--- XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  490. 0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  491.  
  492. 0080 : XXXXXXXXXXXXX--- ---------------- ---------------- ----------------
  493. 00C0 : ---------------- ---------------- ---------------- ----------------
  494.  
  495. 2000 : XXXX---X-------- ---------------- ---------------- ----------------
  496. 2040 : ---------------- ---------------- ---------------- ----------------
  497.  
  498. 2100 : XXXXXXX--------- ---------------- ---------------- ----------------
  499. 2140 : ---------------- ---------------- ---------------- ----------------
  500.  
  501. All other memory blocks unused.
  502.  
  503.  
  504. Errors   :    0
  505. Warnings :   12
  506. Messages :    0
  507.  
  508.