Echo #03
31 марта 1997 |
|
Assembler - An interesting trick with the assembler.
Tips and Tricks (C) VfNG / NEW Do you want to fall? Those who do not know that focus, what I am going to describe just drop. Buy mats (no sports), lots of wool, iodine, and the nurse younger (useful). Tamp or upload the files of the following: ;---------------------------------------- ORG # 6200 ;---------------------------------------- CALL # C000; initialization ; Music ; Module ;---------------------------------------- DI; initialize LD HL, # 6000; IM 2 LD B, L; Vector # 6000 LD A, H; Procedure LD I, A; processing INC A; # C006, ie, L1 LD (HL), A; player INC HL; ringtones DJNZ L1 LD (HL), A LD L, H LD (HL), # C3 INC HL LD DE, # C006; address of the procedure LD (HL), E; play INC HL LD (HL), D IM 2 ;---------------------------------------- LD HL, BEGIN; with LD BC, # C000-BEGIN-3; address L2 LD (HL), # FB; BEGIN create INC HL; how intermeddle DEC BC; teams EI LD A, B OR C JR NZ, L2 LD (HL), # C3; after all the piles INC HL; EI switch to LD DE, BEGIN; BEGIN LD (HL), E INC HL LD (HL), D ;---------------------------------------- BEGIN; EI: EI: EI .. . JP BEGIN ;---------------------------------------- ORG # C000 ;---------------------------------------- INSERT "MUSIC"; some ; Music ; Module in the compiled ; # C000. For example, from PT2 , Or Sound Tracker'a. Let us estimate the logic of applets. At first she sinitsializiruet IM 2, then create a memory procedure, consisting of Continuum EI-NIS, and one purely for the JP loop. Then this same procedure start. Since it consists only of EI, then for some team will interrupt, then the player would be called music from the speaker will pour sweet melody. All right? Run ... * You have already been discharged from hospital? As head? Still ache a little after the fall? Sorry that it happened. But I hope You still wonder why this program worked some did not like from her expected? A casket is opened simply. The thing is Team EI. In fact, she not only permit termination, but also ... prohibits them! At the time of the next a team. This focus is built into the Z80 to the end of processing procedures INT'a, ending EI: RET, this is the RET time to execute before the arrival of a new interrupt. Someone asks: what if EI: HALT, although this theory, they should call hang? Everything and then simply: in fact the team is not just waiting for HALT INT, and also knits socks varit cereal, change diapers and child generates as NOP. Here is the first of HALT'ovskih NOP'ov interrupt actually prohibited and all the other does not. The question remains: where can this Thing apply? Myself do not know yet ...
Other articles:
Similar articles:
В этот день... 21 November