Programming:Next / previous line calculation

From CPCWiki - THE Amstrad CPC encyclopedia!
Revision as of 05:47, 17 April 2015 by Prodatron (Talk | contribs) (Without Firmware)

Jump to: navigation, search

Next line

This routines calculate the next line from the given address.

Firmware

Input: HL=Address

Output: HL=Address of the next line

Destroyed: AF

SCR_NEXT_LINE equ #BC26

call SCR_NEXT_LINE

Without Firmware

Input: HL=Address

Output: HL=Address of the next line

Destroyed: AF,BC

; Richard Fairhurst 
; October 1997 
; 
;*** Next line down from HL *** 

.nline  ld a,8 
        add h 
        ld h,a 
        ret nc
        ld bc,#c050
        add hl,bc 
        ret

Previous line

This routines calculate the previous line from the given address.

Firmware

Input: HL=Address

Output: HL=Address of the previous line

Destroyed: AF

SCR_PREV_LINE equ #BC29

call SCR_PREV_LINE