;COMMENT /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;************************************************************************** ;** ** ;** I N T E L P R O P R I E T A R Y ** ;** ** ;** COPYRIGHT (c) 1996, 1997 BY INTEL CORPORATION. ALL RIGHTS ** ;** RESERVED. NO PART OF THIS PROGRAM OR PUBLICATION MAY ** ;** BE REPRODUCED, TRANSMITTED, TRANSCRIBED, STORED IN A ** ;** RETRIEVAL SYSTEM, OR TRANSLATED INTO ANY LANGUAGE OR COMPUTER ** ;** LANGUAGE IN ANY FORM OR BY ANY MEANS, ELECTRONIC, MECHANICAL, ** ;** MAGNETIC, OPTICAL, CHEMICAL, MANUAL, OR OTHERWISE, WITHOUT ** ;** THE PRIOR WRITTEN PERMISSION OF : ** ;** ** ;** INTEL CORPORATION ** ;** ** ;** 2200 MISSON COLLEGE BLVD ** ;** ** ;** SANTA CLARA, CALIFORNIA 95052-8119 ** ;** ** ;**$Author: kschultz $ ;**$Modtime: 09 Sep 1996 13:42:48 $ ;**$Revision: 1.0 $ ;************************************************************************** ;This software provides the code needed to execute the SV plan. Listed ; below are the ; Whichhas priority Timer 0,1 ; Move USB to Priroty 1 above timers.- Not needed. ; ; bRequest ; 40h Get Function Address ; 41h Get Hub Address ; 42h Get First SOF after reset ; 43h Get SOF in register when Suspend command happens ; 44h Get First SOF after resume ; ; ; 50h Cylon pattern on the LEDs to the right ; 51h Cylon pattern on the LEDs to the Left ; 60h Set Timer Count ; 61h Set RWU Trigger - Part will wait 'X Timer counts' after suspending ; and then drive RWU onto the bus. If zero, the part will just suspend. include "8X931HX.INC" INCLUDE "SWITCH.INC" GET_FUNCTION_ADDRESS equ 40h GET_HUB_ADDRESS equ 41h GET_FIRST_SOF_AFTER_RESET equ 42h GET_SOF_BEFORE_SUSPEND equ 43h GET_SOF_AFTER_RESEUME equ 44h DO_CYLON_RIGHT equ 50h DO_CYLON_LEFT equ 51h SET_RWU_TIMER equ 60h DO_DISCONNECT equ 62h SET_SFR_COMMAND equ 70h GET_SFR_COMMAND equ 71h GET_DOUG_KEY equ 72h ; LAST_KSO_PIN equ 19 public VendorGetDeviceCommandExec, VendorSetDeviceCommandExec public SV_ResetRoutine ,SV_SUSPEND_RESUME_ROUTINE, SV_SOF_ROUTINE public TIMER0_ISR, KSI_ISR, KeyboardResetRoutine, EP1_KYBD_ISR public FLASH_LEDS extern FbRequest:DATA, FwValue:DATA, FwIndex:DATA extern RWUTimer:DATA, fCurrentConfiguration:DATA extern init_serial, putc_ser, putret_ser, puts_ser, putc_hex_ser extern LeftCylon:CODE, RightCylon:CODE extern EMB_FN_RWU_FLG:DATA extern DEVICE_TYPE:DATA DEFINE SV_CODE_SEGMENT, SPACE=CODE SEGMENT SV_CODE_SEGMENT SV_ResetRoutine: ret KeyboardResetRoutine: mov KSOPointer, #0FFh mov KeysInBuffer, #0 mov KbdBufferPointer, #KeyboardBuffer1 ClrBuffers: mov KBCON, #30h ; Edge Triggered, Enable Pull Downs and Enable Interrupt. lcall SetAllKSOPins ; Enabled Function EP1 push EPINDEX mov EPINDEX, #01h mov EPCON, #13h ; SP Mode, TX Only mov TXCON, #14h ; Clear Buffer, ATM Mode pop EPINDEX orl FIE, #04h ; EP1 TX Interupts lcall INIT_TIMER0 orl IEN1, #80h ; Enabled External Int 2 (KBD) ret ;------------------------------------------------------------------------------------- ;--------------------- VendorGetDeviceCommandExec------------------------------------- ;------------------------------------------------------------------------------------- VendorGetDeviceCommandExec: mov A, FbRequest cjne A, #GET_SFR_COMMAND, CheckGetDougKey call GetSfrRoutine ret CheckGetDougKey: ; C0 72 ; wValue (LSB) ; wValue (MSB) KSO Pin to set ; wIndex (LSB) KSI Switch to activate ; wIndex (MSB) KSO Switch to activate ; wLenth = 1 cjne A, #GET_DOUG_KEY, CheckGetFunctionAddress call ScanDougsKeyboard ret CheckGetFunctionAddress: cjne A, #GET_FUNCTION_ADDRESS, CheckGetHubAddress ; is the command Get Function Address mov TXDAT, FADDR mov TXCNTL,#01h ret CheckGetHubAddress: cjne A, #GET_HUB_ADDRESS, CheckGetFirstSOF ; is the command Get Hub Address mov TXDAT, HADDR mov TXCNTL,#01h ret CheckGetFirstSOF: ; is the command Get First SOF after reset cjne A, #GET_FIRST_SOF_AFTER_RESET, CheckGetSuspendSOF mov A, FirstSOF + 1 mov TXDAT, A mov A, FirstSOF mov TXDAT, A mov TXCNTL,#02h ret CheckGetSuspendSOF: ; is the command Get First SOF after reset cjne A, #GET_SOF_BEFORE_SUSPEND, CheckGetResumeSOF mov A, SOFBeforeSuspend + 1 mov TXDAT, A mov A, SOFBeforeSuspend mov TXDAT, A mov TXCNTL,#02h ret CheckGetResumeSOF: ; is the command Get First SOF after reset cjne A, #GET_SOF_AFTER_RESEUME, BadGetVendorDeviceCommand mov A, SOFAfterResume + 1 mov TXDAT, A mov A, SOFAfterResume mov TXDAT, A mov TXCNTL,#02h ret ;------------------------------------------------------------------------------------- ;--------------------- VendorSetDeviceCommandExec------------------------------------- ;------------------------------------------------------------------------------------- VendorSetDeviceCommandExec: mov A, FbRequest cjne A, #SET_SFR_COMMAND, CheckSetRWUTimer call SetSfrRoutine sjmp ExitVendorSetDevice CheckSetRWUTimer: ; is the command Get Hub Address cjne A, #SET_RWU_TIMER, CheckCylonRight ; push WR0 ; mov WR0, FwValue ; mov RWUTimer, WR0 ; pop WR0 sjmp ExitVendorSetDevice CheckCylonRight: ; is the command Cylon pattern on LEDs to the right cjne A, #DO_CYLON_RIGHT, CheckCylonLeft ; push WR2 ; mov WR2, #10h ; call RightCylon ; pop WR2 sjmp ExitVendorSetDevice CheckCylonLeft: ; is the command Cylon pattern on LEDs to the left cjne A, #51h, BadGetVendorDeviceCommand ; push WR2 ; mov WR2, #10h ; call LeftCylon ; pop WR2 sjmp ExitVendorSetDevice BadGetVendorDeviceCommand: orl EPCON, #0C0h ret ExitVendorSetDevice: ; Command was a success. Setup status stage. ;mov TXCNTL, #00 ret ;--------------------------------------------------------------------------------- ;--------------------- FLASH_LEDS ------------------------------------------------ ;--------------------------------------------------------------------------------- FLASH_LEDS: push 00h ; push R0 push 01h ; push R1 mov R0, #0FFh mov R1, #0Ah mov R2, #0Ah ; flash 10 times ! TURN_OFF_LEDS: orl KBCON, #0Fh ; turn off HK keybd LEDS ;mov P1, #00h ; turn off Eval bd LEDS djnz R0, TURN_OFF_LEDS mov R0, #0FFh djnz R1, TURN_OFF_LEDS mov R0, #0FFh mov R1, #0Ah TURN_ON_LEDS: anl KBCON, #0F0h ; turn on HK keybd LEDS ;mov P1, #0FFh ; turn on Eval bd LEDS djnz R0, TURN_ON_LEDS mov R0, #0FFh djnz R1, TURN_ON_LEDS ; loop again mov R0, #0FFh mov R1, #0Ah djnz R2, TURN_OFF_LEDS pop 01h ; pop R1 pop 00h ; pop R0 ret ;------------------------------------------------------------------------------------- ;--------------------- SV_SOF_ROUTINE ------------------------------------------------ ;------------------------------------------------------------------------------------- SV_SOF_ROUTINE: ret ;------------------------------------------------------------------------------------- ;--------------------- SV_SUSPEND_ROUTINE -------------------------------------------- ;------------------------------------------------------------------------------------- SV_SUSPEND_RESUME_ROUTINE: push ACC mov KBCON, #21h mov A, SOFL mov SOFBeforeSuspend+1, A mov A, SOFH mov SOFBeforeSuspend , A SuspendLoop: mov A, fCurrentConfiguration ; if CurrentConfiguration == 2, then do keyboard suspend cjne A, #KEYBOARD_CONFIG, Normal_Suspend ljmp KeyboardSuspend ; If configured, shut down keyboard Normal_Suspend: mov a, PCON1 ;get status - is GSUS bit set anl a, #00000001b ;suspend? cjne a, #00000001b, check_global_resume ; no go_to_sleep: ; yes, put device to sleep ; turn off all LEDS anl KBCON, #11011111b ; turn off LED0:3 mov P1, #00h IF SIO_DEBUG==ENABLED mov DPTR, #GO2SLEEP_MSG lcall puts_ser ENDIF orl PCON, #00000010b ; Set PD bit for powerdown mode nop nop nop nop wakeup_from_suspend: check_global_resume: ; enabled LEDs again orl KBCON, #20h ; turn on LEDS again mov a, PCON1 ;was it a RESUME? anl a, #00000010b cjne a, #00000010b, check_USB_reset ; no ; got the resume anl PCON1, #11111101b ; yes, CLEAR the GRSM bit anl PCON1, #11111110b ; yes, CLEAR the GSUS bit ljmp end_S_R_routine ; and end check_USB_reset: mov a, PCON1 ;get status anl a, #00011000b ;CTI_RESET? cjne a, #00011000b, check_other_exit ; no anl PCON1, #00010111b ; yes, clr USB reset flag (URST bit) ljmp end_S_R_routine ;and end check_other_exit: ; REMOTE-WAKEUP Resume mov A, DEVICE_TYPE ; Based on the device type do different setup jnz SKIP_RWU_STUFF ; If I'm an HX then skip driving RWU orl PCON1, #GRWU_SET_MASK ; now set the remote wakeup bit in PCON1 ; now wait for hardware to clear this bit ; Should be driving "K" upstream at this point CHK_RWU_AGAIN: mov A, PCON1 jb ACC.2, CHK_RWU_AGAIN ; RWU bit has cleared orl KBCON, #20h ; turn on LEDS again ; got the resume ; GRSM bit won't be set when RWU is used anl PCON1, #11111110b ; yes, CLEAR the GSUS bit ljmp end_S_R_routine ; and end SKIP_RWU_STUFF: ljmp NotConfigured ;+------------------- ;+ KEYBOARD SUSPEND ;+------------------- KeyboardSuspend: ;+------------------------------------- ;| Shut down keyboard timers and setup ;| matrix to detect any keyswitch. ;+------------------------------------- ; Clear the timers so we finish the keyboard scanning. ; Exit those interrupts, as long as the keyboard ; ISRs have a high priority than USB ; suspend/resume ISRs we are ok. ; Setup up KSOs to all zeros ; Suspend clr TR0 ; Stop timers clr ET0 ; Disable Timer 0 mov KSOPointer, #0FFh ; Clear pointer to stop all key scans. ; Now clear the all of the KSO outputs ; so that if the user presses ANY key while ; we are asleep, we will wake up. ; The process for waking up is as follows. ; The user presses a key and causes a KSI pin to pull ; low. This may have ringing so we need to be careful ; here. ArmAllKSOs: mov P1, #00h mov P2, #00h anl P3, #0Fh ;Now delay 2 milliseconds to meet the 5 millisecond delay before any RWU can be applied Outer2msecLoop: mov A, #10h Inner2msecLoop: mov B, A mov A, #00h djnz ACC, $ mov A, B djnz ACC, Inner2msecLoop ; Now if GRSM is still not being applied here AND ; GSUS is still set and KSI pins are zero, let's take a ; nap. ;+-------------------- ;+ IS ANY KEY PRESSED? ;+-------------------- mov A, P0 ; Get the KSI inputs jz KbdSus ; if none are set then sleep ; If a key was hit during this three milliseconds ; then we need to delay 2-3 milsseconds and then apply ; RWU. You are not allowed to do a RWU until 5 milliseconds ; after the start of suspend. sjmp DoKeyboardRWU ;+------------------ ;| Suspend Keyboard ;+------------------ KbdSus: mov A, PCON1 ; Get the GSUS & GRSM bits jnb ACC.GSUS_BIT, ExitKbdSuspend ; If GSUS bit is not set, then get out. jb ACC.GRSM_BIT, ExitKbdSuspend ; If GRSM bit is set, then get out. ;(KLS) Clear All LEDs ; turn off all LEDS anl KBCON, #11011111b ; turn off LED0:3 mov P1, #00h orl PCON, #00000010b ; suspend device (set PD bit) nop nop ;waking up orl KBCON, #0F0h ; turn on LEDS ; If we woke up here, we must determine if an external ; interrupt woke us up or a KSI interrupt. CompleteResume: ; Is this a Global Resume? mov A, PCON1 jb ACC.GRSM_BIT, GlobalResume ; If the resume bit is set, then we had a global resume. KbdResume: ; Else the kbd must have woke us up. Do a RWU DoKeyboardRWU: mov A, PCON1 ; If the host did a resume at this time, no need to ; do a RWU as well. jnb ACC.GSUS_BIT, SetupKeyboard mov A, EMB_FN_RWU_FLG ; Check to see if RWU is enabled. jz SetupKeyboard ; If not, then exit. orl PCON1, #GRWU_SET_MASK ; Generate a RWU WaitTillRWUDone: Mov A, PCON1 ; get source jb ACC.GRWU_BIT, WaitTillRWUDone sjmp SetupKeyboard GlobalResume: ExitKbdSuspend: mov A, PCON1 jnb ACC.GRSM_BIT, SetupKeyboard anl PCON1, #GRSM_CLR_MASK ; CLear the GRSM Flag SetupKeyboard: mov A, fCurrentConfiguration cjne A, #KEYBOARD_CONFIG, NOT_KEYBOARD_CONFIGURATION jz NotConfigured ; If not configured, Don't setup keyboard. lcall SetAllKSOPins lcall INIT_TIMER0 NOT_KEYBOARD_CONFIGURATION: NOTCONFIGURED: end_S_R_routine: pop ACC ret ;------------------------------------------------------------------------------------- ;--------------------- SV_RESUME_ROUTINE --------------------------------------------- ;------------------------------------------------------------------------------------- SV_RESUME_ROUTINE: push ACC mov A, #33h mov ResumeOccurred, A ; Set flag so next SOF, is put into the varaible pop ACC ret ;------------------------------------------------------------------------------------- ;--------------------- INIT_TIMER0 ---------------------------------------------- ;------------------------------------------------------------------------------------- INIT_TIMER0: ; Interrupt TIMER0 goes off every cycle (12 clock ticks), ; and since the clock frequency is 12 Mhz, TIMER 0 goes off ; every micro second. To determine the timing between pulses, ; load the 'Negitive' number of microseconds, upto 255 into TL0 & TH0 ; ; anl TMOD, #0f0h orl TMOD, #01h ; Mode 1 IF SIMULATION_MODE1 == ENABLED mov TL0, #LOW(0FFFFh-70h) ; Load counter mov TH0, #HIGH(0FFFFh-70h) ; Load Reload Value ELSE mov TL0, #LOW(0FFFFh-KSO_STEP_TIME) ; Load counter mov TH0, #HIGH(0FFFFh-KSO_STEP_TIME) ; Load Reload Value ENDIF setb ET0 ; Enable the Timer 1 Interrupt Vector setb TR0 ; Enabled Timer1 to run ret ;------------------------------------------------------------------------------- ;--------------------- TIMER0_ISR ---------------------------------------------- ;------------------------------------------------------------------------------- ;###################################################################### ;# SUBROUTINE: TIMER0_ISR ;# PURPOSE: CLears KSO pin contained in A. ;# ;# ;# CALLED BY: Timer 0_ISR and ;# REGS USED: A : ;# ;# RETURNS: None ;# ASSUMES: A & PSW will be modified ;###################################################################### ; Timer0 is the KSO select timer. On every Timer 0 interrupt, the KSO pointer is ; advanced until the KSO19 is finished. The final buffer is updated on Timer1. TIMER0_ISR: ; Load Timer with time to next ISR ; Load KSO pointer with 0 ; Load and enable Timer 1 ISR ; Set KSO pin ; RET clr TR0 push PSW push ACC push 00 push 01 ; switch banks ; Set KSO Pin inc KSOPointer ; Advance the KSO pointer to the next one. ; The routine starts with KSOPointer = FFh mov A, KSOPointer cjne A ,#(LAST_KSO_PIN + 1) ,SetKSO ; If it's equal to the Last + 1 then stop. ; Load the FIFO with data mov A, KeysInBuffer ; Get Keys in Buffer already. jz NoKeysPressed ; If no keys pressed, then exit. call LoadKbdEP1 ; Load the keys pressed. mov KSOPointer, #0FFh mov KbdBufferPointer, #KeyboardBuffer1 NoKeysPressed: sjmp ExitTimer0Isr SetKSO: call ClrKsoPinInA ; Set the KSO pin contained in A ; If anything is detected, it will be shown ; in the KSI Interrupt ExitTimer0Isr: IF SIMULATION_MODE1 == ENABLED mov TL0, #LOW(0FFFFh-70h) ; Load counter mov TH0, #HIGH(0FFFFh-70h) ; Load Reload Value ELSE mov TL0, #LOW(0FFFFh-KSO_STEP_TIME) ; Load counter mov TH0, #HIGH(0FFFFh-KSO_STEP_TIME) ; Load Reload Value ENDIF setb TR0 ; Enabled Timer 1 pop 01 pop 00 pop ACC pop PSW reti ;###################################################################### ;# SUBROUTINE: ClrKsoPinInA: CLears KSO pin contained in A. ;# PURPOSE: CLears KSO pin contained in A. ;# ;# ;# CALLED BY: Timer 0_ISR and ;# REGS USED: A : ;# ;# RETURNS: None ;# ASSUMES: A & PSW will be modified ;###################################################################### ClrKsoPinInA: call SetAllKSOPins ; Set all the KSO pins clr CY ; Test0_7: subb A, #08h ; Is this pin on P1? jnc Test8_15 ; If not then check P2 add A, #08h ; Get the bit mask call ConvertAtoKSOBit ; Set it. mov P1, A IF FAKE_KEY_MODE1==ENABLED cjne A, #0FDH, ExitSetKso mov P0, #22h ENDIF sjmp ExitSetKso Test8_15: subb A, #08h ; Is pin on Port 2? jnc Test16_19 add A, #08h call ConvertAtoKSOBit mov P2, A sjmp ExitSetKso Test16_19: ; Must be KSO16-19 if we made it this far. ; A must then contain 0-3. Since KSO16-19 ; are in the upper nibble, we need to pre-adjust ; A so that ConvertAtoBit works correctly. subb A, #04h jnc ExitSetKso add A, #08h ; call ConvertAtoKSOBit anl A, #0F0h ; Maskoff lower nibble mov B, A mov A, P3 anl A, #0Fh orl A, B mov P3, A ; Now move it back out to p3. ExitSetKso: ret ;###################################################################### ;# SUBROUTINE: SetAllKSOPins: Sets all the KSO pins on P1,P2 & P3 ;# PURPOSE: Sets all the KSO pins on P1,P2 & P3 ;# ;# CALLED BY: A lot of routines ;# REGS USED: None ;# RETURNS: None ;# ASSUMES: Nothing, I know nothing.... ;###################################################################### SetAllKSOPins: mov P1, #0FFh ; Put all of the KSO pins in their high state. mov P2, #0FFh orl P3, #0F0h ret ;###################################################################### ;# SUBROUTINE: ConvertAtoKSOBit: ;# PURPOSE: Takes the pin numer in A and converts it to a bit mask. ;# ;# CALLED BY: A lot of routines ;# REGS USED: A & R1, R1 is saved ;# RETURNS: Bit mask in A ;# ASSUMES: Nothing, I know nothing.... ;###################################################################### ConvertAtoKSOBit: push 01 ; Save R1 ; Convert bit number in A to KSO bit mask. add A, #01h ; add 8 + 1 to counter subtraction from above ; and add one to set correct bit position. mov R1, A mov A, #0FFh ; A equal All ones. clr CY ; CY will be first zero bit and routine ; will walk it to the correct position. CovertNumIoBit: rlc A djnz R1, CovertNumIoBit pop 01 ret ;###################################################################### ;# SUBROUTINE: Clear Buffer ;# PURPOSE: Loads any buffer with #NO_KEY_PRESSED_CAHR ;# ;# CALLED BY: A lot of routines ;# REGS USED: A & R1, R1 is saved ;# RETURNS: Bit mask in A ;# ASSUMES: Nothing, I know nothing.... ;###################################################################### ClearBuffer: mov @R1, #NO_KEY_PRESSED_CHAR inc R1 djnz R0, ClearBuffer ret ;---------------------------------------------------------------------------- ;--------------------- KSI_ISR ---------------------------------------------- ;---------------------------------------------------------------------------- ;###################################################################### ;# SUBROUTINE: KSI_ISR ;# PURPOSE: Loads any buffer with #NO_KEY_PRESSED_CAHR ;# ;# CALLED BY: A lot of routines ;# REGS USED: A & R1, R1 is saved ;# RETURNS: Bit mask in A ;# ASSUMES: Nothing, I know nothing.... ;###################################################################### ;Store Data as KSI in Most signigant 3 bits and KSO in Least signifigant 5 bits. KSI_ISR: ; A key was detected. Now go scan it and ; place it in the buffer. If the buffer becomes ; full, just dump the key and keep on going. push PSW push ACC ;KLS Must clear KSI Interrupt!!! anl KBCON, #07Fh ; Clear Interrupt flag call GetKSIPins pop ACC pop PSW reti ;------------------------------------------------------------------------------- ;--------------------- GetKSIPins ---------------------------------------------- ;------------------------------------------------------------------------------- ;###################################################################### ;# SUBROUTINE: KetKSIPins ;# PURPOSE: Loads any buffer with #NO_KEY_PRESSED_CAHR ;# ;# CALLED BY: A lot of routines ;# REGS USED: A & R1, R1 is saved ;# RETURNS: Bit mask in A ;# ASSUMES: Nothing, I know nothing.... ;###################################################################### GetKSIPins: push 01 ; Save Register 1 mov A, P1 ; If the all the KSO outputs are 0, then reare resuming wwith a RWU orl A, P2 JZ KSIResume NormalKSIInterrupt: clr TR0 ; Stop Timers while we process the keystroke. ;switch Banks cpl P3.1 ; Copliment the SOF Pin/P3.1 to indicate key found cpl P3.1 ; Copliment the SOF Pin/P3.1 to indicate key found Check_P07: jnb P0.7, Check_P06 mov A, #11100000b call AddKeyInA Check_P06: jnb P0.6, Check_P05 mov A, #11000000b call AddKeyInA Check_P05: jnb P0.5, Check_P04 mov A, #10100000b call AddKeyInA Check_P04: jnb P0.4, Check_P03 mov A, #10000000b call AddKeyInA Check_P03: jnb P0.3, Check_P02 mov A, #01100000b call AddKeyInA Check_P02: jnb P0.2, Check_P01 mov A, #01000000b call AddKeyInA Check_P01: jnb P0.1, Check_P00 mov A, #00100000b call AddKeyInA Check_P00: jnb P0.0, DoneScanning mov A, #00000000b call AddKeyInA DoneScanning: IF FAKE_KEY_MODE1==ENABLED Mov P0, #0ffh ENDIF lcall SetAllKSOPins ; Clear KSO Pins WaitForKSIZero: ; Remove Comments to cause system to wait for KSO pins to de-assert. mov A, P0 cjne A, #0FFh, WaitForKSIZero setb TR0 KSIResume: pop 01 ; Restor register 1 ret AddKeyInA: mov R1, KeysInBuffer ; Get address of buffer for keystrokes cjne R1, #KEYBOARD_BUFFER_SIZE, RoomLeft ; Is any room left ret RoomLeft: mov R1, KbdBufferPointer orl A, KSOPointer ; Get KSO value mov @R1, A ; Combine KSO & KSI Values into one inc R1 ; Update buffer pointer mov KbdBufferPointer, R1 inc KeysInBuffer ret ;---------------------------------------------------------------------------------- ;--------------------- EP1_KYBD_ISR ---------------------------------------------- ;---------------------------------------------------------------------------------- ;###################################################################### ;# SUBROUTINE: EP1_KYBD_ISR: Called when a EP1 TX ISR is detected. ;# PURPOSE: This subroutine is loads the data fromt he keyboard buffer ;# into EP1. If the FIFO is full or no data to load then it exits ;# ;# CALLED BY: EP1_KYBD_ISR ;# REGS USED: A : ;# R0 : ;# R1 : ;# RETURNS: None ;# ASSUMES: A & PSW will be modified ;# ;# ;###################################################################### EP1_KYBD_ISR: ; This is a push only design. Data is loaded in the FIFO ; only after all the keys have been scanned. anl FIFLG, #EP1_TX_CLR ; CLear the interrupt and exit. ret ;###################################################################### ;# SUBROUTINE: LoadKbdEP1: Load EP1 from keyboard buffer ;# PURPOSE: This subroutine is loads the data fromt he keyboard buffer ;# into EP1. If the FIFO is full or no data to load then it exits ;# ;# CALLED BY: EP1_KYBD_ISR ;# REGS USED: A : ;# R0 : ;# R1 : ;# RETURNS: None ;# ASSUMES: A, R0 & R1 will be destroyed. ;# ;# ;###################################################################### LoadKbdEP1: push 00 ; push R0 push 01 ; push R1 push EPINDEX mov EPINDEX, #01h IF SIMULATION_MODE1 == ENABLED cpl P3.0 ENDIF mov A, KeysInBuffer ; Get Keys in Buffer already. jz No_Data ; If no keys pressed then exit. ; Now check for room in FIFO. mov A, TXFLG JB ACC.6, No_Data ; If data already in FIFO, go around. mov R1, #KeyboardBuffer1 LoadFifo: mov R0, KeysInBuffer LoadNextByte: mov TXDAT, @R1 inc R1 djnz R0, LoadNextByte mov TXCNTL, KeysInBuffer mov KeysInBuffer, #00h ; CLear buffer No_Data: pop EPINDEX pop 01 pop 00 ret ;------------------------------------------------------------------------------------- ;--------------------- ScanDougsKeyboard --------------------------------------------- ;------------------------------------------------------------------------------------- ;###################################################################### ;# SUBROUTINE: ScanDougsKeyBoard: ;# PURPOSE: This subroutine is loads the data fromt he keyboard buffer ;# into EP1. If the FIFO is full or no data to load then it exits ;# ;# CALLED BY: EP1_KYBD_ISR ;# REGS USED: A : ;# R0 : ;# R1 : ;# RETURNS: None ;# ASSUMES: A, R0 & R1 will be destroyed. ;# ;# ;###################################################################### ; This routine scans the doug keys by first setting up the dougn platform and then ; reading the data. The feilds used are listed below. ; bmRequestType = C0 ; bRequest = 72 ; wValue (LSB) ; wValue (MSB) KSO Pin to clr ; wIndex (LSB) KSI Switch to activate ; wIndex (MSB) KSO Switch to activate ScanDougsKeyboard: Keyboard_Init: anl IEN0, #0DFh ; Disable the keyboard interrupt clr TR0 ; Stop timers clr ET0 ; Disable Timer 0 mov KBCON, #20h ; All LEDs = 0 Call SetAllKSOPins ; Select KSO Pin to connect mov A, FwIndex ; Get KSO_Switch jnb ACC.4, NotSet ; If bit 4 is not set, then don+t set LED3 ; as this is value is < 16 setb KBCON.3 NotSet: mov A, P3 ; Only adjust P3.0->P3.3 anl A, #0F0h mov B, A mov A, FwIndex ; Get KSO_Switch anl A, #0fh orl A, B mov P3, A ; Set the KSO Switch Matrix setb LED2 ; Toggle LED to latch the KSO value clr LED2 ; Select the KSI pin to test setb LED1 ; Select the KSI Latch mov A, P3 anl A, #0F0h mov B, A mov A, FwIndex+1 ; Get KSI_Switch anl A, #07h orl A, B ; Set the KSI Switch Matrix mov P3, A setb LED2 ; Toggle LED to latch the KSI value clr LED2 setb LED0 ; Enable switch matrix output ; Set the KSO Pin mov A, FwValue ; Get KSO Pin to toggle call ClrKsoPinInA ; Wait for any capacitance to discharge mov A, #40h djnz ACC, $ mov A, P0 ; Get KSO Pins IF SIMULATION_MODE1 == ENABLED MOV TXDAT, #42h ELSE mov TXDAT, #69h ;A ; Send it back ENDIF mov TXCNTL, #01h clr LED0 ; Tristate driviers clr LED1 Call SetAllKSOPins ret ;------------------------------------------------------------------------------------- ;--------------------- SET_SFR_ROUTINE --------------------------------------------- ;------------------------------------------------------------------------------------- ; Sets the value of the SFR contained in the LSB of wIndex to the value contained in the ; LSB of wValue ; ; bmRequestType = 40h ; bRequest = 70h ; bValue(LSB) = SFR Value ; wIndex(LSB) = SFR Address ; bLength = 0 SetSfrRoutine: SET_SFR_ROUTINE: push DPH push DPL SetJumpTableSelect: ; Two jump tables are used so that we can use the ; shorted sjmp instruction vs ljmp instruction. ; Makes this a little more complicated but saves ; ~~128 bytes per jump table mov A, FwIndex+1 ; Get SFR to set jb ACC.6, UseSetJmpTable1 UseSetJmpTable0: push FwValue+1 ; Get desired value of SFR mov DPTR, #SetSfrJmpTable0 ; Get address of jmp table anl A, #3Fh ; Mask off unused values rl A ; Multiply by 4 rl A jmp @A+DPTR UseSetJmpTable1: push FwValue+1 ; Get desired value of SFR mov DPTR, #SetSfrJmpTable1 ; Get address of jmp table anl A, #3Fh ; Mask off unused values rl A ; Multiply by 4 rl A jmp @A+DPTR SetSfrDone: ; mov TXCNTL, #0 pop DPL pop DPH ret ExitSetSfrJmpTableA: sjmp SetSfrDone SetSfrJmpTable0: SetSFR_80: pop 80h sjmp ExitSetSfrJmpTableA SetSFR_81: pop 81h sjmp ExitSetSfrJmpTableA SetSFR_82: pop 82h sjmp ExitSetSfrJmpTableA SetSFR_83: pop 83h sjmp ExitSetSfrJmpTableA SetSFR_84: pop 84h sjmp ExitSetSfrJmpTableA SetSFR_85: pop 85h sjmp ExitSetSfrJmpTableA SetSFR_86: pop 86h sjmp ExitSetSfrJmpTableA SetSFR_87: pop 87h sjmp ExitSetSfrJmpTableA SetSFR_88: pop 88h sjmp ExitSetSfrJmpTableA SetSFR_89: pop 89h sjmp ExitSetSfrJmpTableA SetSFR_8A: pop 8Ah sjmp ExitSetSfrJmpTableA SetSFR_8B: pop 8Bh sjmp ExitSetSfrJmpTableA SetSFR_8C: pop 8Ch sjmp ExitSetSfrJmpTableA SetSFR_8D: pop 8Dh sjmp ExitSetSfrJmpTableA SetSFR_8E: pop 8Eh sjmp ExitSetSfrJmpTableA SetSFR_8F: pop 8Fh sjmp ExitSetSfrJmpTableA SetSFR_90: pop 90h sjmp ExitSetSfrJmpTableA SetSFR_91: pop 91h sjmp ExitSetSfrJmpTableA SetSFR_92: pop 92h sjmp ExitSetSfrJmpTableA SetSFR_93: pop 93h sjmp ExitSetSfrJmpTableA SetSFR_94: pop 94h sjmp ExitSetSfrJmpTableA SetSFR_95: pop 95h sjmp ExitSetSfrJmpTableA SetSFR_96: pop 96h sjmp ExitSetSfrJmpTableA SetSFR_97: pop 97h sjmp ExitSetSfrJmpTableA SetSFR_98: pop 98h sjmp ExitSetSfrJmpTableA SetSFR_99: pop 99h sjmp ExitSetSfrJmpTableA SetSFR_9A: pop 9Ah sjmp ExitSetSfrJmpTableA SetSFR_9B: pop 9Bh sjmp ExitSetSfrJmpTableA SetSFR_9C: pop 9Ch sjmp ExitSetSfrJmpTableA SetSFR_9D: pop 9Dh sjmp ExitSetSfrJmpTableA SetSFR_9E: pop 9Eh xxx2: sjmp ExitSetSfrJmpTableA SetSFR_9F: pop 9Fh sjmp xxx2 SetSFR_A0: pop 0A0h sjmp ExitSetSfrJmpTableB SetSFR_A1: pop 0A1h sjmp ExitSetSfrJmpTableB SetSFR_A2: pop 0A2h sjmp ExitSetSfrJmpTableB SetSFR_A3: pop 0A3h sjmp ExitSetSfrJmpTableB SetSFR_A4: pop 0A4h sjmp ExitSetSfrJmpTableB SetSFR_A5: pop 0A5h sjmp ExitSetSfrJmpTableB SetSFR_A6: pop 0A6h sjmp ExitSetSfrJmpTableB SetSFR_A7: pop 0A7h sjmp ExitSetSfrJmpTableB SetSFR_A8: pop 0A8h sjmp ExitSetSfrJmpTableB SetSFR_A9: pop 0A9h sjmp ExitSetSfrJmpTableB SetSFR_AA: pop 0AAh sjmp ExitSetSfrJmpTableB SetSFR_AB: pop 0ABh sjmp ExitSetSfrJmpTableB SetSFR_AC: pop 0ACh sjmp ExitSetSfrJmpTableB SetSFR_AD: pop 0ADh sjmp ExitSetSfrJmpTableB SetSFR_AE: pop 0AEh sjmp ExitSetSfrJmpTableB SetSFR_AF: pop 0AFh sjmp ExitSetSfrJmpTableB SetSFR_B0: pop 0B0h sjmp ExitSetSfrJmpTableB SetSFR_B1: pop 0B1h sjmp ExitSetSfrJmpTableB SetSFR_B2: pop 0B2h sjmp ExitSetSfrJmpTableB SetSFR_B3: pop 0B3h sjmp ExitSetSfrJmpTableB SetSFR_B4: pop 0B4h sjmp ExitSetSfrJmpTableB SetSFR_B5: pop 0B5h sjmp ExitSetSfrJmpTableB SetSFR_B6: pop 0B6h sjmp ExitSetSfrJmpTableB SetSFR_B7: pop 0B7h sjmp ExitSetSfrJmpTableB SetSFR_B8: pop 0B8h sjmp ExitSetSfrJmpTableB SetSFR_B9: pop 0B9h sjmp ExitSetSfrJmpTableB SetSFR_BA: pop 0BAh sjmp ExitSetSfrJmpTableB SetSFR_BB: pop 0BBh sjmp ExitSetSfrJmpTableB SetSFR_BC: pop 0BCh sjmp ExitSetSfrJmpTableB SetSFR_BD: pop 0BDh sjmp ExitSetSfrJmpTableB SetSFR_BE: pop 0BEh sjmp ExitSetSfrJmpTableB SetSFR_BF: pop 0BFh sjmp ExitSetSfrJmpTableB ; Ljmp here is ok since it does not affect ; the others as it is the last one for this table. ExitSetSfrJmpTableB: LJMP SetSfrDone SetSfrJmpTable1: ;--------- No jumps can occur after this from above SetSFR_C0: pop 0C0h sjmp ExitSetSfrJmpTableB SetSFR_C1: pop 0C1h sjmp ExitSetSfrJmpTableB SetSFR_C2: pop 0C2h sjmp ExitSetSfrJmpTableB SetSFR_C3: pop 0C3h sjmp ExitSetSfrJmpTableB SetSFR_C4: pop 0C4h sjmp ExitSetSfrJmpTableB SetSFR_C5: pop 0C5h sjmp ExitSetSfrJmpTableB SetSFR_C6: pop 0C6h sjmp ExitSetSfrJmpTableB SetSFR_C7: pop 0C7h sjmp ExitSetSfrJmpTableB SetSFR_C8: pop 0C8h sjmp ExitSetSfrJmpTableB SetSFR_C9: pop 0C9h sjmp ExitSetSfrJmpTableB SetSFR_CA: pop 0CAh sjmp ExitSetSfrJmpTableB SetSFR_CB: pop 0CBh sjmp ExitSetSfrJmpTableB SetSFR_CC: pop 0CCh sjmp ExitSetSfrJmpTableB SetSFR_CD: pop 0CDh sjmp ExitSetSfrJmpTableB SetSFR_CE: pop 0CEh sjmp ExitSetSfrJmpTableB SetSFR_CF: pop 0CFh sjmp ExitSetSfrJmpTableB SetSFR_D0: pop 0D0h sjmp ExitSetSfrJmpTableB SetSFR_D1: pop 0D1h sjmp ExitSetSfrJmpTableB SetSFR_D2: pop 0D2h sjmp ExitSetSfrJmpTableB SetSFR_D3: pop 0D3h sjmp ExitSetSfrJmpTableB SetSFR_D4: pop 0D4h sjmp ExitSetSfrJmpTableB SetSFR_D5: pop 0D5h sjmp ExitSetSfrJmpTableB SetSFR_D6: pop 0D6h sjmp ExitSetSfrJmpTableB SetSFR_D7: pop 0D7h sjmp ExitSetSfrJmpTableB SetSFR_D8: pop 0D8h sjmp ExitSetSfrJmpTableB SetSFR_D9: pop 0D9h sjmp ExitSetSfrJmpTableB SetSFR_DA: pop 0DAh sjmp ExitSetSfrJmpTableB SetSFR_DB: pop 0DBh sjmp ExitSetSfrJmpTableB SetSFR_DC: pop 0DCh sjmp ExitSetSfrJmpTableB SetSFR_DD: pop 0DDh sjmp ExitSetSfrJmpTableB SetSFR_DE: pop 0DEh xxx1: sjmp ExitSetSfrJmpTableB SetSFR_DF: pop 0DFh sjmp xxx1 SetSFR_E0: pop 0E0h sjmp ExitSetSfrJmpTableC SetSFR_E1: pop 0E1h sjmp ExitSetSfrJmpTableC SetSFR_E2: pop 0E2h sjmp ExitSetSfrJmpTableC SetSFR_E3: pop 0E3h sjmp ExitSetSfrJmpTableC SetSFR_E4: pop 0E4h sjmp ExitSetSfrJmpTableC SetSFR_E5: pop 0E5h sjmp ExitSetSfrJmpTableC SetSFR_E6: pop 0E6h sjmp ExitSetSfrJmpTableC SetSFR_E7: pop 0E7h sjmp ExitSetSfrJmpTableC SetSFR_E8: pop 0E8h sjmp ExitSetSfrJmpTableC SetSFR_E9: pop 0E9h sjmp ExitSetSfrJmpTableC SetSFR_EA: pop 0EAh sjmp ExitSetSfrJmpTableC SetSFR_EB: pop 0EBh sjmp ExitSetSfrJmpTableC SetSFR_EC: pop 0ECh sjmp ExitSetSfrJmpTableC SetSFR_ED: pop 0EDh sjmp ExitSetSfrJmpTableC SetSFR_EE: pop 0EEh sjmp ExitSetSfrJmpTableC SetSFR_EF: pop 0EFh sjmp ExitSetSfrJmpTableC SetSFR_F0: pop 0F0h sjmp ExitSetSfrJmpTableC SetSFR_F1: pop 0F1h sjmp ExitSetSfrJmpTableC SetSFR_F2: pop 0F2h sjmp ExitSetSfrJmpTableC SetSFR_F3: pop 0F3h sjmp ExitSetSfrJmpTableC SetSFR_F4: pop 0F4h sjmp ExitSetSfrJmpTableC SetSFR_F5: pop 0F5h sjmp ExitSetSfrJmpTableC SetSFR_F6: pop 0F6h sjmp ExitSetSfrJmpTableC SetSFR_F7: pop 0F7h sjmp ExitSetSfrJmpTableC SetSFR_F8: pop 0F8h sjmp ExitSetSfrJmpTableC SetSFR_F9: pop 0F9h sjmp ExitSetSfrJmpTableC SetSFR_FA: pop 0FAh sjmp ExitSetSfrJmpTableC SetSFR_FB: pop 0FBh sjmp ExitSetSfrJmpTableC SetSFR_FC: pop 0FCh sjmp ExitSetSfrJmpTableC SetSFR_FD: pop 0FDh sjmp ExitSetSfrJmpTableC SetSFR_FE: pop 0FEh sjmp ExitSetSfrJmpTableC SetSFR_FF: pop 0FFh sjmp ExitSetSfrJmpTableC ; Ljmp here is ok since it does not affect ; the others as it is the last one for this table. ExitSetSfrJmpTableC: LJMP SetSfrDone ;--------- No jumps can occur after this from above ;------------------------------------------------------------------------------------- ;--------------------- GET_SFR_ROUTINE --------------------------------------------- ;------------------------------------------------------------------------------------- ; Sets the value of the SFR contained in the LSB of wIndex ; bRequest = ; bValue(LSB) = xxxx ; wIndex(LSB) = SFR Address ; bLength = 0001 GetSfrRoutine: mov A, FwIndex+1 ; Get SFR to set jb ACC.6, UseGetJmpTable1 UseGetJmpTable0: mov DPTR, #GetSfrJmpTable0 ; Get address of jmp table anl A, #3Fh ; Mask off unused values rl A ; Multiply by 4 rl A mov R0, FwValue+1 ; Get desired value of SFR jmp @A+DPTR UseGetJmpTable1: mov DPTR, #GetSfrJmpTable1 ; Get address of jmp table anl A, #3Fh ; Mask off unused values rl A ; Multiply by 4 rl A mov R0, FwValue+1 ; Get desired value of SFR jmp @A+DPTR GetSfrDone: pop ACC ; Get value off of the stack. mov TXDAT, A ; store teh value mov TXCNTL, #1 pop DPL pop DPH pop B pop ACC ret ExitGetSfrJmpTableA: LJMP GetSfrDone GetSfrJmpTable0: GetSFR_80: push 80h sjmp ExitGetSfrJmpTableA GetSFR_81: push 81h sjmp ExitGetSfrJmpTableA GetSFR_82: push 82h sjmp ExitGetSfrJmpTableA GetSFR_83: push 83h sjmp ExitGetSfrJmpTableA GetSFR_84: push 84h sjmp ExitGetSfrJmpTableA GetSFR_85: push 85h sjmp ExitGetSfrJmpTableA GetSFR_86: push 86h sjmp ExitGetSfrJmpTableA GetSFR_87: push 87h sjmp ExitGetSfrJmpTableA GetSFR_88: push 88h sjmp ExitGetSfrJmpTableA GetSFR_89: push 89h sjmp ExitGetSfrJmpTableA GetSFR_8A: push 8Ah sjmp ExitGetSfrJmpTableA GetSFR_8B: push 8Bh sjmp ExitGetSfrJmpTableA GetSFR_8C: push 8Ch sjmp ExitGetSfrJmpTableA GetSFR_8D: push 8Dh sjmp ExitGetSfrJmpTableA GetSFR_8E: push 8Eh sjmp ExitGetSfrJmpTableA GetSFR_8F: push 8Fh sjmp ExitGetSfrJmpTableA GetSFR_90: push 90h sjmp ExitGetSfrJmpTableA GetSFR_91: push 91h sjmp ExitGetSfrJmpTableA GetSFR_92: push 92h sjmp ExitGetSfrJmpTableA GetSFR_93: push 93h sjmp ExitGetSfrJmpTableA GetSFR_94: push 94h sjmp ExitGetSfrJmpTableA GetSFR_95: push 95h sjmp ExitGetSfrJmpTableA GetSFR_96: push 96h sjmp ExitGetSfrJmpTableA GetSFR_97: push 97h sjmp ExitGetSfrJmpTableA GetSFR_98: push 98h sjmp ExitGetSfrJmpTableA GetSFR_99: push 99h sjmp ExitGetSfrJmpTableA GetSFR_9A: push 9Ah sjmp ExitGetSfrJmpTableA GetSFR_9B: push 9Bh sjmp ExitGetSfrJmpTableA GetSFR_9C: push 9Ch sjmp ExitGetSfrJmpTableA GetSFR_9D: push 9Dh sjmp ExitGetSfrJmpTableA GetSFR_9E: push 9Eh xxx4: sjmp ExitGetSfrJmpTableA GetSFR_9F: push 9Fh sjmp xxx4 GetSFR_A0: push 0A0h sjmp ExitGetSfrJmpTableB GetSFR_A1: push 0A1h sjmp ExitGetSfrJmpTableB GetSFR_A2: push 0A2h sjmp ExitGetSfrJmpTableB GetSFR_A3: push 0A3h sjmp ExitGetSfrJmpTableB GetSFR_A4: push 0A4h sjmp ExitGetSfrJmpTableB GetSFR_A5: push 0A5h sjmp ExitGetSfrJmpTableB GetSFR_A6: push 0A6h sjmp ExitGetSfrJmpTableB GetSFR_A7: push 0A7h sjmp ExitGetSfrJmpTableB GetSFR_A8: push 0A8h sjmp ExitGetSfrJmpTableB GetSFR_A9: push 0A9h sjmp ExitGetSfrJmpTableB GetSFR_AA: push 0AAh sjmp ExitGetSfrJmpTableB GetSFR_AB: push 0ABh sjmp ExitGetSfrJmpTableB GetSFR_AC: push 0ACh sjmp ExitGetSfrJmpTableB GetSFR_AD: push 0ADh sjmp ExitGetSfrJmpTableB GetSFR_AE: push 0AEh sjmp ExitGetSfrJmpTableB GetSFR_AF: push 0AFh sjmp ExitGetSfrJmpTableB ;ExitGetSfrJmpTableB: GetSFR_B0: push 0B0h sjmp ExitGetSfrJmpTableB GetSFR_B1: push 0B1h sjmp ExitGetSfrJmpTableB GetSFR_B2: push 0B2h sjmp ExitGetSfrJmpTableB GetSFR_B3: push 0B3h sjmp ExitGetSfrJmpTableB GetSFR_B4: push 0B4h sjmp ExitGetSfrJmpTableB GetSFR_B5: push 0B5h sjmp ExitGetSfrJmpTableB GetSFR_B6: push 0B6h sjmp ExitGetSfrJmpTableB GetSFR_B7: push 0B7h sjmp ExitGetSfrJmpTableB GetSFR_B8: push 0B8h sjmp ExitGetSfrJmpTableB GetSFR_B9: push 0B9h sjmp ExitGetSfrJmpTableB GetSFR_BA: push 0BAh sjmp ExitGetSfrJmpTableB GetSFR_BB: push 0BBh sjmp ExitGetSfrJmpTableB GetSFR_BC: push 0BCh sjmp ExitGetSfrJmpTableB GetSFR_BD: push 0BDh sjmp ExitGetSfrJmpTableB GetSFR_BE: push 0BEh sjmp ExitGetSfrJmpTableB GetSFR_BF: push 0BFh Sjmp ExitGetSfrJmpTableB ExitGetSfrJmpTableB: ljmp GetSfrDone ;--------- No jumps can occur after this from above GetSfrJmpTable1: GetSFR_C0: push 0C0h sjmp ExitGetSfrJmpTableB GetSFR_C1: push 0C1h sjmp ExitGetSfrJmpTableB GetSFR_C2: push 0C2h sjmp ExitGetSfrJmpTableB GetSFR_C3: push 0C3h sjmp ExitGetSfrJmpTableB GetSFR_C4: push 0C4h sjmp ExitGetSfrJmpTableB GetSFR_C5: push 0C5h sjmp ExitGetSfrJmpTableB GetSFR_C6: push 0C6h sjmp ExitGetSfrJmpTableB GetSFR_C7: push 0C7h sjmp ExitGetSfrJmpTableB GetSFR_C8: push 0C8h sjmp ExitGetSfrJmpTableB GetSFR_C9: push 0C9h sjmp ExitGetSfrJmpTableB GetSFR_CA: push 0CAh sjmp ExitGetSfrJmpTableB GetSFR_CB: push 0CBh sjmp ExitGetSfrJmpTableB GetSFR_CC: push 0CCh sjmp ExitGetSfrJmpTableB GetSFR_CD: push 0CDh sjmp ExitGetSfrJmpTableB GetSFR_CE: push 0CEh sjmp ExitGetSfrJmpTableB GetSFR_CF: push 0CFh sjmp ExitGetSfrJmpTableB GetSFR_D0: push 0D0h sjmp ExitGetSfrJmpTableB GetSFR_D1: push 0D1h sjmp ExitGetSfrJmpTableB GetSFR_D2: push 0D2h sjmp ExitGetSfrJmpTableB GetSFR_D3: push 0D3h sjmp ExitGetSfrJmpTableB GetSFR_D4: push 0D4h sjmp ExitGetSfrJmpTableB GetSFR_D5: push 0D5h sjmp ExitGetSfrJmpTableB GetSFR_D6: push 0D6h sjmp ExitGetSfrJmpTableB GetSFR_D7: push 0D7h sjmp ExitGetSfrJmpTableB GetSFR_D8: push 0D8h sjmp ExitGetSfrJmpTableB GetSFR_D9: push 0D9h sjmp ExitGetSfrJmpTableB GetSFR_DA: push 0DAh sjmp ExitGetSfrJmpTableB GetSFR_DB: push 0DBh sjmp ExitGetSfrJmpTableB GetSFR_DC: push 0DCh sjmp ExitGetSfrJmpTableB GetSFR_DD: push 0DDh sjmp ExitGetSfrJmpTableB GetSFR_DE: push 0DEh xxx3: sjmp ExitGetSfrJmpTableB GetSFR_DF: push 0DFh sjmp xxx3 GetSFR_E0: push 0E0h sjmp ExitGetSfrJmpTableC GetSFR_E1: push 0E1h sjmp ExitGetSfrJmpTableC GetSFR_E2: push 0E2h sjmp ExitGetSfrJmpTableC GetSFR_E3: push 0E3h sjmp ExitGetSfrJmpTableC GetSFR_E4: push 0E4h sjmp ExitGetSfrJmpTableC GetSFR_E5: push 0E5h sjmp ExitGetSfrJmpTableC GetSFR_E6: push 0E6h sjmp ExitGetSfrJmpTableC GetSFR_E7: push 0E7h sjmp ExitGetSfrJmpTableC GetSFR_E8: push 0E8h sjmp ExitGetSfrJmpTableC GetSFR_E9: push 0E9h sjmp ExitGetSfrJmpTableC GetSFR_EA: push 0EAh sjmp ExitGetSfrJmpTableC GetSFR_EB: push 0EBh sjmp ExitGetSfrJmpTableC GetSFR_EC: push 0ECh sjmp ExitGetSfrJmpTableC GetSFR_ED: push 0EDh sjmp ExitGetSfrJmpTableC GetSFR_EE: push 0EEh sjmp ExitGetSfrJmpTableC GetSFR_EF: push 0EFh sjmp ExitGetSfrJmpTableC GetSFR_F0: push 0F0h sjmp ExitGetSfrJmpTableC GetSFR_F1: push 0F1h sjmp ExitGetSfrJmpTableC GetSFR_F2: push 0F2h sjmp ExitGetSfrJmpTableC GetSFR_F3: push 0F3h sjmp ExitGetSfrJmpTableC GetSFR_F4: push 0F4h sjmp ExitGetSfrJmpTableC GetSFR_F5: push 0F5h sjmp ExitGetSfrJmpTableC GetSFR_F6: push 0F6h sjmp ExitGetSfrJmpTableC GetSFR_F7: push 0F7h sjmp ExitGetSfrJmpTableC GetSFR_F8: push 0F8h sjmp ExitGetSfrJmpTableC GetSFR_F9: push 0F9h sjmp ExitGetSfrJmpTableC GetSFR_FA: push 0FAh sjmp ExitGetSfrJmpTableC GetSFR_FB: push 0FBh sjmp ExitGetSfrJmpTableC GetSFR_FC: push 0FCh sjmp ExitGetSfrJmpTableC GetSFR_FD: push 0FDh sjmp ExitGetSfrJmpTableC GetSFR_FE: push 0FEh sjmp ExitGetSfrJmpTableC GetSFR_FF: push 0FFh Sjmp ExitGetSfrJmpTableC ExitGetSfrJmpTableC: LJMP GetSfrDone ;--------- No jumps can occur after this from above IF SIO_DEBUG==ENABLED GO2SLEEP_MSG: db "Going into suspend mode ...",CR,LF,NUL WAKINGUP_MSG: db "Waking up from a suspended state !",CR,LF,NUL ENDIF ;------------------------------------------------------------------------------------- ;--------------------- GET_SFR_ROUTINE --------------------------------------------- ;------------------------------------------------------------------------------------- ;------------------------------------------------------------------------------------- ;------------------------ DATA ------------------------------------------------------- ;------------------------------------------------------------------------------------- DEFINE SV_CODE_DATA_SEG, SPACE=DATA, ORG=040h SEGMENT SV_CODE_DATA_SEG KSOPointer: ds 1 LED_storage: KbdBufferPointer: ds 1 KeysInBuffer: ds 1 FirstSOF: ds 2 SOFBeforeSuspend: ds 2 SOFAfterResume: ds 2 ResumeOccurred: ds 1 KeyboardBuffer1: ds KEYBOARD_BUFFER_SIZE END