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

📄 mmind.asm

📁 一个微型操作系统源码
💻 ASM
📖 第 1 页 / 共 2 页
字号:
             jmp    exilop                                                      ;   And exit inner loop
            ENDIF
            inc     cx                                                          ; Increment inner loop counter
           cmp      cx,       6                                                 ; Processed all entries ?
           UNTIL    Z                                                           
    exilop:                                                                     ; End of inner loop
           pop      si                                                          ;Restore pointer to Target String
           pop      cx                                                          ;Restore counter
           inc      cx                                                          ;Increment counter
          cmp       cx,       6                                                 ;Is the last digit ?
          UNTIL     Z
          CVTW2S    bx,       AuxBuf                                            ;Convert it to text
          PRTSTR    CorDig                                                      ;Inform user
          PRTSTR    AuxBuf

ENDSR
;--------------                                                       
; YOUWIN: Informs User's victory
;--------------                                                       
BEGSR     YOUWIN
          CLRSCR                                                                ;Clear Screen
          PRTSTR    WinYou                                                      ;Print "You WIn"
          EXSR      PRTSCO                                                      ;Print Score
          EXSR      ShwNbr                                                      ;Show CPU Chosen No.
          ENDPGM
          EXSR      
ENDSR     
;--------------                                                       
; SHWNBR: Shows the CPU Chosen Number                                                                         
;--------------                                                       
BEGSR     ShwNbr
          PRTSTR    CPUNbr                                                      ;Print Label
          PRTSTR    TgtStr                                                      ;Print Target String
          PRTSTR    CRLF                                                        ;Print NewLine
ENDSR
;--------------                                                       
; INZRND: Initializes random generator with system clock                                                                          
;--------------                                                       
BEGSR     INZRND                                            
          MOV       ah, 00h                                                     ;Bios Function
          INT       1ah                                                         ;Time elapsed since boot
          MOV       [RndSed], dx                                                ;Preserve it as Seed
ENDSR                                                       
;--------------                                                       
; GETRND: Manipulates Random Seed to produce a "Random" number                                                                              
;--------------                                                       
BEGSR     GETRND                                            
          push      cx                                                          ;Preserve CX
          REPEAT                                                      
           mov      cx,       [RndSed]                                          ;Get Seed
           imul     cx,       13A7h                                             ;Multiply it by mask
           inc      cx                                                          ;Inc
           mov      [RndSed], cx                                                ;Preserve new Seed
          cmp       [RndSed], word 9999                                         ;Check against range          
          UNTIL     g                                                           ;If no try again
          pop       cx                                                          ;Restore CX

ENDSR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;        Data
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

RndSed                        dw 0
TgtStr    times     6         db 0
AuxBuf    times     255       db 0
Buffer    times     255       db 0
InpStr    times     6         db 0
InpNbr                        dw 0
CRLF                          db 13,10,0
Welcme                        db "Master Mind V 0.1", 13, 10, \
                                 "-----------------", 13, 10, \
                                 "No OS Will survive if it has no games",\
                                 "...(Well, maybe OS/400 will ;-) ...)",13,10,\
                                 "The game goal is to find out the 5 digit ",\
                                 "number choosen by the machine.",13,10,\
                                 "You insert your guess and the CPU will ",\
                                 "tell you:",13,10,13,10,\
                                 " - How many digits are correct",13,10,\
                                 " - How Many are well located...",13,10,\
                                 "[- If you are above or below the CPU No.]",\
                                  13,10,\
                                 "Your Score depends on how many tries you ",\
                                 "needed to find out the number.",13,10,\
                                 "You have 25 tries to use.",13,10,\
                                 "Good Luck ...",13,10,\
                                 "Press Intro to Begin the game ...",13,10,\
                                 13,10,0
Prompt                        db "Please enter a 5 digit number ",\
                                 "(0 to quit the game):",0
Sorry                         db "You have lost ...",13,10,0
YourSco                       db 13,10,"Tries left:",0

SeeYou                        db 13,10,"You decided to quit...",13,10,\
                                       "See you soon...",13,10,0
YouEntered                    db 13,10,\
                                 13,10,"The number you entered was ...:",0                             
CorDig                        db 13,10,"Correct Digit(S)..............:",0
WelPos                        db 13,10,"Well Positioned ..............:",0
WinYou                        db 07,07,13,10,"CONGRATULATIONS...",13,10,\
                                             "------------------",13,10,\
                                 "You are the winner...",13,10,\
                                 "Your score:",0
Score                         dw 25                            
CPUNbr                        db 13,10,'The CPU Number was:',0

⌨️ 快捷键说明

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