OK after reading about three books concerning Z80 CPU assembly. The terrible MSX handbook and offcourse the V9938 manual I started doing some fun stuff on the MSX offcourse starting with a little "hello world" program and after 2 weeks there are finally results. I think I am starting to get it alltogether but something in my logic is still bothering me because I get unexpected results from what I am tring to do right now.
I am trying to learn step by step and after sucessfully reading the keys of the keyboard and getting some tekst on the screen I now try to create a main program loop that exits the entire program after the space key is pressed. I first tried this:
org &hc000 key: equ &HFBE5 ei ;somehow doesn't work without this waitspace: ld a,(KEY+8) bit 0,a ret z jr waitspace end
program behaves as expected. The whole systems hangs in a countless amount of loops until I press the space key and I started running through the house of joy upon seeying that I actually have build my first working routine

however the party has ended here:
org &hc000 key: equ &HFBE5 ei main: call waitspace bit 0,c ;check for return from spacekey routine ret nz (tried z too) ;stop program if true jr main ;otherwise keep burning Z80 silicon waitspace: ;read the space key and set value if true ld a,(KEY+8) bit 0,a jr z,spacep ret spacep: ld c,1 ;set some value for the main loop to do something ret end
You might propably ask yourself what I am trying to do here. Well I am practising. Let me explain. In this exercise I try to build some main loop that will do calls and in the future will parse data to these calls. Then the calls return with some value causing the main routine to do something in return. Well I am doing something utterly wrong let it be my way of thinking or coding so please explain to me what I am failing to understand here.

to my joy but offcourse I wonder if there are no easier ways to do this. I guess my code is ugly and very inefficient and all that parsing of variables is to my guess not the way it should be done. I have build this program by using all the knowledge I could understand from the manuals I have read and by reading through all of the forum thread over here.