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

📄 mon88.lst

📁 关于8086的软核fpga代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
    1                             ;**********************************************************************
    2                             ;
    3                             ; MON88 (c) HT-LAB
    4                             ;
    5                             ; - Simple Monitor for 8088/86
    6                             ; - Some bios calls
    7                             ; - Disassembler based on David Moore's "disasm.c - x86 Disassembler v 0.1"
    8                             ; - Requires roughly 14K, default segment registers set to 0380h
    9                             ; - Assembled using A86 assembler
   10                             ;
   11                             ;----------------------------------------------------------------------
   12                             ;
   13                             ; Copyright (C) 2005 Hans Tiggeler - http://www.ht-lab.com
   14                             ; Send comments and bugs to : cpu86@ht-lab.com
   15                             ;
   16                             ; This program is free software; you can redistribute it and/or modify
   17                             ; it under the terms of the GNU General Public License as published by
   18                             ; the Free Software Foundation; either version 2 of the License, or
   19                             ; (at your option) any later version.
   20                             ;
   21                             ; This program is distributed in the hope that it will be useful, but
   22                             ; WITHOUT ANY WARRANTY; without even the implied warranty of
   23                             ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   24                             ; General Public License for more details.
   25                             ;
   26                             ; You should have received a copy of the GNU General Public License
   27                             ; along with this program; if not, write to the Free Software Foundation,
   28                             ; Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   29                             ;----------------------------------------------------------------------
   30                             ;
   31                             ; Ver 0.1     30 July 2005  H.Tiggeler  WWW.HT-LAB.COM
   32                             ;**********************************************************************
   33                             
   34 = : 000A                    LF          EQU     0Ah
   35 = : 000D                    CR          EQU     0Dh
   36 = : 001B                    ESC         EQU     01Bh
   37                             
   38                             ;----------------------------------------------------------------------
   39                             ; UART settings, COM1
   40                             ;----------------------------------------------------------------------
   41 = : 03F8                    COM1        EQU     03F8h
   42 = : 02F8                    COM2        EQU     02F8h
   43 = : 03F8                    COMPORT     EQU     COM1                        ; Select Console I/O Port
   44                             
   45 = : 0000                    DATAREG     EQU     0
   46 = : 0001                    STATUS      EQU     1
   47 = : 0002                    DIVIDER     EQU     2
   48 = : 0002                    TX_EMPTY    EQU     02
   49 = : 0001                    RX_AVAIL    EQU     01
   50 = : 0004                    FRAME_ERR   EQU     04
   51                             
   52                             ;----------------------------------------------------------------------
   53                             ; Used for Load Hex file command
   54                             ;----------------------------------------------------------------------
   55 = : 0001                    EOF_REC     EQU     01                          ; End of file record
   56 = : 0000                    DATA_REC    EQU     00                          ; Load data record
   57 = : 0002                    EAD_REC     EQU     02                          ; Extended Address Record, use to set CS
   58 = : 0003                    SSA_REC     EQU     03                          ; Execute Address
   59                             
   60                             ;----------------------------------------------------------------------
   61                             ; PIO Base Address
   62                             ;----------------------------------------------------------------------
   63 = : 0398                    PIO         EQU     0398h
   64                             
   65                             ;----------------------------------------------------------------------
   66                             ; Real Time Clock
   67                             ;----------------------------------------------------------------------
   68 = : 0070                    RTC_BASE    EQU     0070h
   69 = : 0071                    RTC_DATA    EQU     0071h
   70                             
   71                             ;----------------------------------------------------------------------
   72                             ; Hardware Single Step Monitor, CPU86 IP Core only!
   73                             ; Single Step Registers
   74                             ;
   75                             ; bit3 bit2 bit1 bit0   HWM_CONFIG
   76                             ;  |    |    |     \--- '1' =Enable Single Step
   77                             ;  |    |     \-------- '1' =Select TXMON output for UARTx
   78                             ;  \-----\------------- '00'=No Step
   79                             ;                       '01'=Step
   80                             ;                       '10'=select step_sw input
   81                             ;                       '11'=select not(step_sw) input
   82                             ;----------------------------------------------------------------------
   83                             ;HWM_CONFIG  EQU    0360h
   84                             ;HWM_BITLOW  EQU    0362h                       ; 10 bits divider
   85                             ;HWM_BITHIGH EQU    0363h                       ; bps=clk/HWM_BIT(9 downto 0)
   86                             
   87                             ;------------------------------------------------------------------------------------
   88                             ; Default Base Segment Pointer
   89                             ; All MON88 commands operate on the BASE_SEGMENT:xxxx address.
   90                             ; The base_segment value can be changed by the BS command
   91                             ;------------------------------------------------------------------------------------
   92 = : 0380                    BASE_SEGMENT    EQU  0380h
   93                             
   94                             
   95                             WRSPACE  MACRO                                  ; Write space character
   96                                 MOV     AL,' '
   97                                 CALL    TXCHAR
   98                             #EM
   99                             
  100                             WREQUAL  MACRO                                  ; Write = character
  101                                 MOV     AL,'='
  102                                 CALL    TXCHAR
  103                             #EM
  104                             
  105                                         ORG 0400h                           ; First 1024 bytes used for int vectors
  106                             
  107 0400  8C C8                 INITMON:    MOV     AX,CS                       ; Cold entry point
  108 0402  8E D8                             MOV     DS,AX                       ;
  109                             
  110 0404  8E D0                             MOV     SS,AX
  111 0406  B8 DC 35                          MOV     AX,OFFSET TOS               ; Top of Stack
  112 0409  89 C4                             MOV     SP,AX                       ; Set Stack pointer
  113                             
  114                             ;----------------------------------------------------------------------
  115                             ; Set baudrate for Hardware Monitor
  116                             ; 10 bits divider
  117                             ; Actel Board 9.8214/38400 -> BIT_LOW=255
  118                             ; 192 for 7.3864MHz
  119                             ;----------------------------------------------------------------------
  120                             ;           MOV     DX,HWM_BITLOW
  121                             ;           MOV     AL,255                      ; Set for Actel Board 9.8214
  122                             ;           OUT     DX,AL           ; 38400 bps
  123                             ;
  124                             ;           MOV     DX,HWM_BITHIGH
  125                             ;           MOV     AL,00
  126                             ;           OUT     DX,AL
  127                             
  128                             ;----------------------------------------------------------------------
  129                             ; Install Interrupt Vectors
  130                             ; INT1 & INT3 used for single stepping and breakpoints
  131                             ; INT# * 4     = Offset
  132                             ; INT# * 4 + 2 = Segment
  133                             ;----------------------------------------------------------------------
  134                             
  135 040B  33 C0                             XOR     AX,AX                       ; Segment=0000
  136 040D  8E C0                             MOV     ES,AX
  137                             
  138                                                                             ; Point all vectors to unknown handler!
  139 040F  33 DB                             XOR     BX,BX                       ; 256 vectors * 4 bytes
  140 0411  26 C7 07 EA 16        NEXTINTS:   MOV     WORD ES:[BX], OFFSET INTX   ; Spurious Interrupt Handler
  141 0416  26 C7 47 02 00 00                 MOV     WORD ES:[BX+2], 0
  142 041C  83 C3 04                          ADD     BX,4
  143 041F  81 FB 00 04                       CMP     BX,0400h
  144 0423  75 EC                             JNE     NEXTINTS
  145                             
  146 0425  26 C7 06 04 00 EB                 MOV     ES:[WORD 04], OFFSET INT1_3 ; INT1 Single Step handler
  147 042C  26 C7 06 0C 00 EB                 MOV     ES:[WORD 12], OFFSET INT1_3 ; INT3 Breakpoint handler
  148 0433  26 C7 06 40 00 86                 MOV     ES:[WORD 64], OFFSET INT10  ; INT10h
  149 043A  26 C7 06 58 00 9A                 MOV     ES:[WORD 88], OFFSET INT16  ; INT16h
  150 0441  26 C7 06 68 00 D4                 MOV     ES:[WORD 104],OFFSET INT1A  ; INT1A, Timer functions
  151 0448  26 C7 06 84 00 33                 MOV     ES:[WORD 132],OFFSET INT21  ; INT21h
  152                             
  153                             ;----------------------------------------------------------------------
  154                             ; Entry point, Display welcome message
  155                             ;----------------------------------------------------------------------
  156 044F  FC                    START:      CLD
  157 0450  BE BA 2D                          MOV     SI,OFFSET WELCOME_MESS      ; OFFSET -> SI
  158 0453  E8 A0 0E                          CALL    PUTS                        ; String pointed to by DS:[SI]
  159                             
  160 0456  B8 80 03                          MOV     AX,BASE_SEGMENT             ; Get Default Base segment
  161 0459  8E C0                             MOV     ES,AX
  162                             
  163                             ;----------------------------------------------------------------------
  164                             ; Process commands
  165                             ;----------------------------------------------------------------------
  166 045B  BE 14 2E              CMD:        MOV     SI,OFFSET PROMPT_MESS       ; Display prompt >
  167 045E  E8 95 0E                          CALL    PUTS
  168                             
  169 0461  E8 66 0F                          CALL    RXCHAR                      ; Get Command First Byte
  170 0464  E8 45 0F                          CALL    TO_UPPER
  171 0467  8A F0                             MOV     DH,AL
  172                             
  173 0469  BB AD 04                          MOV     BX,OFFSET CMDTAB1           ; Single Command?
  174 046C  8A 07                 CMPCMD1:    MOV     AL,[BX]
  175 046E  38 F0                             CMP     AL,DH
  176 0470  75 08                             JNE     NEXTCMD1

⌨️ 快捷键说明

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