Re: [Sdcc-user] quesiton about z80

2009-03-30 Thread Guy Hutchison
If you do a function call, the called routine can examine the stack and find the PC of where it was called from. With a function entry like: _copy_ident: pushix ldix,#0 addix,sp ldc, 4(ix) ldb, 5(ix) ... 0(ix) and 1(ix) should be the origina

Re: [Sdcc-user] quesiton about z80

2009-03-29 Thread Hynek Sladky
Or one instruction shorter (and 17 T states faster): loadhlpc: pop hl jp(hl) But this returns PC for Your code because user code doesn't know about Your loadhlpc function and doesn't call it... IMHO the only way after breakpoint (RST or NMI break request) is to look for br

Re: [Sdcc-user] quesiton about z80

2009-03-29 Thread candida lopez rodriguez
On Saturday 28 March 2009 08:25:13 pm Richard Gray wrote: > The true "hardware debugger" is a logic analyser I suppose - that's what I > often use. One can see all traffic on the various buses using one of these, > and for 8-bit stuff one can pick them up quite cheaply on eBay. > > The other way is

Re: [Sdcc-user] quesiton about z80

2009-03-28 Thread Richard Gray
The true "hardware debugger" is a logic analyser I suppose - that's what I often use. One can see all traffic on the various buses using one of these, and for 8-bit stuff one can pick them up quite cheaply on eBay. The other way is an in-circuit-emulator, but that will still use an RST instruct

Re: [Sdcc-user] quesiton about z80

2009-03-28 Thread candida lopez rodriguez
On Saturday 28 March 2009 06:39:23 pm bob...@comcast.net wrote: > - Richard Gray wrote: > > I think this example puts the stack-pointer into HL, doesn't it? > > > > Sorry! (I just woke up, and there is no pepsi in the house...) > > But isn't this sort of a trick question??? You usually know

Re: [Sdcc-user] quesiton about z80

2009-03-28 Thread bobrob
- bob...@comcast.net wrote: > Now if you really want to know what the SP was when it > hit a breakpoint (IOW, which breakpoint did you hit?), then > the standard way to do that on z80 is to use restart inst., > and then look on top of stack. Make that: Now if you really want to know what the

Re: [Sdcc-user] quesiton about z80

2009-03-28 Thread bobrob
- Richard Gray wrote: > I think this example puts the stack-pointer into HL, doesn't it? > Sorry! (I just woke up, and there is no pepsi in the house...) But isn't this sort of a trick question??? You usually know exactly what the PC is at every point in your program! The stack pointer is

Re: [Sdcc-user] quesiton about z80

2009-03-28 Thread bodrato
Hello! > I need to obtain the PC address (one of the commands that I want to have is > dump the registers). My problem is that I can not see a way to obtain the PC, > I can set it using HL but I do not have a way to obtain its value. There is a > way to do so Usually a programmer knows the addres

Re: [Sdcc-user] quesiton about z80

2009-03-28 Thread Richard Gray
A common way of tackling this problem is to use a restart instruction as a breakpoint, so you replace the instruction you want the breakpoint at with the restart, and then in your restart routine the program counter can be popped off the stack. You will have to check the Z80 instruction set doc

Re: [Sdcc-user] quesiton about z80

2009-03-28 Thread Richard Gray
I think this example puts the stack-pointer into HL, doesn't it? On Saturday 28 March 2009 22:02:04 bob...@comcast.net wrote: > - candida lopez rodriguez wrote: > > I need to obtain the PC address (one of the commands that I want to have > > is dump the registers). My problem is that I can no

Re: [Sdcc-user] quesiton about z80

2009-03-28 Thread bobrob
- candida lopez rodriguez wrote: > > I need to obtain the PC address (one of the commands that I want to have is > dump the registers). My problem is that I can not see a way to obtain the PC, > > I can set it using HL but I do not have a way to obtain its value. There is a > way to do s

[Sdcc-user] quesiton about z80

2009-03-28 Thread candida lopez rodriguez
Hello: I have a question that I hope somebody can help me. I want to create a hardware debugger, this debugger consists of a z80 board with a CTC and a UART. The board is connected to an STD bus. I have several other boards that I do not know if they work, so my idea is to use the board that