[Turbo Pascal] Q&A official thread

Page 6/6
1 | 2 | 3 | 4 | 5 |

By popolony2k

Hero (517)

popolony2k's picture

29-06-2016, 17:20

Hi rolandve,

About detecting multiple keys being pressed, you could access the PPI directly to know the state of the keys simultaneously.

There is an example here (taken from my framework):

(*
* Check for the ESC key to stop playing.
*)
Port[$AA] := 7; { PPI keyboard matrix select }
bStopPlaying := ( ( Port[$A9] And 4 ) = 0 ); { ESC key reading }

The port $AA is used to select which keyboard row you'll be reading the $A9 port to know the column status for the selected row. But this method to access the keyboard status is very keyboard dependent because there are a lot of MSX different models, with different keyboard layouts.

Check more information here.

http://map.grauw.nl/resources/msx_io_ports.php#ppi
http://www.angelfire.com/art2/unicorndreams/msx/RR-PPI.html

About multi colored characters without going to the 32 character mode (screen 1??) I really don't know if is possible, but one time I heard something about this feature but using a MSX2 (80 column mode).

About a memory allocation library, did you try the Turbo Pascal standard library procedures/functions GetMem/FreeMem, Mark/Release and related procedures/functions ?

[]'s
PopolonY2k

By rolandve

Expert (113)

rolandve's picture

29-06-2016, 22:21

Hi,

For reading the ESC key, the ord(Ch) value is 27, so measuring this, there is no need to read the ports directly, although accessing ports maybe faster then read(kb,Ch). By using: () and () then {ctrl-enter pressed} should be possible. But, the key matrix is then the real issue Sad

Memory allocation in Pascal is afaik limited to 64K, I want to allocate all available ram if needed.

I saw basic code that used multicolour text, by going to screen 2, color and then pset and then print text. I suppose that can be done in pascal.

Cheers.

By popolony2k

Hero (517)

popolony2k's picture

30-06-2016, 03:33

rolanve,

Yes, the piece of code was taken just to show you an example of how to use the PPI. In this case is easier to use the Turbo Pascal standard calls like Read(kb, ch) and then checking if ch = #27, but in this specific case the software that is using this piece of code has disabled all interrupts, so reading the keyboard using the Turbo Pascal standard procedures/functions won't work. This is the reason I'm retrieving the keyboard status using PPI, but by using PPI is possible to get simultaneous key status, so try to check this idea (the other links I sent before are really very useful).

About memory management functions, you can check Kari's library because he wrote some functions to enable memory mapper use in your Turbo Pascal software. Soon I'll release my two memory mapper implementations (direct and using ROM/BIOS calls) that are a little bit faster and easier than Kari's implementation.

About multicolored text, try to check the Kari's library too, I think that he implemented a good graphic implementation library for Turbo Pascal. Smile

[]'s
PopolonY2k

By AxelStone

Prophet (2505)

AxelStone's picture

30-06-2016, 09:10

popolony2k wrote:

About memory management functions, you can check Kari's library because he wrote some functions to enable memory mapper use in your Turbo Pascal software. Soon I'll release my two memory mapper implementations (direct and using ROM/BIOS calls) that are a little bit faster and easier than Kari's implementation.

[]'s
PopolonY2k

Really interested in BIOS version, sure it can be ported to MSX-C Wink .

By rolandve

Expert (113)

rolandve's picture

30-06-2016, 16:21

AxelStone wrote:

Really interested in BIOS version, sure it can be ported to MSX-C Wink .

Probably: C is slightly more low level and thats where you need to go for these things, but why would you need BIOS if you can use the hardware? Sure BIOS is a library with code, but jumping to and from BIOS also introduces overhead and loss of performance. From a human level, pascal is easier to read, while C doesn't try to hide that its assembler V2, but with a few defines C can be made much more human friendly.

By AxelStone

Prophet (2505)

AxelStone's picture

30-06-2016, 18:36

@rolandve I like BIOS oriented programming, is more standard, I don't mind to lose a bit performance but I feel that MSX is designed use BIOS. In fact, oficial manuals allways says that "commercial software must use BIOS to ensure compatibility".

You are right, Pascal is more human readable.

By rolandve

Expert (113)

rolandve's picture

30-06-2016, 18:43

AxelStone wrote:

@rolandve I like BIOS oriented programming, is more standard, I don't mind to lose a bit performance but I feel that MSX is designed use BIOS. In fact, oficial manuals allways says that "commercial software must use BIOS to ensure compatibility".

You are right, Pascal is more human readable.

Ofcourse using bios ensures that whatever strange machine you have, the program will work, because the factory integrated bios knows the actual hardware. The art is in knowing what needs BIOS to ensure interoperability and what not. Also measuring the code makes sense: sometimes standard libraries are faster then the ones you create, because they use an algorithm which is better Smile

Overall: its a matter of taste, the speed difference is often not experienced by the user Smile

By popolony2k

Hero (517)

popolony2k's picture

30-06-2016, 19:05

I agree that using BIOS is more controlled and safe to produce compatible software for MSX but there are several cases that performance is the main requisite for a software to run.

This is the reason why I have implemented both models for the Memory Mapper functions (direct and using BIOS).

[]'s
PopolonY2k

By AxelStone

Prophet (2505)

AxelStone's picture

01-07-2016, 19:28

@popolony2k A great idea Wink

By raymond

Champion (299)

raymond's picture

15-08-2017, 21:41

I'm busy with textfiles. However, with TP3.3f in the manual they speak about the command append. This command doesn't seem to exist (unknown command or syntax). Does anybody know if this command has been removed from version 3.3f?

Page 6/6
1 | 2 | 3 | 4 | 5 |
My MSX profile