Update from Oliver Schmidt: Includes gotox/gotoy which were missing before.

git-svn-id: svn://svn.cc65.org/cc65/trunk@3447 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2005-04-01 09:59:53 +00:00
parent 08808c0ec9
commit 35aafe8b44
8 changed files with 147 additions and 112 deletions

View File

@@ -59,6 +59,8 @@ OBJS= _scrsize.o \
dosdetect.o \ dosdetect.o \
get_ostype.o \ get_ostype.o \
getenv.o \ getenv.o \
gotoxy.o \
gotoy.o \
joy_stddrv.o \ joy_stddrv.o \
kbhit.o \ kbhit.o \
mainargs.o \ mainargs.o \

View File

@@ -5,22 +5,20 @@
; void __fastcall__ cputc (char c); ; void __fastcall__ cputc (char c);
; ;
.ifdef __APPLE2ENH__ .ifdef __APPLE2ENH__
.constructor initconio .constructor initconio
.endif .endif
.export _cputcxy, _cputc .export _cputcxy, _cputc
.export _gotoxy, cputdirect .export cputdirect, newline, putchar
.export newline, putchar .import popa, _gotoxy, VTABZ
.import popa, VTABZ .include "apple2.inc"
.include "apple2.inc" .segment "INIT"
.segment "INIT" .ifdef __APPLE2ENH__
.ifdef __APPLE2ENH__
initconio: initconio:
sta SETALTCHAR ; Switch in alternate charset sta SETALTCHAR ; Switch in alternate charset
rts rts
.endif .endif
@@ -29,76 +27,67 @@ initconio:
; Plot a character - also used as internal function ; Plot a character - also used as internal function
_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
sta (BASL),Y sta (BASL),Y
bit LOWSCR bit LOWSCR
rts rts
.endif .endif
col40: sta (BASL),Y col40: sta (BASL),Y
rts
_gotoxy:
clc
adc WNDTOP
sta CV ; Store Y
jsr VTABZ
jsr popa ; Get X
sta CH ; Store X
rts rts

View File

@@ -1,7 +1,7 @@
; ;
; Oliver Schmidt, 31.03.2005 ; Oliver Schmidt, 31.03.2005
; ;
; sectnum_t __fastcall__ dio_query_sectcount(dhandle_t handle); ; sectnum_t __fastcall__ dio_query_sectcount (dhandle_t handle);
; ;
.export _dio_query_sectcount .export _dio_query_sectcount

View File

@@ -1,7 +1,7 @@
; ;
; Oliver Schmidt, 31.03.2005 ; Oliver Schmidt, 31.03.2005
; ;
; sectsize_t __fastcall__ dio_query_sectsize(dhandle_t handle); ; sectsize_t __fastcall__ dio_query_sectsize (dhandle_t handle);
; ;
.export _dio_query_sectsize .export _dio_query_sectsize

View File

@@ -1,70 +1,70 @@
; ;
; Oliver Schmidt, 04.01.2005 ; Oliver Schmidt, 04.01.2005
; ;
; unsigned char get_ostype(void) ; unsigned char get_ostype (void)
; ;
.constructor initostype .constructor initostype
.export _get_ostype .export _get_ostype
; Identify machine according to: ; Identify machine according to:
; "Apple II Miscellaneous TechNote #7: Apple II Family Identification" ; "Apple II Miscellaneous TechNote #7: Apple II Family Identification"
.segment "INIT" .segment "INIT"
initostype: initostype:
sec sec
jsr $FE1F jsr $FE1F
bcs nogs bcs nogs
tya tya
ora #$80 ora #$80
done: sta ostype done: sta ostype
rts rts
nogs: ldx #$FF nogs: ldx #$FF
next: inx next: inx
lda value,x lda value,x
ldy index,x ldy index,x
beq done ; $00 is no valid index beq done ; $00 is no valid index
cmp $FB00,y cmp $FB00,y
beq next beq next
: inx : inx
ldy index,x ldy index,x
bne :- bne :-
beq next ; Branch always beq next ; Branch always
index: .byte $B3, $00 ; Apple ][ index: .byte $B3, $00 ; Apple ][
.byte $B3, $1E, $00 ; Apple ][+ .byte $B3, $1E, $00 ; Apple ][+
.byte $B3, $1E, $00 ; Apple /// (emulation) .byte $B3, $1E, $00 ; Apple /// (emulation)
.byte $B3, $C0, $00 ; Apple //e .byte $B3, $C0, $00 ; Apple //e
.byte $B3, $C0, $DD, $BE, $00 ; Apple //e Option Card .byte $B3, $C0, $DD, $BE, $00 ; Apple //e Option Card
.byte $B3, $C0, $00 ; Apple //e (enhanced) .byte $B3, $C0, $00 ; Apple //e (enhanced)
.byte $B3, $C0, $BF, $00 ; Apple //c .byte $B3, $C0, $BF, $00 ; Apple //c
.byte $B3, $C0, $BF, $00 ; Apple //c (3.5 ROM) .byte $B3, $C0, $BF, $00 ; Apple //c (3.5 ROM)
.byte $B3, $C0, $BF, $00 ; Apple //c (Mem. Exp.) .byte $B3, $C0, $BF, $00 ; Apple //c (Mem. Exp.)
.byte $B3, $C0, $BF, $00 ; Apple //c (Rev. Mem. Exp.) .byte $B3, $C0, $BF, $00 ; Apple //c (Rev. Mem. Exp.)
.byte $B3, $C0, $BF, $00 ; Apple //c Plus .byte $B3, $C0, $BF, $00 ; Apple //c Plus
.byte $00 .byte $00
value: .byte $38, $10 ; Apple ][ value: .byte $38, $10 ; Apple ][
.byte $EA, $AD, $11 ; Apple ][+ .byte $EA, $AD, $11 ; Apple ][+
.byte $EA, $8A, $20 ; Apple /// (emulation) .byte $EA, $8A, $20 ; Apple /// (emulation)
.byte $06, $EA, $30 ; Apple //e .byte $06, $EA, $30 ; Apple //e
.byte $06, $E0, $02, $00, $40 ; Apple //e Option Card .byte $06, $E0, $02, $00, $40 ; Apple //e Option Card
.byte $06, $E0, $31 ; Apple //e (enhanced) .byte $06, $E0, $31 ; Apple //e (enhanced)
.byte $06, $00, $FF, $50 ; Apple //c .byte $06, $00, $FF, $50 ; Apple //c
.byte $06, $00, $00, $51 ; Apple //c (3.5 ROM) .byte $06, $00, $00, $51 ; Apple //c (3.5 ROM)
.byte $06, $00, $03, $53 ; Apple //c (Mem. Exp.) .byte $06, $00, $03, $53 ; Apple //c (Mem. Exp.)
.byte $06, $00, $04, $54 ; Apple //c (Rev. Mem. Exp.) .byte $06, $00, $04, $54 ; Apple //c (Rev. Mem. Exp.)
.byte $06, $00, $05, $55 ; Apple //c Plus .byte $06, $00, $05, $55 ; Apple //c Plus
.byte $00 .byte $00
.code .code
_get_ostype: _get_ostype:
lda ostype lda ostype
ldx #$00 ldx #$00
rts rts
.bss .bss
ostype: .res 1 ostype: .res 1

23
libsrc/apple2/gotoxy.s Normal file
View File

@@ -0,0 +1,23 @@
;
; Ullrich von Bassewitz, 06.08.1998
;
; void __fastcall__ gotoxy (unsigned char x, unsigned char y);
; void __fastcall__ gotox (unsigned char x);
;
.export _gotoxy, _gotox
.import popa, VTABZ
.include "apple2.inc"
_gotoxy:
clc
adc WNDTOP
sta CV ; Store Y
jsr VTABZ
jsr popa ; Get X
_gotox:
sta CH ; Store X
rts

19
libsrc/apple2/gotoy.s Normal file
View File

@@ -0,0 +1,19 @@
;
; Ullrich von Bassewitz, 06.08.1998
;
; void __fastcall__ gotoy (unsigned char y);
;
.export _gotoy
.import VTABZ
.include "apple2.inc"
_gotoy:
clc
adc WNDTOP
sta CV ; Store Y
jmp VTABZ

View File

@@ -59,6 +59,8 @@ OBJS= _scrsize.o \
dosdetect.o \ dosdetect.o \
get_ostype.o \ get_ostype.o \
getenv.o \ getenv.o \
gotoxy.o \
gotoy.o \
joy_stddrv.o \ joy_stddrv.o \
kbhit.o \ kbhit.o \
mainargs.o \ mainargs.o \