Well, there goes any chance you had of getting help.inflater wrote:*** EXPLETIVES! ***Good luck finding a Pascal OSDev Forum
inflater
[EDIT]This post was modified by Brendan too - quotes from the previously deleted post modified[/EDIT]
Your code has a few problems....inflater wrote:The problem is:
When trying to write text on console, it works fine, but when i try to read from keyboard (all BIOS ints), it freezes.
Code: Select all
data[0] := inportb($60);
data[1] := inportb($60);
data[2] := inportb($60);
Code: Select all
Port[$20] := $20;
Port[$A0] := $20;
Code: Select all
SetIntVec($74,ADDR(Mouse_ISR));
Code: Select all
dummy_IRQ0:
push ax
push ds
xor ax,ax
mov ds,ax
push word [ (8 + 0) * 4 + 2]
push word [ (8 + 0) * 4]
pop ds
pop ax
retf
dummy_IRQ1:
push ax
push ds
xor ax,ax
mov ds,ax
push word [ (8 + 1) * 4 + 2]
push word [ (8 + 1) * 4]
pop ds
pop ax
retf
dummy_IRQ2:
push ax
push ds
xor ax,ax
mov ds,ax
push word [ (8 + 2) * 4 + 2]
push word [ (8 + 2) * 4]
pop ds
pop ax
retf
Code: Select all
dummy_IRQ0:
jmp far [ cs: <offset_for_array> + 0 * 4 ]
dummy_IRQ1:
jmp far [ cs: <offset_for_array> + 1 * 4 ]
dummy_IRQ2:
jmp far [ cs: <offset_for_array> + 2 * 4 ]
Code: Select all
data[0] := inportb($60);
data[1] := inportb($60);
data[2] := inportb($60);
For the PS/2 controller's buffer, either the keyboard IRQ handler removes the byte in the buffer (when IRQ 1 occurs) or the mouse IRQ handler removes the byte in the buffer (when IRQ 12 occurs). If this buffer is full, then either your keyboard or mouse IRQ handler didn't work.inflater wrote:What should I do with these?
(This is from myself converted mouse driver [on page 1])/quote]Code: Select all
data[0] := inportb($60); data[1] := inportb($60); data[2] := inportb($60);
Only read one byte per IRQ. For example:
Code: Select all
static int index = 0; data[index++] := inportb($60); if(index > 2) { // Process the 3 bytes here index = 0; } send_EOI(); }
inflater wrote:The keyb buffer is full!
What should I do? ;(
Code: Select all
procedure Mouse_ISR;
var index: integer;
label biger_2;
begin
data[index] := inportb($60);
if index > 2 then goto biger_2;
Inc(index);
data[index] := inportb($60);
if index > 2 then goto biger_2;
Inc(index);
data[index] := inportb($60);
if index > 2 then goto biger_2;
Inc(index);
data[index] := inportb($60);
if index > 2 then goto biger_2;
biger_2:
asm cli end;
x := 80;
y := 80;
if data[0] and $01 <> button[0] then begin
button[0] := button[0] xor $01;
if button[0] = 1 then left_button_down(x, y) else
left_button_up(x, y);
end;
if data[0] and $04 <> button[1] then begin
button[1] := button[1] xor $01;
if button[1] = 1 then middle_button_down(x, y) else
middle_button_up(x, y);
end;
if data[0] and $02 <> button[2] then begin
button[2] := button[2]xor $01;
if button[1] = 1 then right_button_down(x, y) else
right_button_up(x, y);
end;
if data[0] and $10 = 1 then x := x + 256 - data[1] * -1 else
x := x + data[1];
if data[0] and $20 = 1 then y := y + 256 - data[2] else
y := y + data[2] * -1;
if y > 184 then y := 184 else if y < 0 then y := 0;
if x > 311 then x := 311 else if x < 0 then x := 0;
index := 0;
asm sti end;
Port[$20] := $20;
Port[$A0] := $20;
pos_mouse(x, y);
end;
Code: Select all
procedure Mouse_ISR;
var index: integer;
data[index] := inportb($60);
index := index + 1;
if index > 2 then begin
index := 0;
// Pre-process the 3 bytes (from the 3 IRQs) here.
end;
Port[$20] := $20;
Port[$A0] := $20;
end;
Again, I am programming REAL mode, so that means - in RM is not required to remap PIC due to CPU errors - in RM is only INT 0 - a divide overflow.because if you dont, you cant tell the differenve between hard-ints, and exceptions
Yes - for example, the double fault handler conflicts with IRQ 0.JAAman wrote:because if you dont, you cant tell the differenve between hard-ints, and exceptionsi dont know why i should remap the PIC.
No.inflater wrote:Again, I am programming REAL mode, so that means - in RM is not required to remap PIC due to CPU errors - in RM is only INT 0 - a divide overflow.
In PM it is different - there are many CPU errors and you MUST remap the PIC.