Changeset 580 in xtideuniversalbios for trunk/Assembly_Library/Src
- Timestamp:
- Feb 19, 2015, 1:38:02 PM (10 years ago)
- google:author:
- krille_n_@hotmail.com
- Location:
- trunk/Assembly_Library/Src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Src/Display/DisplayFormatCompressed.asm
r567 r580 89 89 xor bx, bx 90 90 xchg si, ax 91 jmp shortDisplayPrint_NullTerminatedStringFromBXSI91 jmp SHORT DisplayPrint_NullTerminatedStringFromBXSI 92 92 93 93 DisplayFormatCompressed_Format_x: 94 94 DisplayFormatCompressed_Format_5_x: 95 mov si, 16 ; hex output, change base to 1696 mov bx, (04<<8) + 'h' ; 4 bytes, with postfix character 'h' to emit95 mov si, 16 ; hex output, change base to 16 96 mov bx, (04<<8) + 'h' ; 4 bytes, with postfix character 'h' to emit 97 97 ; (note that the count includes the 'h') 98 jmp DisplayFormatCompressed_Format_u 99 100 DisplayFormatCompressed_Format_2_I: 101 mov si,g_szDashForZero ; preload dash string in case we jump 102 test ax,ax ; if parameter equals zero, emit dash string instead 103 jz DisplayFormat_ParseCharacters 104 ; fall through 98 SKIP2B f ; Fall through to DisplayFormatCompressed_Format_u 105 99 106 100 DisplayFormatCompressed_Format_2_u: 107 mov bh, 2 ; only two characters (instead of the default 5)101 mov bh, 2 ; only two characters (instead of the default 5) 108 102 ; fall through 109 103 … … 111 105 DisplayFormatCompressed_Format_5_u: 112 106 push bx ; push postfix character - either a zero (default) or a 'h' 113 mov bl, bh ; preserve character count for .PrintLoop107 mov bl, bh ; preserve character count for .PrintLoop 114 108 115 109 .DivLoop: … … 119 113 120 114 dec bh 121 jnz .DivLoop115 jnz SHORT .DivLoop 122 116 123 117 .PrintLoop: … … 125 119 126 120 dec bl ; on second to last iteration, emit digit whether it is zero or not 127 jz .PrintDigit 128 129 js short DisplayPrint_CharacterFromAL ; on last iteration, emit postfix character 121 jz SHORT .PrintDigit 122 js SHORT DisplayPrint_CharacterFromAL ; on last iteration, emit postfix character 130 123 ; if it is zero, DisplayPrint_CharacterFromAL will not emit 131 124 132 125 or bh, al ; skip leading zeros, bh keeps track if we have emitted anything non-zero 133 jnz .PrintDigit; note that bh starts at zero, from the loop above134 135 test ch, 2 ; are we padding with leading spaces?136 jnz .PrintLoop; test the even/odd of the format byte in the string126 jnz SHORT .PrintDigit ; note that bh starts at zero, from the loop above 127 128 test ch, 2 ; are we padding with leading spaces? 129 jnz SHORT .PrintLoop ; test the even/odd of the format byte in the string 137 130 138 131 mov al, 89h ; emit space … … 144 137 145 138 call DisplayPrint_CharacterFromAL 146 147 jmp .PrintLoop 148 139 jmp SHORT .PrintLoop 140 141 DisplayFormatCompressed_Format_2_I: 142 test ax, ax 143 jnz SHORT DisplayFormatCompressed_Format_2_u 144 mov si, g_szDashForZero ; if parameter equals zero, emit dash string instead 145 SKIP2B bx ; Fall through to DisplayFormat_ParseCharacters 149 146 150 147 ;-------------------------------------------------------------------- … … 161 158 ; AX, BX, CX, DX, BP 162 159 ;-------------------------------------------------------------------- 163 164 160 DisplayFormatCompressed_BaseFormatOffset: 165 166 161 DisplayFormat_ParseCharacters_FromAX: 167 mov si, ax162 mov si, ax 168 163 ; fall through to DisplayFormat_ParseCharacters 169 164 … … 174 169 ; and must be handled differently. 175 170 ; 176 cmp si, byte 07fh ; well within the boundaries of ROMVARS_size177 mov bx, cs ; preload bx with cs in case we take the following jump178 jb shortDisplayPrint_NullTerminatedStringFromBXSI171 cmp si, BYTE 7Fh ; well within the boundaries of ROMVARS_size 172 mov bx, cs ; preload bx with cs in case we take the following jump 173 jb SHORT DisplayPrint_NullTerminatedStringFromBXSI 179 174 180 175 .decode: 181 176 cs lodsb ; load next byte of the string 182 183 mov ch,al ; save a copy for later processing of high order bits 184 185 test al,0c0h ; check for translation/format character 186 jz DisplayFormatCompressed_TranslatesAndFormats 187 188 and al,03fh ; "Normal" character, mask off high order bits 189 add al,StringsCompressed_NormalBase ; and add character offset (usually around 0x40) 177 mov ch, al ; save a copy for later processing of high order bits 178 test al, 0C0h ; check for translation/format character 179 jz SHORT DisplayFormatCompressed_TranslatesAndFormats 180 181 and al, 3Fh ; "Normal" character, mask off high order bits 182 add al, StringsCompressed_NormalBase ; and add character offset (usually around 0x40) 190 183 191 184 .output: … … 193 186 194 187 .process_after_output: 195 eSHL_IM ch, 1 ; check high order bits for end of string or space196 jns shortDisplayFormatCompressed_ret197 jnc .decode198 mov al, ' '188 eSHL_IM ch, 1 ; check high order bits for end of string or space 189 jns SHORT DisplayFormatCompressed_ret 190 jnc SHORT .decode 191 mov al, ' ' 199 192 call DisplayPrint_CharacterFromAL 200 jmp .decode193 jmp SHORT .decode 201 194 202 195 … … 207 200 ; DisplayFormatCompressed_BaseFormatOffset and jump targets (must fit in 256 bytes) 208 201 ; 209 eSHL_IM ch,1 ; setup ch for later testing of null in .process_after_output 210 and ax,0001fh ; also clears AH for addition with BX and DX below 211 212 mov bx,StringsCompressed_TranslatesAndFormats ; calculate offset of translation/formats offset byte 213 add bx,ax 214 215 cmp al,StringsCompressed_FormatsBegin ; determine if this is a translation or a format 216 217 mov al,[cs:bx] ; fetch translation/formats byte 218 219 jb DisplayFormat_ParseCharacters.output ; check if this a translation or a format 202 eSHL_IM ch, 1 ; setup ch for later testing of null in .process_after_output 203 and ax, 001Fh ; also clears AH for addition with BX and DX below 204 205 mov bx, StringsCompressed_TranslatesAndFormats ; calculate offset of translation/formats offset byte 206 add bx, ax 207 208 cmp al, StringsCompressed_FormatsBegin ; determine if this is a translation or a format 209 mov al, [cs:bx] ; fetch translation/formats byte 210 jb SHORT DisplayFormat_ParseCharacters.output ; check if this a translation or a format 220 211 ; if it is translation, output and postprocess for eos 221 212 ; note that the flags for this conditional jump were 222 213 ; set with the cmp al,StringsCompressed_FormatsBegin 223 214 224 mov dx, DisplayFormatCompressed_BaseFormatOffset; calculate address to jump to for format handler225 sub dx, ax226 227 mov ax, [bp]; preload ax with parameter215 mov dx, DisplayFormatCompressed_BaseFormatOffset ; calculate address to jump to for format handler 216 sub dx, ax 217 218 mov ax, [bp] ; preload ax with parameter 228 219 dec bp ; if no parameter is needed (format 'nl' for example), 229 220 dec bp ; the format handler can reincrement bp 230 221 231 mov bx, 0500h ; preload bh with 5 decimal places for numeric output222 mov bx, 0500h ; preload bh with 5 decimal places for numeric output 232 223 ; bl is zero, indicating not to output a 'h' (default base 10) 233 224 … … 235 226 push cx 236 227 237 mov si,10 ; preload si with 10 for numeric output (default base 10) 238 228 mov si, 10 ; preload si with 10 for numeric output (default base 10) 239 229 call dx ; call the format routine 240 230 … … 242 232 pop si 243 233 244 jmp DisplayFormat_ParseCharacters.process_after_output ; continue postprocessing, check for end of string 245 234 jmp SHORT DisplayFormat_ParseCharacters.process_after_output ; continue postprocessing, check for end of string -
trunk/Assembly_Library/Src/Display/DisplayPrint.asm
r567 r580 125 125 DisplayPrint_WordFromAXWithBaseInBX: 126 126 push cx 127 push bx128 127 129 128 xor cx, cx 130 129 ALIGN DISPLAY_JUMP_ALIGN 131 130 .DivideLoop: 131 inc cx ; Increment character count 132 132 xor dx, dx ; DX:AX now holds the integer 133 133 div bx ; Divide DX:AX by base 134 134 push dx ; Push remainder 135 inc cx ; Increment character count136 135 test ax, ax ; All divided? 137 136 jnz SHORT .DivideLoop ; If not, loop 138 137 138 ALIGN DISPLAY_JUMP_ALIGN 139 139 PrintAllPushedDigits: ; Unused entrypoint OK 140 mov bx, g_rgcDigitToCharacter141 ALIGN DISPLAY_JUMP_ALIGN142 140 .PrintNextDigit: 143 141 pop ax ; Pop digit 144 cs xlatb 142 cmp al, 10 ; Convert binary digit in AL to ASCII hex digit ('0'-'9' or 'A'-'F') 143 sbb al, 69h 144 das 145 145 call DisplayPrint_CharacterFromAL 146 146 loop .PrintNextDigit 147 147 148 pop bx 149 pop cx 150 ret 151 152 g_rgcDigitToCharacter: db "0123456789ABCDEF" 153 154 %endif ; MODULE_STRINGS_COMPRESSED 148 pop cx 149 ret 150 %endif ; ~MODULE_STRINGS_COMPRESSED 155 151 156 152 ;-------------------------------------------------------------------- … … 170 166 DisplayPrint_QWordFromSSBPwithBaseInBX: 171 167 push cx 172 push bx173 168 174 169 mov cx, bx ; CX = Integer base … … 181 176 cmp WORD [bp], BYTE 0 ; All divided? 182 177 jne SHORT .DivideLoop ; If not, loop 183 mov cx, bx ; Character count to CX178 xchg cx, bx ; Character count to CX, Integer base to BX 184 179 jmp SHORT PrintAllPushedDigits 185 180 %endif -
trunk/Assembly_Library/Src/Menu/MenuBorders.asm
r568 r580 388 388 mov si, ATTRIBUTE_CHARS.cNormalTimeout 389 389 cmp di, BYTE MENU_TIMEOUT_SECONDS_FOR_HURRY 390 jnb SHORT .NormalTimeout 391 dec si ; SI = ATTRIBUTE_CHARS.cHurryTimeout 392 .NormalTimeout: 390 sbb si, 0 ; SI = ATTRIBUTE_CHARS.cHurryTimeout (if CF was set) 393 391 call MenuAttribute_GetToAXfromTypeInSI 394 392 -
trunk/Assembly_Library/Src/Util/Memory.asm
r526 r580 159 159 ; CX 160 160 ;-------------------------------------------------------------------- 161 %ifndef EXCLUDE_FROM_XTIDECFG 161 %ifndef EXCLUDE_FROM_XTIDECFG OR NO_ATAID_VALIDATION 162 162 ALIGN JUMP_ALIGN 163 163 Memory_SumCXbytesFromESSItoAL: -
trunk/Assembly_Library/Src/Util/Size.asm
r567 r580 57 57 .MagnitudeConversionLoop: 58 58 ePUSH_T di, .MagnitudeConversionLoop; DI corrupted only on 8086/8088 build 59 %ifdef USE_186 59 60 test bx, bx ; Bits 32...47 in use? 60 61 jnz SHORT Size_DivideSizeInBXDXAXby1024andIncrementMagnitudeInCX 61 62 test dx, dx ; Bits 16...31 in use? 62 63 jnz SHORT Size_DivideSizeInBXDXAXby1024andIncrementMagnitudeInCX 64 %else ; 808x 65 mov di, bx 66 or di, dx 67 jnz SHORT Size_DivideSizeInBXDXAXby1024andIncrementMagnitudeInCX 68 %endif 63 69 cmp ax, 10000 ; 5 digits needed? 64 70 jae SHORT Size_DivideSizeInBXDXAXby1024andIncrementMagnitudeInCX … … 68 74 ; Convert remainder to tenths 69 75 xchg bx, ax ; Store AX 70 mov a x, 576 mov al, 5 ; AH = 0 71 77 mul cx ; DX:AX = remainder * (10 / 2) 72 78 %ifdef USE_186 … … 89 95 ret 90 96 .rgbMagnitudeToChar: db " kMGTP" 91 %endif92 97 93 98 ;-------------------------------------------------------------------- … … 95 100 ; Parameters: 96 101 ; BX:DX:AX: Size 97 ; CX: Magnitude in BYTE_MULTIPLES 102 ; CX: Magnitude in BYTE_MULTIPLES (must be 254 or less) 98 103 ; Returns: 99 104 ; BX:DX:AX: Size in magnitude … … 105 110 ALIGN UTIL_SIZE_JUMP_ALIGN 106 111 Size_DivideSizeInBXDXAXby1024andIncrementMagnitudeInCX: 112 inc cx ; Increment magnitude 113 mov si, 1023 114 and si, ax ; Remainder now in SI 115 ; Fall to Size_DivideSizeInBXDXAXby1024 116 %endif ; INCLUDE_MENU_LIBRARY 117 118 ;-------------------------------------------------------------------- 119 ; Size_DivideSizeInBXDXAXby1024 120 ; Parameters: 121 ; BX:DX:AX: Size 122 ; CX: Must be 255 or less 123 ; Returns: 124 ; BX:DX:AX: Size divided by 1024 125 ; Corrupts registers: 126 ; Nothing 127 ;-------------------------------------------------------------------- 128 ALIGN UTIL_SIZE_JUMP_ALIGN 129 Size_DivideSizeInBXDXAXby1024: 130 %ifdef USE_386 131 shrd ax, dx, 10 132 shrd dx, bx, 10 133 shr bx, 10 134 %else 107 135 push cx 108 xor si, si ; Zero remainder 109 mov cl, 10 ; Divide by 1024 136 mov cl, 10 110 137 ALIGN UTIL_SIZE_JUMP_ALIGN 111 138 .ShiftLoop: 112 139 call Size_DivideBXDXAXbyTwo 113 rcr si, 1 ; Update remainder114 140 loop .ShiftLoop 115 %ifdef USE_186 116 shr si, 6 ; Remainder to SI beginning 117 %else 118 mov cl, 6 119 shr si, cl 141 pop cx 120 142 %endif 121 pop cx122 inc cx ; Increment magnitude123 143 ret 124 144 … … 134 154 ; Nothing 135 155 ;-------------------------------------------------------------------- 156 %ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS 157 %ifdef USE_386 158 %define EXCLUDE 159 %endif 160 %ifdef MODULE_BOOT_MENU 161 %undef EXCLUDE 162 %endif 163 %endif 164 165 %ifndef EXCLUDE 136 166 ALIGN UTIL_SIZE_JUMP_ALIGN 137 167 Size_ConvertSectorCountInBXDXAXtoKiB: ; unused entrypoint ok … … 141 171 rcr ax, 1 ; ...kiB 142 172 ret 173 %endif 174 %undef EXCLUDE
Note:
See TracChangeset
for help on using the changeset viewer.