Jump to content

Programming:Next / previous line calculation: Difference between revisions

From CPCWiki - THE Amstrad CPC encyclopedia!
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:'''..."
 
Line 23: Line 23:
'''Output:''' HL=Address of the next line
'''Output:''' HL=Address of the next line


'''Destroyed:''' AF
'''Destroyed:''' AF,BC


<pre>
<pre>
Line 34: Line 34:
         add h  
         add h  
         ld h,a  
         ld h,a  
        and 64
         ret nc
         ret nz
         ld bc,#c050
         ld bc,16304
         add hl,bc  
         sbc hl,bc  
         ret
         ret
</pre>
</pre>

Revision as of 09:47, 17 April 2015

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