Product specifications
;
; ROUTINE USES TO BYTE VARIABLE TOPSCR WHICH MUST
;
; BE SET TO CONTAIN THE START ADDRESS OF THE TOP LEFT
; HAND CORNER OF THE SCREEN PRIOR TO ENTRY TO THIS
; ROUTINE
;
TOPSCR: DW £1800 ;(See description above)
;
DOTSUB: LD DE,0 ;Set DE to zero
LD A,L ;and mask off lowest three bits of Y
AND 248 ;coord held in register L
;this gives (Y coord DIV 8) * 8
LD E,A ;Multiply above value by 4
SLA E
RL D
SLA E
RL D ;Screen Y position in DE
LD A,H ;Divide X coord by 8
SRL A
SRL A
SRL A ;X position in Acc
LD HL,0` ;Set HL to zero
LD L,A ;Screen X position in HL
ADD HL,DE ;Add screen X and Y positions
;together to give position relative
;to the top of the screen
LD DE,(TOPSCR);Calculate actual VRAM address by
;adding start address to top left hand
;corner of screen held in TOPSCR
ADD HL,DE ;Result in HL register pair at this point
;
EX DE,HL ;Transfer result to DE and set read
CALL VSETRD ;from VRAM pointer to this address
CALL VDINPT ;Read data byte held at this address
LD A,C ;in VRAM and place into Acc
RET ;Return to calling routine
;
; SETUHL-LOAD SPRITE VRAM X COORD INTO H
; LOAD SPRITE VRAM Y COORD INTO L
; FROM SPRITE VRAM CONTROL BLOCK START LOCATION
; HELD IN DE ON ENTRY
;
SETUHL: PUSH BC ;Save old BC register pair
CALL VSETRD ;Set read from VRAM pointer to start
;of sprite control block
CALL VDINPT ;Read sprite Y coord from VRAM and
LD L,C ;place into register L
INC L ;Increment Y coord in L by 1
;(See section 4.2) – Adjusts sprite
;Y coord position to take into account
;VDP offset of –1 on Y coord