flat assembler
Message board for the users of flat assembler.
Index
> Main > How to access high memory position |
Author |
|
Matrix 13 Aug 2006, 00:40
this is not possible in pascal.
btw, turbo pascal was written on 286. and there is a built in fpu emulator too. this 1MB limit comes from the beginning (8086), "once upon a time, there was an 8086 microprocessor that didn't have 256MB ram, when the 640k base memory was cool..." "then came the 80286 microprocessors, that could be paired with 80287 floatingpoint units" the 8086 was working at ~4.77-10MHz, has 29000 transistors, in a 40 pin dip package, 16 bit registers, with its 20bit address line, it can address a maximum of 1MB of memory, the 80286 was working at ~8-20MHz clock frequency, and does not have any cache memory, has 130000 transistors, in a 68 pin pga, 16 bit registers, with its 24 bit data line, it can address phisically 16MB, virtually 4GB of memory. the 80286 can work in 2 modes because of the backward compatibility with the 8086: Real Mode: the 8086-os is working in this mode. It is possible to address 1MB of memory in this mode. Protected Mode: multitasking, virtual memory addressing to a maximum of 16 MBytes phisically, maximum 4GB Virtually after enabling A20 line. you can use all of your ram in protected mode, or in unreal mode. i remember Tomasz's kelvar example uses unreal mode. |
|||
13 Aug 2006, 00:40 |
|
fafastrungen 13 Aug 2006, 00:46
I've red all about memory limitation on old x86.
So, there is not anyway to do this ? : mov [134217728], 150 |
|||
13 Aug 2006, 00:46 |
|
0x4e71 13 Aug 2006, 08:18
not without switching to protected mode or flat real mode.
But what Pascal are you using? Freepascal for DOS comes with GO32V2 dos extender, so you can create multi-megabyte arrays and use them. But is it a large array you want to create or just something to peek/poke memory locations with? If what you are trying to do is access the memory location at address 134217728, then you'll have to check the docs of the Freepascal and the go32 unit, there may be a 4GB version of TurboPascal's Mem/MemW/MemL pseudo-arrays. Good luck. |
|||
13 Aug 2006, 08:18 |
|
fafastrungen 13 Aug 2006, 13:44
0x4e71 wrote: not without switching to protected mode or flat real mode. Thanks for the answer. I'm not using pascal at all, I just put the example in pascal becouse I use to program with it. Now I'm learning a little asm and I need to know how access random memory location without limitations. Now is more clear, so thanks again. |
|||
13 Aug 2006, 13:44 |
|
revolution 13 Aug 2006, 13:53
If you use a 32bit OS (Windows95+, LINUX, UNIX) then the memory locations won't be linear, this is because of the paging mechanism. Once you allocate memory (with an OS call) you will get the beginning address of the array. Then you use offsets to get to the data position you need.
|
|||
13 Aug 2006, 13:53 |
|
vid 13 Aug 2006, 15:33
i used to combine turbo pascal and asm to get access to memory >1MB in DOS
|
|||
13 Aug 2006, 15:33 |
|
fafastrungen 14 Aug 2006, 07:27
In fact, I don't use any OS behind, I made my own boot diskette and I boot with it, then I try the programs I build.
What I want is just program the microprocessor directly without an OS behind. Of course I back up with the BIOS's functions (one way or another I use an OS) but nothing more, no DOS, no Windows, no Linux, nothing, just the things I make. In this schema I need to know how can I access to high memory areas. Based on what I've red, 486 and superior machines can directly points to a maximun of 4 GB of memory due to the 32 bits's address bus, but when I try something like this: Buf byte 134217728 dup (?) or mov [134217728], 150 I get an error. |
|||
14 Aug 2006, 07:27 |
|
vid 14 Aug 2006, 11:18
of course, because you start in real mode, where max. allowd offset id 0FFFFh.
i suggest you to search this board for "real mode", "flat real mode", "unreal mode" and read some general info about 386's selectors, protected mode etc. you need lot of theory to understand these, so prepare to few days of study.... |
|||
14 Aug 2006, 11:18 |
|
fafastrungen 14 Aug 2006, 23:57
vid wrote: of course, because you start in real mode, where max. allowd offset id 0FFFFh. Thanks man for the info. |
|||
14 Aug 2006, 23:57 |
|
f0dder 15 Aug 2006, 11:33
matrix wrote:
Look up the "absolute" keyword Dunno if the various 32bit compilers support it, though. |
|||
15 Aug 2006, 11:33 |
|
Matrix 31 Aug 2006, 03:56
f0dder wrote:
i was thinking about the 286 turbo pascal(borland) ofcourse there are 32 bit pascals already, including many libraries. btw, there is himem.sys if you want to use ram in dos, but it won't work as "[128*1024*1024]:=150;" either search for "extended memory usage in asm gate a20" |
|||
31 Aug 2006, 03:56 |
|
Artlav 31 Aug 2006, 09:21
About pascal (standard or 32bit) - you can access any memory location this way:
var p:pbyte; {or ^for any other structure} begin ... p:=pointer($010020F0); //Now p^ is the byte at address $010020F0. //To access next byte do p:=pointer(dword(p)+1); ... end. |
|||
31 Aug 2006, 09:21 |
|
f0dder 31 Aug 2006, 13:16
Well, for 16bit code of course you can't directly access high memory - but you can depend on himem.sys and use "windowed" memory.
|
|||
31 Aug 2006, 13:16 |
|
rugxulo 01 Sep 2006, 03:16
off-topic: FreePascal 2.0.4 is released!
|
|||
01 Sep 2006, 03:16 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.