home *** CD-ROM | disk | FTP | other *** search
- ;┌────────────────┬────────────────┬─────────────────────┬───────┬────────────┐
- ;│█████ Z80 ██████│ HardwareScroll │█████████████████████│ movax │████████████│
- ;└────────────────┴────────────────┴─────────────────────┴───────┴────────────┘
-
- .org 9327h
-
- ;┌────────────────┬────────────────┬─────────────────────┬───────┬────────────┐
- ;│█████ Z80 ██████│ CODE │█████████████████████│ movax │████████████│
- ;└────────────────┴────────────────┴─────────────────────┴───────┴────────────┘
-
- START:
- call INIT ; Initialize screen and stuff
-
- ld a,40h ; We want too start at offset 0 (40h+0)
- push af ; Push it on the stack to use it later
-
- MAIN:
- ld a,(SPEED) ; Load the current speed
- cp 8 ; If it's 8 then don't accelerate more
- jp z,SKP1
- dec a ; Accelerate (lower value=faster scroll)
- ld (SPEED),a
- SKP1:
-
- ld a,0ffh ; Reset the keyport (kinda)
- out (1),a
- ld a,0feh ; Enable the arrows
- out (1),a
- in a,(1)
-
- cp 254 ; Has anyone pressed down?
- jp nz,NODOWN
- pop af ; Get offset from stack
- dec a ; Decrement offset
- jp SCROLL
-
- NODOWN:
- cp 247 ; Has anyone pressed up?
- jp nz,NOUP
- pop af ; Get offset from stack
- inc a ; Increase offset
- jp SCROLL
-
- NOUP:
- ld a,64 ; Reset speed if no key pressed
- ld (SPEED),a ; (64 = slowest)
- pop af
-
- SCROLL:
- and 01111111b ; Clr bit 7 (we don't want values >7fh)
- or 01000000b ; Set bit 6 (we don't want values <40h)
- out (010h),a ; Out current offset to LCD instr. port
- push af
-
- call WAIT ; Wait
-
- ld a,0ffh ; Reset the keyport (kinda)
- out (1),a
- ld a,0fdh ; Enable the row with clear
- out (1),a
- in a,(1)
-
- cp 191 ; Check for clear
- jp nz,MAIN ; If not pressed, jump to MAIN
-
- XIT: ; If pressed, quit
- pop af
- ld a,40h ; Set screen to offset 0 (40h+0)
- out (010h),a ; Out it to the LCD instructions port
-
- call CLRTSHD ; Clear textshadow
- call GOHOME ; Go to the homescreen
- call HOMEUP ; Place cursor at home
-
- ld hl,MSG ; Print message
- call STRING
- call WAITKEY ; Pick up the keypress from clear
-
- ret ; Exit program
-
- ;┌────────────────┬────────────────┬─────────────────────┬───────┬────────────┐
- ;│█████ Z80 ██████│ PROCEDURES │█████████████████████│ movax │████████████│
- ;└────────────────┴────────────────┴─────────────────────┴───────┴────────────┘
-
- ;▄████████████▀ INIT ▀███████████████████████████████████████████████████████
- INIT:
-
- call RINDOFF ; Runindicator off
-
- ld hl,PIC ; Copy picture to graphbuf
- ld de,8e29h
- ld bc,768
- ldir
-
- call BUFCOPY ; Copy graphbuf to LCD
-
- ret
- ;▄████████████▄ INIT ▄███████████████████████████████████████████████████████
-
-
- ;▄████████████▀ WAIT ▀███████████████████████████████████████████████████████
- WAIT:
- push bc
-
- ld hl,SPEED ; Time to wait depends on SPEED
- ld c,(hl)
- WLOP2: ; Outer loop
-
-
- ld b,0
- WLOP1: nop ; Inner loop
- nop
-
- dec b ; Decrease b (you can use djnz here)
- jp nz,WLOP1 ; Loop to WLOP1 if not zero
-
-
- dec c ; Decrease c
- jp nz,WLOP2 ; Loop to WLOP2 if not zero
-
- pop bc
- ret
- ;▄████████████▄ WAIT ▄███████████████████████████████████████████████████████
-
- ;┌────────────────┬────────────────┬─────────────────────┬───────┬────────────┐
- ;│█████ Z80 ██████│ EQUALS │█████████████████████│ movax │████████████│
- ;└────────────────┴────────────────┴─────────────────────┴───────┴────────────┘
-
- WAITKEY .equ 4CFEh ; Wait for a key and read
- BUFCLR .equ 515Bh ; Clear the graph backup
- BUFCOPY .equ 5164h ; Copy the graph backup to the screen
- RINDOFF .equ 4795h ; Turn off runindicator
- PRINTHL .equ 4709h ; Print HL in dec. on the screen
- OP2TOP1 .equ 41C2h ; Move OP2 to OP1
- CONVOP1 .equ 4EFCh ; Convert fp value in OP1 to a 2 byte hex
- READKEY .equ 4A18h ; Read key and place it in OP2 as a fp value
- GOHOME .equ 47A1h ; Go to home screen (finish gfx program)
- CLRTSHD .equ 4765h ; Clear text shadow
- HOMEUP .equ 4775h ; Place cursor at home
- STRING .equ 470Dh ; Print 0 terminated string to screen (hl->string)
-
- ;┌────────────────┬────────────────┬─────────────────────┬───────┬────────────┐
- ;│█████ Z80 ██████│ DATA │█████████████████████│ movax │████████████│
- ;└────────────────┴────────────────┴─────────────────────┴───────┴────────────┘
-
- .include pic.db ; The picture
-
- SPEED .db 64 ; Speed of the scroll (lower = faster)
- MSG .db "HAVE A NICE DAY!",0 ; Message
-
- .end
- ;┌────────────────┬────────────────┬─────────────────────┬───────┬────────────┐
- ;│█████ Z80 ██████│ HardwareScroll │█████████████████████│ movax │████████████│
- ;└────────────────┴────────────────┴─────────────────────┴───────┴────────────┘
-
-