Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CLS/Fade out ASM Sub-routine
#1
This is a small clear screen, that sort of fades out the screen pixel by pixel to the background colour.  I took it from one of the Melbourne house books, can't remember which one though.

No idea if it breaks anything else, but I've not had any issues.

Code:
SUB CLSFadeOut()
' Fade out Screen Clearing

    ASM

        LD DE,08feh
        NXTFADE:
            LD A,E
            RLCA
            RLCA
            RLCA
            LD E,A
            LD HL,4000H
            LD BC,0018H
            NXT:
                LD A, (HL)
                AND E
                LD (HL),A
                INC HL
            DJNZ NXT
            DEC C
            JR NZ,NXT
            DEC D
        JR NZ,NXTFADE
        LD A,(5C8DH)
        LD (HL),A
        LD D,H
        LD E,L
        INC DE
        LD BC,02C0H
        LDIR
        LD A,(5C48H)
        LD (HL),A
        LD C,3FH
        LDIR
    END ASM

END SUB
Reply
#2
Good one!
No, it won't break anything (only IX should be preserved (push/pop) before the function returns).
Also, it's recommended to make your labels private. To do so:
Wrap your ASM routine between
Code:
PROC
...
ENDP
directives.
Declare your labels locals after PROC, with:
LOCAL NXTFADE, NXT
:-)

If your code is BSD / MIT / Apache I can put it in the standard library for other people to use it.
---
Boriel
Reply
#3
Happy for it to be used however by whoever - which ever licence doesn't require anything from me or from the user.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)