⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rom_offsets.inc

📁 tini的http-slientC程序
💻 INC
📖 第 1 页 / 共 2 页
字号:
INSTALLREDIRECTHOOK  MACRO OFFSET
      mov   dptr, #(CALL_TABLE_TOP + OFFSET)
      ;
      ; Now write r3:r2:r1 to this location
      ;
      mov   a, r3
      PUTX
      inc   dptr
      mov   a, r2
      PUTX
      inc   dptr
      mov   a, r1
      PUTX
      ENDM

;
; Put a byte into XDATA
;
; Input: Value in accumulator to put.
;
; Output: None.
;
PUTX MACRO 
      movx  @dptr, a
      ENDM

;
; Get a byte from XDATA
;
; Input: None.
;
; Output: Value read in the accumulator.
;
GETX MACRO 
      movx a, @dptr
      ENDM

;
; Get a pointer from XDATA
;
; Input: Dptr points to px:ph:pl triple
;
; Output: Dptr = px:ph:pl
;
; Destroyed: Acc
;
GETPTR  MACRO
      movx a, @dptr
      push acc
      inc  dptr
      movx a, @dptr
      push acc
      inc  dptr
      movx a, @dptr
      mov  dpl, a
      pop  dph
      pop  dpx
      ENDM


;
; Get a byte from CODE
;
; Input: None.
;
; Output: Value read in the accumulator.
;
GETC MACRO 
      clr  a
      movc a, @a+dptr
      ENDM

;
; Keil sends addresses down to native all screwy.
; They high byte is 1 too high and might have the msbit set.
;
; Input: Param DIRECT_DPX The direct to be fixed (i.e. 'dpx' or 'r3').
;                         Should be the high byte of a data address.
;
; Output: One double-plus good high address byte.
;
;  DESTROYED: A
;
FIXKEILPOINTER  MACRO DIRECT_DPX
      LOCAL must_be_null
;IF (DIRECT_DPX != acc)
      mov   a, DIRECT_DPX
;ENDIF
      jz    must_be_null
      dec   a
      anl   a, #7Fh
;IF (DIRECT_DPX != acc)
      mov   DIRECT_DPX, a
;ENDIF
must_be_null:
      ENDM

;
; Make a normal 24-bit pointer so that it is acceptable to Keil
;     
UNFIXKEILPOINTER MACRO DIRECT
    inc DIRECT
    ENDM

;
; Ensure that we are not process swapped
;
WOS_ENTER_CRITICAL_SECTION  MACRO
	inc	wos_crit_count_reg
        ENDM

WOS_EXIT_CRITICAL_SECTION  MACRO
	dec	wos_crit_count_reg
        ENDM


 
;
; Push the current data pointer
;
PUSH_DPTR0  MACRO
       push  DPL
       push  DPH
       push  DPX
       ENDM

;
; Restore the current data pointer
;
;  DESTROYED: dptr, but you asked for it
;
POP_DPTR0  MACRO
       pop   DPX
       pop   DPH
       pop   DPL
       ENDM

;
; Push the current 2nd data pointer
;
PUSH_DPTR1  MACRO
       push  DPL1
       push  DPH1
       push  DPX1
       ENDM

;
; Restore the current 2nd data pointer
;
;  DESTROYED: dptr1, but you asked for it
;
POP_DPTR1  MACRO
       pop   DPX1
       pop   DPH1
       pop   DPL1
       ENDM

;
; Assume dptr points to beginning of 4 bytes param record.
; param1 is LSB, param4 is MSB
;
;  DESTROYED: A, dptr
;
SETPARAMETER  MACRO param1, param2, param3, param4
       mov    a, param1
       PUTX
       inc    dptr
       mov    a, param2
       PUTX
       inc    dptr
       mov    a, param3
       PUTX
       inc    dptr
       mov    a, param4
       PUTX
       inc    dptr
       ENDM

;
; Subtracts 3 from the X:H:L triple argument.  Meant to be used to 
; correct for the 3 byte pad assumed by the native interface.
;
; Input: Param paramX High byte of pointer to be backed-off
;        Param paramH Middle byte of pointer to be backed-off
;        Param paramL Low byte of pointer to be backed-off
;
; Output: paramX:H:L - 3
;
;  DESTROYED: A, PSW
;
;
;
BACKOFF_3  MACRO paramX, paramH, paramL
        local backoff_exit
        mov   a, paramL
        clr   c
        subb  a, #3
        mov   paramL, a
        jnc   backoff_exit
        mov   a, paramH
        subb  a, #0
        mov   paramH, a
        mov   a, paramX
        subb  a, #0
        mov   paramX, a

backoff_exit:
        ENDM


;
; A += B. 
;
; A, psw are destroyed!
;
ADD_32     MACRO A_0, A_1, A_2, A_3, B_0, B_1, B_2, B_3
	   mov   a, A_0 
	   add   a, B_0 
	   xch   a, A_0
	   mov   a, A_1 
	   addc  a, B_1 
	   xch   a, A_1 
	   mov   a, A_2 
	   addc  a, B_2 
	   xch   a, A_2 
	   mov   a, A_3 
	   addc  a, B_3  
	   xch   a, A_3 
           ENDM

SUB_32     MACRO A_0, A_1, A_2, A_3, B_0, B_1, B_2, B_3
           clr   c 
	   mov   a, A_0 
	   subb  a, B_0 
	   xch   a, A_0
	   mov   a, A_1 
	   subb  a, B_1 
	   xch   a, A_1 
	   mov   a, A_2 
	   subb  a, B_2 
	   xch   a, A_2 
	   mov   a, A_3 
	   subb  a, B_3  
	   xch   a, A_3 
           ENDM

;
; Pushes all registers in bank 0
;
PUSH_BANK_0  MACRO
       push  R0_B0
       push  R1_B0
       push  R2_B0
       push  R3_B0
       push  R4_B0
       push  R5_B0
       push  R6_B0
       push  R7_B0
       ENDM

;
; Pops all registers in bank 0
;
POP_BANK_0  MACRO
       pop   R7_B0
       pop   R6_B0
       pop   R5_B0
       pop   R4_B0
       pop   R3_B0
       pop   R2_B0
       pop   R1_B0
       pop   R0_B0
       ENDM

;
; Pushes all registers in bank 1
;
PUSH_BANK_1  MACRO
       push  R0_B1
       push  R1_B1
       push  R2_B1
       push  R3_B1
       push  R4_B1
       push  R5_B1
       push  R6_B1
       push  R7_B1
       ENDM

;
; Pops all registers in bank 1
;
POP_BANK_1  MACRO
       pop   R7_B1
       pop   R6_B1
       pop   R5_B1
       pop   R4_B1
       pop   R3_B1
       pop   R2_B1
       pop   R1_B1
       pop   R0_B1
       ENDM

;
; Pushes all registers in bank 2
;
PUSH_BANK_2  MACRO
       push  R0_B2
       push  R1_B2
       push  R2_B2
       push  R3_B2
       push  R4_B2
       push  R5_B2
       push  R6_B2
       push  R7_B2
       ENDM

;
; Pops all registers in bank 2
;
POP_BANK_2  MACRO
       pop   R7_B2
       pop   R6_B2
       pop   R5_B2
       pop   R4_B2
       pop   R3_B2
       pop   R2_B2
       pop   R1_B2
       pop   R0_B2
       ENDM

;
; Pushes all registers in bank 3
;
PUSH_BANK_3  MACRO
       push  R0_B3
       push  R1_B3
       push  R2_B3
       push  R3_B3
       push  R4_B3
       push  R5_B3
       push  R6_B3
       push  R7_B3
       ENDM

;
; Pops all registers in bank 3
;
POP_BANK_3  MACRO
       pop   R7_B3
       pop   R6_B3
       pop   R5_B3
       pop   R4_B3
       pop   R3_B3
       pop   R2_B3
       pop   R1_B3
       pop   R0_B3
       ENDM

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -