flat assembler
Message board for the users of flat assembler.
Index
> Main > Some questions: [edi+ecx*3] | PUSH | RAM limit | IDT PIT Goto page Previous 1, 2, 3, 4 Next |
Author |
|
Teehee 02 Mar 2011, 11:20
question
there is a way to shift bits filling them with 1's: 0000 0011 0000 1111 ; shl 2 1111 1111 ; shl 6 1100 0000 1111 1100 ; shr 4 _________________ Sorry if bad english. |
|||
02 Mar 2011, 11:20 |
|
edfed 02 Mar 2011, 11:27
rcl, rcl + stc
only for one shift. Code: stc rcl op1,1 stc rcr op1,1 or for many shifts: Code: mov ah,0FFh shl al,n shl ah,n not ah or al,ah mov ah,0FFh shr ah shr al not ah or al,ah Last edited by edfed on 02 Mar 2011, 11:27; edited 1 time in total |
|||
02 Mar 2011, 11:27 |
|
revolution 02 Mar 2011, 11:27
The closet in x86 with a single instruction is sar. Otherwise just do an or after the shift.
[edit] Just to slightly improve on edfed's suggestion: Code: shl reg,bits or reg,1 shl bits - 1 |
|||
02 Mar 2011, 11:27 |
|
Madis731 02 Mar 2011, 14:29
use shld:
Code: or reg1,-1 shld reg2,reg1,n Last edited by Madis731 on 02 Mar 2011, 14:34; edited 1 time in total |
|||
02 Mar 2011, 14:29 |
|
JohnFound 02 Mar 2011, 14:33
Code:
not eax
shl eax, n
not eax
|
|||
02 Mar 2011, 14:33 |
|
DOS386 03 Mar 2011, 06:47
.
Teehee wrote: 4. in PMode, do i really need to define a IDT NO. As long as no interrupts arrive and no exceptions occur, then you need no IDCT. If nevertheless: BOOM (TripleFault) |
|||
03 Mar 2011, 06:47 |
|
Teehee 03 Mar 2011, 10:48
so why in that tutorial teaches to define one if there is no interupts or exceptions in PM? o.o
|
|||
03 Mar 2011, 10:48 |
|
revolution 03 Mar 2011, 10:51
Teehee wrote: so why in that tutorial teaches to define one if there is no interupts or exceptions in PM? o.o |
|||
03 Mar 2011, 10:51 |
|
Madis731 03 Mar 2011, 12:23
Try this: "you are not required to put on clothes when you go to work"
With interrupts you can: 1) catch mouse and keyboard movement - very useful 2) catch time events - less useful, but you can update clock and measure time (of course there are other ways) 3) usually system functions are implemented through interrupting. For example int 64 (with eax=123), you can "call" system function number 123, which can be helpful to draw images or other stuff... |
|||
03 Mar 2011, 12:23 |
|
edfed 03 Mar 2011, 12:37
yep, IRQ (interupt request) is the link to the outside of the CPU.
without them, the computer is just a non interactive calculator. with them, it becomes a video game, a web browser, a mp3 player, a porn watcher, a pic programmer, etc... |
|||
03 Mar 2011, 12:37 |
|
Teehee 03 Mar 2011, 13:19
but if i cant use INTs in PM, how to catch mouse & keyboard in PM then? o.o
|
|||
03 Mar 2011, 13:19 |
|
revolution 03 Mar 2011, 13:31
Teehee wrote: but if i cant use INTs in PM, how to catch mouse & keyboard in PM then? o.o |
|||
03 Mar 2011, 13:31 |
|
Teehee 03 Mar 2011, 13:34
hmm okay.
|
|||
03 Mar 2011, 13:34 |
|
revolution 03 Mar 2011, 13:37
Just to clarify, you can't catch events, but you can poll for them without using interrupts. It is usually not as convenient to use polling. But one never knows your particular requirements may just be perfect for a polling non-interrupt OS.
Last edited by revolution on 03 Mar 2011, 15:09; edited 1 time in total |
|||
03 Mar 2011, 13:37 |
|
edfed 03 Mar 2011, 14:50
to catch events form keyboard and mouse in PM, first switch in PM with interrupts disabled.
get a good video driver and lib to display infos, it will be usefull for debug later. and then, reprogram pic to revector IRQ0 to 7 to a non reserved vector (INT 20h is the first allowed vector for user in PM), and relocate IRQ 8 to 15 to the next, then, INT 28h. declare a vector for IRQ1 (INT21h) to the keyboard handler declare a vector for IRQ12 (INT2Ch) to the mouse handler. and then, it is ok, you can exploit any jkeyboard and mouse driver source code, by converting them to work in PM memory interface, basically, use32 and assume DS=linear0 |
|||
03 Mar 2011, 14:50 |
|
Madis731 03 Mar 2011, 15:21
If you look at http://board.flatassembler.net/topic.php?p=118339#118339 and open VESA64_15.11_resize.7z , browse to Stage2\PIC_PIT.inc , you can see that the code to do that is really simple. Sorry that I haven't had more time to comment the code, but you can always find support from this site: http://wiki.osdev.org/PIC
|
|||
03 Mar 2011, 15:21 |
|
Teehee 04 Mar 2011, 22:34
I will check.
But first lets go back a lil bit. I need ask why its faster to use a double buffer instead to access directly the video memory. |
|||
04 Mar 2011, 22:34 |
|
edfed 04 Mar 2011, 23:15
take as an example:
you put an image, then, over the image, you put a box, inside the box, you put a text and another image. some pixels will be writen many times before to have their final values. if you do the writes directlly in video memory (that is slow), you will loose a lot of time. that's why it is better to first fill a buffer located in fast RAM, and transfert it in video memory ones it is done. each pixels in video memory will be writen only one time. |
|||
04 Mar 2011, 23:15 |
|
Teehee 04 Mar 2011, 23:23
Thank you, ed.
|
|||
04 Mar 2011, 23:23 |
|
Goto page Previous 1, 2, 3, 4 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.