Custom C64 eumlator crashes in FreeDOS

DOS specific questions.
Post Reply
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Custom C64 eumlator crashes in FreeDOS

Post by fatman2021 »

Program compiles but crashes when executed. It works when compiles end executed in Linux.

https://raw.githubusercontent.com/fatma ... 510CPU.bas

Image
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Custom C64 eumlator crashes in FreeDOS

Post by D.J.Peters »

print (&H10FFFFFF*2 + &H00FFFFFF) / (1024*1024)
sleep

You allocate 560 MB in DOS or DOSBOX that must fail !

it's a crime what you do with my elegant code ;-)

Joshy
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Custom C64 eumlator crashes in FreeDOS

Post by fatman2021 »

Test programs

Code: Select all

10 a$ = "press <cr> to exit."
20 adr = 679: rem gpu address 
30 gosub 200: X = 8: y=8
40 rem display message
50 for a=1 to len(a$)
60 poke adr+4,x: poke adr+8,y
70 poke adr+9,asc(mid$(a$,a,1))
80 for b=10 to 17 
90 poke adr+b,255
100 next b
110 poke adr, 5
120 x=x+9
130 next a
140 rem wait until <cr> key is pressed
150 poke adr+1,13:poke adr,7
160 rem sets 384x264x8-bit video mode
170 poke adr+3,1: poke adr+4,128
180 poke adr+7,1: poke adr+8,8
190 poke adr+12,8: poke adr,4
200 rem sets 640x480x32-bit video mode
210 poke adr+3,2: poke adr+4,128
220 poke adr+7,1: poke adr+8,224
230 poke adr+12,32: poke adr,4
240 return

Code: Select all

10 adr=679: rem gpu
20 rem imagecreate
30 poke adr+3,1: rem offset in vram
40 poke adr+7,255: rem width
50 poke adr+11,255: rem heigth
60 poke adr+19,8: rem depth
70 poke adr,9 call imagecreate
80 for x=0 to 255
90 for y=0 to 255
100 rem pset
110 poke adr+3,1: rem offset in vram
120 poke adr+7,x: rem x
130 poke adr+11,y: rem y
140 poke adr+15,x: rem color x
150 poke adr,12: rem call pset
160 next y
170 next x
180 rem put
190 poke adr+3,1: rem offset in vram
200 poke adr+7,0: rem x
210 poke adr+11,0: rem y
220 poke adr+12,0: rem method
220 poke adr,14: rem call put

Code: Select all

10 adr=679: rem gpu
20 rem string address: 53300
30 poke adr+3,208: poke adr+4,52
40 file$="TEST.BMP"
50 poke adr+8,len(file$)
60 for i=0 to len(file$)-1
70 poke 53300+I,asc(mid$(file$,i+1,1))
80 next i
90 poke adr+12,0
100 poke adr,23 : rem call bload
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Custom C64 eumlator crashes in FreeDOS

Post by fatman2021 »

D.J.Peters wrote:it's a crime what you do with my elegant code ;-)
Your version locks up in both FreeDOS and DOSBOX....
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Custom C64 eumlator crashes in FreeDOS

Post by D.J.Peters »

Why do you allocate 560 MB ?

Joshy
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Custom C64 eumlator crashes in FreeDOS

Post by fatman2021 »

D.J.Peters wrote:Why do you allocate 560 MB ?

Joshy
Most modern computers can access at least 512MB of RAM(for embedded systems). Also 32-bit protected mode programs should be able to address up to 4GB of RAM.
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Custom C64 eumlator crashes in FreeDOS

Post by counting_pine »

Try the following:

Code: Select all

type T
    a(560e6) as byte
end type
var p = new T
print p
delete p
If this code fails, there's not much you can do.
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Custom C64 eumlator crashes in FreeDOS

Post by fatman2021 »

counting_pine wrote:Try the following:

Code: Select all

type T
    a(560e6) as byte
end type
var p = new T
print p
delete p
If this code fails, there's not much you can do.
It works when using the -t command line option.
-t Set .exe stack size in kbytes, default: 1024 (win32/dos)
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Custom C64 eumlator crashes in FreeDOS

Post by counting_pine »

Does the stack size make a difference? I wouldn't have expected it to, since it shouldn't be allocating on the stack.
If allocating 560MB works, then guess other things to try then are:
- try smaller amounts of memory. Is there a point below which it succeeds?
- print something after the two 'new' statements - does it get that far?
But at some point I'm going to run out of ideas..
I presume, by the way, that it is working on other platforms?
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Custom C64 eumlator crashes in FreeDOS

Post by fatman2021 »

counting_pine wrote:Does the stack size make a difference? I wouldn't have expected it to, since it shouldn't be allocating on the stack.
If allocating 560MB works, then guess other things to try then are:
- try smaller amounts of memory. Is there a point below which it succeeds?
- print something after the two 'new' statements - does it get that far?
But at some point I'm going to run out of ideas..
I presume, by the way, that it is working on other platforms?
It works fine as is on Linux.
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Custom C64 eumlator crashes in FreeDOS

Post by fatman2021 »

I changed lines 59 through 64 as follows:

Code: Select all

  as any ptr  vram  (&H0000FFFF) ' Video Ram
  as ubyte    ram   (&H0000FFFF) ' System Ram
  as ubyte    kernal(&H00001FFF) ' OS
  as ubyte    basic (&H00001FFF) ' Basic
  as ubyte    char  (&H000007FF) ' Font
  as ubyte    col   (&H000003E7) ' color triples
Now it locks up like D.J.Peter's version did.
Post Reply