Well, it’s not 0x5CCB per se, but rather whatever’s held in the PROG system variable. The value will change depending on which peripherals are attached to the Spectrum (and initialized), so don’t just assume it’s 23755.
Memory questions
- Ast A. Moore
- Rick Dangerous
- Posts: 2640
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Memory questions
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Re: Memory questions
If you don't need ALL existing memory you can safely do for example in standard Spectrum 48kB
This leaves area above 24000 for machine code. Your tiny Basic loader starts at 23755 and will fit below 24000
And if your machine code program is short just place it above 32768 so it runs in memory not slowed down by ULA.
Code: Select all
1 CLEAR 24000
2 LOAD "" SCREEN$
3 LOAD "" CODE
4 RANDOMIZE USR 24000
And if your machine code program is short just place it above 32768 so it runs in memory not slowed down by ULA.
Re: Memory questions
IIRC, for Balachor's Revenge I started the program at 24500 and pointed the stack pointer just below it. The stack isn't particularly big during the game, <100 bytes.
I figured that'd be pretty safe for most models, peripherals etc. as I didn't need to return to BASIC for anything. Though it was more a rough guess than anything else.
I figured that'd be pretty safe for most models, peripherals etc. as I didn't need to return to BASIC for anything. Though it was more a rough guess than anything else.
My Speccy site: thirdharmoniser.com
- Einar Saukas
- Bugaboo
- Posts: 3070
- Joined: Wed Nov 15, 2017 2:48 pm
Re: Memory questions
It should be CLEAR 23999Ralf wrote: ↑Wed Apr 04, 2018 1:33 pm If you don't need ALL existing memory you can safely do for example in standard Spectrum 48kB
This leaves area above 24000 for machine code. Your tiny Basic loader starts at 23755 and will fit below 24000Code: Select all
1 CLEAR 24000 2 LOAD "" SCREEN$ 3 LOAD "" CODE 4 RANDOMIZE USR 24000
And if your machine code program is short just place it above 32768 so it runs in memory not slowed down by ULA.
Re: Memory questions
Eagle eyes Einar
Re: Memory questions
Alright, I think I've got a handle on the "memory map" now. I do plan to use ALL available memory (and then some) since I'll be trying to write my project in C for the most part.
Perfect, that's just what I need. At the moment this reads 0x5CCB for me, but I should check that var in my loader or program code so I know exactly where to place my code/data or wtv ends up in that area.Ast A. Moore wrote: ↑Wed Apr 04, 2018 9:42 am Well, it’s not 0x5CCB per se, but rather whatever’s held in the PROG system variable.
- Ast A. Moore
- Rick Dangerous
- Posts: 2640
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Memory questions
For releases, I personally use a machine-code loader placed inside the BASIC file. To run it, I make use of the PROG variable (but there’s an even better way to do it). As for the value that PROG contains, try this experiment (that is, if your emulator can also emulate the Interface 1):
1. “Attach” the Interface 1 and reset the machine
2. Read the PROG system variable: PRINT PEEK 23635+256*PEEK 23636
3. Do CAT 1 (you’ll get an error, but that’s irrelevant)
4. Now read the PROG sys. variable again. The value will change.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
- 1024MAK
- Bugaboo
- Posts: 3104
- Joined: Wed Nov 15, 2017 2:52 pm
- Location: Sunny Somerset in the U.K. in Europe
Re: Memory questions
In case you have not worked it out, the names in the table in the Spectrum manual that define the location in memory where the boundaries are, are system variables. So to find the current location of said boundary, read the appropriate system variable.w00tguy wrote: ↑Wed Apr 04, 2018 2:17 amCode: Select all
--+-------------+-----+-------+------+-----+-------------------+----+-----+-- | Channel | 80h | BASIC | Vars | 80h | Command or prog. | NL | 80h | | information | | prog | | | line being edited | | | --+-------------+-----+-------+------+-----+-------------------+----+-----+-- ^ ^ | | 5CB6h WORKSP (23734) CHANS
Mark
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.