📄 ps2.asm
字号:
CPU 63413
label: XPAGEON
;========================================================================
; FILE: dual_ifc.asm
;
; This file includes all the files necessary to build a ps2 keyboard
; executable.
;REVISION HISTORY
;
;
;
;========================================================================
;include all "inc" files used by the code
include "regs.inc"
include "ps2.inc"
include "macros.inc"
include "at101.inc"
include "portdef.inc"
PS2_KEYBOARD: equ 0
USB_KEYBOARD: equ 1
;========================================================================
; interrupt vector table -- must be located here
;========================================================================
ORG 00h
jmp sys_reset ; reset vector
jmp illegal_int ; USB bus reset
jmp illegal_int ; 128us interrupt
jmp dual_ifc_1ms_ISR ; 1.024ms interrupt
jmp illegal_int ; endpoint 0 interrupt
jmp illegal_int ; endpoint 1 interrupt
jmp illegal_int ; endpoint 2 interrupt
jmp illegal_int ; reserved interrupt
jmp illegal_int ; reserved interrupt
jmp illegal_int ; reserved interrupt
jmp illegal_int ; DAC interrupt
jmp illegal_int ; GPIO interrupt
jmp illegal_int ; reserved interrupt
;========================================================================
;
; FUNCTION: dual_ifc_1ms_ISR
;
; purpose:
; provides the entry point for the 1 millisecond tick.
; it performs the necessary ps2-specific
; functions and returns.
;
;
;========================================================================
dual_ifc_1ms_ISR:
push A ;save A
inc [dual_ifc_1ms] ;otherwise increment 1msec counter
; iowr WATCHDOG_REG ;clear watchdog
pop a ;restore A reg
reti ;return from interrupt
;========================================================================
;
; FUNCTION: sys_reset
;
; purpose:
; reset entry point for code
;
;
;========================================================================
illegal_int:
sys_reset:
di ;disable interrupts
mov A,0ffh
iowr PORT3_DATA_REG
mov A,NORMAL ;configure GPIO reg
iowr GPIO_CONFIG_REG
mov A,0ffh ;drive connect bit high
iowr PORT3_DATA_REG
mov a,0 ;set psp stack to 0
mov psp,a ;
mov a,0ffh ;set dsp stack to 0xff
swap a,dsp ;now we can call functions
mov A,0 ;zero endpoint interrupt reg
iowr ENDPOINT_INTERRUPT_REG
mov [dual_ifc_keyboard],A ;set type to ps2 initially
jmp ps2main ; go straight to ps2
.bummer:
jmp .bummer ;loop if we ever get here
; the dsp will remain at 0 for both ps2 and usb. Allow 30h bytes for it.
dsp_stack_size: equ 30h
; the psp will start at 0xff for ps2 and 0xe0 for usb (to avoid the
; USB queues)
psp_stack_size: equ 20h
ram_base: equ psp_stack_size ;application ram start
dual_ifc_keyboard: equ ram_base ;keyboard type
dual_ifc_1ms: equ ram_base+1 ;1msec counter
ps2main_ram_base: equ ram_base+2 ;and ps2 ram also
;include all code which resides in lower 4k now.
include "ps2main.asm"
include "ps2_io.asm"
ps2key_ram_base: equ (ps2main_ram_base + PS2MAIN_RAM_SIZE)
include "ps2key.asm"
;stub out this routine, it's not used in a ps2-only build but must be resolved
;during assembly
usbkey_putkey:
ret
ps2_ram_end: equ (ps2key_ram_base + PS2KEY_RAM_SIZE)
ksc_ram_base: equ 080h
include "keyscan.asm"
include "matrix.asm"
;define some constants which are not used but will show up in the
;listing file in a contiguous block so that we can easily examine the
;ram usage for the project in the listing file.
AAA_RAM_PS2_START: equ ps2main_ram_base
AAB_RAM_PS2_END: equ ps2main_ram_base + PS2MAIN_RAM_SIZE- 1
AAC_RAM_PS2_START: equ ps2key_ram_base
AAD_RAM_PS2_2END: equ ps2key_ram_base + PS2KEY_RAM_SIZE - 1
AAI_RAM_KSC_START: equ ksc_ram_base
AAJ_RAM_KSC_END: equ ksc_ram_base + KSC_RAM_SIZE - 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -