Bugfix from Oliver Schmidt

git-svn-id: svn://svn.cc65.org/cc65/trunk@3480 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2005-04-21 02:08:29 +00:00
parent c0f6dea213
commit deab71739a
2 changed files with 55 additions and 50 deletions

View File

@@ -2,47 +2,51 @@
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Zero page stuff ; Zero page stuff
WNDLFT := $20 ; Text window left WNDLFT := $20 ; Text window left
WNDWDTH := $21 ; Text window width WNDWDTH := $21 ; Text window width
WNDTOP := $22 ; Text window top WNDTOP := $22 ; Text window top
WNDBTM := $23 ; Text window bottom+1 WNDBTM := $23 ; Text window bottom+1
CH := $24 ; Cursor horizontal position CH := $24 ; Cursor horizontal position
CV := $25 ; Cursor vertical position CV := $25 ; Cursor vertical position
BASL := $28 ; Text base address low BASL := $28 ; Text base address low
BASH := $29 ; Text base address high BASH := $29 ; Text base address high
INVFLG := $32 ; Normal/inverse(/flash) INVFLG := $32 ; Normal/inverse(/flash)
PROMPT := $33 ; Used by GETLN PROMPT := $33 ; Used by GETLN
RNDL := $4E ; Random counter low RNDL := $4E ; Random counter low
RNDH := $4F ; Random counter high RNDH := $4F ; Random counter high
HIMEM := $73 ; Highest available memory address+1 HIMEM := $73 ; Highest available memory address+1
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Vectors ; Vectors
DOSWARM := $03D0 ; DOS warmstart vector DOSWARM := $03D0 ; DOS warmstart vector
BRKVec := $03F0 ; Break vector BRKVec := $03F0 ; Break vector
SOFTEV := $03F2 ; Vector for warm start SOFTEV := $03F2 ; Vector for warm start
PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1 PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Hardware ; Hardware
; Keyboard input ; Keyboard input
KBD := $C000 ; Read keyboard KBD := $C000 ; Read keyboard
KBDSTRB := $C010 ; Clear keyboard strobe KBDSTRB := $C010 ; Clear keyboard strobe
; 80 column card switches ; 80 column card switches
CLRALTCHAR := $C00E ; Normal Apple II char set CLR80COL:= $C000 ; Disable 80 column store
SETALTCHAR := $C00F ; Norm/inv LC, no flash SET80COL:= $C001 ; Enable 80 column store
ALTCHARSET := $C01E ; >127 if alt charset switched in CLRALTCHAR := $C00E ; Normal Apple II char set
RD80VID := $C01F ; >127 if 80 column video enabled SETALTCHAR := $C00F ; Norm/inv LC, no flash
ALTCHARSET := $C01E ; >127 if alt charset switched in
RD80VID := $C01F ; >127 if 80 column video enabled
; Video soft switches ; Video soft switches
MIXCLR := $C052 ; Disable 4 lines of text MIXCLR := $C052 ; Disable 4 lines of text
MIXSET := $C053 ; Enable 4 lines of text MIXSET := $C053 ; Enable 4 lines of text
LOWSCR := $C054 ; Page 1 LOWSCR := $C054 ; Page 1
HISCR := $C055 ; Page 2 HISCR := $C055 ; Page 2
LORES := $C056 ; Lores graphics
HIRES := $C057 ; Hires graphics
; Game controller ; Game controller
BUTN0 := $C061 ; Open-Apple Key BUTN0 := $C061 ; Open-Apple Key
BUTN1 := $C062 ; Closed-Apple Key BUTN1 := $C062 ; Closed-Apple Key

View File

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