KrNews #10
20 августа 1999 |
|
CODING - Intro to 256 bytes?
_ CODING ... _ (C) Viper / TEchno Lab'99 Intro to 256 bytes? In connection with the nomination 512 intro to CC999 some question arose, whether write your intro in 256 bytes? The answer is simple - not only possible, but this figure easily blocked. An example is a Screen Saver for KrNews, which you could watch for a few numbers in a row. The reason for such constancy - a small amount of memory required for his work. It takes only 153 bytes! And if you remove the poll keypad (standard Screen Saver;), then 145 bytes, brings it to the limit is 128 bytes. AND this despite the fact that he actively uses stack for its work. This Screen Saver - Full Screen (fullscreen) Program is not required 128'oy memory. Need only address table memory screen, located to the smooth address, in this version # C000. Naturally, all realtime and nothing is cut. All this SS was written as a 96, if not before, so do not blame me. If someone does not know: REPT 16 PUSH HL ENDR - Directive Zx Asm3.10, correspond DUP 1916 PUSH HL; in Alasm'e EDUP .16 PUSH HL; - in Storm'e -I mean PUSH repeat 16 times in a row So: BEG EQU 7; min-distance ENX EQU 63; max-lines GTAB EQU # C000; address table ORG # 8000 FLIC LD DE, # 401F; construction LD HL, GTAB; table LD B, H FLI INC DE LD (HL), E INC L LD (HL), D INC HL DEC DE INC D; standard Down LD A, D AND 7 JR NZ, FL1 LD A, E SUB # E0 LD E, A JR NC, FL1 LD A, D SUB 8 LD D, A FL1 DJNZ FLI EI LD DE, GTAB EXX LD E, 96; half of the screen SFX LD B, BEG CYCLE1 LD HL, # FFFF; terrible number CALL CYC2 HALT INC HL; inversion though:) CALL CYC2 INC B LD A, B CP ENX JR C, CYCLE1 CYCLE2 DEC HL; back to the Universe CALL CYC2 HALT INC HL CALL CYC2 DEC B LD A, B CP BEG JR NC, CYCLE2 JR SFX CYC2 LD (OLDSP +1), SP LD A, B SRL A CYC21 LD C, A ADD A, E; added 96 for ; Middle of the screen EXX LD H, E; in the E -0 LD L, A ADD HL, HL; multiplication by 2 ADD HL, DE; address, in which at ; Hoditsya display ad , Res (well said) LD SP, HL; in his stekpoynt POP HL; display address LD SP, HL; again stekpoynt EXX REPT 16 PUSH HL; long line ENDR SUB C; or LD A, E-no SUB C; SUB C difference EXX LD H, E; symmetry is still LD L, A ADD HL, HL ADD HL, DE LD SP, HL POP HL LD SP, HL EXX REPT 16 PUSH HL ENDR LD A, C ADD A, B CP E; off the screen JP C, CYC21; no climbs? OLDSP LD SP, 0, and that the stack? SUB A IN A, (# FE); do not touch CPL; keys! AND # 1F RET Z POP HL RET _
Other articles:
Similar articles:
В этот день... 21 November