Until Yesterday I didn't know what the story was with SCR FLOOD BOX (&BC47) thinking it was a Firmware Equivalent to the BASIC 1.1 'FILL' command, though I tested it to discovered it works in 1.0 Firmware, though I also discovered it can simply be a 1x1 Pixel.
In order to draw a Sprite using SCR FLOOD BOX I've just made some adjustments to SCR PIXELS routine (posted above), which had produce a more compacted piece of code because unlike SCR PIXELS, SCR FLOOD BOX doesn't need to know the Mask of the PEN to draw with. C = Encoded PEN to be used, D & E give the width and height, which will always be 1 for this routine & HL holds the Screen Address, Using SCR DOT POSITION (&BC1D) sorts that out and I'm using SCR PREVIOUS LINE (&BC29) to Calculate the Next Line, so in some ways it's similar to SCR PIXELS (&BC5C), though it's compacted cause doesn't need as much information to draw the image to screen.
;; 8x9 Sprite using SCR FLOOD BOX.
;; Until Yesterday I didn't even know if SCR FLOOD BOX did 1x1 Encoded INK Pixels
;; and just thought it was based on BASIC 1.1 FILL command. :(
;; Entry from BASIC:
;; CALL &4000,<address of sprite>,<x-coordinate>,<y-coordinate>
;; E.g. CALL &4000,&4094,80,100
org &4000
ld hl,addofimage ;; Address of the Sprite Data comes in here and stored
ld e,(ix+04)
ld d,(ix+05)
ld (hl),e
inc hl
ld (hl),d
ld hl,ypos ;; Value of YPOS comes in here and is stored,
ld e,(ix+00)
ld d,(ix+01)
ld (hl),e
inc hl
ld (hl),d
ld hl,xpos ;; And the same for XPOS as well.
ld e,(ix+02)
ld d,(ix+03)
ld (hl),e
inc hl
ld (hl),d
ld hl,(xpos)
ex hl,de ;; haha.
ld hl,(ypos)
call &bc1d ;; SCR DOT POSITION coverts this into a Screen Address
ld (scraddr),hl ;; Screen Address of Location
ld (storscraddr),hl ;; This is used because Scradr has to be Incremented
.loop ld d,1 ;; Width of the Image
ld e,d ;; Height of the Image
ld hl,(addofimage) ;; This points to the Bit Mask Data (the patten which
ld c,(hl) ;; gets drawn), and gets stored into the C register.
ld hl,(scraddr) ;; Address of the screen address.
call &bc47 ;; SCR FLOOD BOX.
;; Entry: C = Encoded INK
;; D = Width of the Image
;; E = Height of the Image
;; HL = Address to draw the Image.
ld hl,(scraddr) ;; I then have to increment the value of screen
inc hl ;; address to the next position to draw the next spot
ld (scraddr),hl ;; along. It gets stored so I can reuse my registers.
ld hl,(addofimage) ;; The address for the Bit Mask Pattern is also
inc hl ;; increment to point to the next value and is also
ld (addofimage),hl ;; stored as well.
ld a,(count1) ;; This is my loop sequence and again I needed to store
inc a ;; values into memory. I wanted to use my old friend
ld (count1),a ;; DJNZ, though was proving to be a nightmare.
ld b,a ;; This one checks if count1 equals loop1 and if it
ld a,(loop1) ;; doesn't it will jump back to loop to do another pass.
cp b
jr nz,loop ;; The Jump is applied here back to the loop label.
ld a,(count1) ;; If it has reacted this point then count1 equals loop1
xor a ;; it must be set back to zero so it can work when it
ld (count1),a ;; returns back to the main loop.
ld hl,(storscraddr) ;; This is used to calculate the previous line.
call &bc29 ;; SCR PREVIOUS LINE
ld (scraddr),hl ;; I store the value into scraddr for the main loop
ld (storscraddr),hl ;; and I also store the screen address for this routine.
ld a,(count2) ;; Once all that is done I have to do the same thing
inc a ;; here and check to see if count2 equals loop2. And
ld (count2),a ;; again the values need to be stored in memory and
ld b,a ;; recalled again for when I need to check.
ld a,(loop2) ;; As long as count2 is not equal to loop 2, it will
cp b ;; return back to the main loop, otherwise it will
jr nz,loop ;; proceed to exit, back to BASIC if called from there.
ld a,(count2) ;; though upon exit count2 needs to return to 0
xor a ;; Just so this routine can be recalled again.
ld (count2),a ;; values are returned into it's rightful place.
ret
.loop1 defb 2 ;; Width of the Image
.loop2 defb 9 ;; Height of the Image
.xpos defw 0 ;; Store XPOS here for use with SCR DOT POSITION
.ypos defw 0 ;; Store YPOS here for use with SCR DOT POSITION
.count1 defb 0 ;; Checks for when the Width of the Image is Reached
.count2 defb 0 ;; Checks for when the Height of the Image is Reached
.scraddr defw 0 ;; Holds the screen address in relation to the Width.
.storscraddr defw 0 ;; Retains original screen address to calculate next line.
.addofimage defw 0 ;; Points to the address of the image to Display
.rocket defb &00,&00 ;; What I'm using as my Display image.
defb &d0,&60
defb &77,&cc
defb &03,&08
defb &03,&08
defb &03,&08
defb &03,&08
defb &03,&08
defb &10,&00
I've made this image 8x9 in size, the 9th line is a blank so once it's been Compiled the Rocket can blast off without the flame:
10 MODE 1:FOR y%=0 TO 190:CALL &BD19:CALL &4000,&4094,100,y%:NEXT y%