;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; This file is part of 'M', a MIPS system emulator. ;; ;; ;; ;; (C) 2019 Stanislav Datskovskiy ( www.loper-os.org ) ;; ;; http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html ;; ;; ;; ;; You do not have, nor can you ever acquire the right to use, copy or ;; ;; distribute this software ; Should you use this software for any purpose, ;; ;; or copy and distribute it to anyone or in any manner, you are breaking ;; ;; the laws of whatever soi-disant jurisdiction, and you promise to ;; ;; continue doing so for the indefinite future. In any case, please ;; ;; always : read and understand any software ; verify any PGP signatures ;; ;; that you use - for any purpose. ;; ;; ;; ;; See also http://trilema.com/2015/a-new-software-licensing-paradigm . ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;----------------------------------------------------------------------------- ; Emulator Flags (kept in Flag_Reg) ;----------------------------------------------------------------------------- %define InDelaySlot 0 %define RunningDelaySlot 1 %define Waiting 2 %define LL_Bit 3 %define IsWriting 4 %define ExcWasTLBNoMatch 5 %define Shutdown 6 ;----------------------------------------------------------------------------- ; Set a given Flag: %macro Flg_On 1 bts Flag_Reg, %1 ; Set the given Flag. %endmacro ;----------------------------------------------------------------------------- ; Clear a given Flag: %macro Flg_Off 1 btr Flag_Reg, %1 ; Clear the given Flag. %endmacro %define Flg_GOF Flg_Off ; BTR inst also gives the old value ;----------------------------------------------------------------------------- ; Get a given Flag (into CF) : %macro Flg_Get 1 bt Flag_Reg, %1 ; Read the given Flag. %endmacro ;----------------------------------------------------------------------------- ; Clear all Flags: %macro Flg_Clear_All 0 xor Flag_Reg, Flag_Reg ; Clear all Flags. %endmacro ;----------------------------------------------------------------------------- ; Copy one Flag to another Flag. Uses EAX for scratch. %macro Flg_Cpy 2 ; %1 : destination Flag; %2 : source Flag. Flg_Off %1 ; Clear the Destination Flag xor eax, eax ; eax := 0 Flg_Get %2 ; CF := Source Flag setc al ; AL := CF (value of Source Flag) shl eax, %1 ; Slide this bit up to destination pos. or Flag_Reg, eax ; Write the destination Flag %endmacro ;-----------------------------------------------------------------------------