X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libsrc%2Fpce%2Fconio.s;h=b9333e1fa6f9eb302106370ea99c02328aef042b;hb=57b8af1adc21f5c9215559af16f134957743baf6;hp=4fb3b1394e7715d33a2acf2f667c557ad8ab9551;hpb=0e29a0993fbaf3e387b93a6fcd93aafb3dc73ddd;p=cc65 diff --git a/libsrc/pce/conio.s b/libsrc/pce/conio.s index 4fb3b1394..b9333e1fa 100644 --- a/libsrc/pce/conio.s +++ b/libsrc/pce/conio.s @@ -1,121 +1,123 @@ - .include "pce.inc" + .include "pce.inc" - .import vce_init - .import psg_init - .import vdc_init + .import vce_init + .import psg_init + .import vdc_init - .constructor initconio, 24 + .constructor initconio, 24 + + .macpack longbranch - .macpack longbranch initconio: -;; jsr vdc_init - jsr vce_init - jsr psg_init - jsr conio_init - jsr set_palette - - st0 #VDC_RCR - st1 #<$0088 - st2 #>$0088 - rts - - .import colors + jsr vce_init + jsr psg_init + jsr conio_init + jsr set_palette + + st0 #VDC_RCR + st1 #<$0088 + st2 #>$0088 + rts + + .import colors set_palette: - stz VCE_ADDR_LO - stz VCE_ADDR_HI + stz VCE_ADDR_LO + stz VCE_ADDR_HI - ldx #0 + ldx #0 @lp: - ldy #16 + ldy #16 @lp1: - lda colors,x - sta VCE_DATA_LO - lda colors+1,x - sta VCE_DATA_HI - dey - bne @lp1 + lda colors,x + sta VCE_DATA_LO + lda colors+1,x + sta VCE_DATA_HI + dey + bne @lp1 - inx - inx - cpx #16*2 - jne @lp + inx + inx + cpx #16*2 + jne @lp - stz VCE_ADDR_LO - stz VCE_ADDR_HI - stz VCE_DATA_LO - stz VCE_DATA_HI + stz VCE_ADDR_LO + stz VCE_ADDR_HI + stz VCE_DATA_LO + stz VCE_DATA_HI - rts + rts ;---------------------------------------------------------------------------- ; ;---------------------------------------------------------------------------- - .importzp ptr1, tmp1 + .importzp ptr1, tmp1 conio_init: - ; Load font - st0 #VDC_MAWR - st1 #<$2000 - st2 #>$2000 + ; Load font + st0 #VDC_MAWR + st1 #<$2000 + st2 #>$2000 - ; ptr to font data - lda #font - sta ptr1+1 + ; ptr to font data + lda #font + sta ptr1+1 - st0 #VDC_VWR ; VWR + st0 #VDC_VWR ; VWR - lda #0 - sta tmp1 - jsr copy + lda #0 + sta tmp1 + jsr copy - lda #font - sta ptr1+1 + lda #font + sta ptr1+1 - lda #$ff - sta tmp1 - jsr copy + lda #$ff + sta tmp1 + jsr copy - ldx #0 - stx BGCOLOR - inx - stx CHARCOLOR + ldx #0 + stx BGCOLOR + inx + stx CHARCOLOR - rts + rts copy: - ldy #$80 ; 128 chars -charloop: ldx #$08 ; 8 bytes/char + ldy #$80 ; 128 chars +charloop: + ldx #$08 ; 8 bytes/char lineloop: - lda (ptr1) - eor tmp1 - sta a:VDC_DATA_LO ; bitplane 0 - stz a:VDC_DATA_HI ; bitplane 1 - - clc ; increment font pointer - lda ptr1 - adc #$01 - sta ptr1 - lda ptr1+1 - adc #$00 - sta ptr1+1 - dex - bne lineloop ; next bitplane 0 byte - ldx #$08 ; fill bitplane 2/3 with 0 -fillloop: st1 #$00 - st2 #$00 - dex - bne fillloop ; next byte - dey - bne charloop ; next character - - rts - - .rodata + lda (ptr1) + eor tmp1 + sta a:VDC_DATA_LO ; bitplane 0 + stz a:VDC_DATA_HI ; bitplane 1 + + clc ; increment font pointer + lda ptr1 + adc #$01 + sta ptr1 + lda ptr1+1 + adc #$00 + sta ptr1+1 + dex + bne lineloop ; next bitplane 0 byte + ldx #$08 ; fill bitplane 2/3 with 0 +fillloop: + st1 #$00 + st2 #$00 + dex + bne fillloop ; next byte + dey + bne charloop ; next character + + rts + + .rodata font: - .include "vga.inc" + .include "vga.inc"