lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bar counts and repeats in repetitive music


From: David Kastrup
Subject: Re: Bar counts and repeats in repetitive music
Date: Tue, 28 Feb 2017 21:18:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Peter Toye <address@hidden> writes:

> David and other,
>
> All of which makes me think that it's not really worth while pursuing
> this development any further. As an ex-programmer (yes, I sometimes
> did write comments, but in assembler you rather have to)

How else would you keep track of cycle counts?

        .Z80

        NAME    ('SCROLL')

        ENTRY   SCRLFT,SCRRIG
        PUBLIC  SCRX

        EXT     STAGE,SHBTAB
        EXT     DELAY
        EXT     SCREEN,OUTCTL

        DSEG

SCRLFT: LD      IY,STAGE        ;14(20)
        LD      HL,SCRX         ;30
        LD      A,4             ;37
        ADD     A,(HL)          ;44
        LD      (HL),A          ;51
        ADD     A,44            ;58
        LD      L,A             ;62
        LD      H,0             ;69
        LD      E,L             ;73
        LD      D,H             ;77
        ADD     HL,HL           ;88
        ADD     HL,DE           ;99
        EX      DE,HL           ;103
        ADD     IY,DE           ;118
        LD      A,12            ;125
        LD      (SPSAVE),SP     ;145
        LD      SP,SCREEN+22    ;155
SCRL05: EX      AF,AF'          ;4
        LD      A,(IY)          ;23
        AND     31              ;30
        ADD     A,A             ;34
        LD      C,A             ;38
        LD      B,0             ;45
        LD      HL,SHBTAB       ;55
        ADD     HL,BC           ;66
        LD      E,(HL)          ;73
        INC     HL              ;79
        LD      D,(HL)          ;86
        LD      C,4             ;93
SCRL10: LD      A,70H           ;7
        OR      C               ;11
        DEFW    OUTCTL  ;22
        LD      B,16            ;29
SCRL11: EX      DE,HL           ;4
        LD      E,(HL)          ;11
        INC     HL              ;17
        LD      D,(HL)          ;24
        INC     HL              ;30
        EX      DE,HL           ;34
        REPT    11
        EX      (SP),HL         ;35
        DEC     SP              ;41
        DEC     SP              ;47
        ENDM                    ;551
        EX      (SP),HL         ;586
        LD      HL,22+40H       ;596
        ADD     HL,SP           ;607
        LD      SP,HL           ;611
        DJNZ    SCRL11          ;10008
        SRL     C               ;10016
        JR      C,SCRL20        ;10023 / 30237
        LD      HL,-16*40H      ;10033
        ADD     HL,SP           ;10044
        LD      SP,HL           ;10048
        JP      SCRL10          ;10058
SCRL20: LD      A,70H
        DEFW    OUTCTL
        EX      AF,AF'          ;30241
        DEC     A               ;30245
        INC     IY              ;30255
        JP      NZ,SCRL05       ;363335
SCRL21: LD      SP,(SPSAVE)     ;363373
        LD      A,182
        JP      DELAY

Though I have to admit that this was from my youth, an age where you
consider yourself and your memory immortal.

DELAY is sort of a misnomer: it does not actually do any delay but
tells the timing logic how much time a routine spent doing its job.
Since we are talking about 363373 cycles on a 4MHz machine, the unit for
"DELAY" would appear to be slices of 0.5ms.

Scrolling by 16 pixels on a bitmapped display by using

        EX      (SP),HL         ;19
        DEC     SP              ;25
        DEC     SP              ;31

as the workhorse rather than

        LDI ;16
        LDI ;32

may seem a bit overoptimizing but it leaves quite more registers
available for loop control and stride adjustment and only takes 3 bytes
instead of 4.

Sorry for the distraction: your remark about the necessity of commenting
assembly language triggered this memory.

It turns out that basically the module moving player and monsters
actually has bonafide comments in it (and it is not timing-critical so
there are no cycle counts and no call of DELAY).  A collaborator
insisted on them.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]