📄 vregsw.psm
字号:
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
LOAD s0, ascii_P
CALL tx_to_dce
LOAD s0, ascii_C
CALL tx_to_dce
LOAD s0, ascii_B
CALL tx_to_dce
LOAD s0, ascii_EXCLAIM
CALL tx_to_dce
LOAD s0, ascii_CR
CALL tx_to_dce
LOAD s0, ascii_CR
CALL tx_to_dce
RETURN
print1: CALL print_reg1
CALL print_ldo1
CALL print_sel
RETURN
print2: CALL print_reg1
CALL print_ldo2
CALL print_sel
RETURN
print3: CALL print_reg1
CALL print_sw1
CALL print_sel
RETURN
print4: CALL print_reg1
CALL print_sw2
CALL print_sel
RETURN
print5: CALL print_reg2
CALL print_ldo1
CALL print_sel
RETURN
print6: CALL print_reg2
CALL print_ldo2
CALL print_sel
RETURN
print7: CALL print_reg2
CALL print_sw1
CALL print_sel
RETURN
print8: CALL print_reg2
CALL print_sw2
CALL print_sel
RETURN
print_reg1: LOAD s0, ascii_R
CALL tx_to_dce
LOAD s0, ascii_E
CALL tx_to_dce
LOAD s0, ascii_G
CALL tx_to_dce
LOAD s0, ascii_1
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
print_reg2: LOAD s0, ascii_R
CALL tx_to_dce
LOAD s0, ascii_E
CALL tx_to_dce
LOAD s0, ascii_G
CALL tx_to_dce
LOAD s0, ascii_2
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
print_ldo1: LOAD s0, ascii_L
CALL tx_to_dce
LOAD s0, ascii_D
CALL tx_to_dce
LOAD s0, ascii_O
CALL tx_to_dce
LOAD s0, ascii_1
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
print_ldo2: LOAD s0, ascii_L
CALL tx_to_dce
LOAD s0, ascii_D
CALL tx_to_dce
LOAD s0, ascii_O
CALL tx_to_dce
LOAD s0, ascii_2
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
print_sw1: LOAD s0, ascii_S
CALL tx_to_dce
LOAD s0, ascii_W
CALL tx_to_dce
LOAD s0, ascii_1
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
print_sw2: LOAD s0, ascii_S
CALL tx_to_dce
LOAD s0, ascii_W
CALL tx_to_dce
LOAD s0, ascii_2
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
print_sel: LOAD s0, ascii_S
CALL tx_to_dce
LOAD s0, ascii_e
CALL tx_to_dce
LOAD s0, ascii_l
CALL tx_to_dce
LOAD s0, ascii_e
CALL tx_to_dce
LOAD s0, ascii_c
CALL tx_to_dce
LOAD s0, ascii_t
CALL tx_to_dce
LOAD s0, ascii_e
CALL tx_to_dce
LOAD s0, ascii_d
CALL tx_to_dce
LOAD s0, ascii_CR
CALL tx_to_dce
RETURN
print_rg: LOAD s0, ascii_R
CALL tx_to_dce
LOAD s0, ascii_e
CALL tx_to_dce
LOAD s0, ascii_g
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
LOAD s0, ascii_EQUAL
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
message_l: LOAD s0, ascii_L
CALL tx_to_dce
LOAD s0, ascii_O
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
message_n: LOAD s0, ascii_N
CALL tx_to_dce
LOAD s0, ascii_O
CALL tx_to_dce
LOAD s0, ascii_M
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
message_h: LOAD s0, ascii_H
CALL tx_to_dce
LOAD s0, ascii_I
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
message_f: LOAD s0, ascii_F
CALL tx_to_dce
LOAD s0, ascii_P
CALL tx_to_dce
LOAD s0, ascii_G
CALL tx_to_dce
LOAD s0, ascii_A
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
message_d: LOAD s0, ascii_D
CALL tx_to_dce
LOAD s0, ascii_D
CALL tx_to_dce
LOAD s0, ascii_R
CALL tx_to_dce
LOAD s0, ascii_2
CALL tx_to_dce
LOAD s0, ascii_SPACE
CALL tx_to_dce
RETURN
message_t: LOAD s0, ascii_T
CALL tx_to_dce
LOAD s0, ascii_e
CALL tx_to_dce
LOAD s0, ascii_s
CALL tx_to_dce
LOAD s0, ascii_t
CALL tx_to_dce
LOAD s0, ascii_CR
CALL tx_to_dce
LOAD s0, ascii_CR
CALL tx_to_dce
RETURN
;;============================================================================
;; Routines lifted from programmable clock source design for I2C ports.
;;============================================================================
i2c_select_off: LOAD s0, i2c_select_none
OUTPUT s0, i2c_select
RETURN
i2c_select_one: LOAD s0, i2c_select_reg1
OUTPUT s0, i2c_select
RETURN
i2c_select_two: LOAD s0, i2c_select_reg2
OUTPUT s0, i2c_select
RETURN
i2c_delay_1us: LOAD s0, delay_1us_const
i2c_1us_loop: SUB s0, 01
JUMP NZ, i2c_1us_loop
RETURN
i2c_delay_5us: CALL i2c_delay_1us
i2c_delay_4us: CALL i2c_delay_1us
CALL i2c_delay_1us
CALL i2c_delay_1us
CALL i2c_delay_1us
RETURN
i2c_sda_prep_hi: FETCH s0, i2c_lines
OR s0, i2c_sdascl_ssda
STORE s0, i2c_lines
RETURN
i2c_sda_prep_lo: FETCH s0, i2c_lines
AND s0, i2c_sdascl_csda
STORE s0, i2c_lines
RETURN
i2c_scl_prep_hi: FETCH s0, i2c_lines
OR s0, i2c_sdascl_sscl
STORE s0, i2c_lines
RETURN
i2c_scl_prep_lo: FETCH s0, i2c_lines
AND s0, i2c_sdascl_cscl
STORE s0, i2c_lines
RETURN
i2c_drive: FETCH s0, i2c_lines
OUTPUT s0, i2c_sdascl
RETURN
i2c_sda_low: CALL i2c_sda_prep_lo
CALL i2c_drive
RETURN
i2c_sda_high: CALL i2c_sda_prep_hi
CALL i2c_drive
RETURN
i2c_scl_low: CALL i2c_scl_prep_lo
CALL i2c_drive
CALL i2c_delay_5us
RETURN
i2c_scl_high: CALL i2c_scl_prep_hi
CALL i2c_drive
i2c_wait_scl: INPUT s0, i2c_sdascl
TEST s0, i2c_sdascl_sscl
JUMP Z, i2c_wait_scl
RETURN
i2c_initialize: LOAD s0, i2c_sdascl_init
STORE s0, i2c_lines
OUTPUT s0, i2c_sdascl
LOAD s0, i2c_select_none
OUTPUT s0, i2c_select
RETURN
i2c_start: CALL i2c_sda_high
CALL i2c_scl_high
CALL i2c_delay_5us
CALL i2c_sda_low
CALL i2c_delay_4us
CALL i2c_scl_low
RETURN
i2c_stop: CALL i2c_sda_low
CALL i2c_delay_5us
CALL i2c_scl_high
CALL i2c_delay_4us
CALL i2c_sda_high
RETURN
i2c_tx_ack: CALL i2c_sda_low
CALL i2c_delay_5us
CALL i2c_scl_high
CALL i2c_delay_4us
CALL i2c_scl_low
RETURN
i2c_tx_noack: CALL i2c_sda_high
CALL i2c_delay_5us
CALL i2c_scl_high
CALL i2c_delay_4us
CALL i2c_scl_low
RETURN
i2c_tx_byte: LOAD s1, 80
i2c_tx_next_bit: TEST s2, s1
JUMP NZ, i2c_tx1
CALL i2c_sda_low
JUMP i2c_tx_tsu
i2c_tx1: CALL i2c_sda_high
i2c_tx_tsu: CALL i2c_delay_5us
CALL i2c_scl_high
CALL i2c_delay_4us
CALL i2c_scl_low
SR0 s1
RETURN C
JUMP i2c_tx_next_bit
i2c_rx_bit: CALL i2c_sda_high
CALL i2c_delay_5us
CALL i2c_scl_high
CALL i2c_delay_1us
CALL i2c_delay_1us
INPUT s1,i2c_sdascl
CALL i2c_delay_1us
CALL i2c_delay_1us
CALL i2c_scl_low
RETURN
i2c_rx_ack: CALL i2c_rx_bit
TEST s1, i2c_sdascl_ssda
RETURN
i2c_rx_byte: LOAD s3, 80
i2c_rx_next_bit: CALL i2c_rx_bit
TEST s1, i2c_sdascl_ssda
SLA s2
SR0 s3
RETURN C
JUMP i2c_rx_next_bit
;;============================================================================
;;
;;============================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -