Pages: 1
|
 |
|
Author
|
Topic: Add new word to retroforth (Read 2491 times)
|
borisman
Member
 
Karma: +0/-0
Offline
Posts: 6
|
Hi everybody.
I'm trying to improve native RetroForth little bit. I want to make boot loader tell core from what drive it was booted up. For doing this, i need to add new word to the core (either variable or constant (better) )
I've added var marco call in core.asm: ; -------------------------------------------------------------- var 'h0', h, h0 ; h0 (pointer to HERE) var 'base', base, 10 ; base current numeric base var '>in', tin, 0 ; >IN Pointer into the TIB var 'word?', notfound, 0 ; ?word Handler for errors var 'bootd', bootdr, 0 ; <- i added this
And vdev call in core.dict: vdef 'h0', h, h0 ; h0 (pointer to HERE) vdef 'base', base, 10 ; base current numeric base vdef '>in', tin, 0 ; >IN Pointer into the TIB vdef 'word?', notfound, 0 ; ?word Handler for errors vdef 'bootd', bootdr, 0 ; <- i added this
After compile, retroforth starts and crashes. Depending on the initial value (0 or some other) it behaves differently, but very strangely - for example, starts editor right after loading, puts some values on data stack...
What i do wrong ?
|
|
|
|
|
Logged
|
|
|
|
borisman
Member
 
Karma: +0/-0
Offline
Posts: 6
|
Also, for some reason, if i add a single byte to the source blocks, for example, add any text output (even in welome) like this:
." RetroForth 8.0 :: Visit http://www.retroforth.org for updates" cr cr ." GOGOGO " | <- i added this
then compiled image crashes.
|
|
|
|
|
Logged
|
|
|
|
borisman
Member
 
Karma: +0/-0
Offline
Posts: 6
|
Even if i just add spaces or lines to any of the source blocks, the same problem.
I use development version rf8-dev-native.zip, because release version does not work for the same reasons i think.
|
|
|
|
|
Logged
|
|
|
|
Charles Childers
Administrator
Sr. Member
    
Karma: +2/-0
Offline
Posts: 745
|
There seems to be a bug arising when execution of the bootstrap code reaches source/blocks/edit (the final bit of code). I'm looking into this.
|
|
|
|
« Last Edit: July 20, 2005, 12:46:15 AM by Charles Childers »
|
Logged
|
|
|
|
Charles Childers
Administrator
Sr. Member
    
Karma: +2/-0
Offline
Posts: 745
|
Ok, it should work now. The bug was a problem with the boot sector. (It was loading the first 17 sectors, or 8,704 bytes. It now loads 30 sectors, for a maximum size of 15,360 bytes)
This should be enough, at least for a while. Thank you for discovering this and alerting me!
|
|
|
|
|
Logged
|
|
|
|
borisman
Member
 
Karma: +0/-0
Offline
Posts: 6
|
Ok, it should work now. The bug was a problem with the boot sector. (It was loading the first 17 sectors, or 8,704 bytes. It now loads 30 sectors, for a maximum size of 15,360 bytes)
Yeah, you're right, i've discovered that by myself after a day of stupid hacking  By the way, i think this is not a bug, this is intentional. Let everybody choose bootstrap blocks they need to fit into 17 sectors and load other code from blocks. But, currently retroforth can't really work with blocks either It has blockio that works with IDE drives only. This is stopping me little bit. Also, using protected mode is a questionable thing, because nobody can use BIOS calls anymore. And providing disk access implementation for each drive (IDE, FDD, SCSI) is little bit scary. Can we implement real mode callback for calling BIOS 
This should be enough, at least for a while. Thank you for discovering this and alerting me!
O, i think you already knew about this, because bootstrap code is optimized so that it fits EXACTLY in 17 sectors. This should be intentional.
|
|
|
|
|
Logged
|
|
|
|
Charles Childers
Administrator
Sr. Member
    
Karma: +2/-0
Offline
Posts: 745
|
Well, I am going to leave the upper limit at 30 sectors. (This will be needed for some people, especially if they require larger drivers to boot and make use of their hardware.)
ATA/IDE drives are all I have. The driver should work with Serial ATA (sata) as well though. SCSI is harder since there are various formats. I also lack any systems that use SCSI drives.
I'll see what I can do to enable BIOS interrupts. Making sure that nothing gets corrupted in the pmode->rmode switch, and during the BIOS call will be tricky, but is doable. We'll see. (Anybody with experience doing this is welcome to help!)
|
|
|
|
|
Logged
|
|
|
|
Pages: 1
|
|
|
|
|