wildchild83 / blastforth Goto Github PK
View Code? Open in Web Editor NEWBlastForth is a development kit for the Sega Genesis/Megadrive system, using the Forth programming language.
License: MIT License
BlastForth is a development kit for the Sega Genesis/Megadrive system, using the Forth programming language.
License: MIT License
Generated ROM image for your Hello World example runs in many emulators, but not on a real Genesis stackup (at least, not with code loaded via a MEGA EVERDRIVE PRO which is how I test).
It also does not run in REGEN v0.97d if you set that emulator to flag illegal memory accesses (in regen.ini set EmulateLockups=1
).
I have debugged it far enough to tell that some code is reading from uninitialized memory (perhaps a variable or a value?) and then using that as a destination to write to.
Code in system/finalize.fs preloads all of RAM with 0xdeadce11, so the bad write is to that address.
Since I don't have time tonight to run this to ground, a hacky work-around is to change the sentinel value from 0xdeadce11 to 0xff8000, which is at least legal to write to and the code can proceed onward.
Here is the relevant code snippet from finalize.fs for the work-around:
\ clear System RAM and CPU registers
\ WAS:
\ rp clear, $deadce11 # d1 move, d2 64 kilobytes cell/ for d1 rpush, loop
\ CHANGED TO
rp clear, $ff8000 # d1 move, d2 64 kilobytes cell/ for d1 rpush, loop
This is an awesome project, and I am having a lot of fun playing around with it.
However, as a Forth dabbler I am finding it very hard to debug issues like the previous one I filed.
Using tools like Regen (debugger build) it is not too hard to tell what memory address is at fault, but then it is hard to map that back to the original word in the *.fs file.
It would be great if the cross-compilation output included a MAP file telling the ROM addresses of the various words and the RAM addresses of the variables and values.
For variables and values, modifying word buffer: like in the following code snippet (I have not verified I am outputting the correct RAM addresses) shows the general idea, but so far I have not been able to pull off the same trick for ROM addresses.
(snippet from system/forth.fs, new code shown in bold)
( ---------------------------------------------------------------------------- )
( Memory Buffers )
( ---------------------------------------------------------------------------- )
create domem& asm tos push, -1 # tos move, [dfa] tos h move, next
{ : buffer: ( u "name" -- ) host-only
save-input bl parse type space ramspace @ hex. cr restore-input drop
create domem& codefield, +ramspace> h, does> ; }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.