From 35aafe8b4458fea3d7ee3e09c7f683c4e9d4841b Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 1 Apr 2005 09:59:53 +0000 Subject: [PATCH] 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 --- libsrc/apple2/Makefile | 2 + libsrc/apple2/cputc.s | 121 ++++++++++++++++------------------- libsrc/apple2/diosectcount.s | 2 +- libsrc/apple2/diosectsize.s | 2 +- libsrc/apple2/get_ostype.s | 88 ++++++++++++------------- libsrc/apple2/gotoxy.s | 23 +++++++ libsrc/apple2/gotoy.s | 19 ++++++ libsrc/apple2enh/Makefile | 2 + 8 files changed, 147 insertions(+), 112 deletions(-) create mode 100644 libsrc/apple2/gotoxy.s create mode 100644 libsrc/apple2/gotoy.s diff --git a/libsrc/apple2/Makefile b/libsrc/apple2/Makefile index 697459bee..82da35128 100644 --- a/libsrc/apple2/Makefile +++ b/libsrc/apple2/Makefile @@ -59,6 +59,8 @@ OBJS= _scrsize.o \ dosdetect.o \ get_ostype.o \ getenv.o \ + gotoxy.o \ + gotoy.o \ joy_stddrv.o \ kbhit.o \ mainargs.o \ diff --git a/libsrc/apple2/cputc.s b/libsrc/apple2/cputc.s index 75cc99d9a..cbf875b19 100644 --- a/libsrc/apple2/cputc.s +++ b/libsrc/apple2/cputc.s @@ -5,22 +5,20 @@ ; void __fastcall__ cputc (char c); ; - .ifdef __APPLE2ENH__ - .constructor initconio + .ifdef __APPLE2ENH__ + .constructor initconio .endif - .export _cputcxy, _cputc - .export _gotoxy, cputdirect - .export newline, putchar + .export _cputcxy, _cputc + .export cputdirect, newline, putchar + .import popa, _gotoxy, VTABZ - .import popa, VTABZ + .include "apple2.inc" - .include "apple2.inc" + .segment "INIT" - .segment "INIT" - - .ifdef __APPLE2ENH__ + .ifdef __APPLE2ENH__ initconio: - sta SETALTCHAR ; Switch in alternate charset + sta SETALTCHAR ; Switch in alternate charset rts .endif @@ -29,76 +27,67 @@ initconio: ; Plot a character - also used as internal function _cputcxy: - pha ; Save C - jsr popa ; Get Y - jsr _gotoxy - pla ; Restore C + pha ; Save C + jsr popa ; Get Y + jsr _gotoxy + pla ; Restore C _cputc: - cmp #$0D ; Test for \r = carrage return - beq left - cmp #$0A ; Test for \n = line feed - beq newline - ora #$80 ; Turn on high bit - .ifndef __APPLE2ENH__ - cmp #$E0 ; Test for lowercase - bcc cputdirect - and #$DF ; Convert to uppercase + cmp #$0D ; Test for \r = carrage return + beq left + cmp #$0A ; Test for \n = line feed + beq newline + ora #$80 ; Turn on high bit + .ifndef __APPLE2ENH__ + cmp #$E0 ; Test for lowercase + bcc cputdirect + and #$DF ; Convert to uppercase .endif cputdirect: - jsr putchar - inc CH ; Bump to next column - lda CH - cmp WNDWDTH - bcc :+ -left: lda #$00 ; Goto left edge of screen - sta CH + jsr putchar + inc CH ; Bump to next column + lda CH + cmp WNDWDTH + bcc :+ +left: lda #$00 ; Goto left edge of screen + sta CH : rts newline: - inc CV ; Bump to next line - lda CV - cmp WNDBTM - bcc :+ - lda WNDTOP ; Goto top of screen - sta CV -: jmp VTABZ + inc CV ; Bump to next line + lda CV + cmp WNDBTM + bcc :+ + lda WNDTOP ; Goto top of screen + sta CV +: jmp VTABZ putchar: - .ifdef __APPLE2ENH__ - ldy INVFLG - cpy #$FF ; Normal character display mode? - beq put - cmp #$E0 ; Lowercase? - bcc mask - and #$7F ; Inverse lowercase - bra put + .ifdef __APPLE2ENH__ + ldy INVFLG + cpy #$FF ; Normal character display mode? + beq put + cmp #$E0 ; Lowercase? + bcc mask + and #$7F ; Inverse lowercase + bra put .endif -mask: and INVFLG ; Apply normal, inverse, flash -put: ldy CH - .ifdef __APPLE2ENH__ - bit RD80VID ; In 80 column mode? - bpl col40 ; No, in 40 cols +mask: and INVFLG ; Apply normal, inverse, flash +put: ldy CH + .ifdef __APPLE2ENH__ + bit RD80VID ; In 80 column mode? + bpl col40 ; No, in 40 cols pha tya - lsr ; Div by 2 + lsr ; Div by 2 tay pla - bcs col40 ; Odd cols go in 40 col memory - bit HISCR - sta (BASL),Y - bit LOWSCR + bcs col40 ; Odd cols go in 40 col memory + bit HISCR + sta (BASL),Y + bit LOWSCR rts .endif -col40: sta (BASL),Y - rts - -_gotoxy: - clc - adc WNDTOP - sta CV ; Store Y - jsr VTABZ - jsr popa ; Get X - sta CH ; Store X +col40: sta (BASL),Y rts diff --git a/libsrc/apple2/diosectcount.s b/libsrc/apple2/diosectcount.s index 299314278..749248232 100644 --- a/libsrc/apple2/diosectcount.s +++ b/libsrc/apple2/diosectcount.s @@ -1,7 +1,7 @@ ; ; 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 diff --git a/libsrc/apple2/diosectsize.s b/libsrc/apple2/diosectsize.s index 16287a2ec..40b8113b4 100644 --- a/libsrc/apple2/diosectsize.s +++ b/libsrc/apple2/diosectsize.s @@ -1,7 +1,7 @@ ; ; 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 diff --git a/libsrc/apple2/get_ostype.s b/libsrc/apple2/get_ostype.s index 98cd99fb8..77bf95f43 100644 --- a/libsrc/apple2/get_ostype.s +++ b/libsrc/apple2/get_ostype.s @@ -1,70 +1,70 @@ ; ; Oliver Schmidt, 04.01.2005 ; -; unsigned char get_ostype(void) +; unsigned char get_ostype (void) ; - .constructor initostype - .export _get_ostype + .constructor initostype + .export _get_ostype ; Identify machine according to: ; "Apple II Miscellaneous TechNote #7: Apple II Family Identification" - .segment "INIT" + .segment "INIT" initostype: sec - jsr $FE1F - bcs nogs + jsr $FE1F + bcs nogs tya - ora #$80 -done: sta ostype + ora #$80 +done: sta ostype rts -nogs: ldx #$FF +nogs: ldx #$FF next: inx - lda value,x - ldy index,x - beq done ; $00 is no valid index - cmp $FB00,y - beq next + lda value,x + ldy index,x + beq done ; $00 is no valid index + cmp $FB00,y + beq next : inx - ldy index,x - bne :- - beq next ; Branch always + ldy index,x + bne :- + beq next ; Branch always -index: .byte $B3, $00 ; Apple ][ - .byte $B3, $1E, $00 ; Apple ][+ - .byte $B3, $1E, $00 ; Apple /// (emulation) - .byte $B3, $C0, $00 ; Apple //e - .byte $B3, $C0, $DD, $BE, $00 ; Apple //e Option Card - .byte $B3, $C0, $00 ; Apple //e (enhanced) - .byte $B3, $C0, $BF, $00 ; Apple //c - .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 (Rev. Mem. Exp.) - .byte $B3, $C0, $BF, $00 ; Apple //c Plus - .byte $00 +index: .byte $B3, $00 ; Apple ][ + .byte $B3, $1E, $00 ; Apple ][+ + .byte $B3, $1E, $00 ; Apple /// (emulation) + .byte $B3, $C0, $00 ; Apple //e + .byte $B3, $C0, $DD, $BE, $00 ; Apple //e Option Card + .byte $B3, $C0, $00 ; Apple //e (enhanced) + .byte $B3, $C0, $BF, $00 ; Apple //c + .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 (Rev. Mem. Exp.) + .byte $B3, $C0, $BF, $00 ; Apple //c Plus + .byte $00 -value: .byte $38, $10 ; Apple ][ - .byte $EA, $AD, $11 ; Apple ][+ - .byte $EA, $8A, $20 ; Apple /// (emulation) - .byte $06, $EA, $30 ; Apple //e - .byte $06, $E0, $02, $00, $40 ; Apple //e Option Card - .byte $06, $E0, $31 ; Apple //e (enhanced) - .byte $06, $00, $FF, $50 ; Apple //c - .byte $06, $00, $00, $51 ; Apple //c (3.5 ROM) - .byte $06, $00, $03, $53 ; Apple //c (Mem. Exp.) - .byte $06, $00, $04, $54 ; Apple //c (Rev. Mem. Exp.) - .byte $06, $00, $05, $55 ; Apple //c Plus - .byte $00 +value: .byte $38, $10 ; Apple ][ + .byte $EA, $AD, $11 ; Apple ][+ + .byte $EA, $8A, $20 ; Apple /// (emulation) + .byte $06, $EA, $30 ; Apple //e + .byte $06, $E0, $02, $00, $40 ; Apple //e Option Card + .byte $06, $E0, $31 ; Apple //e (enhanced) + .byte $06, $00, $FF, $50 ; Apple //c + .byte $06, $00, $00, $51 ; Apple //c (3.5 ROM) + .byte $06, $00, $03, $53 ; Apple //c (Mem. Exp.) + .byte $06, $00, $04, $54 ; Apple //c (Rev. Mem. Exp.) + .byte $06, $00, $05, $55 ; Apple //c Plus + .byte $00 .code _get_ostype: - lda ostype - ldx #$00 + lda ostype + ldx #$00 rts .bss -ostype: .res 1 +ostype: .res 1 diff --git a/libsrc/apple2/gotoxy.s b/libsrc/apple2/gotoxy.s new file mode 100644 index 000000000..9a2587f5a --- /dev/null +++ b/libsrc/apple2/gotoxy.s @@ -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 diff --git a/libsrc/apple2/gotoy.s b/libsrc/apple2/gotoy.s new file mode 100644 index 000000000..e59de2d01 --- /dev/null +++ b/libsrc/apple2/gotoy.s @@ -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 + + diff --git a/libsrc/apple2enh/Makefile b/libsrc/apple2enh/Makefile index 7d91d049c..dc809675b 100644 --- a/libsrc/apple2enh/Makefile +++ b/libsrc/apple2enh/Makefile @@ -59,6 +59,8 @@ OBJS= _scrsize.o \ dosdetect.o \ get_ostype.o \ getenv.o \ + gotoxy.o \ + gotoy.o \ joy_stddrv.o \ kbhit.o \ mainargs.o \ -- 2.39.5