Timeline for How can a Z80 assembly program find out its own memory address?
Current License: CC BY-SA 4.0
32 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 3, 2020 at 18:44 | answer | added | darooman | timeline score: 2 | |
Feb 22, 2020 at 13:09 | vote | accept | twisted | ||
Feb 13, 2020 at 6:01 | comment | added | UncleBod | Looking at question, answers and the questioners comments to answers I find this question even more confusing. It is still unclear why you want the program to guesstimate the adress. In this type of system the starting address need to be known before the program is run, otherwise you can't start the program. A Z80 processor will not relocate the code by itself, neither will a simple monitor program. | |
Feb 13, 2020 at 4:18 | answer | added | Tommy | timeline score: 2 | |
Feb 12, 2020 at 20:13 | comment | added | CJ Dennis | Slight nit-pick: assembly language is the uncompiled code using mnemonics. It gets complied into machine code which is then executable by the CPU. Depending on what you mean by "program" the answer might be "it can't". However, you probably want some instructions that after executing leave the address in a specific register. | |
Feb 12, 2020 at 13:07 | answer | added | the busybee | timeline score: 1 | |
Feb 12, 2020 at 11:31 | answer | added | Janka | timeline score: 1 | |
Feb 12, 2020 at 6:49 | comment | added | Flydog57 | If CP/M is still available, you should consider using it. It's spectacularly simple - programs load at 0x100 and run from there. Back in the day, I wrote real time embedded software for Z-80s, but we did all our dev/debug work in CP/M. When it was time to burn an EPROM, we'd just burn a JMP to 0x100 at address zero and go. The release builds could also run from the CP/M command line - though they'd blow away the "OS" in the process. We'd get it back with a reset and a reload. | |
Feb 12, 2020 at 6:38 | answer | added | George Phillips | timeline score: 4 | |
Feb 11, 2020 at 19:26 | answer | added | user16247 | timeline score: 3 | |
Feb 11, 2020 at 14:38 | comment | added | lvd |
Now the environment is known, so the simplest way is to put POP HL:JP [HL] into the ROM at the known address, for exampe at 0x7FE (last two bytes).
|
|
Feb 11, 2020 at 13:56 | comment | added | Radovan Garabík |
Depends on the environment. E. g. in CP/M it's easy: the address is 100h. The same goes for MS DOS .com programs.
|
|
Feb 11, 2020 at 13:42 | history | edited | Raffzahn | CC BY-SA 4.0 |
edited title, spelling case
|
Feb 11, 2020 at 13:35 | comment | added | Raffzahn | Thanks. Considering the environment, I'm now really curious for the reason you need to determinate the loading address at runtime? After all, it's already defined during assembly time, so all calculation can be done during compile, not wasting any instructions at runtime. | |
Feb 11, 2020 at 13:29 | history | edited | twisted | CC BY-SA 4.0 |
added detail re hardware
|
Feb 11, 2020 at 13:17 | comment | added | Raffzahn | It might be really helpful to add the CPU used, as well as what computer and OS it is about - maybe as well mentioning the Assembler/Linker in use - as all of that may influence what is the right answer. | |
Feb 11, 2020 at 12:41 | history | edited | twisted |
added assembly tag
|
|
S Feb 11, 2020 at 12:39 | history | suggested | Toby Speight | CC BY-SA 4.0 |
Spelling and grammar
|
Feb 11, 2020 at 11:58 | comment | added | UncleBod | Is it a program you write yourself? In that case you will know the address on most systems, since Z80 don:t have any automatic system for relocatable code. There is a small chance the system will relocate loaded programs, but that was not common on Z80 systems | |
Feb 11, 2020 at 11:58 | answer | added | Martin Maly | timeline score: 13 | |
Feb 11, 2020 at 11:28 | review | Suggested edits | |||
S Feb 11, 2020 at 12:39 | |||||
Feb 11, 2020 at 6:01 | history | became hot network question | |||
Feb 10, 2020 at 23:38 | answer | added | Rui F Ribeiro | timeline score: 7 | |
Feb 10, 2020 at 23:20 | answer | added | Raffzahn | timeline score: 5 | |
Feb 10, 2020 at 23:16 | answer | added | lvd | timeline score: 8 | |
Feb 10, 2020 at 22:29 | comment | added | Rui F Ribeiro | This could be platform dependent.... | |
Feb 10, 2020 at 22:22 | answer | added | supercat | timeline score: 23 | |
Feb 10, 2020 at 22:08 | vote | accept | twisted | ||
Feb 11, 2020 at 18:41 | |||||
Feb 10, 2020 at 22:02 | answer | added | Jean-François Fabre | timeline score: 9 | |
Feb 10, 2020 at 21:56 | comment | added | Jean-François Fabre | I don't know the z80 specifically, but I would call a routine, in this routine get the value in the stack to get return address, do a few adjustments & return value in a register: done. | |
Feb 10, 2020 at 21:55 | review | First posts | |||
Feb 10, 2020 at 21:58 | |||||
Feb 10, 2020 at 21:51 | history | asked | twisted | CC BY-SA 4.0 |