JPEGView/Source/68020/InitRegion.a
Aaron Giles 92bdb55672 JPEGView 3.3 for Macintosh
These are the sources for the final official release of JPEGView for the
Mac, back in 1994.
2015-02-05 00:18:10 -08:00

1 line
1.9 KiB
Plaintext

;*********************************************************/
;* This source code copyright (c) 1991-2001, Aaron Giles */
;* See the Read Me file for licensing information. */
;* Contact email: mac@aarongiles.com */
;*********************************************************/
;
; On entry here we expect the following values:
;
; a0 = pointer to the current region definition
; a1 = pointer to rgnBuffer[0]
; d2 = boxRect.top
; d3 = boxRect.left
; d4 = height
; d5 = width
;
; The following registers will be modified:
;
; d0,d1
; a0,a1
;
move.l a2,-(sp) ;save a2 on the stack
move.l a1,a2 ;copy a1 there
;
; Check for a rectangular region
;
move.l (a0),a0 ;deference a0
cmpi.w #10,(a0)+ ;is this a rectangular region?
beq.s @RectRgn ;if so, set that up
;
; Region is non-rectangular; set up the first scan line buffer
;
addq.w #8,a0 ;skip over rectangle
move.w (a0)+,d0 ;get Y coordinate
sub.w d2,d0 ;offset it from the top
move.w d0,(a1)+ ;store this as a count in Y
clr.w (a1)+ ;zero out the next word
tst.w d0 ;is the first row included?
bne.s @RgnCont ;if not, proceed from here
@CopyFirst:
move.w (a0)+,d0 ;get X coordinate
cmpi.w #32767,d0 ;are we done? (32767 = $7fff)
beq.s @CopyFDone ;if so, skip ahead
sub.w d3,d0 ;offset it from the left
move.w d0,(a1)+ ;store it
bra.s @CopyFirst ;loop until done
@CopyFDone:
move.w (a0)+,d0 ;get next Y coordinate
sub.w d2,d0 ;offset it from the top
move.w d0,(a2) ;store it as the first word
bra.s @RgnCont ;continue onwards
;
; Set up a rectangular region; fill in a fake buffer
;
@RectRgn:
move.w d4,(a1)+ ;row count = height
clr.w (a1)+ ;zero out the next word
clr.w (a1)+ ;left side is zero
move.w d5,(a1)+ ;right side is width
;
; Terminate the buffer and save our position
;
@RgnCont:
move.w #32767,(a1)+ ;store the terminator (32767 = $7fff)
move.l (sp)+,a2 ;restore a2 from the stack