📄 calllogger.lst
字号:
(0020) export _LoadConfig_calllogger
(0021)
(0022) export NO_SHADOW
(0023) export _NO_SHADOW
(0024)
(0025) FLAG_CFG_MASK: equ 10h ;M8C flag register REG address bit mask
(0026) END_CONFIG_TABLE: equ ffh ;end of config table indicator
(0027)
(0028) AREA psoc_config(rom, rel)
(0029)
(0030) _LoadConfigInit:
(0031) LoadConfigInit:
(0032)
(0033) call LoadConfig_calllogger
01B5: 01 7F ADD A,127
(0034)
(0035) ret
01B7: 08 PUSH A
(0036)
(0037) ;
(0038) ; Load Configuration calllogger
(0039) ;
(0040) _LoadConfig_calllogger:
(0041) LoadConfig_calllogger:
(0042) push a
(0043) push x
01B8: 10 PUSH X
(0044) M8C_SetBank1 ;set for bank 1
01B9: 71 10 OR F,16
(0045) mov A, >LoadConfigTBL_calllogger_Bank1 ;load bank 1 table
01BB: 50 01 MOV A,1
(0046) mov X, <LoadConfigTBL_calllogger_Bank1
01BD: 57 06 MOV X,6
(0047) call LoadConfig ;load the bank 1 values
01BF: 90 0B CALL 0x01CC
(0048) M8C_SetBank0 ;switch to bank 0
01C1: 70 EF AND F,239
(0049) mov A, >LoadConfigTBL_calllogger_Bank0 ;load bank 0 table
01C3: 50 01 MOV A,1
(0050) mov X, <LoadConfigTBL_calllogger_Bank0
01C5: 57 6D MOV X,109
(0051) call LoadConfig ;load the bank 0 values
01C7: 90 03 CALL 0x01CC
(0052) pop x
01C9: 20 POP X
(0053) pop a
01CA: 18 POP A
(0054) ret
01CB: 7F RET
(0055)
(0056)
(0057) ;
(0058) ; LoadConfig
(0059) ;
(0060) ; This function is not exported. It assumes that the address of the table
(0061) ; to be loaded is contained in the X and A registers as if a romx instruction
(0062) ; is the next instruction to be executed, i.e. lower address in X and uppper
(0063) ; address in A. There is no return value.
(0064) ;
(0065) LoadConfig:
(0066) add SP, 1
01CC: 38 01 ADD SP,1
(0067) LoadConfigLp:
(0068) M8C_ClearWDT ;clear the watchdog for long inits
01CE: 62 E3 00 MOV REG[227],0
(0069) push X ;save config table address on stack
01D1: 10 PUSH X
(0070) push A
01D2: 08 PUSH A
(0071) romx ;load config address
01D3: 28 ROMX
(0072) cmp A, END_CONFIG_TABLE ;check for end of table
01D4: 39 FF CMP A,255
(0073) jz EndLoadConfig ;if so, end of load
01D6: A0 1A JZ 0x01F1
(0074) mov X, SP ;save the address away
01D8: 4F MOV X,SP
(0075) mov [X-3], A
01D9: 54 FD MOV [X-3],A
(0076) pop A ;retrieve the table address
01DB: 18 POP A
(0077) pop X
01DC: 20 POP X
(0078) inc X ;advance to the data byte
01DD: 75 INC X
(0079) jnc NoOverFlow1 ;check for overflow
01DE: D0 02 JNC 0x01E1
(0080) inc A ;if so, increment MSB
01E0: 74 INC A
(0081) NoOverFlow1:
(0082) push X ;save the config table address again
01E1: 10 PUSH X
(0083) push A
01E2: 08 PUSH A
(0084) romx ;load the config data
01E3: 28 ROMX
(0085) mov X, SP ;retrieve the config address
01E4: 4F MOV X,SP
(0086) mov X, [X-3]
01E5: 59 FD MOV X,[X-3]
(0087) mov reg[X], A ;write the config data
01E7: 61 00 MOV REG[X+0],A
(0088) pop A ;retrieve the table address
01E9: 18 POP A
(0089) pop X
01EA: 20 POP X
(0090) inc X ;advance to the next address
01EB: 75 INC X
(0091) jnc NoOverFlow2 ;check for overflow
01EC: D0 02 JNC 0x01EF
(0092) inc A ;if so, increment MSB
01EE: 74 INC A
(0093) NoOverFlow2:
(0094) jmp LoadConfigLp ;loop back
01EF: 8F DE JMP 0x01CE
(0095) EndLoadConfig:
(0096) pop A ;clean up the stack
01F1: 18 POP A
(0097) pop X
01F2: 20 POP X
(0098) add SP, -1
01F3: 38 FF ADD SP,255
(0099) ret
01F5: 7F RET
FILE: .\main4.asm
(0001) ;-----------------------------------------------------------------------------
(0002) ; Assembly main line
(0003) ;-----------------------------------------------------------------------------
(0004)
(0005) include "m8c.inc"
(0006) include "pwm16_1.inc"
(0007) include "pwm16_2.inc"
(0008) include "E2PROM_1.inc"
(0009) include "TX8_1.inc"
(0010) include "RX8_1.inc"
(0011)
(0012)
(0013) area bss (RAM)
(0014)
(0015) export month
(0016) export day
(0017) export hour
(0018) export minute
(0019) export tel_status
(0020) export indexreg
(0021) export odd_even
(0022) export temp
(0023) export te_second
(0024) export te_minute
(0025) export ram_lsb
(0026) export address_lsb
(0027) export address_msb
(0028) export temp2
(0029) export counter1
(0030) export counter2
(0031) export dateandtime
(0032) export msb_dateandtime
(0033) export temp3
(0034) export delay
(0035)
(0036)
(0037)
(0038)
(0039) buffer: BLK 50h
(0040) temp: BLK 1
(0041) month: BLK 1
(0042) day: BLK 1
(0043) hour: BLK 1
(0044) minute: BLK 1
(0045) tel_status: BLK 1
(0046) tel_status2: BLK 1
(0047) indexreg: BLK 1
(0048) odd_even: BLK 1
(0049) te_minute: BLK 1
(0050) te_second: BLK 1
(0051) ram_lsb: BLK 1
(0052) address_lsb: BLK 1
(0053) address_msb: BLK 1
(0054) temp_msb: BLK 1
(0055) temp_lsb: BLK 1
(0056) temp2: BLK 1
(0057) counter1: BLK 1
(0058) counter2: BLK 1
(0059) //bRxData: blk 1 ; Rx data storage area
(0060) TRUE: equ 1
(0061) FALSE: equ 0
(0062) temp3: BLK 1
(0063) msb_dateandtime: BLK 1
(0064) dateandtime: BLK 8
(0065) tempbyte: BLK 8
(0066)
(0067)
(0068) area text (ROM, REL)
(0069) export _main
(0070)
(0071) _main:
(0072)
(0073) mov [tel_status],00h //Telephone is not in-use=00,(Telephone in use=FF)
_main:
__text_start:
01F6: 55 56 00 MOV [tel_status],0
(0074) mov [indexreg],00h //This will hold the index register value
01F9: 55 58 00 MOV [indexreg],0
(0075) mov [odd_even],00h //This is about writing to dialed number in one memory location
01FC: 55 59 00 MOV [odd_even],0
(0076) mov [ram_lsb],00h //Temporary call details are in range of 00h-64h memory location
01FF: 55 5C 00 MOV [ram_lsb],0
(0077) mov [address_msb],0Fh //First 64 byte block will be written to 0FC0+40h = 1000h address
0202: 55 5E 0F MOV [address_msb],15
(0078) mov [address_lsb],C0h
0205: 55 5D C0 MOV [address_lsb],192
(0079) mov reg[PRT2DR],00h //port2_4 will be 0V (Showing that there is enouh space in ROM)
0208: 62 08 00 MOV REG[8],0
(0080)
(0081)
(0082)
(0083) mov [month],1 //Reset DATE
020B: 55 52 01 MOV [month],1
(0084) mov [day],1
020E: 55 53 01 MOV [day],1
(0085) mov [hour],0
0211: 55 54 00 MOV [hour],0
(0086) mov [minute],0
0214: 55 55 00 MOV [minute],0
(0087)
(0088)
(0089) startmodules:
(0090) //Check if any key on the phone is pressed?
(0091) //If a button is pressed , then Port1_0 will detect this thru the DTMF
(0092) //receiver chip(from StD Pin of MT8870D)
(0093)
(0094) M8C_EnableGInt
0217: 71 01 OR F,1
(0095) or reg[INT_MSK0], 20h ;This will be enable the GPIO
0219: 43 E0 20 OR REG[224],32
(0096)
(0097) call PWM8_1_EnableInt
021C: 92 55 CALL PWM8_1_EnableInt
(0098) call PWM8_1_Start
021E: 92 65 CALL PWM8_1_Start
(0099) call PWM16_1_Start
0220: 93 74 CALL PWM16_1_Start
(0100) call PWM16_2_Start
0222: 92 D4 CALL _PWM16_2_Start
(0101) call TX8_1_Start
0224: 91 E2 CALL TX8_1_Start
(0102) call RX8_1_Start
0226: 92 03 CALL _RX8_1_Start
(0103)
(0104) call clearRAM
0228: 91 79 CALL clearRAM
(0105)
(0106)
(0107)
(0108) receivedata:
(0109) call RX8_1_Start
022A: 91 FF CALL _RX8_1_Start
(0110) call delay //Prevents serial communication error.
022C: 91 8C CALL delay
(0111) mov A,<dateandtime
022E: 50 66 MOV A,102
(0112) mov X,A
0230: 5C MOV X,A
(0113) mov [temp3],A
0231: 53 64 MOV [temp3],A
(0114) mov [msb_dateandtime],[temp3]
0233: 5F 65 64 MOV [msb_dateandtime],[temp3]
(0115) add [msb_dateandtime],9
0236: 06 65 09 ADD [msb_dateandtime],9
(0116)
(0117)
(0118) .WAIT_FOR_RX_ACTIVE:
(0119) call bRX8_1_ReadRxStatus
0239: 91 FC CALL _bRX8_1_ReadRxStatus
(0120) and A, RX8_RX_ACTIVE
023B: 21 10 AND A,16
(0121) jnz .WAIT_FOR_RX_COMPLETE
023D: B0 03 JNZ 0x0241
(0122) jz .WAIT_FOR_RX_ACTIVE ; data byte has not been received
023F: AF F9 JZ 0x0239
(0123)
(0124) ; Receiver is actively receiving data, wait for it to complete
(0125) .WAIT_FOR_RX_COMPLETE:
(0126) call bRX8_1_ReadRxStatus
0241: 91 F4 CALL _bRX8_1_ReadRxStatus
(0127) push A
0243: 08 PUSH A
(0128) AND A, RX8_RX_COMPLETE
0244: 21 08 AND A,8
(0129) jnz .CHECK_RX_ERRORS
0246: B0 04 JNZ 0x024B
(0130) pop A
0248: 18 POP A
(0131) jmp .WAIT_FOR_RX_COMPLETE
0249: 8F F7 JMP 0x0241
(0132) ; Data completely received now check for errors
(0133) .CHECK_RX_ERRORS:
(0134) pop A
024B: 18 POP A
(0135) call bRX8_1_ReadRxStatus ; get the Rx status register
024C: 91 E9 CALL _bRX8_1_ReadRxStatus
(0136) and A, RX8_RX_NO_ERROR ; mask off non-status bits
024E: 21 E0 AND A,224
(0137) jz .DATA_RX_WITH_NO_ERRORS ; data is valid - no error detected
0250: A0 05 JZ 0x0256
(0138)
(0139) ; Errors detected in received data - return with error condition
(0140)
(0141) ; 1) A is set to FALSE indicating error condition
(0142)
(0143) ; 2) bRxData contains the RX status flags for further processing
(0144)
(0145) .RX_ERRORS_FOUND:
(0146) // mov [bRxData], A ; bRxData contains the status flags
(0147) call bRX8_1_ReadRxData ; Read RxData reg to prevent future overrun error
0252: 91 E0 CALL bRX8_1_ReadRxData
(0148) mov A, FALSE ; Set A to FALSE condition
0254: 50 00 MOV A,0
(0149) // jmp receivedata
(0150)
(0151) ; No error detected in received data - return with data
(0152)
(0153) ; 1) A is set to TRUE indicating NO error condition
(0154)
(0155) ; 2) bRxData contians the received data byte
(0156) .DATA_RX_WITH_NO_ERRORS:
(0157) call bRX8_1_ReadRxData ; get the received data in A
0256: 91 DC CALL bRX8_1_ReadRxData
(0158) mov X,[temp3]
0258: 58 64 MOV X,[temp3]
(0159) mov [X],A
025A: 54 00 MOV [X+0],A
(0160) inc [temp3]
025C: 76 64 INC [temp3]
(0161) mov A,[temp3]
025E: 51 64 MOV A,[temp3]
(0162) cmp A,[msb_dateandtime] ;6Ch
0260: 3A 65 CMP A,[msb_dateandtime]
(0163) jz end
0262: A0 05 JZ 0x0268
(0164) // mov [bRxData], A ; bRxData contains received data byte
(0165) mov A, TRUE ; set a to NO error condition
0264: 50 01 MOV A,1
(0166) jmp .WAIT_FOR_RX_ACTIVE
0266: 8F D2 JMP 0x0239
(0167) end:
(0168) call RX8_1_Stop
0268: 91 C6 CALL _RX8_1_Stop
(0169) call delay //Prevents serial communication error.
026A: 91 4E CALL delay
(0170) call delay //Prevents serial communication error.
026C: 91 4C CALL delay
(0171)
(0172)
(0173) mov X,[msb_dateandtime]
026E: 58 65 MOV X,[msb_dateandtime]
(0174) dec X
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -