2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 06.08.1998
|
|
|
|
;
|
2005-03-26 17:03:30 +00:00
|
|
|
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
|
|
|
; void __fastcall__ cputc (char c);
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
|
2005-04-01 09:59:53 +00:00
|
|
|
.ifdef __APPLE2ENH__
|
2011-01-29 21:36:18 +00:00
|
|
|
.constructor initconio
|
2005-03-26 17:03:30 +00:00
|
|
|
.endif
|
2005-04-01 09:59:53 +00:00
|
|
|
.export _cputcxy, _cputc
|
|
|
|
.export cputdirect, newline, putchar
|
2016-06-05 12:58:38 +00:00
|
|
|
.import gotoxy, VTABZ
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2005-04-01 09:59:53 +00:00
|
|
|
.include "apple2.inc"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2016-03-06 20:26:22 +00:00
|
|
|
.segment "ONCE"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2005-04-01 09:59:53 +00:00
|
|
|
.ifdef __APPLE2ENH__
|
2004-03-11 21:54:22 +00:00
|
|
|
initconio:
|
2005-04-21 02:08:29 +00:00
|
|
|
sta SETALTCHAR ; Switch in alternate charset
|
2013-05-09 11:56:54 +00:00
|
|
|
bit LORES ; Limit SET80COL-HISCR to text
|
2005-03-26 17:03:30 +00:00
|
|
|
rts
|
|
|
|
.endif
|
2004-03-11 21:54:22 +00:00
|
|
|
|
2005-03-26 17:03:30 +00:00
|
|
|
.code
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2005-03-26 17:03:30 +00:00
|
|
|
; Plot a character - also used as internal function
|
2005-02-26 09:34:01 +00:00
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
_cputcxy:
|
2005-04-01 09:59:53 +00:00
|
|
|
pha ; Save C
|
2016-06-05 12:58:38 +00:00
|
|
|
jsr gotoxy ; Call this one, will pop params
|
|
|
|
pla ; Restore C and run into _cputc
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
_cputc:
|
2005-04-21 02:08:29 +00:00
|
|
|
cmp #$0D ; Test for \r = carrage return
|
2005-04-01 09:59:53 +00:00
|
|
|
beq left
|
2005-04-21 02:08:29 +00:00
|
|
|
cmp #$0A ; Test for \n = line feed
|
2005-04-01 09:59:53 +00:00
|
|
|
beq newline
|
2005-04-21 02:08:29 +00:00
|
|
|
ora #$80 ; Turn on high bit
|
2005-04-01 09:59:53 +00:00
|
|
|
.ifndef __APPLE2ENH__
|
2005-04-21 02:08:29 +00:00
|
|
|
cmp #$E0 ; Test for lowercase
|
2005-04-01 09:59:53 +00:00
|
|
|
bcc cputdirect
|
2005-04-21 02:08:29 +00:00
|
|
|
and #$DF ; Convert to uppercase
|
2005-03-26 17:03:30 +00:00
|
|
|
.endif
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
cputdirect:
|
2005-04-01 09:59:53 +00:00
|
|
|
jsr putchar
|
2005-04-21 02:08:29 +00:00
|
|
|
inc CH ; Bump to next column
|
2005-04-01 09:59:53 +00:00
|
|
|
lda CH
|
|
|
|
cmp WNDWDTH
|
|
|
|
bcc :+
|
2005-04-21 02:08:29 +00:00
|
|
|
left: lda #$00 ; Goto left edge of screen
|
2005-04-01 09:59:53 +00:00
|
|
|
sta CH
|
2005-03-26 17:03:30 +00:00
|
|
|
: rts
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
newline:
|
2005-04-21 02:08:29 +00:00
|
|
|
inc CV ; Bump to next line
|
2005-04-01 09:59:53 +00:00
|
|
|
lda CV
|
|
|
|
cmp WNDBTM
|
|
|
|
bcc :+
|
2005-04-21 02:08:29 +00:00
|
|
|
lda WNDTOP ; Goto top of screen
|
2005-04-01 09:59:53 +00:00
|
|
|
sta CV
|
|
|
|
: jmp VTABZ
|
2005-03-26 17:03:30 +00:00
|
|
|
|
2005-02-26 09:34:01 +00:00
|
|
|
putchar:
|
2005-04-01 09:59:53 +00:00
|
|
|
.ifdef __APPLE2ENH__
|
|
|
|
ldy INVFLG
|
2005-04-21 02:08:29 +00:00
|
|
|
cpy #$FF ; Normal character display mode?
|
2005-04-01 09:59:53 +00:00
|
|
|
beq put
|
2005-04-21 02:08:29 +00:00
|
|
|
cmp #$E0 ; Lowercase?
|
2005-04-01 09:59:53 +00:00
|
|
|
bcc mask
|
2005-04-21 02:08:29 +00:00
|
|
|
and #$7F ; Inverse lowercase
|
2005-04-01 09:59:53 +00:00
|
|
|
bra put
|
2005-03-26 17:03:30 +00:00
|
|
|
.endif
|
2005-04-21 02:08:29 +00:00
|
|
|
mask: and INVFLG ; Apply normal, inverse, flash
|
2005-04-01 09:59:53 +00:00
|
|
|
put: ldy CH
|
|
|
|
.ifdef __APPLE2ENH__
|
2005-04-21 02:08:29 +00:00
|
|
|
bit RD80VID ; In 80 column mode?
|
|
|
|
bpl col40 ; No, in 40 cols
|
2005-03-26 17:03:30 +00:00
|
|
|
pha
|
|
|
|
tya
|
2005-04-01 09:59:53 +00:00
|
|
|
lsr ; Div by 2
|
2005-03-26 17:03:30 +00:00
|
|
|
tay
|
|
|
|
pla
|
2005-04-21 02:08:29 +00:00
|
|
|
bcs col40 ; Odd cols go in 40 col memory
|
|
|
|
bit HISCR ; Assume SET80COL
|
2005-04-01 09:59:53 +00:00
|
|
|
sta (BASL),Y
|
2005-04-21 02:08:29 +00:00
|
|
|
bit LOWSCR ; Assume SET80COL
|
2005-03-26 17:03:30 +00:00
|
|
|
rts
|
|
|
|
.endif
|
2005-04-01 09:59:53 +00:00
|
|
|
col40: sta (BASL),Y
|
2005-03-26 17:03:30 +00:00
|
|
|
rts
|