06-05-2010, 02:22 PM
It seems cut the sprites on screen thirds.
Code:
SUB putChars(x as uByte,y as uByte,height as uByte,width as uByte,dataAddress as uInteger)
DIM columns as uByte
REM Let's put our variables into our code:
POKE @BLPutCharWidth+1,width
POKE @BLPutCharHeight+1,height
POKE @BLPutCharX+1, x
POKE @BLPutCharY+1, y
POKE uInteger @BLPutCharData+1,dataAddress
asm
call BLPutChar
end asm
return
BLPutCharX:
asm
BLPutChar:
LD a,1
AND 31
ld l,a
end asm
BLPutCharY:
asm
ld a,2 ; Y value
ld d,a
AND 24
add a,64
ld h,a
ld a,d
AND 7
rrca
rrca
rrca
OR l
ld l,a
PUSH HL ; save our address.
end asm
BLPutCharData:
asm
LD DE,16384 ; Marker - This will be poked for the data address by the subroutine
end asm
BLPutCharWidth:
asm
LD B,3 ; Marker - this will be poked for the width
PUSH BC ; save our column count.
BLPutCharColumnLoop:
end asm
BLPutCharHeight:
asm
LD B,1 ; Marker - this will be poked for the height by the subroutine.
BLPutCharInColumnLoop:
call BLPutBytes
DEC B
JR Z,BLPutCharNextColumn
;The following code calculates the address of the next line down below current HL address.
PUSH DE ; save DE
ld a,l
and 224
cp 224
jp z,BLPutCharSameThird
BLPutCharNextThird:
ld de,-1760
;and a
add hl,de
POP DE ; get our data point back.
jp BLPutCharInColumnLoop
BLPutCharSameThird:
ld de,32
;and a
POP DE ; get our data point back.
add hl,de
JP BLPutCharInColumnLoop
BLPutCharNextColumn:
POP BC
POP HL
DEC B
RET Z
INC HL
PUSH HL
PUSH BC
JP BLPutCharColumnLoop
end asm
asm
BLPutBytes:
; gets screen address in HL, and bytes address in DE. Copies the 8 bytes to the screen.
ld a,(DE)
LD (HL),a
INC DE
INC H
ld a,(DE)
LD (HL),a
INC DE
INC H
ld a,(DE)
LD (HL),a
INC DE
INC H
ld a,(DE)
LD (HL),a
INC DE
INC H
ld a,(DE)
LD (HL),a
INC DE
INC H
ld a,(DE)
LD (HL),a
INC DE
INC H
ld a,(DE)
LD (HL),a
INC DE
INC H
ld a,(DE)
LD (HL),a
INC DE
ret
end asm
END SUB
goto start
datapoint:
asm
defb 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32
defb 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64
end asm
start:
cls
putChars(0,0,2,2,@datapoint)
putChars(0,7,2,2,@datapoint)
putChars(0,15,2,2,@datapoint)
print at 19,0;"error when line=7 or line=15"