Earlier in this topic (on page 2), I was playing with the idea of Drawing a large Bub Character onscreen in BASIC and then writing a similar routine in Assembly using SCR FILL BOX. A while ago I was pondering in how to make the character appear from the bottom of the screen and wasn't able to generate the effect correctly until now.
I've gone back to the BASIC and changed how the drawing takes place and using a physical cursor down to move the line up. The idea here was to simply draw each line at the same position until it gets to the end, the trouble I was having earlier was trying to overcomplicate things and was using 2 FOR Loops for the original program when it was better to using a WHILE loop for the "y%" variable to control when I can increment the Loop, which comes after doing a physical cursor down.
10 MODE 0: INK 0,0:INK 1,26:INK 4,3:INK 6,1:INK 7,2:INK 8,4:INK 9,16
20 DIM col%(242):GOSUB 100:a%=1
30 WHILE (y%<>22)
40 FOR x%=1 TO 11
50 LOCATE x%,25:PEN col%(a%):PRINT CHR$(143);
60 a%=a%+1
70 NEXT x%:LOCATE 1,25:PRINT CHR$(10):y%=y%+1:WEND
80 CALL &BB18:PEN 1:MODE 2:END
100 ' Set up Colours
110 FOR a%=1 TO 241
120 READ c%
130 col%(a%)=c%
140 NEXT a%:RETURN
150 DATA 0,4,4,4,4,4,4,0,0,0,0
160 DATA 0,4,4,4,4,4,4,4,4,4,0
170 DATA 0,4,4,4,4,4,4,9,4,4,0
180 DATA 4,4,4,4,4,4,4,9,4,4,0
190 DATA 4,4,4,4,4,4,9,9,9,4,4
200 DATA 4,4,4,4,1,0,9,0,1,4,4
210 DATA 4,9,4,9,1,0,9,0,1,4,4
220 DATA 0,9,4,9,1,0,9,0,1,4,4
230 DATA 0,9,9,9,1,0,9,0,1,4,0
240 DATA 0,4,9,9,1,1,9,1,9,9,0
250 DATA 0,4,9,9,9,1,9,1,9,9,0
260 DATA 0,4,9,9,9,9,9,9,9,9,0
270 DATA 0,7,4,9,9,9,0,9,9,9,0
280 DATA 7,7,7,9,9,9,9,9,9,8,0
290 DATA 7,7,7,8,7,7,7,8,7,8,0
300 DATA 7,7,9,8,7,7,7,8,9,9,0
310 DATA 7,9,9,9,8,8,8,8,9,9,0
320 DATA 0,9,9,8,6,1,6,1,8,9,0
330 DATA 0,8,8,8,8,6,6,6,6,8,0
340 DATA 0,8,8,8,8,8,8,8,8,8,8
350 DATA 0,4,6,6,6,0,6,6,6,6,4
360 DATA 0,4,4,4,4,0,4,4,4,4,4
The Assembly program I made earlier is a little bit easier to modify, none of the loops needed changing. row variable becomes a constant pointing to the line 25 (or 24 in this case being 0 based), and using SCR HW ROLL (&BC4D) to roll the screen up.
The effect from the Assembly is interesting as the character emerges very quickly from the bottom of the screen using Block Imagery to cover the screen.
org &4000
;; Main Routine
ld a,0
call &bc0e ;; Set Screen Mode 0
call setupcols ;; CALL to Setup Screen Inks
call drawimg ;; Main Routine to Draw using SCR FILL BOX
call resval ;; Reset values so program can execute again once Exit.
call &bb18 ;; KM WAIT KEY, Waits for any key to be pressed
ld a,2
call &bc0e ;; Set Screen Mode 2
ret ;; Program exits here
.setupcols
ld hl,cols ;; Adress of Cols (Colours) points to HL Register
ld a,0 ;; Accumulator contains PEN Colour
.inkloop
ld c,(hl) ;; Place INK value into C
ld b,c ;; And B
push af ;; Preserve Accumulator by PUSHing onto the Stack
push hl ;; Preserve HL Reigister by PUSHing onto the Stack
call &bc32 ;; SCR SET INK, Entry: A = Ink no, B = First Colour,
;; C = Second Colour. Exit: AF & HL are corrupt.
pop hl ;; Restore previous HL Register by POPing off the stack
pop af ;; Restore previous Accumulator value by POPing off the stack
inc hl ;; hl = hl + 1
inc a ;; a = a + 1
cp 10 ;; Does A = 10?
jr c,inkloop ;; Loop back to inkloop if A <> 10
ret ;; Return to Main routine
.drawimg
ld hl,(bubptr) ;; Address of INK values goes into HL
ld a,(hl) ;; Accumulator contains the contents that address points at,
;; in this case the encoded INK value.
push af ;; Those values are then PUSHed onto Stack to protect
ld a,(column) ;; Contents of Column is loaded into Accumulator
ld h,a ;; and then put into H register
ld d,a ;; and D register
ld a,(row) ;; Contents of Row is loaded into Accumulator
ld l,a ;; and then put into L register
ld e,a ;; and E register
pop af ;; Accumulator can now be restored to hold encoded INK value
call &bc44 ;; SCR FILL BOX Routine, Entry = all the above registers are
;; used, H, D, L & E work using Text Based Co-ordinates &
;; accumulator uses Encoded INK to draw an 8 x 8 pixel shape.
ld hl,(bubptr) ;;
inc hl ;; Increase Address of pointer to INK values
ld (bubptr),hl ;;
ld a,(column) ;;
inc a ;; Increase Address of Column
ld (column),a ;;
ld a,(fcount) ;;
inc a ;; Increment First Counter for X Co-ordinate Position
ld (fcount),a ;;
ld b,a ;; If the First Counter hasn't reached the value
ld a,(xval) ;; in the X Co-ordinate Position (xval), then
cp b ;; Return to the start (drawimg), otherwise continue
jr nz,drawimg ;; to the second part adjust the Y Co-ordinate position.
ld a,(fcount) ;;
xor a ;; First Counter Position (fcount) must return to 0
ld (fcount),a ;;
ld (column),a ;; Column can also return to 0
ld b,1
ld a,0
call &bc4d
ld a,(scount) ;;
inc a ;; Increment Second Counter for Y Co-ordinate Position
ld (scount),a ;;
ld b,a ;; If the Second Counter hasn't reached the value
ld a,(yval) ;; in the Y Co-ordinate Position (yval), then
cp b ;; Return to the start (drawimg), otherwise proceed
jr nz,drawimg ;; to the end of this cycle.
ret ;; Return to Main Routine
.resval
xor a ;; Fancy way of Returning Accumulator to 0.
ld (fcount),a ;;
ld (scount),a ;;
ld (column),a ;; Return all these Variables back to 0
ld hl,bub ;; Restore original address to the inks
ld (bubptr),hl ;; by returning the address of the inks to the Pointer
ret ;; Return to Main Routine
.cols defb 0,26,0,0,3,0,1,2,4,16 ;; Setup INKs using these colours
.fcount defb 0 ;; Value of First Counter (used during the X Co-ordinate Position)
.scount defb 0 ;; Value of Second Counter (used during the Y Co-ordinate Position)
.column defb 0 ;; Position of Column
.row defb 24 ;; Position of Row
.yval defb 22 ;; Image to be draw is 22 columns in height
.xval defb 11 ;; By 11 Rows Across as defined in 'bub'
.bubptr defw bub
.bub ;; Dimension 11 x 22 in size
defb &00,&30,&30,&30,&30,&30,&30,&00,&00,&00,&00
defb &00,&30,&30,&30,&30,&30,&30,&30,&30,&30,&00
defb &00,&30,&30,&30,&30,&30,&30,&c3,&30,&30,&00
defb &00,&30,&30,&30,&30,&30,&30,&c3,&30,&30,&00
defb &30,&30,&30,&30,&30,&30,&c3,&c3,&c3,&30,&30
defb &30,&30,&30,&30,&c0,&00,&c3,&00,&c0,&30,&30
defb &30,&c3,&30,&c3,&c0,&00,&c3,&00,&c0,&30,&30
defb &00,&c3,&30,&c3,&c0,&00,&c3,&00,&c0,&30,&30
defb &00,&c3,&c3,&c3,&c0,&00,&c3,&00,&c0,&30,&00
defb &00,&30,&c3,&c3,&c0,&c0,&c3,&c0,&c3,&c3,&00
defb &00,&30,&c3,&c3,&c3,&c0,&c3,&c0,&c3,&c3,&00
defb &00,&30,&c3,&c3,&c3,&c3,&c3,&c3,&c3,&c3,&00
defb &00,&fc,&30,&c3,&c3,&c3,&00,&c3,&c3,&c3,&00
defb &fc,&fc,&fc,&c3,&c3,&c3,&c3,&c3,&c3,&03,&00
defb &fc,&fc,&fc,&03,&fc,&fc,&fc,&03,&fc,&03,&00
defb &fc,&fc,&c3,&03,&fc,&fc,&fc,&03,&c3,&c3,&00
defb &fc,&c3,&c3,&c3,&03,&03,&03,&03,&c3,&c3,&00
defb &00,&c3,&c3,&03,&3c,&c0,&3c,&c0,&03,&c3,&00
defb &00,&03,&03,&03,&03,&3c,&3c,&3c,&3c,&03,&00
defb &00,&03,&03,&03,&03,&03,&03,&03,&03,&03,&03
defb &00,&30,&3c,&3c,&3c,&00,&3c,&3c,&3c,&3c,&30
defb &00,&30,&30,&30,&30,&00,&30,&30,&30,&30,&30
;; Masks to be used in PENs
;; pen 0 = &00
;; pen 1 = &c0
;; pen 4 = &30
;; pen 6 = &3c
;; pen 7 = &FC
;; pen 8 = &03
;; pen 9 = &c3