Controlling the emulator from the zx program

ZXNet echo conference «zxnet.pc»

From Andrey Bogdanovich To All 6 March 2006

Hello, All Behind this mysterious title lies a request to respected emulator authors make it possible to slightly control the emulator from the emulated program. Specifically interested in the ability to turn on/off maximum speed (it would be convenient to correct it to enable it during compilation), modes screen (in the same setting enable/disable Anti64 mode). To avoid false positives, you can enter a disabling setting in the config this feature. What will the management itself look like? For example like this: LD HL,#0102 LD HL,(#1234) Where in H is the number of the operation, in L is the value of this operation, and according to codes #21 xx yy 21 34 12 the emulator determines that it is knocking on its door. You can enable and read the current settings, for this in H or L set the 7th bit. Of course, there are a lot of implementation options, I’ll adjust the design to suit any one and post it for everyone. p.s. As far as I remember in the US there was once something similar...

From Slavik Tretiak To All 6 March 2006

Hello Specter why bother with emulator bullshit if KAY has been around for a long time (the turbo hangs on the port)

From Andrey Bogdanovich To All 6 March 2006

Hello Sinus There is also Scorpio, where the turbo is turned on and off by software, but Emulators don't support this anyway. In general, the question was broader, not because of one turbo “to block out emulator bullshit.” Read the first message carefully.

From Vladimir Kladov To All 6 March 2006

Hello Specter If I do, I don’t like this interface. Why slow down even one command (LD HL,(xxxx)), adding a check of the address there or some other conditions, when ZX has a bunch of unused commands. How, for example, is SLT Trap made for loading levels: ED FB. In the same way, it is better to do ED FF - check for support for a set of functions, changes the value of A. That is if nothing is done and nothing is maintained, then This command doesn't change anything. If there is support for extensions (control emulator), then XOR A: DB $ED, $FF - and in A - a set of up to 8 flags. Let's say bit 0 - speed control support. And then LD HL,xxxx : ED FE - changes speed. The xx values are for example: 0 - pause, 10 - 10%, 50 - 50%, 100 - 100%, 255 - 255%, 65000 - 65000%, 65535 - full throttle

From SMT To All 6 March 2006

Hello, Vladimir Kladov All this is bullshit, because it is necessary to unify the interface for all emulators, which hardly possible due to differences in features that emulator authors will want to include via API (EDFF, by the way, was previously in unreal)

From Andrey Bogdanovich To All 6 March 2006

Hello SMT SMT> all this is bullshit, because it is necessary to unify the interface for everyone SMT> emulators, which is hardly possible due to differences in features that SMT> emulator authors will want to enable it via the API (EDFF, by the way, was previously available SMT> unreal) Absolutely true. I think you need something like this: Functions 0..#3f - common to all emulators, such as speed control, timing, memory models, etc Functions #40..#4f - US specific features Functions #50..#5f - specific features of EMUZWIN etc. To have something to start with, let's make function N0, speed control emulator, where 0..250 is the Z80 speed as a percentage of the “standard” one, 255 is maximum possible.

From Vladimir Kladov To All 6 March 2006

Hello Specter Let's not touch ED 00 - ED 3F, but (or vice versa ED C0 - ED FF, but everything is already there equals SLT Trap, it seems to be a de facto standard)? Moreover, in some in the ancient emulsion ED 00 - ED 3F they were full to capacity. In general, you need to use less less "stairways". The function number can be transferred, for example, to A, additional. parameters if necessary in DC, DE, HL, also at the output if you need to receive something. Then, in this sense, ED FF is a check for the presence of a feature, and ED FE is a function (number in A - you can keep the same numbers, and there will still be a reserve). Will that work? Then A=0 is speed control, A=1 is “reading” speed in HL (one could do it at once, in HL - return the previous one, but if you suddenly don’t do this is it necessary, it’s better not to pull the emulator, or then you need to highlight some value - "leave speed" unchanged). As for 254 maximum - it won't be enough. I just drove RZXs today, I have Almost all are running at 1500%, some are running at 3000%, and some are running at 5000%. Why not and then don’t ask in HL. In 10 years, 65000% will be normal.

From Vladimir Kladov To All 6 March 2006

Hello, Vladimir Kladov I think what is missing is the definition of the emulsion type. Let in the same ED FF in HL returns two letters: H='U

From Andrey Bogdanovich To All 6 March 2006

Hello SMT These ED nn commands have given in to you. I like the sequence better consists of documented commands (so that problems with assemblers and debuggers was not), but with near-zero probability it occurs in real code. I don’t see the point in detecting an emulator at all. And what should I do? program if it wants to enable pentagon mode, but it fails? Nothing! Therefore, it is enough to turn on something, and if it does not turn on, the user is to blame, which has disabled it in the emulator or is using the wrong version. I somehow I doubt that even reading the current values will be needed.

From Witch Doctor To All 6 March 2006

Hello, Vladimir Kladov Finally!!! It's high time!!!

From Vladimir Kladov To All 6 March 2006

Hello Specter 2Smt: Actually, EDFF is pure NOP. So you can’t double-check it 100 times. necessary. If this ladder changed anything, then this is the ladder :) 2Spectre: if you do something, then let it be on separate teams, and it won’t affect not a fraction of a microsecond on the speed of execution of other commands. And we earlier they didn't do anything and everything was fine. Let it be now. You can always option/configuration to disable/disable.

From Vladimir Kladov To All 6 March 2006

Hello SMT if such a miracle comes across, it won’t take long to chop it off - in the options (especially if the options are cut off by the config on the fly). This is when ED FF herself is in this Xorka is being performed. Why would anyone in their right mind do it? Just to make things worse isn't it...

From SMT To All 6 March 2006

Hello, Vladimir Kladov you need to use a minimum of traps (that is, one, for example, #EDFF) and recheck 100 times (for example, I used to have a 6-byte signature 'unreal' in registers bc,de,hl) for some undocumented super-test team did not accidentally run into a trap. on the other hand, coders will say that It’s inconvenient to use very long API call procedures. now I I thought about this option - make 1 function that checks a bunch of conditions (to avoid accidental triggering), returns the type and version of the emulator and sets a flag that allows EDFF to be accessed with lightweight parameters (without double-checking). checkbox cleared on reset or boot new snapshot Spe> Functions #40..#4f - US specific features Spe> Functions #50..#5f - specific features of EMUZWIN one person wants an auto-enable feature in his editor text64, and in the registers indicate the address and other parameters of the font. and then this one The function will appear in another emulator, but with a different enable code. here it will be It's a joy to detect the emulator type and enable the mode in different ways ;-)

From SMT To All 6 March 2006

Hello, Vladimir Kladov Vla> if such a miracle comes across, it won’t take long to chop it off - in the options (especially if Vla> options are cut off by the config on the fly). This is when ED FF herself is in this Vla> xorke is executed but try to guess what exactly needs to be cut off. especially when this #EDFF was It was made six months ago and there were no such problems before Vla> Why would anyone in their right mind do it? Why in the right mind would you put greetings in the bootloaders between the XORs? why on these greetings transfer control, fall into ROM-48 by mistake or calculator and run the following raskorka as a message handler rst#08? go understand these spektrumists. and foreign ones were no different ;-)

From SMT To All 6 March 2006

Hello, Vladimir Kladov Vla> Actually, EDFF is pure NOP. So 100 times Vla> There is no need to double-check. If this ladder changed anything, then this ladder necessary. this #EDFF may be among the garbage inside the xorca. if it affects registers, it won’t get messed up

From SMT To All 7 March 2006

Hello Specter line is fine. or maybe, in fact, make it so that the emulated the machine had no way of knowing that TRAP had been activated? all the necessary functions (even hypothetical) do not require data return: speed, post-processing modes picture/sound, stereo layout for AY

From SMT To All 7 March 2006

Hello, Vladimir Kladov Vla> In theory, a lot of things can be done through the ladders. Ask for a cut Vla> equipment. Enable the desired model the model is incorrect. for good reason, after changing the model (i.e. ROM and ports memory) needs reset. the trap that calls reset is useless. unless it's a model, and temporary buildings (what for are coders) Vla> Yes, at least implement a 3D graphics engine and there will be exactly 1 game for this engine, written by the author of the emulator ;-) Vla> the current speed can be done to find out. For example - Vla> found out, saved, put up a new (large) one, did some work, turned on the old one I very much doubt that they will use values other than normal/max. There is no point in speeding up an interactive program or demo a little (if there is one, the user himself This will be done in the emulator settings. but there is no need to force it), it will be in real money slow down It’s easier then to write a full-fledged pisish version Spe> it’s another matter to save IX, call the ladder, calculate the CRC received Spe> lines, compare with the required one, restore IX. This is already byte 50 Spe> will pull a little smaller - ┌─- CODE ─── call nn db 'emulator traps' nn: pop ix dw #FFED └── CODE ─── I knew that the coders would rush to count the bytes ;)

From Andrey Bogdanovich To All 7 March 2006

Hello SMT SMT> line - normal. The line is wild. It’s one thing to cram 5 bytes into the program code with STS, turning on the turbo, it’s a completely different matter to save IX, call the ladder, calculate the CRC the resulting string, compare with the required one, restore IX. This is already 50 bytes will pull. This means you won’t remember them from memory, and you’ll have to look for the place. Moreover, I repeat once again: there is no need for ED and other prefixes if I use this code I want to disassemble, will the disassembler understand it? Plus in different assemblers different designations for undocumented commands. SMT> and can, indeed, make sure that the emulated machine does not SMT> had the opportunity to know that TRAP was triggered? all the necessary functions (even SMT> hypothetical) do not require data return: speed, modes SMT> image/sound post-processing, stereo layout for AY Here, we are getting closer and closer to Spectrum programmers. :)

From Vladimir Kladov To All 7 March 2006

Hello SMT Well, why, you can speed up the current one to find out. For example - I found out, saved it, put up a new (larger) one, did some work, turned on the old one. Other The thing is that for this feature you can add another option - like do not react. A cool for example: an audio player that reads the emulation speed, adjusts audio speed so that it goes at normal speed hehe. In theory, a lot of things can be done through the ladders. Ask to cut the equipment. Enable the desired model. Yes, at least implement a 3D graphics engine. :)

From Vladimir Kladov To All 7 March 2006

Hello SMT I'll set it to off by default. If he turns it on and doesn’t know why he did it, This is a user problem. But it's unlikely to be a serious problem. Well. You can do this thing: let IX point to when calling these features line in memory: 'Emulator traps'. Is that enough?

From Vladimir Kladov To All 7 March 2006

Hello SMT I’ll say right away: whether it’s good or bad, I did it on purpose so that the model could be changed on the fly and, if possible, without having to do a reset. By at least if ishra is already working - what for does it need ROM. And for RAM, many RAMs and so on converge. “Changing the model” in this case is simply a transition to another decryption ports, different multicolor, timing, sound. Overall it helped me a lot debugging multicolor, when I still didn’t know what color this or that deme was for sharpened. True, in this case, I took care of the timing, I have models as such It didn’t exist then. Let the user do the reset if he wants.

From Witch Doctor To All 7 March 2006

Hello SMT Well, why doesn’t it work like it did in Unreal? That's right: you can diss it, etc. too I doubt the need for normal and max speeds... well, maybe 200% turbo??? I will also support independence from the emulator. just functions. why do the authors of emuline make a standard, so to speak. There are many function numbers in 1 byte, here they are divide, support similar ones, divide different ones and all things... in short, Specter - let's see how it will be exactly... I'm FOR it with all my limbs! oft: SPECTER!!! - how is QC 311B with sprView??? :confused:

From Vladimir Kladov To All 7 March 2006

Hello, Vladimir Kladov and I don’t give a damn whether a specific disassembler will understand or not understand this instructions (mine will understand, he's smart :)). It is more important to me that with the prefix ED - I I just go through the table of jumps in the emulator, if it’s a trap, then it starts there is something to do there, and if it’s not Trapovsky, then there’s no need to do anything. From what By the way, I have to add PC clock cycles to analyze additional conditions in the usual team. She must do what she is supposed to do - for the minimum amount beats, and run further. It just seems like the emulator has a lot of time to spend. frame emulation (70,000 clock cycles - big deal). And if any graphics mode like HQM or Blur motion? What if the emulator is running on a slow PC? - up to 200 MHz? I only agree to ED prefixes (other unused commands would also fit, but there are not many of them equivalent to NOP). Actually, I already done, all that remains is to add that along IX lies “that line”. But the code is true why do you start counting bytes? But it’s already 99.999999% that no Xorks will break. I don't understand about CRC. What other CRC? Here is the interface I implemented, verbatim: PUSH IX:LD A,0:LD IX,strap:DEFB $ED,$FF:POP IX RRCA:JR NC,@1;if there is no transition, then there is support for speed-control, HL='EW' PUSH IX:LD A,1:LD IX,strap:DEFB $ED,$FE:POP IX ;HL=current speed HL=new_speed PUSH IX:LD A,0:LD IX,strap:DEFB $ED,$FE:POP IX;new speed set strap: DEFB 'Emulator traps'; the final byte or flag is not needed in the line (No, well, you can optimize it, I wrote it in a simple way for clarity. Already it is clear that this is the same code, and by self-modification it is possible reuse so as not to duplicate 3 times). Another potential possibility: make a plugin that will treat additional ladders. Pass block addresses to this plugin processor memory and registers, and let him do what he wants with them. Possible application: drain-stub for future functionality, which is simpler implement at first while the program is debugged not by code in the spec, but by code in PC. Or a trap-stub for accessing some external equipment that is still not ready for real connection to the spec (but there is a chance to emulate it on PC or just contact him at the PC), but I want to test it and make software necessary (and possible) at the same time or “before”.

From SMT To All 9 March 2006

Hello Specter Spe> In short, almost the entire US config needs to be rewritten here What are you doing, people! what except max. speed will actually be used in programs? yeah, you know better than the user what he simply needs FullScr, and that with vsync it has enough performance and the video card does not glitch Spe> Just one question: is it necessary to check for the presence of ladders no one is forcing you. turn on the speed immediately, without checking what happened (and if it doesn’t work out, who should I complain to?) unless I implement the idea with a flag, when the #EDFF trap requires a line in IX and returns the emulator version, checks the box. a subsequent calls to #EDFE no longer require the use of IX (if the flag installed)

From Andrey Bogdanovich To All 9 March 2006

Hello, Vladimir Kladov Vla> Here is the interface that I implemented, verbatim: Vla> Vla> PUSH IX:LD A,0:LD IX,strap:DEFB $ED,$FF:POP IX Vla> RRCA:JR NC,@1;if there is no transition, then there is support for speed-control, Vla> HL='EW' Vla> Vla> PUSH IX:LD A,1:LD IX,strap:DEFB $ED,$FE:POP IX Vla> ;HL=current speed Vla> Vla> HL=new_speed Vla> PUSH IX:LD A,0:LD IX,strap:DEFB $ED,$FE:POP IX Vla> ;new speed set Vla> Vla> strap: DEFB 'Emulator traps'; final byte or flag is not needed in Vla> line Well, if it’s more convenient for the authors of emulators, then do it that way. I, as I wrote in the first message, I will support any standard. Just one question: is it necessary? check for the presence of ladders (it would be more convenient for me not to) before starting to work with them? All that remains is to decide on the necessary operations and their numbers. My option is this: Memory model: PENTAGON, SCORPION, KAY, PROFI, ATM450, ATM710 Memory size: 0 = 0Kb, 255 = 4096Kb (that is, each one corresponds to 16Kb) CMOS type: none, DALLAS, 512Bu1CMOS size: 0..32Kb (in 1Kb increments) EFF7mask SMUC features RESET to: BASIC,DOS,MENU,SYS,CACHE,... Keyboard Layout Mouse type: NONE/KEMPSTON/AY/emulate kempston joystick on mouse Mouse Scale Swap mouse buttons Frame ; t-states in frame Paper ; t-states before paper Line ; t-states in line int ; int frequency intlen ; int length in t-states EvenM1 ; align M1 cycle to even T-state (for scorpion) 4TBorder ; update border every 4T states (for scorpion) FloatBus ; unstable data bus, unstable data bus in TR-DOS mode AtmPalette VSync Full Screen Border size [...] In short, almost the entire US config needs to be rewritten here. Just throw it away the ability to change the screen frequency, disk and other system features, that is, that only the user himself should change.

From Witch Doctor To All 9 March 2006

Hello SMT Is it really usable? Anti64 is a must!

From Vladimir Kladov To All 9 March 2006

Hello Specter Right now. Whatever we have enough of, we will support. What is anti64? What is 64 against? Video effects and full screen inclusion are the prerogative of the user after all, and not Spekovskaya program. Spec's programs are actually necessary for real life (hm, sort of) be done, not for the emulsion. Emulsion, as I understand it, is for people who cannot tolerate the smell of burnt rosin, and vice versa for hardware developers to get their ideas implement faster and more accurately.

From Vladimir Kladov To All 9 March 2006

Hello, Witch Doctor So I didn’t understand. Let it turn on the text video mode under ATM and that’s it. Or Why am I not getting it?

From Witch Doctor To All 9 March 2006

Hello, Vladimir Kladov What are you doing, Volodya??? Many of us need this for 1 only ALASMA with a 64 character font. That's all. So that we can I turned this thing on myself at startup, and turned it off during vacation. This is an idiot's dream :) Specter, am I speaking correctly???. Same for max. speed when compiling the same alasma. Of course, it’s better in ZXemuASMe - not everyone wants something... But the rest of the options... IMHO optional, probably...

From Vladimir Kladov To All 10 March 2006

Hello, Witch Doctor Ah, well, that’s for unreal. I don't see such a filter. Author alasma alive and well, but doesn’t want to convert the ASAM to ATM? This is not good. There are more Pentagon with 512x192, also high resolution. (There are also 384x304, a little there will be less, right now I’m downloading ZX-Guide, like someone somewhere gave it to someone in The quality of the answer to the question about this regime is a hint. Somehow this doesn’t suit me I like it. Electronic media should be more accessible. Like clicked on Google - and uploaded the text. Is it difficult for the authors of their “media” to post texts? No, let him suffer, load it into the emulator and read it in the original, in a poor square font, poor keyboard control... And most importantly, Google does not index the content archives, and even in the form of scl-trd files!)

From Witch Doctor To All 10 March 2006

Hello, Vladimir Kladov So under ATM there is no asma - Alasma :( And who will rewrite it? AlCo? I don’t think so... I'm trying to clarify: This is what just alasm looks like... and alasm with an anti64 filter is completely different thing :) is much more readable. File: al64.png http://zx.pk.ru/attachment.php?attachmentid=2807 File: al1.png http://zx.pk.ru/attachment.php?attachmentid=2806

From Witch Doctor To All 10 March 2006

Hello, Vladimir Kladov SMT!!!! Why are you silent when a “colleague” asks? I don't think anyone is here Volodya couldn’t explain better than you what’s what... especially since he clearly has a reason interested :), i.e. Apparently it will be implemented. Help progress!

From SMT To All 11 March 2006

Hello, Witch Doctor I have no time for that. such a video card burned out :-( and other things piled up :-(

From Andrey Bogdanovich To All 13 March 2006

Hello SMT Actually, I agree that “the entire US config” is not needed. ;) Personally, I would enough: 1. normal speed 2.max speed 3.anti64 4. default video mode (that is, which is specified in the config, for some double, I have quadro) 5.Memory model 6.Memory size Maybe something else will be needed later in the process of implementation. I'm waiting for support from the authors of emulators...

From Andrey Bogdanovich To All 13 March 2006

Hello, Vladimir Kladov Vla> The author Alasma is alive and well, This is not the author, but the 5th “continuator”. Global changes Alasma AlCo not will pull (I said it myself once). Vla> and doesn’t want to convert the ASM to ATM? This is not good. There is also the Pentagon Vla> with 512x192, also high resolution. The conversion of Alasm for ATM is approximately comparable to the conversion of EmuZWin for MS-DOS... Or maybe an order of magnitude heavier. Under the Pentagon 512 it’s easier, but is this effort worth the final result?

From Witch Doctor To All 16 March 2006

Hello Specter Indeed, remaking the alasma is a very grim task. Thank God that although I would like to slowly improvise what is... In addition, AlCo pursues the line of maximum compatibility and “maximum minimalism" i.e. should go under 128k and take up a MINIMUM of memory. Offer It was not possible to expand the 6x6 font into a separate page to speed it up precisely for this reason considerations... Hmm... But this has its own logic, of course... (although for myself I I'll expand the font anyway :) )

From Vladimir Kladov To All 17 March 2006

Hello Specter Well, there is also conditional compilation. The MINIMAL_VERSION symbol, and with it maximum minimalism, SUPPORT_EXTVIDEO symbol, and additional video modes. As a programmer who works a lot with Asm, this is not a problem for me at all. seems complicated. I also make the emulsion - the main part - on Asma. Exactly Thanks to conditional compilation and macros, I managed to solve an unsolvable problem: combine speed and support for such a huge number of combinations of all kinds modes. As a result, I don’t need to write out the code separately for mode 48 (so that it was optimal, and the memory was addressed simply as 64K of memory in a row, at least least for reading), separately - at 128K with multicolor, and separately - without multicolor (I mean branded multicolor, domestic multicolor does not require such optimizations. But before everything was exactly separately, even for the 256 color mode there was a separate code. (I'm just tired of them synchronize with each change, it turned out to be easier to make a procedure for compiling PC-Asm into memory on the fly). Or the output of the current page of text is so difficult to separate into a separate one procedure so that you can use advanced modes? The plan is to replace this procedure with at least conditional compilation and get the ATM version of the same or Pentagon 512x192 mono at least.

From Vladimir Kladov To All 17 March 2006

Hello, Vladimir Kladov Something happened to the connection yesterday - the message disappeared. I repeat: Actually, I agree that “the entire US config” is not needed. Personally I would enough: 1. normal speed 2.max speed 3.anti64 4. default video mode (that is, which is specified in the config, for some double, I have quadro) 5.Memory model 6.Memory size Maybe something else will be needed later in the process of implementation. I'm waiting for support from the authors of emulators... I already supported 1.2. 3.4 is for SMT. 5.6 - this option: ED FF returns set bit 2 to A (not 1 and not 0, bit 1 will be left by SMT). And then: ED FC register H, L - two letters of the model, DE - memory in kilobytes. At the entrance - sets the model/memory, if the corresponding register is not 0000, to the output - returns the model and memory as they were before the call. Still convenient on the way out return the model number. You can use your number at the entrance, but it seems to me letters are more convenient: S4 = Spectrum48 S1 = Spectrum128 S+ = Spectrum128+ S2 = Spectrum128+2 SA = Spectrum128+2A SB = Spectrum128+2B S3 = Spectrum+3 SE = SpectrumSE T4 = Timex2048 T6 = Timex2068 SC = Sam Coupe Di = Didaktik Sc = Scorpio Pe = Pentagon Pr = Profi A1 = ATM-1 A2 = ATM-2 A+ = ATM-2+ A3 = ATM-3 Sp = Sprinter KA = KAY Kv = Kvorum Ho = Hobbit PL = PLM Automatica Le = Leningrad Mo = Moscow

From Witch Doctor To All 17 March 2006

Hello, Vladimir Kladov this is all clear, but there is another more terrible problem - places in There are almost 40 bytes left on the Alasma page (I don’t remember exactly right now, but it’s a fact) - i.e. as if it were more cultural... there is no place to fart there anymore. By the way, this would be in the department. branch and milk well on the answers of AlCo himself...

From Wladimir Bulchukey To Witch Doctor 19 March 2006

Hello, Witch Doctor...! I believe that the emulator should be controlled from the program by writing to ports. This is the only way to clearly track access to resources as real. Spectrum and virtual. Let's select a range of ports that were not initially existing in a real computer, which we will select to control the emulator. With the best - Wlodek # wlblack()newmail.ru # http://wlodeks.narod.ru [ZX] [500:95/462@ZXNet] [2:5016 Forever] [Golyanovo] [Old Russians]

From Andrey Bogdanovich To All 29 March 2006

Hello, Vladimir Kladov Vla> It is not clear what default is. Is it difficult to save HL, DE? Well, excuse me Vla> didn't know. 8-] Probably haven’t written on a real Spectrum for a very long time? ;) I alternate: I’ve been writing on PC for several months, then on Spectrum. So when switching to Spectrum some things are unpleasantly surprising. But what to do... :( Vla> (Why restore them at all?) Culture. We played with the settings, and when exiting the program, we returned those that the user exposed.