]> git.sur5r.net Git - cc65/blobdiff - libsrc/apple2/cputc.s
Dito for the enhanced apple2
[cc65] / libsrc / apple2 / cputc.s
index cbf875b19589feb08a4fb2971450d82b12c70a08..f3adc2f5478a7fc31f46375fdf1ec9e03e878675 100644 (file)
@@ -6,11 +6,11 @@
 ;
 
         .ifdef  __APPLE2ENH__
-        .constructor    initconio
+        .constructor    initconio, 17
         .endif
         .export         _cputcxy, _cputc
         .export         cputdirect, newline, putchar
-        .import                popa, _gotoxy, VTABZ
+        .import         popa, _gotoxy, VTABZ
 
         .include        "apple2.inc"
 
@@ -18,7 +18,8 @@
 
         .ifdef  __APPLE2ENH__
 initconio:
-        sta     SETALTCHAR     ; Switch in alternate charset
+        sta     SETALTCHAR      ; Switch in alternate charset
+        bit    LORES           ; Limit SET80COL-HISCR to text
         rts
         .endif
 
@@ -28,65 +29,65 @@ initconio:
 
 _cputcxy:
         pha                     ; Save C
-        jsr     popa           ; Get Y
+        jsr     popa            ; Get Y
         jsr     _gotoxy
         pla                     ; Restore C
 
 _cputc:
-        cmp     #$0D           ; Test for \r = carrage return
+        cmp     #$0D            ; Test for \r = carrage return
         beq     left
-        cmp     #$0A           ; Test for \n = line feed
+        cmp     #$0A            ; Test for \n = line feed
         beq     newline
-        ora     #$80           ; Turn on high bit
+        ora     #$80            ; Turn on high bit
         .ifndef __APPLE2ENH__
-        cmp     #$E0           ; Test for lowercase
+        cmp     #$E0            ; Test for lowercase
         bcc     cputdirect
-        and     #$DF           ; Convert to uppercase
+        and     #$DF            ; Convert to uppercase
         .endif
 
 cputdirect:
         jsr     putchar
-        inc     CH             ; Bump to next column
+        inc     CH              ; Bump to next column
         lda     CH
         cmp     WNDWDTH
         bcc     :+
-left:   lda     #$00           ; Goto left edge of screen
+left:   lda     #$00            ; Goto left edge of screen
         sta     CH
 :       rts
 
 newline:
-        inc     CV             ; Bump to next line
+        inc     CV              ; Bump to next line
         lda     CV
         cmp     WNDBTM
         bcc     :+
-        lda     WNDTOP         ; Goto top of screen
+        lda     WNDTOP          ; Goto top of screen
         sta     CV
 :       jmp     VTABZ
                 
 putchar:
         .ifdef  __APPLE2ENH__
         ldy     INVFLG
-        cpy     #$FF           ; Normal character display mode?
+        cpy     #$FF            ; Normal character display mode?
         beq     put
-        cmp     #$E0           ; Lowercase?
+        cmp     #$E0            ; Lowercase?
         bcc     mask
-        and     #$7F           ; Inverse lowercase
+        and     #$7F            ; Inverse lowercase
         bra     put
         .endif
-mask:   and     INVFLG         ; Apply normal, inverse, flash
+mask:   and     INVFLG          ; Apply normal, inverse, flash
 put:    ldy     CH
         .ifdef  __APPLE2ENH__
-        bit     RD80VID        ; In 80 column mode?
-        bpl     col40          ; No, in 40 cols
+        bit     RD80VID         ; In 80 column mode?
+        bpl     col40           ; No, in 40 cols
         pha
         tya
         lsr                     ; Div by 2
         tay
         pla
-        bcs     col40          ; Odd cols go in 40 col memory
-        bit     HISCR
+        bcs     col40           ; Odd cols go in 40 col memory
+        bit     HISCR           ; Assume SET80COL
         sta     (BASL),Y
-        bit     LOWSCR
+        bit     LOWSCR          ; Assume SET80COL
         rts
         .endif
 col40:  sta     (BASL),Y