Programming:Next / previous line calculation

From CPCWiki - THE Amstrad CPC encyclopedia!
Revision as of 07:45, 28 December 2010 by Octoate (Talk | contribs) (Created page with "= Next line = This routines calculate the next line from the given address. == Firmware == '''Input:''' HL=Address '''Output:''' HL=Address of the next line '''Destroyed:'''...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

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

.nline  ld a,8 
        add h 
        ld h,a 
        and 64 
        ret nz 
        ld bc,16304 
        sbc 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