mirror of
https://github.com/irmen/prog8.git
synced 2024-11-25 19:31:36 +00:00
removed txt.VERA_TEXTMATRIX_BANK/VERA_TEXTMATRIX_ADDR it's now just txt.VERA_TEXTMATRIX (long const)
This commit is contained in:
parent
a874aec6a1
commit
984230e8fa
@ -12,9 +12,7 @@ txt {
|
||||
|
||||
const ubyte DEFAULT_WIDTH = 80
|
||||
const ubyte DEFAULT_HEIGHT = 60
|
||||
|
||||
const ubyte VERA_TEXTMATRIX_BANK = 1
|
||||
const uword VERA_TEXTMATRIX_ADDR = $b000
|
||||
const long VERA_TEXTMATRIX = $1b000
|
||||
|
||||
extsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character.
|
||||
|
||||
@ -131,10 +129,10 @@ _ly ldy #1 ; modified
|
||||
|
||||
set_vera_textmatrix_addresses:
|
||||
stz cx16.VERA_CTRL
|
||||
ora #VERA_TEXTMATRIX_BANK
|
||||
ora #VERA_TEXTMATRIX>>16
|
||||
sta cx16.VERA_ADDR_H
|
||||
stz cx16.VERA_ADDR_L ; start at (0,0)
|
||||
lda #>VERA_TEXTMATRIX_ADDR
|
||||
lda #>VERA_TEXTMATRIX
|
||||
sta cx16.VERA_ADDR_M
|
||||
rts
|
||||
|
||||
@ -280,18 +278,18 @@ asmsub scroll_left() clobbers(A, X, Y) {
|
||||
|
||||
_nextline
|
||||
stz cx16.VERA_CTRL ; data port 0: source column
|
||||
lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1
|
||||
lda #%00010000 | VERA_TEXTMATRIX>>16 ; auto increment 1
|
||||
sta cx16.VERA_ADDR_H
|
||||
lda #2
|
||||
sta cx16.VERA_ADDR_L ; begin in column 1
|
||||
lda P8ZP_SCRATCH_B1
|
||||
clc
|
||||
adc #>VERA_TEXTMATRIX_ADDR
|
||||
adc #>VERA_TEXTMATRIX
|
||||
tay
|
||||
sty cx16.VERA_ADDR_M
|
||||
lda #1
|
||||
sta cx16.VERA_CTRL ; data port 1: destination column
|
||||
lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1
|
||||
lda #%00010000 | VERA_TEXTMATRIX>>16 ; auto increment 1
|
||||
sta cx16.VERA_ADDR_H
|
||||
stz cx16.VERA_ADDR_L
|
||||
sty cx16.VERA_ADDR_M
|
||||
@ -331,18 +329,18 @@ asmsub scroll_right() clobbers(A,X,Y) {
|
||||
|
||||
_nextline
|
||||
stz cx16.VERA_CTRL ; data port 0: source column
|
||||
lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1
|
||||
lda #%00011000 | VERA_TEXTMATRIX>>16 ; auto decrement 1
|
||||
sta cx16.VERA_ADDR_H
|
||||
_rcol lda #79*2-1 ; modified
|
||||
sta cx16.VERA_ADDR_L ; begin in rightmost column minus one
|
||||
lda P8ZP_SCRATCH_B1
|
||||
clc
|
||||
adc #>VERA_TEXTMATRIX_ADDR
|
||||
adc #>VERA_TEXTMATRIX
|
||||
tay
|
||||
sty cx16.VERA_ADDR_M
|
||||
lda #1
|
||||
sta cx16.VERA_CTRL ; data port 1: destination column
|
||||
lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1
|
||||
lda #%00011000 | VERA_TEXTMATRIX>>16 ; auto decrement 1
|
||||
sta cx16.VERA_ADDR_H
|
||||
_rcol2 lda #79*2+1 ; modified
|
||||
sta cx16.VERA_ADDR_L
|
||||
@ -373,18 +371,18 @@ asmsub scroll_up() clobbers(A, X, Y) {
|
||||
dey
|
||||
sty P8ZP_SCRATCH_B1
|
||||
stz cx16.VERA_CTRL ; data port 0 is source
|
||||
lda #1 | (>VERA_TEXTMATRIX_ADDR)
|
||||
lda #1 | (>VERA_TEXTMATRIX)
|
||||
sta cx16.VERA_ADDR_M ; start at second line
|
||||
stz cx16.VERA_ADDR_L
|
||||
lda #%00010000 | VERA_TEXTMATRIX_BANK
|
||||
lda #%00010000 | VERA_TEXTMATRIX>>16
|
||||
sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0.
|
||||
|
||||
lda #1
|
||||
sta cx16.VERA_CTRL ; data port 1 is destination
|
||||
lda #>VERA_TEXTMATRIX_ADDR
|
||||
lda #>VERA_TEXTMATRIX
|
||||
sta cx16.VERA_ADDR_M ; start at top line
|
||||
stz cx16.VERA_ADDR_L
|
||||
lda #%00010000 | VERA_TEXTMATRIX_BANK
|
||||
lda #%00010000 | VERA_TEXTMATRIX>>16
|
||||
sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0.
|
||||
|
||||
_nextline
|
||||
@ -424,10 +422,10 @@ asmsub scroll_down() clobbers(A, X, Y) {
|
||||
dey
|
||||
tya
|
||||
clc
|
||||
adc #>VERA_TEXTMATRIX_ADDR
|
||||
adc #>VERA_TEXTMATRIX
|
||||
sta cx16.VERA_ADDR_M ; start at line before bottom line
|
||||
stz cx16.VERA_ADDR_L
|
||||
lda #%00010000 | VERA_TEXTMATRIX_BANK
|
||||
lda #%00010000 | VERA_TEXTMATRIX>>16
|
||||
sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0.
|
||||
|
||||
lda #1
|
||||
@ -435,10 +433,10 @@ asmsub scroll_down() clobbers(A, X, Y) {
|
||||
iny
|
||||
tya
|
||||
clc
|
||||
adc #>VERA_TEXTMATRIX_ADDR
|
||||
adc #>VERA_TEXTMATRIX
|
||||
sta cx16.VERA_ADDR_M ; start at bottom line
|
||||
stz cx16.VERA_ADDR_L
|
||||
lda #%00010000 | VERA_TEXTMATRIX_BANK
|
||||
lda #%00010000 | VERA_TEXTMATRIX>>16
|
||||
sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0.
|
||||
|
||||
_nextline
|
||||
@ -471,14 +469,14 @@ asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) {
|
||||
%asm {{
|
||||
pha
|
||||
stz cx16.VERA_CTRL
|
||||
lda #VERA_TEXTMATRIX_BANK
|
||||
lda #VERA_TEXTMATRIX>>16
|
||||
sta cx16.VERA_ADDR_H
|
||||
txa
|
||||
asl a
|
||||
sta cx16.VERA_ADDR_L
|
||||
tya
|
||||
; clc
|
||||
adc #>VERA_TEXTMATRIX_ADDR
|
||||
adc #>VERA_TEXTMATRIX
|
||||
sta cx16.VERA_ADDR_M
|
||||
pla
|
||||
sta cx16.VERA_DATA0
|
||||
@ -492,13 +490,13 @@ asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A {
|
||||
asl a
|
||||
pha
|
||||
stz cx16.VERA_CTRL
|
||||
lda #VERA_TEXTMATRIX_BANK
|
||||
lda #VERA_TEXTMATRIX>>16
|
||||
sta cx16.VERA_ADDR_H
|
||||
pla
|
||||
sta cx16.VERA_ADDR_L
|
||||
tya
|
||||
; clc
|
||||
adc #>VERA_TEXTMATRIX_ADDR
|
||||
adc #>VERA_TEXTMATRIX
|
||||
sta cx16.VERA_ADDR_M
|
||||
lda cx16.VERA_DATA0
|
||||
rts
|
||||
@ -512,7 +510,7 @@ asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) {
|
||||
%asm {{
|
||||
pha
|
||||
stz cx16.VERA_CTRL
|
||||
lda #VERA_TEXTMATRIX_BANK
|
||||
lda #VERA_TEXTMATRIX>>16
|
||||
sta cx16.VERA_ADDR_H
|
||||
txa
|
||||
asl a
|
||||
@ -520,7 +518,7 @@ asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) {
|
||||
sta cx16.VERA_ADDR_L
|
||||
tya
|
||||
; clc
|
||||
adc #>VERA_TEXTMATRIX_ADDR
|
||||
adc #>VERA_TEXTMATRIX
|
||||
sta cx16.VERA_ADDR_M
|
||||
pla
|
||||
sta cx16.VERA_DATA0
|
||||
@ -535,13 +533,13 @@ asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A {
|
||||
ina
|
||||
pha
|
||||
stz cx16.VERA_CTRL
|
||||
lda #VERA_TEXTMATRIX_BANK
|
||||
lda #VERA_TEXTMATRIX>>16
|
||||
sta cx16.VERA_ADDR_H
|
||||
pla
|
||||
sta cx16.VERA_ADDR_L
|
||||
tya
|
||||
; clc
|
||||
adc #>VERA_TEXTMATRIX_ADDR
|
||||
adc #>VERA_TEXTMATRIX
|
||||
sta cx16.VERA_ADDR_M
|
||||
lda cx16.VERA_DATA0
|
||||
rts
|
||||
@ -558,12 +556,12 @@ sub setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor) {
|
||||
tax
|
||||
ldy row
|
||||
stz cx16.VERA_CTRL
|
||||
lda #VERA_TEXTMATRIX_BANK
|
||||
lda #VERA_TEXTMATRIX>>16
|
||||
sta cx16.VERA_ADDR_H
|
||||
stx cx16.VERA_ADDR_L
|
||||
tya
|
||||
;clc
|
||||
adc #>VERA_TEXTMATRIX_ADDR
|
||||
adc #>VERA_TEXTMATRIX
|
||||
sta cx16.VERA_ADDR_M
|
||||
lda character
|
||||
sta cx16.VERA_DATA0
|
||||
@ -589,12 +587,12 @@ sub setcc2 (ubyte col, ubyte row, ubyte character, ubyte colors) {
|
||||
tax
|
||||
ldy row
|
||||
stz cx16.VERA_CTRL
|
||||
lda #VERA_TEXTMATRIX_BANK
|
||||
lda #VERA_TEXTMATRIX>>16
|
||||
sta cx16.VERA_ADDR_H
|
||||
stx cx16.VERA_ADDR_L
|
||||
tya
|
||||
; clc
|
||||
adc #>VERA_TEXTMATRIX_ADDR
|
||||
adc #>VERA_TEXTMATRIX
|
||||
sta cx16.VERA_ADDR_M
|
||||
lda character
|
||||
sta cx16.VERA_DATA0
|
||||
|
@ -737,7 +737,7 @@ class NumericLiteral(val type: DataType, // only numerical types allowed
|
||||
throw FatalAstException("type cast of weird type $type")
|
||||
}
|
||||
}
|
||||
return ValueAfterCast(false, "no cast available from $type to $targettype", null)
|
||||
return ValueAfterCast(false, "no cast available from $type to $targettype number=$number", null)
|
||||
}
|
||||
|
||||
fun convertTypeKeepValue(targetDt: DataType): ValueAfterCast {
|
||||
|
@ -18,7 +18,7 @@ main {
|
||||
word balloon_y = 120
|
||||
|
||||
; clear the screen (including all the tiles outside of the visible area)
|
||||
cx16.vaddr(txt.VERA_TEXTMATRIX_BANK, txt.VERA_TEXTMATRIX_ADDR, 0, 1)
|
||||
cx16.vaddr(txt.VERA_TEXTMATRIX>>16, txt.VERA_TEXTMATRIX & $ffff, 0, 1)
|
||||
repeat 128 * txt.DEFAULT_HEIGHT {
|
||||
cx16.VERA_DATA0 = sc:' '
|
||||
cx16.VERA_DATA0 = $00
|
||||
|
@ -8,9 +8,7 @@
|
||||
; an example that displays and moves a single dragon (actually 2 sprites).
|
||||
|
||||
main {
|
||||
; we choose arbitrary unused vram location for sprite data: $12000
|
||||
const ubyte SPRITE_DATA_BANK = 1
|
||||
const uword SPRITE_DATA_ADDR = $2000
|
||||
const long SPRITE_DATA = $12000
|
||||
const ubyte SPRITE_PALETTE_OFFSET = 1 ; sprite palette at color index 16
|
||||
|
||||
sub start() {
|
||||
@ -18,12 +16,12 @@ main {
|
||||
txt.print("there be dragons!")
|
||||
|
||||
; load the sprite data and color palette directly into Vera ram
|
||||
void diskio.vload_raw("dragonsprite.bin", SPRITE_DATA_BANK, SPRITE_DATA_ADDR)
|
||||
void diskio.vload_raw("dragonsprite.bin", SPRITE_DATA>>16, SPRITE_DATA & $ffff)
|
||||
void diskio.vload_raw("dragonsprite.pal", 1, $fa00 + SPRITE_PALETTE_OFFSET*16*2)
|
||||
|
||||
; initialize the dragon sprites
|
||||
sprites.init(1, SPRITE_DATA_BANK, SPRITE_DATA_ADDR, sprites.SIZE_64, sprites.SIZE_64, sprites.COLORS_16, SPRITE_PALETTE_OFFSET)
|
||||
sprites.init(2, SPRITE_DATA_BANK, SPRITE_DATA_ADDR + 64*64/2, sprites.SIZE_64, sprites.SIZE_64, sprites.COLORS_16,SPRITE_PALETTE_OFFSET)
|
||||
sprites.init(1, SPRITE_DATA>>16, SPRITE_DATA & $ffff, sprites.SIZE_64, sprites.SIZE_64, sprites.COLORS_16, SPRITE_PALETTE_OFFSET)
|
||||
sprites.init(2, SPRITE_DATA>>16, (SPRITE_DATA & $ffff) + 64*64/2, sprites.SIZE_64, sprites.SIZE_64, sprites.COLORS_16,SPRITE_PALETTE_OFFSET)
|
||||
|
||||
ubyte tt = 0
|
||||
word xpos = -64
|
||||
|
@ -8,9 +8,7 @@
|
||||
; an example that displays and then moves many sprites at once.
|
||||
|
||||
main {
|
||||
; we choose arbitrary unused vram location for sprite data: $12000
|
||||
const ubyte SPRITE_DATA_BANK = 1
|
||||
const uword SPRITE_DATA_ADDR = $2000
|
||||
const long SPRITE_DATA = $12000
|
||||
const ubyte SPRITE_PALETTE_OFFSET = 1 ; sprite palette at color index 16
|
||||
|
||||
const ubyte NUM_DRAGONS = 25
|
||||
@ -22,14 +20,14 @@ main {
|
||||
txt.print("there be many dragons!")
|
||||
|
||||
; load the sprite data and color palette directly into Vera ram
|
||||
void diskio.vload_raw("dragonsprite.bin", SPRITE_DATA_BANK, SPRITE_DATA_ADDR)
|
||||
void diskio.vload_raw("dragonsprite.bin", SPRITE_DATA>>16, SPRITE_DATA & $ffff)
|
||||
void diskio.vload_raw("dragonsprite.pal", 1, $fa00 + SPRITE_PALETTE_OFFSET*16*2)
|
||||
|
||||
; initialize the dragon sprites (every dragon needs 2 sprites, top and bottom half)
|
||||
ubyte sprite_num
|
||||
for sprite_num in 0 to NUM_DRAGONS*2-2 step 2 {
|
||||
sprites.init(sprite_num+1, SPRITE_DATA_BANK, SPRITE_DATA_ADDR, sprites.SIZE_64, sprites.SIZE_64, sprites.COLORS_16, SPRITE_PALETTE_OFFSET)
|
||||
sprites.init(sprite_num+2, SPRITE_DATA_BANK, SPRITE_DATA_ADDR + 64*64/2, sprites.SIZE_64, sprites.SIZE_64, sprites.COLORS_16, SPRITE_PALETTE_OFFSET)
|
||||
sprites.init(sprite_num+1, SPRITE_DATA>>16, SPRITE_DATA & $ffff, sprites.SIZE_64, sprites.SIZE_64, sprites.COLORS_16, SPRITE_PALETTE_OFFSET)
|
||||
sprites.init(sprite_num+2, SPRITE_DATA>>16, (SPRITE_DATA & $ffff) + 64*64/2, sprites.SIZE_64, sprites.SIZE_64, sprites.COLORS_16, SPRITE_PALETTE_OFFSET)
|
||||
|
||||
xpositions[sprite_num] = math.rndw() % (640-64) as word
|
||||
xpositions[sprite_num+1] = xpositions[sprite_num]
|
||||
|
Loading…
Reference in New Issue
Block a user