1 ifndef reg96inc ; avoid multiple inclusion 2reg96inc equ 1 3;**************************************************************************** 4;* * 5;* AS 1.42 - File REG96.INC * 6;* * 7;* Contains Macro, SFR and Address Definitions for MCS-96 Processors * 8;* * 9;**************************************************************************** 10 11 save 12 listing off ; no listing over this file 13 14 if (MOMCPUNAME<>"8096")&&(MOMCPUNAME<>"80196")&&(MOMCPUNAME<>"80196N")&&(MOMCPUNAME<>"80296") 15 fatal "wrong target selected: only 8096, 80196, 80196N, or 80299 supported" 16 endif 17 18 19 if MOMPASS=1 20 message "MCS-96 SFR Definitions (C) 1994 Alfred Arnold" 21 message "binde \{MOMCPU}-SFRs ein" 22 endif 23 24;---------------------------------------------------------------------------- 25; CPU Registers 26 27R0 equ 0 ; Zero Register 28ZERO_REG equ R0 29ONES_REG equ 2 ; All Ones 30SP equ 18h ; Stack Pointer 31 if MOMCPU>=80196h 32WSR equ 14h ; RAM Window in Register Bank 33 if MOMCPU>=80296h 34WSR1 equ 15h ; RAM-Window in lower Half of Register Bank 35 endif 36 endif 37 38 if MOMCPU>=80296h ; Signal Processor Registers 39ACC_00 equ 000ch ; Accumulator 40ACC_02 equ 000eh 41ACC_04 equ 0006h 42ACC_STAT equ 000bh 43ICB0 equ 1fc3h ; Index Register 44ICB1 equ 1fc7h 45ICX0 equ 0010h 46ICX1 equ 0016h 47IDX0 equ 1fc0h 48IDX1 equ 1fc4h 49RPT_CNT equ 0004h ; Count Register 50 endif 51 52;---------------------------------------------------------------------------- 53; SFRs: 54 55;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 56; A/D Converter 57 58 switch MOMCPUNAME 59 60 case "80296" ; Suppress Warning 61 62 63 case "80196N" 64AD_RESULT equ 1faah ; Conversion Result (read as word) 65AD_COMMAND equ 1fach ; A/D Converter Control Register 66AD_TEST equ 1faeh ; Adjustment 67AD_TIME equ 1fafh ; Conversion Speed 68 69 70 case "80196" 71AD_Result equ 1faah ; Conversion Result (read as word) 72AD_Command equ 1fach ; A/D Converter Control Register 73AD_Test equ 1faeh ; Adjustment 74AD_Time equ 1fafh ; Conversion Speed 75 76 77 case "8096" 78AD_Command equ 2 ; A/D Converter Control Register 79AD_Result_Lo equ 2 ; A/D Converter Result 80AD_Result_Hi equ 3 ; ONLY read as bytes! 81 82 83 endcase 84 85;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 86; HSI/HSO/EPA 87 88 switch MOMCPUNAME 89 90 case "80296" 91EPA_MASK equ 1f9ch ; Interrupt Mask 92EPA_PEND equ 1f9eh ; Interrupts Pending 93__CNT set 0 94 rept 4 95EPA{"\{__CNT}"}_CON equ 1f60h+(__CNT*4) ; Capture/Compare Units Control 96EPA{"\{__CNT}"}_TIME equ 1f62h+(__CNT*4) ; " " Time 97__CNT set __CNT+1 98 endm 99 100 101 case "80196N" 102COMP0_CON equ 1f88h ; Comparator 0 Control 103COMP0_TIME equ 1f8ah ; Comparator 0 Time 104 105COMP1_CON equ 1f8ch ; ditto Comparator 1 106COMP1_CON equ 1f8eh 107 108EPA_MASK equ 1fa0h ; Interrupt Masks 109EPA_MASK1 equ 1fa4h 110EPA_PEND equ 1fa2h ; Interrupts Pending 111EPA_PEND1 equ 1fa6h 112__CNT set 0 113 rept 10 114EPA{"\{__CNT}"}_CON equ 1f60h+(__CNT*4) ; Capture/Compare Units Control 115EPA{"\{__CNT}"}_TIME equ 1f62h+(__CNT*4) ; " " Time 116__CNT set __CNT+1 117 endm 118EPAIPV equ 1fa8h ; Interrupt Priority 119 120 121 case "80196" 122EPA_Mask equ 1fa0h ; (w) EPA Interrupt Masks 4..9, 0..1, Overrun 0..9/0/1 123EPA_Mask1 equ 1fa4h 124EPA_Pend equ 1fa2h ; (w) EPA Interrupts Pending 4..9, 0..1, Overrun 0..9/0/1 125EPA_Pend1 equ 1fa6h 126EPAIpv equ 1fa8h ; EPA Interrupts Priority 127 128EPA_Control0 equ 1f60h ; Capture/Compare Control Channels 0..9 Control 129EPA_Time0 equ 1f62h ; (w) Channels 0..9 Saved Time 130EPA_Control1 equ 1f64h 131EPA_Time1 equ 1f66h 132EPA_Control2 equ 1f68h 133EPA_Time2 equ 1f6ah 134EPA_Control3 equ 1f6ch 135EPA_Time3 equ 1f6eh 136EPA_Control4 equ 1f70h 137EPA_Time4 equ 1f72h 138EPA_Control5 equ 1f74h 139EPA_Time5 equ 1f76h 140EPA_Control6 equ 1f78h 141EPA_Time6 equ 1f7ah 142EPA_Control7 equ 1f7ch 143EPA_Time7 equ 1f7eh 144EPA_Control8 equ 1f80h 145EPA_Time8 equ 1f82h 146EPA_Control9 equ 1f84h 147EPA_Time9 equ 1f86h 148Comp_Control0 equ 1f88h ; Compare Channels 0..1 Control 149Comp_Time0 equ 1f8ah ; Compare Channels 0..1 Time 150Comp_Control1 equ 1f8ch 151Comp_Time1 equ 1f8eh 152 153 154 case "8096" 155HSI_Time equ 4 ; HSI Trigger Time (word-only) 156HSI_Mode equ 3 ; HSI Mode Register 157HSI_Status equ 6 ; HSI Status Register 158 159HSO_Time equ 4 ; HSO Time Setting (word-only) 160HSO_Command equ 6 ; HSO Control Register 161 162 163 endcase 164 165;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 166; Serial 167 168 switch MOMCPUNAME 169 170 case "80296" 171SP_CON equ 1fbbh ; SIO Control 172SP_BAUD equ 1fbch ; (w) SIO Baud Rate 173SP_STATUS equ 1fb9h ; SIO Status 174SBUF_RX equ 1fb8h ; Receive Data 175SBUF_TX equ 1fbah ; Transmit Data 176 177 178 case "80196N" 179SP_CON equ 1fbbh ; SIO Control 180SP_BAUD equ 1fbch ; (w) SIO Baud Rate 181SP_STATUS equ 1fb9h ; SIO Status 182SBUF_RX equ 1fb8h ; Receive Data 183SBUF_TX equ 1fbah ; Transmit Data 184 185SSIO_BAUD equ 1fb4h ; SSIO Baud Rate 186SSIO0_BUF equ 1fb0h ; SSIO0 Data Register 187SSIO1_BUF equ 1fb2h ; SSIO1 Data Register 188SSIO0_CON equ 1fb1h ; SSIO0 Mode 189SSIO1_CON equ 1fb3h ; SSIO1 Mode 190 191 192 case "80196" 193SSIO_StB0 equ 1fb0h ; SSIO Channel 0 Data Buffer 194SSIO_StCr0 equ 1fb1h ; SSIO Channel 0 Transmitter/Receiver Control 195SSIO_StB1 equ 1fb2h ; SSIO Channel 1 Data Buffer 196SSIO_StCr1 equ 1fb3h ; SSIO Channel 1 Transmitter/Receiver Control 197SSIO_Baud equ 1fb4h ; SSIO Baud Rate 198SBuf_RX equ 1fb8h ; Receive Data 199SP_Stat equ 1fb9h ; SIO State 200SBuf_TX equ 1fbah ; Transmit Data 201SP_Con equ 1fbbh ; SIO Control 202SP_Baud equ 1fbch ; (w) SIO Baud Rate 203 204 205 case "8096" 206SBUF equ 7 ; UART Data Register 207SPStat equ 11h ; UART Status Register 208SPCon equ 11h ; UART Control Register 209Baud_Reg equ 0eh ; UART Data Rate 210 211 endcase 212 213;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214; Interrupt Control 215 216 switch MOMCPUNAME 217 218 case "80296" 219INT_MASK equ 08h ; Interrupt Masks 220INT_MASK1 equ 13h 221INT_PEND equ 09h ; Interrupts Pending 222INT_PEND1 equ 12h 223EXTINT_CON equ 1fcch ; External Interrupts Edge Selection 224IN_PROG0 equ 1fc8h ; Interrupt Handling in Progress 225IN_PROG1 equ 1fcah 226INT_CON0 equ 1fe8h ; Priority Setting 227INT_CON1 equ 1feah 228INT_CON2 equ 1fech 229INT_CON3 equ 1feeh 230NMI_PEND equ 1fc9h ; NMI Pending 231VECT_ADDR equ 1ff0h ; Vekcor Base 232 233 case "80196N" 234INT_MASK equ 08h ; Interrupt Masks 235INT_MASK1 equ 13h 236INT_PEND equ 09h ; Interrupts Pending 237INT_PEND1 equ 12h 238 239PTSSRV equ 06h ; (w) PTS Interrupt Served 240PTSSEL equ 04h ; (w) Enable PTS Sources 241 242 243 case "80196" 244Int_Mask_Lo equ 08h ; Interrupt Masks 245Int_Mask_Hi equ 13h 246Int_Pend_Lo equ 09h ; Interrupts Pending 247Int_Pend_Hi equ 12h 248 249PTS_Srv equ 06h ; (w) PTS Interrupt Served 250PTS_Select equ 04h ; (w) Enable PTS Sources 251 252 253 case "8096" 254INT_Mask equ 8 ; Interrupt Mask 255INT_Pending equ 9 ; Interrupts Pending 256 257 endcase 258 259;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 260; Timer 261 262Watchdog equ 0ah ; Reset Watchdog 263 264 switch MOMCPUNAME 265 266 267 case "80296" 268CON_REG0 equ 1fb6h ; PWM Control 269PWM0_CONTROL equ 1fb0h ; PWMn Duty Cycle 270PWM1_CONTROL equ 1fb2h 271PWM2_CONTROL equ 1fb4h 272 273T1CONTROL equ 1f90h ; Timer 1 Control 274TIMER1 equ 1f92h ; (w) Timer 1 Data 275T2CONTROL equ 1f94h ; Timer 2 Control 276TIMER22 equ 1f96h ; (w) Timer 2 Data 277 278 279 case "80196N" 280T1CONTROL equ 1f98h ; Timer 1 Control 281TIMER1 equ 1f9ah ; (w) Timer 1 Data 282T2CONTROL equ 1f9ch ; Timer 2 Control 283TIMER22 equ 1f9eh ; (w) Timer 2 Data 284 285 286 case "80196" 287Timer1_Control equ 1f98h ; Timer 1 Control 288Timer1 equ 1f9ah ; (w) Timer 1 Data 289Timer2_Control equ 1f9ch ; Timer 2 Control 290Timer2 equ 1f9eh ; (w) Timer 2 Data 291 292 293 case "8096" 294Timer1 equ 0ah ; Timer 1 (word-only) 295Timer2 equ 0ch ; Timer 2 (word-only) 296 297PWM_Control equ 17h ; PWM Duty Cycle Setting 298 299 300 endcase 301 302;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 303; Ports 304 305 switch MOMCPUNAME 306 307 308 case "80296" 309 310P1_DIR equ 1fd2h ; Port 1 Direction Register 311P1_MODE equ 1fd0h ; Port 1 Special Functions vs. IO Port Selection 312P1_PIN equ 1fd6h ; Port 1 Pin Status 313P1_REG equ 1fd4h ; Port 1 Output Data 314 315P2_DIR equ 1fd3h ; the same for remaining ports 316P2_MODE equ 1fd1h 317P2_PIN equ 1fd7h 318P2_REG equ 1fd5h 319 320P3_DIR equ 1fdah 321P3_MODE equ 1fd8h 322P3_PIN equ 1fdeh 323P3_REG equ 1fdch 324 325P4_DIR equ 1fdbh 326P4_MODE equ 1fd9h 327P4_PIN equ 1fdfh 328P4_REG equ 1fddh 329 330EP_DIR equ 1fe3h 331EP_MODE equ 1fe1h 332EP_PIN equ 1fe7h 333EP_REG equ 1fe5h 334 335 336 case "80196N" 337P0_PIN equ 1fdah ; Port 0 Data 338 339P1_DIR equ 1fd2h ; Port 1 Direction Register 340P1_MODE equ 1fd0h ; Port 1 Special Functions vs. IO Port Selection 341P1_PIN equ 1fd6h ; Port 1 Pin Status 342P1_REG equ 1fd4h ; Port 1 Output Data 343 344P2_DIR equ 1fcbh ; the same for remaining ports 345P2_MODE equ 1fc9h 346P2_PIN equ 1fcfh 347P2_REG equ 1fcdh 348 349P3_PIN equ 1ffeh 350P3_REG equ 1ffch 351 352P4_PIN equ 1fffh 353P4_REG equ 1ffdh 354 355P34_DRV equ 1ff4h ; Configure Ports 3/4 as Open Drain or Push-Pull 356 357P5_DIR equ 1ff3h 358P5_MODE equ 1ff1h 359P5_PIN equ 1ff7h 360P5_REG equ 1ff5h 361 362P6_DIR equ 1fd3h 363P6_MODE equ 1fd1h 364P6_PIN equ 1fd7h 365P6_REG equ 1fd5h 366 367EP_DIR equ 1fe3h 368EP_MODE equ 1fe1h 369EP_PIN equ 1fe7h 370EP_REG equ 1fe5h 371 372 373 case "80196" 374P0PIn equ 1fdah ; Port 0 Data 375 376P1SSel equ 1fd0h ; Port 1 Special Functions Selection 377P1IO equ 1fd2h ; Port 1 Direction Register 378P1Reg equ 1fd4h ; Port 1 Data Output 379P1PIn equ 1fd6h ; Port 1 Input State 380 381P2SSel equ 1fc9h ; the same for remaining ports 382P2IO equ 1fcbh 383P2Reg equ 1fcdh 384P2PIn equ 1fcfh 385 386P3Reg equ 1ffch 387P3PIn equ 1ffeh 388 389P4Reg equ 1ffdh 390P4PIn equ 1fffh 391 392P5SSel equ 1ff1h 393P5IO equ 1ff3h 394P5Reg equ 1ff5h 395P5PIn equ 1ff7h 396 397P6SSel equ 1fd1h 398P6IO equ 1fd3h 399P6Reg equ 1fd5h 400P6PIn equ 1fd7h 401 402 403 case "8096" 404Port0 equ 0eh ; Port 0 405Port1 equ 0fh ; Port 1 406Port2 equ 10h ; Port 2 407Port3 equ 1ffeh ; Port 3 (if no external memory) 408Port4 equ 1fffh ; Port 4 (if no external memory) 409 410IOS0 equ 15h ; I/O Status Register 0 411IOS1 equ 16h ; I/O Status Register 1 412IOC0 equ 15h ; I/O Control Register 0 413IOC1 equ 16h ; I/O Control Register 1 414 415 endcase 416 417;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 418; Slave Port 419 420 switch MOMCPUNAME 421 422 case "80296" ; Suppress Warning 423 424 425 case "80196N" 426SLP_CMD equ 1ffah ; Command Register 427SLP_CON equ 1ffbh 428SLP_STAT equ 1ff8h 429 430 431 case "80196" ; Suppress Warning 432 433 434 case "8096" 435SlpStat equ 1ff8h ; Slave Port Status 436SlpCmd equ 1ffah ; Slave Port Command Register 437SlpFunReg equ 1ffbh ; Slave-Port Control 438 439 endcase 440 441;---------------------------------------------------------------------------- 442; Interrupt Vectors 443 444 if MOMCPU>=80196h 445EPAIntX_Vec equ 2000h ; EPA Channel 4...9/0/1 Vector 446EPAInt3_Vec equ 2002h ; EPA Channel 3 Vector 447EPAInt2_Vec equ 2004h ; EPA Channel 2 Vector 448EPAInt1_Vec equ 2006h ; EPA Channel 1 Vector 449EPAInt0_Vec equ 2008h ; EPA Channel 0 Vector 450AD_Complete_Vec equ 200ah ; A/D Conversion Complete Vector 451OBE_Slp_Vec equ 200ch ; Output Buffer Empty Vector 452IBF_Slp_Vec equ 200eh ; Input Buffer Full Vector 453Trap_Vec equ 2010h ; Software Trap Vector 454Ill_Opcode_Vec equ 2012h ; Undefined Opcode Vector 455CMD_Full_Vec equ 2030h ; Command Buffer Full Vector 456SSIO0_Trans_Vec equ 2032h ; SSIO0 Transfer Completed Vector 457SSIO1_Trans_Vec equ 2034h ; SSIO1 Transfer Completed Vector 458SIO_TrInt_Vec equ 2036h ; SIO Character Transmitted Vector 459SIO_RcInt_Vec equ 2038h ; SIO Character Received Vector 460ExtInt_Vec equ 203ch ; External Interrupt Vector 461NMI_Vec equ 203eh ; Non Maskable Interrupt 462 elseif 463TOverInt_Vec equ 2000h ; Timer Overflow Vector 464ADInt_Vec equ 2002h ; AD Conversion Completed Vector 465HSIDataInt_Vec equ 2004h ; HSI Data Available Vector 466HSOInt_Vec equ 2006h ; HSO Vector 467HSI0Int_Vec equ 2008h ; HSI.0 Vector 468TimeInt_Vec equ 200ah ; Timer Vector 469SerialInt_Vec equ 200ch ; Serial Interrupt Vector 470ExtInt_Vec equ 200eh ; External Interrupt Vector 471SoftInt_Vec equ 2010h ; TRAP Interrupt Vector 472Self_Jump equ 201ah ; Infinite Loop 473 endif 474 475;---------------------------------------------------------------------------- 476; Meory Layout, Reserved Addresses 477 478 switch MOMCPUNAME 479 480 481 case "80296" 482IRAM equ 1ah ; Beginn Internal RAM 483IRAMEND equ 1ffh ; Ende Internal RAM 484CODERAM equ 0f800h ; Beginn Code-RAM 485CODERAMEND equ 0ffffh ; Ende Code-RAM 486EXTMEM1 equ 400h ; Beginn External Memory Area 1 487EXTMEM1END equ 1bffh ; Ende External Memory Area 1 488EXTMEM2 equ 02000h ; Beginn External Memory Area 2 489EXTMEM2END equ 0f7ffh ; Ende External Memory Area 2 490EXTMEM3 equ 0ff0400h ; Beginn External Memory Area 3 491EXTMEM3END equ 0fff7ffh ; Ende External Memory Area 3 492CCB0 equ 0ff2018h ; Chip Configuration 493CCB1 equ 0ff201ah ; Extended Chip Configuration 494Reset_Location equ 0ff2080h ; RESET Entry 495 496 497 case "80196N" 498IRAM equ 1ah ; Internal RAM Start 499IRAMEND equ 3ffh ; Internal RAM End 500IROM equ 0ff2000h ; Internal Program ROM Start 501IROMEND equ 0ff9fffh ; Internal Program ROM End 502EXTMEM1 equ 600h ; External Memory Area 1 Start 503EXTMEM1END equ 1effh ; External Memory Area 1 End 504EXTMEM2 equ 0a000h ; External Memory Area 2 Start 505EXTMEM2END equ 0ffffh ; External Memory Area 2 End 506EXTMEM3 equ 0ff0100h ; External Memory Area 3 Start 507EXTMEM3END equ 0ff03ffh ; External Memory Area 3 End 508EXTMEM4 equ 0ff0600h ; External Memory Area 4 Start 509EXTMEM4END equ 0ff1fffh ; External Memory Area 4 End 510EXTMEM5 equ 0ffa000h ; External Memory Area 5 Start 511EXTMEM5END equ 0ffffffh ; External Memory Area 5 End 512CCB0 equ 0ff2018h ; Chip Configuration 513CCB1 equ 0ff201ah ; Extended Chip Configuration 514CCB2 equ 0ff201ch 515Security_Key equ 0ff2020h ; Key 516Reset_Location equ 0ff2080h ; RESET Entry 517USFR equ 1ff6h ; ??? 518IRAM_CON equ 1fe0h ; Konfiguration Code-RAM 519 520 521 case "80196" 522IRAM equ 1ah ; Internal RAM Start 523IRAMEND equ 1ffh ; Internal RAM End 524PDRAM equ IRAM ; Power Down RAM Start 525PDRAMEND equ 1ffh ; Power Down RAM End 526CODERAM equ 400h ; Code RAM Start (NO Windowing!) 527CODERAMEND equ 4ffh ; Code RAM End 528IROM equ 2000h ; Internal Program ROM Start 529IROMEND equ 3fffh ; Internal Program ROM End 530EXTMEM1 equ 500h ; External Memory Area 1 Start 531EXTMEM1END equ 1effh ; External Memory Area 1 End 532EXTMEM2 equ 4000h ; External Memory Area 2 Start 533EXTMEM2END equ 0ffffh ; External Memory Area 2 End 534CCB equ 2018h ; Chip Configuration 535CCB1 equ 201ah ; Extended Chip Configuration 536Security_Key equ 2020h ; Key 537Reset_Location equ 2080h ; RESET Entry 538USFR equ 1ff6h ; ??? 539 540 541 case "8096" 542IRAM equ 1ah ; Internal RAM Start 543IRAMEND equ 0ffh ; Internal RAM End 544PDRAM equ 0f0h ; Power-Down-RAM Start 545PDRAMEND equ 0ffh ; Power-Down-RAM End 546IROM equ 2000h ; Internal Program ROM Start 547IROMEND equ 3fffh ; Internal Program ROM End 548EXTMEM1 equ 100h ; External Memory Area 1 Start 549EXTMEM1END equ 1effh ; External Memory Area 1 End 550EXTMEM2 equ 4000h ; External Memory Area 2 Start 551EXTMEM2END equ 0ffffh ; External Memory Area 2 End 552CCB equ 2018h ; Chip Configuration 553Security_Key equ 2020h ; Key 554Reset_Location equ 2080h ; RESET Entry 555 556 557 endcase 558 559Security_Key_End equ Security_Key+15 560 561;-------------------------------------------------------------------------- 562; Long Jumps 563 564__DefLongJmp macro new,old 565new macro Adr,{NoExpand} 566 old Skip 567 ljmp Adr 568Skip: 569 endm 570 endm 571 572 __DefLongJmp bc,jnc 573 __DefLongJmp be,jne 574 __DefLongJmp bge,jlt 575 __DefLongJmp bgt,jle 576 __DefLongJmp bh,jnh 577 __DefLongJmp ble,jgt 578 __DefLongJmp blt,jge 579 __DefLongJmp bnc,jc 580 __DefLongJmp bne,je 581 __DefLongJmp bnh,jh 582 __DefLongJmp bnst,jst 583 __DefLongJmp bnv,jv 584 __DefLongJmp bnvt,jvt 585 __DefLongJmp bst,jnst 586 __DefLongJmp bv,jnv 587 __DefLongJmp bvt,jnvt 588 589;-------------------------------------------------------------------------- 590 591 restore ; re-enable listing 592 593 endif ; reg96inc 594