Re: [fpc-pascal] Directory Tree

2021-04-10 Thread James Richters via fpc-pascal
Jean, 
Thank you very much for the example!   That gives me a great start and I really 
appreciate the effort you put in.  
Thanks for re-sending it, the first one never came though.

I was able to replace the sample INI file with some of the real data and it all 
came in very nicely!

I'm curious if there is a way that I can make the selections with a normal left 
click.. or better yet make left-click toggle the selection?
So... the same as ctrl-click wihtout holding down control 
I know the normal way you make multiple selections in Windows is with 
CTRL-Click, so I don't know is there is a way to change this that isn't super 
complicated.

James

-Original Message-
From: fpc-pascal  On Behalf Of Jean 
SUZINEAU via fpc-pascal
Sent: Friday, April 9, 2021 7:36 PM
To: fpc-pascal@lists.freepascal.org
Cc: Jean SUZINEAU 
Subject: Re: [fpc-pascal] Directory Tree

(I re-send my mail with different sender, it seem the first one has been 
blocked by orange)

I made a short example based on TTreeView with your data at :

https://github.com/jsuzineau/pascal_o_r_mapping/tree/TjsDataContexte/tools/FileTree

You just need to download all the files , open project FileTree.lpi in Lazarus 
and hit F9.

You can multi-select with Ctrl+Click and see you select with "Get Selection" 
button.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Interruption handling on i8086

2021-04-10 Thread Sven Barth via fpc-pascal

Am 10.04.2021 um 12:15 schrieb Guillermo via fpc-pascal:

El Sat, 10 Apr 2021 10:42:12 +0200
Christo Crause  escribió:

On Sat, Apr 10, 2021 at 10:14 AM Guillermo via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:


Hi pascaloids,

I'm doing DOS development for fun and, after installing the compiler
(was quite hard), I'm having problems handling interrupts.

I started with keyboard and it doesn't work.  The handler
declaration:

   procedure DOS_KbdHandler; interrupt;

but compiler says:

   keybrd.inc(14,29) Warning: Calling convention directive ignored:
   "OldFPCCall"
  

This was fixed in trunk rev 39838 (
https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/pdecsub.pas?r1=39703&r2=39838),
but so far the fix didn't make it into a release yet.  At least for
AVR the warning can be ignored. Not sure why your code doesn't work
properly on i8086 though.

So it whould be fixed in 3.2.2.  Maybe I should install the RC and test
it.
That revision wasn't merged to 3.2.x, so it's not fixed in the RC. I've 
now done so, thus it should be in the final 3.2.2.


Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Interruption handling on i8086

2021-04-10 Thread Guillermo via fpc-pascal
El Sat, 10 Apr 2021 10:42:12 +0200
Christo Crause  escribió:
> On Sat, Apr 10, 2021 at 10:14 AM Guillermo via fpc-pascal <
> fpc-pascal@lists.freepascal.org> wrote:
> 
> > Hi pascaloids,
> >
> > I'm doing DOS development for fun and, after installing the compiler
> > (was quite hard), I'm having problems handling interrupts.
> >
> > I started with keyboard and it doesn't work.  The handler
> > declaration:
> >
> >   procedure DOS_KbdHandler; interrupt;
> >
> > but compiler says:
> >
> >   keybrd.inc(14,29) Warning: Calling convention directive ignored:
> >   "OldFPCCall"
> >  
> 
> This was fixed in trunk rev 39838 (
> https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/pdecsub.pas?r1=39703&r2=39838),
> but so far the fix didn't make it into a release yet.  At least for
> AVR the warning can be ignored. Not sure why your code doesn't work
> properly on i8086 though.

So it whould be fixed in 3.2.2.  Maybe I should install the RC and test
it.

Thanks for the note.

Guillermo "Ñuño" Martínez
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Interruption handling on i8086

2021-04-10 Thread Tomas Hajny via fpc-pascal
On 2021-04-09 19:56, Guillermo via fpc-pascal wrote:


Hi,

> I'm doing DOS development for fun and, after installing the compiler
> (was quite hard), I'm having problems handling interrupts.
> 
> I started with keyboard and it doesn't work. The handler declaration:
> 
> procedure DOS_KbdHandler; interrupt;
> 
> but compiler says:
> 
> keybrd.inc(14,29) Warning: Calling convention directive ignored:
> "OldFPCCall"

I believe that you need to add the "far" modifier after the "interrupt" - at 
least this has been the case with TP/BP and is probably needed at least for 
some memory models supported with FPC for i8086. The {$F+} directive as 
mentioned in your later post is an alternative, but not needed for the whole 
program (it might make it less efficient). I don't know if there are any other 
caveats.

Tomas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Interruption handling on i8086

2021-04-10 Thread Guillermo via fpc-pascal
El Sat, 10 Apr 2021 11:35:18 +0200
Marco Borsari via fpc-pascal  escribió:
> Il 09/04/2021 19:56, Guillermo via fpc-pascal ha scritto:
> > Hi pascaloids,
> > 
> > I'm doing DOS development for fun and, after installing the compiler
> > (was quite hard), I'm having problems handling interrupts.  
> 
> I have this handler from SWAG, hope it would be helpful.
> Marco

Thanks for the code snippet.  It is quite similar to mine, but in
Assembler.  I'll test it (specially the "{$F+}" thing that I didn't know
about).

Guillermo "Ñuño" Martínez
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Interruption handling on i8086

2021-04-10 Thread Marco Borsari via fpc-pascal

Il 09/04/2021 19:56, Guillermo via fpc-pascal ha scritto:

Hi pascaloids,

I'm doing DOS development for fun and, after installing the compiler
(was quite hard), I'm having problems handling interrupts.


I have this handler from SWAG, hope it would be helpful.
Marco
{
Unit for reading multiple keys... works brilliantly, 
although I (Scott Tunstall) didn't write it, I think it was
Lou Duchez. Thanks Lou!
}

Unit NWKBDINT ; 

Interface
Procedure HookKeyBoardInt;  { Take over keyboard handler }
Procedure UnHookKeyBoardInt;{ Return control back to system }

Var
   KeyDown : Array[0..127] of Boolean ;

Implementation
Uses DOS;

Var
   OldInt09 : Pointer ;


{$F+}
procedure NewInt09; assembler;{ new keyboard handler }
  asm
push ax   { push registers }
push bx
push ds
mov ax, SEG @Data
mov ds, ax
in  al, 60h
mov bx, ax
and bx, 007fh { switch high bit of BX to zero }
and al, 80h   { check high bit of port value }
jz @press
@release: { high bit = 1: "release" code }
mov byte ptr keydown[bx], 00h { write 00 to "down" array element }
jmp @done
@press:   { high bit = 0: "press" code }
mov byte ptr keydown[bx], 01h { write 01 to "down" array element }
@done:
in al, 61h{ read port 61h, system ctrl port }
mov ah, al{ save value to AH }
or al, 80h{ set top bit to "1" - reset kbd }
out 61h, al   { write out value to port }
xchg ah, al   { put original value back into AL }
out 61h, al   { rewrite original value in AL }
mov al, 20h   { generate End of Interrupt }
out 20h, al
pop ds{ pop registers }
pop bx
pop ax
iret  { return }
end;
{$F-}


Procedure HookKeyBoardInt;{ Take over keyboard }
Var KeyCount: byte;
Begin
 For KeyCount:=0 to 127 do
 KeyDown[KeyCount]:=False;
 GetIntVec(9,OldInt09);
 SetIntVec(9,@NewInt09);
End;


Procedure UnHookKeyBoardInt;  { Let system do hard work now }
Begin
 SetIntVec(9,OldInt09);
 Mem[$40:$1c]:=Mem[$40:$1a];  { Flush key buffer so
there's no phantom keys }
End;


Begin
 Writeln('Installing NEWKBDINT multiple key handler..');
End.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Interruption handling on i8086

2021-04-10 Thread Christo Crause via fpc-pascal
On Sat, Apr 10, 2021 at 10:14 AM Guillermo via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> Hi pascaloids,
>
> I'm doing DOS development for fun and, after installing the compiler
> (was quite hard), I'm having problems handling interrupts.
>
> I started with keyboard and it doesn't work.  The handler declaration:
>
>   procedure DOS_KbdHandler; interrupt;
>
> but compiler says:
>
>   keybrd.inc(14,29) Warning: Calling convention directive ignored:
>   "OldFPCCall"
>

This was fixed in trunk rev 39838 (
https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compiler/pdecsub.pas?r1=39703&r2=39838),
but so far the fix didn't make it into a release yet.  At least for AVR the
warning can be ignored. Not sure why your code doesn't work properly on
i8086 though.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Interruption handling on i8086

2021-04-10 Thread Guillermo via fpc-pascal
Hi pascaloids,

I'm doing DOS development for fun and, after installing the compiler
(was quite hard), I'm having problems handling interrupts.

I started with keyboard and it doesn't work.  The handler declaration:

  procedure DOS_KbdHandler; interrupt;

but compiler says:

  keybrd.inc(14,29) Warning: Calling convention directive ignored:
  "OldFPCCall"

When running the program in DOSBox it just executes the interruption
once when I press any key and then the interruption doesn't executes
anymore.  I thought the compiler doesn't manage the interruption
enter/exit stuff properly (since it says the calling convention was
ignored) so I tried to add the "CLI" and "STI IRET" by myself, but the
compiler sayd:

  keybrd.inc(21,7) Error: Instruction not supported by the selected
  instruction set

The instruction not supported is IRET.

BTW, I tried the same thing for DOS 32bits (with all the GO32V2 stuff)
and it worked as expected.  I've attached both 16bits and 32bits code,
complete with initialization, handling and finalization.

Do anybody see what I'm doing wrong?  How can I fix it?

Guillermo "Ñuño" Martínez


keyb16.inc
Description: Binary data


keyb32.inc
Description: Binary data
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal