Hi All
I was wondering if the following would work as a NOP Generator ?
I have a Lower Rom board, If I flash an eprom with all 00 (Zeros)
Would this work.
Thanks
Keep Safe
Ray
in order to work, you ROM code must first initialise all memory to zero, then disconnect ROM :)
the Z80 will run trough all NOPs in RAM
is that what you wanted to do?
Or stick a JP 0 at the end of the rom so it loops back to the start rather than running off the end into uninitialised memory :D
Quote from: roudoudou on 10:43, 04 March 23in order to work, you ROM code must first initialise all memory to zero, then disconnect ROM :)
the Z80 will run trough all NOPs in RAM
is that what you wanted to do?
Hi roudoudou
I wanted to have it run
Continuously to check the address lines on the CPU.
I think Pelrun has an answer
Thanks
Keep Safe
Ray
Quote from: pelrun on 10:56, 04 March 23Or stick a JP 0 at the end of the rom so it loops back to the start rather than running off the end into uninitialised memory :D
Hi PelrunThanks for that,I wanted to have it run Continuously to check the address lines on the CPU.I will give it a try.Keep SafeRay
Just be warned my approach would only run through the bottom 16k, so the top 2 address bits would be always 0. If you need it to run through all 64k, you'll want to do what roudoudou suggested instead.
@pelrun Ok Thanks
I will give your suggestion a try and see how it goes
Thanks
Keep Safe
Ray
Quote from: Audronic on 12:17, 04 March 23Quote from: roudoudou on 10:43, 04 March 23in order to work, you ROM code must first initialise all memory to zero, then disconnect ROM :)
the Z80 will run trough all NOPs in RAM
is that what you wanted to do?
Hi roudoudou
I wanted to have it run Continuously to check the address lines on the CPU.
I think Pelrun has an answer
Thanks
Keep Safe
Ray
yep so just init the RAM and disconnet the ROM, like this
; lower rom code
org 0
xor a
ld h,a
ld l,a
razmem
ld (hl),a : inc l : jr nz,razmem : inc h : jr nz,razmem
ld bc,#7F80+%1100 ; ROM OFF
out (c),c
@roudoudou The Operating system (10.13.6) of the Mac I use is to old for the assembler to work
I will have to have a look for something that works.
Or if you could spare the time could you produce the code and post it.
Thanks
Keep safe
Ray
here is the lower ROM
@roudoudou Thanks
I will burn an eprom and see how it goes
Can you suggest an assembler for the CPC6128
I normally work at the Hardware level
Thanks
Keep Safe
Ray
i use Rasm with my PC (it can compile on any OS) and Orgams on the CPC (but this need a romboard)
Hi All
Cheeky request for the NOP ROM
Also would it be possible to ? Flash the screen, Change a colour or some thing on the screen to tell that its working.
Programming is not my space
Thanks in anticipation
Keep Safe
Ray
Can't you fill up a second 64kb with nop then page it in without the rom enabled and there you have it
Quote from: Audronic on 05:34, 05 March 23Hi All
Cheeky request for the NOP ROM
Also would it be possible to ? Flash the screen, Change a colour or some thing on the screen to tell that its working.
Programming is not my space
Thanks in anticipation
Keep Safe
Ray
Do you mean before it starts running the NOPs?
You can't really do it during, because that would require running code that isn't NOPs which would surely defeat the purpose in the first place?
Quote from: zhulien on 10:35, 05 March 23Can't you fill up a second 64kb with nop then page it in without the rom enabled and there you have it
That is how I would do it, if you have a 6128 anyway. Then there is no need for a special rom at all.
Quote from: andycadley on 13:03, 05 March 23Quote from: Audronic on 05:34, 05 March 23Hi All
Cheeky request for the NOP ROM
Also would it be possible to ? Flash the screen, Change a colour or some thing on the screen to tell that its working.
Programming is not my space
Thanks in anticipation
Keep Safe
Ray
Do you mean before it starts running the NOPs?
You can't really do it during, because that would require running code that isn't NOPs which would surely defeat the purpose in the first place?
on a CPC 6128, there are 8 blocks of 16kb RAM, usually numbered 0 to 7. 0 to 3 make the first 64kb which is paged in by default when you turn on your CPC. 4 to 7 can easily be paged in from &4000 and &7fff 1 at a time. So yes, to setup the 2nd 64kb bank with NOPS you will need to run something first, it can be a small program run from disc, or you could make a custom upper ROM if you really wanted it on ROM.
to select a bank, you ld bc,&7f<bankvalue>, then out (c),c.
the banks value below relates to the bank numbers above:
4 &c4
5 &c5
6 &c6
7 &c7
use &c0 to page the original bank back in. This is a simple explanation and hides some things. In reality there are 8 different arrangements of bank as follows:
&c0 0 1 2 3
&c1 0 1 2 7
&c2 4 5 6 7
&c3 0 3 2 7
&c4 0 4 2 3
&c5 0 5 2 3
&c6 0 6 2 3
&c7 0 7 2 3
As you can see from the arrangements from BASIC if you don't use any RSXs or machine code functions, you can easily page in those banks 4, 5, 6, 7 one at a time to store info in them before switching back to the main one - as long as you do a memory &3fff first, then although you lost lots of BASIC programming area, you are safe to use that extra memory.
From BASIC using that technique, you can poke all the NOPS into banks 4, 5, 6, 7.
What is not so obvious although it should be, if you select arrangement &c2 you will instantly select the alternate 64kb of RAM - of course this will usually not be great for BASIC, but... it does have some odd uses (decoding protected games)... back to this.
In reality, you cannot easily turn off the ROMs with BASIC because it is the ROMs that are running your BASIC program, so you need to resort to machine code for that part - so might as well do the lot in machine code as it is very simple too.
If you make a machine code program that does the following, perhaps load it at &8000 from BASIC and call it. The machine code should:
- for each bank in &c4, &c5, &c6, &c7 select it with the method described above, and fill it with NOPS (from 4000 to 7fff, you can loop or setup 1 and do an LDIR or LDDR), turn off the ROMs using another out, then simply select &c2.
selecting &c2 since ROMs are now off, will run the NOPS from the 2nd 64kb bank indefinitely. I cannot think of a simpler way.
You do need 128kb RAM for this method though.
Quote from: roudoudou on 12:44, 04 March 23Quote from: Audronic on 12:17, 04 March 23Quote from: roudoudou on 10:43, 04 March 23in order to work, you ROM code must first initialise all memory to zero, then disconnect ROM :)
the Z80 will run trough all NOPs in RAM
is that what you wanted to do?
Hi roudoudou
I wanted to have it run Continuously to check the address lines on the CPU.
I think Pelrun has an answer
Thanks
Keep Safe
Ray
yep so just init the RAM and disconnet the ROM, like this
; lower rom code
org 0
xor a
ld h,a
ld l,a
razmem
ld (hl),a : inc l : jr nz,razmem : inc h : jr nz,razmem
ld bc,#7F80+%1100 ; ROM OFF
out (c),c
I like this method for 64kb machines too, it takes advantage that even when ROMs are enabled on the CPC, the writes go to RAM - cannot use LDIR though as it would read memory from the ROM - but certainly can manually loop like that. I think this is the best way to do it if you use a custom ROM.
Hi All
Ok This is getting out of hand, Thanks anyway.
I with to place an Eprom in my Lower rom board that contains the NOP ? Program.
My reason for the NOP Generator is to enable me to look at all the all the address lines ONLY
with an oscilloscope with known sequence of activity.
I was thinking that if I had an indication on the screen that the program was activated
it would be better than a blank screen.
So Perhaps at the start of the NOP Program put some text or some colours on the screen
to show that the NOP is running, and then run the NOP Program.
Thats all I was enquiring about.
Keep Safe
Ray
Quote from: andycadley on 13:03, 05 March 23Quote from: Audronic on 05:34, 05 March 23Hi All
Cheeky request for the NOP ROM
Also would it be possible to ? Flash the screen, Change a colour or some thing on the screen to tell that its working.
Programming is not my space
Thanks in anticipation
Keep Safe
Ray
Do you mean before it starts running the NOPs?
You can't really do it during, because that would require running code that isn't NOPs which would surely defeat the purpose in the first place?
Hi Andycadly
Yes a small program before the NOP Program to display something on the screen at Powerup
Thanks
Keep Safe
Ray
Quote from: Audronic on 23:12, 05 March 23My reason for the NOP Generator is to enable me to look at all the all the address lines ONLY
with an oscilloscope with known sequence of activity.
For this task it would be easier to simply read out values from addresses using a loop.
di
ld hl,0
loop: ld a,(hl)
inc hl
jp loop
Or addressing address lines individually
di
loop:
ld a,(1)
ld a,(2)
ld a,(4)
ld a,(8)
ld a,(16)
ld a,(32)
ld a,(64)
ld a,(128)
ld a,(256)
ld a,(512)
ld a,(1024)
ld a,(2048)
ld a,(4096)
ld a,(8192)
ld a,(16384)
ld a,(32768)
jr loop
@Fessor Thanks for that
I have just burned the
@roudoudou code and will do some tests this afternoon
Thanks
keep Safe
Ray
@roudoudou Thanks for the code
I have burned it into an Eprom and :-
It WORKS, all the address lines have stable readings on them
It is easy to see if the Address lines are OK
Thanks Again
Keep Safe
Ray
There is a missconception with the screen and the understanding how memory works in the CPC and where a Z80 executes programs.
The following assumptions from my end:
1. You want to test all address lines - that means your nop routine need to run throughout the whole memory. (all 64kb).
2. You want to have it as a rom routine, because a program to load cannot erase all memory before it actually runs.
3. You want to output some text to understand if the programm is running correctly.
Here are the missconceptions:
The screen is just memory - so your NOP routine need to have all of that &00 to not crash at some point in your cycle. That means you cannot print anything. The only thing you could do is set the border color as this is not memory dependent. But no text or any graphics is possible.
Also changing the screen color periodically to understand where you are in the programm is not possible as this requires your programm to actually do anything. You have no CPU cycles (during the NOP runs as the CPU shall only execute NOPs) so nothing will happen actually on the CPC other then reading one byte from memory and executing the NOP, then reading next.
There is one idea to output something.
Your pogramm actually does not need to be all NOPs. It would run as well if it is just no loops. So instead of running any loops or jmps, you can have a programm that has one instructions after the next one, so that PC steps through all the addresses.
That could be used to change the border color a lot, or the background color (blue) to any other every now and then. So there is something to see on the screen.
Quote from: SerErris on 11:43, 10 March 23Your pogramm actually does not need to be all NOPs. It would run as well if it is just no loops. So instead of running any loops or jmps, you can have a programm that has one instructions after the next one, so that PC steps through all the addresses.
That could be used to change the border color a lot, or the background color (blue) to any other every now and then. So there is something to see on the screen.
I was thinking that, then I realised I was wrong. If you had a bunch of OUTs to make border rasters, for example, then the GA address will get put on the address bus every time the CPU OUTs a value, messing up your pattern. I guess if you only monitor M1 states on the bus and stick to single instructions it might work.
I guess you could put some display info into #C000 but then page in an Upper ROM full of zeroes so that it runs through NOPs but has something on the screen (it couldn't change but you'd at least know it started ok)
Hmm, you are right, I did not thought about the IORQs...
But M1 would also not give you the right thing, as you would not see any additional bytes of the operation. So for instance LD HL,&4000 would consist of a 3 byte command (opcode + 2 address bytes). If you monitor the M1 line, you would only see the opcode byte address, but not the other two addresses.
So you would actually need to monitor the MRQ (memory request) line to capture all memory reads. That will then give you everything, but still that does not work very well with a logic probe or a oscilloscope.