Changeset 589 in xtideuniversalbios for trunk/Assembly_Library
- Timestamp:
- May 22, 2016, 12:26:57 PM (9 years ago)
- Location:
- trunk/Assembly_Library
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Inc/CgaSnow.inc
r52 r589 1 ; File name : CgaSnow.inc 2 ; Project name : AssemblyLibrary 3 ; Created date : 8.10.2010 4 ; Last update : 11.10.2010 5 ; Author : Tomi Tilli 1 ; Project name : Assembly Library 6 2 ; Description : Macros for preventing CGA snow. 7 3 %ifndef CGASNOW_INC … … 9 5 10 6 ;-------------------------------------------------------------------- 11 ; WAIT_RETRACE_IF_NECESSARY_THEN 7 ; CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN 8 ; JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN 12 9 ; Parameters: 13 10 ; %1: Instruction that accessed CGA memory … … 22 19 ; AX, DX 23 20 ;-------------------------------------------------------------------- 24 %macro WAIT_RETRACE_IF_NECESSARY_THEN 121 %macro CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN 1 25 22 %ifdef ELIMINATE_CGA_SNOW 26 23 %ifidn %1, stosb … … 31 28 call CgaSnow_RepMovsb 32 29 %else 33 %error "Invalid instruction passed to WAIT_RETRACE_IF_NECESSARY_THEN"30 %error "Invalid instruction passed to CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN" 34 31 %endif 35 32 %else ; No CGA snow prevention … … 38 35 %else 39 36 %1 ; Single instruction 37 %endif 38 %endif 39 %endmacro 40 41 %macro JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN 1 42 %ifdef ELIMINATE_CGA_SNOW 43 %ifidn %1, stosb 44 jmp CgaSnow_Stosb 45 %elifidn %1, stosw 46 jmp CgaSnow_Stosw 47 %elifidn %1, rep movsb 48 jmp CgaSnow_RepMovsb 49 %else 50 %error "Invalid instruction passed to JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN" 51 %endif 52 %else ; No CGA snow prevention 53 %ifidn %1, rep movsb 54 eSEG_STR rep, es, movsb 55 ret 56 %else 57 %1 ; Single instruction 58 ret 40 59 %endif 41 60 %endif -
trunk/Assembly_Library/Inc/DosFunctions.inc
r446 r589 9 9 DOS_TSR_MULTIPLEX_INTERRUPT_2Fh EQU 2Fh 10 10 11 ; DOS drive and file functions 12 SELECT_DEFAULT_DRIVE EQU 0Eh 13 GET_CURRENT_DEFAULT_DRIVE EQU 19h 14 GET_DISK_TRANSFER_AREA_ADDRESS EQU 2Fh 15 GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE EQU 32h 16 SET_CURRENT_DIRECTORY EQU 3Bh 17 CREATE_OR_TRUNCATE_FILE EQU 3Ch 18 OPEN_EXISTING_FILE EQU 3Dh 19 CLOSE_FILE EQU 3Eh 20 READ_FROM_FILE_OR_DEVICE EQU 3Fh 21 WRITE_TO_FILE_OR_DEVICE EQU 40h 22 SET_CURRENT_FILE_POSITION EQU 42h 23 GET_CURRENT_DIRECTORY EQU 47h 24 FIND_FIRST_MATCHING_FILE EQU 4Eh 25 FIND_NEXT_MATCHING_FILE EQU 4Fh 26 27 ; DOS functions for TSRs 28 SET_INTERRUPT_VECTOR EQU 25h 29 GET_INTERRUPT_VECTOR EQU 35h 11 ; DOS functions 12 WRITE_CHARACTER_TO_STANDARD_OUTPUT EQU 02h ; DOS 1+ 13 WRITE_STRING_TO_STANDARD_OUTPUT EQU 09h ; DOS 1+ 14 SELECT_DEFAULT_DRIVE EQU 0Eh ; DOS 1+ 15 GET_CURRENT_DEFAULT_DRIVE EQU 19h ; DOS 1+ 16 SET_INTERRUPT_VECTOR EQU 25h ; DOS 1+ 17 GET_DISK_TRANSFER_AREA_ADDRESS EQU 2Fh ; DOS 2+ 18 GET_DOS_VERSION EQU 30h ; DOS 2+ 19 GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE EQU 32h ; DOS 2+ 20 GET_INTERRUPT_VECTOR EQU 35h ; DOS 2+ 21 SET_CURRENT_DIRECTORY EQU 3Bh ; DOS 2+ 22 CREATE_OR_TRUNCATE_FILE EQU 3Ch ; DOS 2+ 23 OPEN_EXISTING_FILE EQU 3Dh ; DOS 2+ 24 CLOSE_FILE EQU 3Eh ; DOS 2+ 25 READ_FROM_FILE_OR_DEVICE EQU 3Fh ; DOS 2+ 26 WRITE_TO_FILE_OR_DEVICE EQU 40h ; DOS 2+ 27 SET_CURRENT_FILE_POSITION EQU 42h ; DOS 2+ 28 CHECK_IF_BLOCK_DEVICE_REMOTE EQU 4409h ; DOS 3.1+ 29 GET_CURRENT_DIRECTORY EQU 47h ; DOS 2+ 30 TERMINATE_WITH_RETURN_CODE EQU 4Ch ; DOS 2+ 31 FIND_FIRST_MATCHING_FILE EQU 4Eh ; DOS 2+ 32 FIND_NEXT_MATCHING_FILE EQU 4Fh ; DOS 2+ 30 33 31 34 ; DOS errors 35 ERR_DOS_FUNCTION_NUMBER_INVALID EQU 01h 36 ERR_DOS_INVALID_DRIVE EQU 0Fh 32 37 ERR_DOS_DRIVE_NOT_READY EQU 15h 33 34 38 35 39 -
trunk/Assembly_Library/Inc/Emulate.inc
r586 r589 579 579 580 580 %macro eRCL_IM 2 581 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS 582 %ifdef USE_386 583 %if %2 = 1 584 adc %1, %1 ; Same size but faster on 386 and 486. Fails if %1 is a memory operand. 585 %else 586 eSHIFT_IM %1, %2, rcl 587 %endif 588 %else 581 589 eSHIFT_IM %1, %2, rcl 590 %endif 591 %endif 582 592 %endmacro 583 593 -
trunk/Assembly_Library/Inc/Math.inc
r445 r589 80 80 .ShiftNextBit: 81 81 eSHL_IM ax, 1 82 rcldx, 182 eRCL_IM dx, 1 83 83 loop .ShiftNextBit 84 84 %endmacro -
trunk/Assembly_Library/Inc/SystemTimer.inc
r287 r589 1 1 ; Project name : Assembly Library 2 ; Description : System Timer (8254) relate sequates and macros.2 ; Description : System Timer (8254) related equates and macros. 3 3 %ifndef SYSTEMTIMER_INC 4 4 %define SYSTEMTIMER_INC … … 34 34 CONTROL_WORD_REGISTER_out EQU 43h 35 35 36 ; Timer 2 is connected to PC Speaker that can be controlle rfrom port 61h.36 ; Timer 2 is connected to PC Speaker that can be controlled from port 61h. 37 37 SPEAKER_CONTROL_REGISTER EQU 61h 38 38 FLG_TIMER_2_OUTPUT_in EQU (1<<5) ; AT+ only -
trunk/Assembly_Library/Src/Display/DisplayCharOut.asm
r526 r589 41 41 cmp al, ' ' ; Printable character? 42 42 jb SHORT DisplayCharOut_BiosTeletypeOutput 43 WAIT_RETRACE_IF_NECESSARY_THEN stosw 44 ret 43 JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN stosw 45 44 46 45 ALIGN DISPLAY_JUMP_ALIGN … … 96 95 xchg al, ah ; Swap character and attribute 97 96 inc di ; Skip character 98 WAIT_RETRACE_IF_NECESSARY_THEN stosb 99 ret 97 JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN stosb 100 98 101 99 ALIGN DISPLAY_JUMP_ALIGN 102 100 DisplayCharOut_Character: 103 WAIT_RETRACE_IF_NECESSARY_THEN stosb101 CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN stosb 104 102 inc di ; Skip attribute 105 103 ret … … 107 105 ALIGN DISPLAY_JUMP_ALIGN 108 106 DisplayCharOut_CharacterWithAttribute: 109 WAIT_RETRACE_IF_NECESSARY_THEN stosw 110 ret 107 JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN stosw 111 108 112 109 -
trunk/Assembly_Library/Src/Display/DisplayFormat.asm
r526 r589 269 269 jz SHORT .CopyWithoutDisplayProcessing 270 270 271 WAIT_RETRACE_IF_NECESSARY_THEN rep movsb271 CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN rep movsb 272 272 dec di ; Point to preceeding character instead of attribute 273 273 ret 274 274 275 ALIGN DISPLAY_JUMP_ALIGN 275 276 .CopyWithoutDisplayProcessing: -
trunk/Assembly_Library/Src/Display/DisplayPage.asm
r526 r589 43 43 %ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS 44 44 %define EXCLUDE 45 %ifdef MODULE_HOTKEYS 46 %undef EXCLUDE 47 %endif 48 %ifdef MODULE_BOOT_MENU 45 %ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU 49 46 %undef EXCLUDE 50 47 %endif -
trunk/Assembly_Library/Src/Display/DisplayPrint.asm
r580 r589 296 296 %undef EXCLUDE 297 297 %endif 298 %ifdef MODULE_HOTKEYS 299 %undef EXCLUDE 300 %endif 301 %ifdef MODULE_BOOT_MENU 298 %ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU 302 299 %undef EXCLUDE 303 300 %endif -
trunk/Assembly_Library/Src/File/Drive.asm
r526 r589 86 86 xchg dx, ax ; Default drive to DL 87 87 call Drive_SetDefaultFromDL 88 eMOVZX cx, al; Number of potentially valid drive letters available89 cmp cl,3290 jb SHORT .Return91 mov cl, 32 92 ALIGN JUMP_ALIGN, ret 93 .Return: 88 cmp al, 32 ; Number of potentially valid drive letters available 89 jb SHORT .Below32 90 mov al, 32 91 .Below32: 92 cbw 93 xchg cx, ax 94 94 ret 95 95 … … 133 133 134 134 inc dx ; Default drive is 00h and first drive is 01h 135 mov ax, CHECK_IF_BLOCK_DEVICE_REMOTE ; Needs DOS 3.1+ 136 mov bx, dx 137 push dx 138 int DOS_INTERRUPT_21h 139 pop dx 140 jnc SHORT .DriveIsValid 141 cmp ax, ERR_DOS_INVALID_DRIVE 142 je SHORT .DriveIsNotValid 143 ; Fall back to old method if ERR_DOS_FUNCTION_NUMBER_INVALID 144 135 145 mov ah, GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE 136 146 int DOS_INTERRUPT_21h 147 .DriveIsValid: 148 .DriveIsNotValid: 137 149 dec dx 138 150 test al, al -
trunk/Assembly_Library/Src/Keyboard/Keyboard.asm
r581 r589 291 291 %ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS 292 292 %define EXCLUDE 293 %ifdef MODULE_HOTKEYS 294 %undef EXCLUDE 295 %endif 296 %ifdef MODULE_BOOT_MENU 293 %ifdef MODULE_HOTKEYS OR MODULE_BOOT_MENU 297 294 %undef EXCLUDE 298 295 %endif -
trunk/Assembly_Library/Src/Menu/CharOutLineSplitter.asm
r526 r589 162 162 push si 163 163 push cx 164 WAIT_RETRACE_IF_NECESSARY_THEN rep movsb164 CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN rep movsb 165 165 pop cx 166 166 pop si -
trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
r568 r589 239 239 ; AppendFileFromDTAinDSSItoOffScreenBuffer 240 240 ; Parameters: 241 ; CX: Files/director es found241 ; CX: Files/directories found 242 242 ; DL: Zero if root directory selected 243 243 ; DS:SI: Ptr to DTA containing file information -
trunk/Assembly_Library/Src/Menu/MenuLoop.asm
r581 r589 106 106 %ifndef MENU_NO_ESC 107 107 cmp al, ESC 108 je SHORT .LeaveMenuWithoutSelectingItem 109 %endif 110 cmp al, CR 111 je SHORT .SelectItem 112 113 test BYTE [bp+MENU.bFlags], FLG_MENU_USER_HANDLES_SCROLLING 114 jz SHORT MenuLoop_ProcessScrollingKeysFromAX 115 ret ; Return with CF cleared since keystroke not processed 116 117 %ifndef MENU_NO_ESC 118 ALIGN MENU_JUMP_ALIGN 119 .LeaveMenuWithoutSelectingItem: 108 jne SHORT .NotEscape 109 110 ; Leave menu without selecting item 120 111 call MenuEvent_ExitMenu 121 112 jnc SHORT .CancelMenuExit … … 128 119 129 120 ALIGN MENU_JUMP_ALIGN 130 .SelectItem: 121 .NotEscape: 122 cmp al, CR 123 jne SHORT .NotCarriageReturn 124 125 ; Select item 131 126 mov cx, [bp+MENUINIT.wHighlightedItem] 132 127 call MenuEvent_ItemSelectedFromCX 133 128 stc 134 ret 129 .Return: 130 ret 131 132 ALIGN MENU_JUMP_ALIGN 133 .NotCarriageReturn: 134 test BYTE [bp+MENU.bFlags], FLG_MENU_USER_HANDLES_SCROLLING 135 jnz SHORT .Return ; With CF cleared since keystroke not processed 136 ; Fall to MenuLoop_ProcessScrollingKeysFromAX 135 137 136 138 … … 172 174 .ChangeToPreviousPage: 173 175 call MenuScrollbars_GetMaxVisibleItemsOnPageToCX 174 xchg ax, cx 175 neg ax 176 mov cx, [bp+MENUINIT.wHighlightedItem] 177 add cx, ax 176 neg cx 177 mov ax, cx 178 add cx, [bp+MENUINIT.wHighlightedItem] 178 179 jge SHORT .MoveHighlightedItemByAX ; No rotation for PgUp 179 180 ; Fall to .SelectFirstItem … … 187 188 .ChangeToNextPage: 188 189 call MenuScrollbars_GetMaxVisibleItemsOnPageToCX 189 xchg ax, cx 190 mov cx, [bp+MENUINIT.wHighlightedItem] 191 add cx, ax 190 mov ax, cx 191 add cx, [bp+MENUINIT.wHighlightedItem] 192 192 cmp cx, [bp+MENUINIT.wItems] 193 193 jb SHORT .MoveHighlightedItemByAX ; No rotation for PgDn -
trunk/Assembly_Library/Src/Serial/SerialServerScan.asm
r567 r589 46 46 47 47 test dx, dx 48 jnz shortSerialServerScan_CheckForServer_PortAndBaudInDX48 jnz SHORT SerialServerScan_CheckForServer_PortAndBaudInDX 49 49 50 mov di, .scanPortAddresses-151 mov ch, 1 ; tell server that we are scanning50 mov di, .scanPortAddresses-1 51 mov ch, 1 ; tell server that we are scanning 52 52 53 53 .nextPort: 54 54 inc di ; load next port address 55 xor dh, dh56 mov dl, [cs:di]55 mov dh, 40h ; Clear DH and make sure CF is set if error 56 mov dl, [cs:di] 57 57 eSHL_IM dx, 2 ; shift from one byte to two 58 stc ; setup error code for exit 59 jz .error 58 jz SHORT .error 60 59 61 60 ; … … 63 62 ; 64 63 push dx 65 add dl, Serial_UART_lineControl66 mov al, 09ah64 add dl, Serial_UART_lineControl 65 mov al, 9Ah 67 66 out dx, al 68 67 in al, dx 69 68 pop dx 70 cmp al, 09ah71 jn z.nextPort69 cmp al, 9Ah 70 jne SHORT .nextPort 72 71 73 mov al, 0 ch72 mov al, 0Ch 74 73 out dx, al 75 74 in al, dx 76 cmp al, 0 ch77 jn z.nextPort75 cmp al, 0Ch 76 jne SHORT .nextPort 78 77 79 78 ; … … 84 83 ; *on the server side* if the client side had a 4x clock multiplier, a 2x clock multiplier, or no clock multiplier. 85 84 ; 86 ; Starting with 30h, that means 30h (2400 baud), 18h (4800 baud), 0 ch (9600 baud), and85 ; Starting with 30h, that means 30h (2400 baud), 18h (4800 baud), 0Ch (9600 baud), and 87 86 ; 04h (28800 baud), 02h (57600 baud), 01h (115200 baud) 88 87 ; 89 ; Note: hardware baud multipliers (2x, 4x ) will impact the final baud rate and are not known at this level88 ; Note: hardware baud multipliers (2x, 4x, 8x) will impact the final baud rate and are not known at this level 90 89 ; 91 mov dh, 030h * 2 ; multiply by 2 since we are about to divide by 292 mov dl, [cs:di] ; restore single byte port address for scan90 mov dh, 30h * 2 ; multiply by 2 since we are about to divide by 2 91 mov dl, [cs:di] ; restore single byte port address for scan 93 92 94 93 .nextBaud: 95 shr dh, 196 jz .nextPort97 cmp dh, 6 ; skip from 6 to 4, to move from the top of the 9600 baud range98 jn z .testBaud; to the bottom of the 115200 baud range99 mov dh, 494 shr dh, 1 95 jz SHORT .nextPort 96 cmp dh, 6 ; skip from 6 to 4, to move from the top of the 9600 baud range 97 jne SHORT .testBaud ; to the bottom of the 115200 baud range 98 mov dh, 4 100 99 101 100 .testBaud: 102 101 call SerialServerScan_CheckForServer_PortAndBaudInDX 103 jc .nextBaud102 jc SHORT .nextBaud 104 103 105 104 .error: … … 135 134 SerialServerScan_CheckForServer_PortAndBaudInDX: 136 135 push bp ; setup fake SerialServer_Command 137 138 136 push dx ; send port baud and rate, returned in inquire packet 139 137 ; (and possibly returned in the drive identification string) 140 141 138 push cx ; send number of sectors, and if it is on a scan or not 142 143 mov bl,SerialServer_Command_Inquire ; protocol command onto stack with bh 139 mov bl, SerialServer_Command_Inquire ; protocol command onto stack with bh 144 140 push bx 145 141 146 mov bp,sp 147 142 mov bp, sp 148 143 call SerialServer_SendReceive 149 144 -
trunk/Assembly_Library/Src/Util/Math.asm
r526 r589 36 36 ALIGN JUMP_ALIGN 37 37 Math_DivQWatSSBPbyCX: 38 %if 1 38 39 xor dx, dx 39 40 mov ax, [bp+6] ; Load highest divident WORD to DX:AX … … 53 54 mov [bp], ax 54 55 ret 56 %else ; ~1 57 ; This is about half the size compared to the above code but it's not tested which is why it's commented away. 58 push di 59 mov di, 6 60 xor dx, dx 61 .Next: 62 mov ax, [bp+di] 63 div cx 64 mov [bp+di], ax 65 dec di 66 dec di 67 jns .Next 68 pop di 69 ret 70 %endif ; 1 55 71 %endif 56 72
Note:
See TracChangeset
for help on using the changeset viewer.