INT & RESET questions

ZXNet echo conference «code.zx»

From Aleksandr Majorov To Valentin Pimenov 1 March 1999

Greetings, oh dearest Valentin! Once in morning 28-02-99 16:10:04 somebody Valentin Pimenov has written to All about 'INT & RESET issues'. [ ] VP> Question about INT: VP> Is it true that interrupts are disabled when processing INT VP> automatically when an interrupt pulse arrives. Then not entirely true. Interrupts are disabled if they are enabled. ;-) VP> why is DI often the first ISR instruction? most often for insurance purposes. And there are also some bells and whistles when you have to skip the interrupt for some reason, and then "catch up" for lost time ;-))))) VP> May be original on other z-80 compatible processors VP> is the assumption incorrect? on other “Soviet” z80s, the DI command is NOP! After DI: HALT the program continues to work great! See some news [ ] VP> I experimented with placing a RESET handler VP> in 0 page of scorpion in ROM replacement mode. It turned out VP> that only a few handler commands are executed, after VP> which turns on the ROM and the further fate of the handler is sad. VP> Question: what is happening, and is it possible to force it somehow VP> handle RESET in this way? _several_?????????? I think you've screwed up! When you press RESET, a _hardware_ reset occurs registers #1FFD and #7FFD in #00, i.e. ROM-128, RAM-0, etc.! So after reset the computer should _immediately_ go to address #000 in ROM-128! VP> If not, who else will suggest? Place "resident" in the 8th bank Do you only need RESET interception? here is something similar, from MMD_4.00 Tnks to FK0 for the tip. ┌────────────────────── ──────────────────────┐ ;Preparation - searching for addresses, etc. LD BC,#7FFD: LD A,#10: OUT (C),A LD BC,#1FFD: LD A,#12: OUT (C),A ;LOOKING FOR THE ADDRESS WHERE THE PIECE OF CODE IS IN THE 8TH BANK ; #7B LD A,E ; #E6 #10 AND #10 ; #ED #79 OUT (C),A ; #06 #1F LD B,#1F LD IX,#E2D0 SEA_ROM INC IX LD A,XH : CP #F0 JR NC,ERROR_RESIDENT ;BUMM, DO NOT SET RESIDENT LD A,(IX+0): CP #7B: JR NZ,SEA_ROM LD A,(IX+1): CP #E6: JR NZ,SEA_ROM LD A,(IX+2): CP #10: JR NZ,SEA_ROM LD A,(IX+3): CP #ED: JR NZ,SEA_ROM LD A,(IX+4): CP #79: JR NZ,SEA_ROM LD A,(IX+5): CP #06: JR NZ,SEA_ROM LD A,(IX+6): CP #1F: JR NZ,SEA_ROM ;found, remember the addresses PUSH IX: POP HL LD (ADR_ROM+1),HL LD (ADR_ROM2+1),HLINC HL: INC HL: INC HL LD (ADR_ROM1+1),HL METKA1 LD BC,#1FFD: XOR A: OUT (C),A RET ;that's it, preparation is complete ;**************************************************************** ;now let’s activate the resident LD BC,#7FFD: LD A,#10: OUT (C),A LD BC,#1FFD: LD A,#10: OUT (C),A ADR_ROM LD HL,0 ;RESIDENT ADDRESS ;as you can see instead of this paragraph ;put command JP #F200, where ours will be ;handler LD DE,#F200 LD (HL),#C3: INC HL LD (HL),E: INC HL: LD (HL),D ;now we transfer our resident to the 8th jar LD HL,MAGIK: LD DE,#F200 LD BC,LEN_RESIDENT LDIR LD BC,#1FFD: XOR A: OUT (C),A RET ;that’s it, the resident has been transferred and activated, ;as soon as we press RESET, it will work immediately ;**************************************************************** ;and here is our resident. ;first check - if the stack is found ;at address #5B??, then you pressed RESET MAGIK PUSH HL LD HL,0: ADD HL,SP LD A,H POP HL CP #5B: JR Z,MAGIK1 ;the stack is not in the printer buffer, which means ;not RESET, do LD A,E: AND #10, ;instead of which there is currently JP #F200 ;and back to continue ;performing a shadow job ;like nothing happened LD A,E: AND #10 ADR_ROM1 JP #C3C3 ;aha! Someone pressed RESET!!! ;first we make a delay, otherwise without it ;for some reason the system crashed ;-);probably they didn’t have time to release RESET, ;or because of "bounce"... MAGIK1 DI LD BC,0 MAG_DEL DEC BC LD A,B: OR C: JR NZ,MAG_DEL ;now instead of JP #F200 we restore ;LD A,E: AND #10 so that the resident is more ;did not work on RESET ADR_ROM2 LD HL,#2121 LD (HL),#7B: INC HL LD (HL),#E6: INC HL LD (HL),#10 ;HERE GOES YOUR PROGRAM ;it will be somewhere in the 8th jar ;at address #F225 ;You can do whatever you want, I’ll start ;I drop the code “down” to about #BE00, ;so that you can click the jars and move on. LEN_RESIDENT EQU $-MAGIK ;****************************************************** └─────────────────────── ───────────────────────┘ Now a few words: I transfer the resident to MMD to save memory into the 8th jar immediately after preparation, i.e. on "METKA1" there is a transfer of the resident to #F200 And when I need to activate it, I just I put JP #F200 at the found address. I took the address #F200 "from the lantern" - I checked that neither ROM-2.95 nor ProfPZU-4.?? they don't keep anything there so I used it. As experiments on live camels have shown, there really are empty - you can play with the shadow, mount a screw, etc. and only by RESET we trigger. Obviously, with a “cold reset” with the “left arrow” or if the integrity identifier of the 8th bank is damaged The computer is _completely_ reset! Yes, by the way 2All: Out of boredom, I tore out from the ROM how MOA calculates CRCthat sector of the propeller where mounted ones are stored image... It's just rulez! ;-))))))) Who cares? Well that's it *MAS* with a sledgehammer

From Aleksandr Majorov To Valentin Pimenov 3 March 1999

Hayushki, Valentin! 02-03-99 at 18:50:07 someone Valentin Pimenov wrote 2 Aleksandr Majorov on the topic 'INT & RESET questions'. [ ] VP> "Do all Z-80 clones have interrupts enabled when entering the ISR VP> are prohibited? science doesn't know... According to the documentation, it _should_ be prohibited, but since everyone does as they want... [ ] AM>> When you press RESET, a _hardware_ reset occurs AM>> registers #1FFD and #7FFD in #00, i.e. ROM-128, RAM-0, etc.! AM>> So after reset the computer should _immediately_ switch AM>> to address #000 in ROM-128! VP> Exculpatory program: VP> ==================================== VP> ;STORM-style ASM VP> ORG #8000 VP> LD BC,#7FFD VP> LD A,#10 VP> OUT A VP> LD B,#1F VP> LD A,1 VP> OUT A VP>LOOP JR LOOP VP> ORG 0,#C000 VP> LD HL,#5800 VP> LD A,%01001001 VP>LOOP1 LD (HL),A:INC HL:JR LOOP1 Here's what I'll tell you - IMHO it's worth throwing rubbish so that they are clear to everyone, or for the majority! Okay I know that OUT A means OUT (C),A but if someone doesn’t know??? I believe that such “improvements” are asma not rulez. What, is it really because you press four Buttons change anything anymore? If you really want to type, then from the listing then everything should be _right_! And throw around random stuff that can’t be compiled in no other context except some special - it's complete sax! What if Vasya doesn’t have this asma in Uryupinsk? What should he look at and try? convert them to _normal_ form? 2LD: By the way, many popular asmas, which store sorts in unreadable form have decoders, so why for Storm does not make a decoder that will convert the source into ASCII form and restore _standard_ spelling of mnemonics? Okay, LD E,A,A,(DE) is also possible easy to decipher, but I couldn't understand _what_ LD IX,31'+250 means, how to understand ORG $+512: ORG $^ [ ] VP> I have after doing this piece and pressing VP> on the upper left appeared on the screen VP> attribute (blue). That. from the handler VP> clearly executed: VP> LD HL,#5800 VP> LD A,%01001001 VP> LD (HL),A VP> only after which control was transferred to ROM. VP> Please test it on your “scorpions”. Maybe someone VP> won't work :) it didn't work out, which was to be expected. Neither in TURBO, nor in HE_TURBO... It didn’t care about this program, just “fast test of computer” and forward... Yes, by the way, you have a glitch in the program! What about interruptions? You don't change them, but are you sure? Will they be turned off at startup? Otherwise the percent will go to address #0038 but since instead of ROM there is RAM-0, then he will get there. And what will this lead to? AM>> "Resident" is placed in the 8th bank AM>> Do you only need to intercept RESET? AM>> here's something similar, from MMD_4.00 VP> Thank you. I'll have to reserve the eighth jar... do you mean "reserve"??? A _normal_ program should not touch it at all 8th jar! So that the scorpion can work normally, so that there is access to the screw... Obviously resident, all sorts of “interceptions” like MagOS and turning off the shadow (several options) doesn't count. [ ] VP> By the way, there are some versions of ROM (2.5c, I have one VP> used to be), on which cannot be intercepted at all VP> residents in the 8th bank. Those. ZXF1,2,MMD, etc. programs VP> after reset they reset quietly :) Obviously, this is the same old ROM, it contains interceptions and residents were not provided. Tama and MaagOS does not work, etc. VP> ps/ Write, please, resident "with the left arrow." this is unreal! You can make the resident spit on left arrow, but this is MarASM! There you have to completely bang the 8th can, and rewrite it in your own way, as a result the resident will work on both RESET and MAGIC and to any input via RST 8, i.e. like in MMD 2.20 (by the way, you need to check how his with business arrow) But in the light of Witnov machines and all sorts of relishes, which through RST 8 I believe that this is no need... VP> pps/ Work with your current marks in ZX-ASM. Obviously, I use normal asmas, like zasma, asm_2.0 on PCs, where there are no special restrictions on length marks and there are all sorts of rules... PS: don’t think that this is a flame ;-) I don't use Storm because I'm not used to its controls. I downloaded it once, got confused with the keyboard and deleted it, I'm used to ssm/Dos_Pofigator, and the developments There are some too big, damn it’s possible to shorten the marks, remake all sorts of features for Storm and into Storm move... So MMDs remain in jeopardy, because transferring them to the PC is problematic, but I write everything new on PC, Tama and keyboard are normal ;-)And the viewer is fast - 22 lines of 80 characters quickly they fly ;-) and ASM works instantly ;-))))) Well that's it *MAS* with a sledgehammer

From Dmitry Lomov To Aleksandr Majorov 6 March 1999

Hi, Alexander! VP>> But, IMHO, there is no standard for directives VP>> assembler type org, db, dw, ds, defm, etc. VP>> Therefore, each ASMA author comes up with his own bells and whistles. AM> WHAT?????????? AM> All these directives are standard for all ASMS. AM> org - the address of the code location, and that’s it! AM> If you need to put a jar in a thread, then it is better to enter AM> a separate command, such as in PC "*P3" AM> And db - define byte defined bytes ^^^^ tell that to Gens ;-) AM> ds - -//- string text line where did this come from? there was always a reservation, even on pussy pain, like... AM> Only the author does not invent his own bells and whistles! VP>> For example, in is-dos assembler, which is implemented via ... VP>> no directive to align to segment boundary, AM> DS $+256/256*256 - $ yeah, and then it turns out that ASM follows priorities - in what minced meat will turn into this expression? VP>> By the way, you told me about intercepting the reset of the program, but I have VP>> for example, there is no ZX-ASM, and what should I do? Suppose VP>> I only have GEHS :) AM> well? AM> The text is purely ASCII, without using “new” spellings AM> commands. AM> Colons? Yes, this will have to be removed manually. AM> And _all_! Well, here too - enter registers and commands, and that’s it :) VP>> In general, I think everyone who has gathered in this echo will be able to VP>> understand the storm syntax and shorten the tags (to VP>> necessary) and other transformations with flying sources VP>> do. What I threw was an _illustration_ that AM> yeah, only if I throw in the sorts for ASM_2_0, where AM> the following commands are allowed: AM> a++ AM> (hl)-- AM> a+=b AM> add a,b,a,d,10 AM> c<< Give real examples of their use - interesting. ++ is, like, +1? (xl) -- post-decrement addressing? a+=b a=b+1? AM> and you figure out what it is and what it is eaten with ;-) we'll figure it out :) AM> for the sake of subscribers, it’s enough to throw rubbish AM> in _normal_ form: let's try to derive a criterion for "normality". AM> do not use "features" AM> type ORG $^, OUT C, etc... (after all, not all ASMAs keep all this?). we will introduce a limit of 16k (show me an asm that eats more), we won’t use it INCBIN because it is spelled differently everywhere; those who are sitting on Alasma, should not use compilation to a jar; those who are on XAS, they should not use !ASSM 10, since nowhere it is no more; we will not use "", since in XAS this is not the case, finally, we will not use "*", since this Can't do either GENS or TASM. We will not use long lines, since STORM choke and XAS ignores them; we won't use DB, since it is spelled differently in GENS, labels in in large texts we will limit it to 3 characters, since XAS and STORM will experience a buffer overflow... should I continue? :-) AM> That is. all mnemonics are standard. and when I enter the command LDI (L)+,#08,DE,(IX+31),-(BC),{ADD A,{LD A,B}} you will say that the zetnik does not have such a command, although this is only The recording method that will be in STORM 2.0 is: LD (HL),#08:INC L LD (HL),E:INC L LD (HL),D:INC L LD A,(IX+31)LD (HL),A:INC L DEC BC:LD A,(BC) LD (HL),A:INC L LD (HL),#C6:INC L LD (HL),#78:INC L AM> Colons? Well, many people understand them, AM> and it’s not difficult to remove them... your "well" looks great here :) AM> Although you can do without them. well, well ;-) AM> Label length? Uses short tags AM> only GENS and STORM, and all the rest AM> do not have a 6-character limit. Nu-nu. XAS - set, in real programs there is no more than 7 It turns out that TASM is 14/7, depending on the version. AM> You can assemble it into any jar and get the output AM> or files page by page (each file begins AM> from ORG to ORG or end of file), or AM> receive a file in .z80 format (all 128-memory at once AM> and all registers together) that's it, all your arguments are valid for working in all kinds of pseudo-Spectrums, and not on real cars. AM> Alignment? Do you really need it? I need it so much that I don’t even know how to express it. AM> I usually just make an ORG to the address yeah, and you check with your hands whether the program has reached itsceiling. AM> and skip a bunch of bytes to fit AM> some piece of code - funny it’s not funny, it’s sometimes necessary, and besides, it can be done once, when the code ends and all sorts of different things begin buffers at beautiful addresses. AM> I'd rather move the variables and code like this AM> so that the desired mekta crawls to the border. but this can be done once - when the program is finished, in this case, there will be no torment at the stage of its debugging. AM> And this way you can easily align: AM> DS $/256*256+256-$ very easy. I have to think for a long time before I understand what it is like this :) AM> But everyone understands well, well. I understand ORG $^, if rounded up, and ORG $`, if down. VP>> no one asks to be transported during a storm. just from everything VP>> is available to me, I _most_most_ use it. AM> is logical, but also don’t forget that not everything AM> they use a storm, and therefore it’s worth throwing sorts so that AM> there would be as few problems with the transfer as possible. i.e. do you suggest either writing in Gens or before sending ruin it all? Best wishes. Dmitry...LD..X-TRADE..

From Kirill Frolov To Aleksandr Majorov 6 March 1999

Hello Alexander. 03 Mar 99 00:04, Aleksandr Majorov wrote to Valentin Pimenov: VP>> "Do all Z-80 clones have interrupts enabled when entering the ISR VP>> are prohibited?" AM> science doesn’t know this... AM> According to the documentation _should_ be prohibited, but since AM> they do everything as they want... IMHO there are no such processors at all. Not even a Z80. AM> Otherwise the percentage will go to address #0038 AM> but since instead of ROM there is RAM-0, then AM> it will go there. AM> And what will this lead to? And I don’t have any blue squares either. But I do have interruptions. AM> of course, this is the same old ROM, it contains interceptions and residents AM> were not provided. AM> Tama and MaagOS does not work, etc. Magos doesn't work :-( ) IMHO it should work everywhere. After all, he does not use undocumented possibilities, but about the address of the shadow operator in C064 since very ancient versions it was known. AM> in MMD 2.20 (by the way, you need to check how it is AM> with case arrow) At 2.95 it is intercepted. And on 4.01 you can’t intercept. Kirill

From Vitaly Vidmirov To Valentin Pimenov 11 March 1999

Hello, hello Valentin! One day, in the cold summer, something around (08-03-99/09:38:00) Dmitry Lomov once wrote to Valentin Pimenov... VP>> Yes, I’m still figuring out this crazy OS idea. VP>> By the way, I don’t know to what extent Dark has it VP>> has it advanced and is it moving now? It's hard to say ;) It’s just that what was in the summer of ’98 was rewritten and added a piece of something there... In principle, the kernel is completely ready. It works quite quickly. Here is the list of calls: - Execution Unit --------------------- FORBID() Disable preemptive multitask PERMIT() Enable preemptive multitask SHEDULE() Free time ADDTASK (DATA,STACK,PRI)(HL,B,C) ADDITIONS (INTNODE)(HL) REMTASK (TASK)(HL) - EU IPC ----------------------------- NEWSEM (SEM,CNT)(HL,A) LOCKSEM (SEM)(HL) WAITSEM (SEM)(HL) FREESEM (SEM)(HL) WAITMSG() REPMSG (MSG)(HL) GETMSG() PUTMSG (TASK,MSG)(HL,IY) SIGNAL (TASK,SIGMASK)(HL,A) SENDMSG (TASK,MSG)(HL,IY) WAIT (SIGMASK)(A) - Memory Unit ------------------------ LMALLOC (LSIZE)(A) -> HL(ZF)=ADR 32 bytes each HMALLOC (HSIZE)(A) -> HL(ZF)=BADR 2048 bytes each LMFREE (ADR,LSIZE)(HL,A) HMFREE (BADR,HSIZE)(HL,A) MAVAIL (REQMASK)(A) -> CHL=TOTAL SIZE - MU copier -------------------------- MEMCPY (SRC,DST,LEN,BANK)(HL,DE,BC,A) MEMMOV (SRC,DST,LEN,BANK)(HL,DE,BC,A)MEMSET (ADR,DAT,LEN,BANK)(HL, E,BC,A) MEMCOPY(XSRC,XDST,LEN)(lYHL,hYDE,BC) STMEMB (ADR,BANK,DATA)(HL,C,E) STMEMW (ADR,BANK,DATA)(HL,C,DE) LDMEMB (ADR,BANK,DATA)(HL,C,E) LDMEMW (ADR,BANK,DATA)(HL,C,DE) - MU misc ---------------------------- CALLX (XADR)(AHL) JUMPX (XADR)(AHL) BANKA (BANK)(A) - Lists -(doubly linked lists)----------- NEWLIST (LIST)(HL) -> HL+LH_SZOF TSTLIST (LIST)(HL) -> HL(ZF)=NODE REMTAIL (LIST)(HL) -> HL(ZF)=NODE REMHEAD (LIST)(HL) -> HL(ZF)=NODE REMOVE (NODE)(HL) -> HL(ZF)=SAME NODE ADDTAIL (LIST,NODE)(HL,DE) ADDHEAD (LIST,NODE)(HL,DE) INSERT (TARGET NODE,NODE)(HL,DE) ENQUEUE (LIST,NODE)(HL,IY) -> HL=NODE PREDLST (NODE)(HL) -> HL(ZF) PREDECESSOR SUCCLST (NODE)(HL) -> HL(ZF) SUCCESSOR - Queues -(simply linked lists)--------- REMQU (ST.NODE,NODE)(HL,DE)->HL(ZF)TRUE? INSQU (LAST NODE,NODE)(HL,DE)->SAME NEXTQU (QUEUE NODE)(HL)->HL(ZF)=NXT NODE It’s bad that there’s no time at all right now. In the 2 hours allocated per day for "spectrumism" there is not much you'll screw up ;( Dark-] //______ [-from //|rade