1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 02:29:52 +00:00

New version from Oliver Schmidt

git-svn-id: svn://svn.cc65.org/cc65/trunk@3421 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2005-03-26 17:03:30 +00:00
parent fe2d8f26ed
commit 071c58bda2
27 changed files with 512 additions and 598 deletions

View File

@ -57,7 +57,6 @@ OBJS= _scrsize.o \
mainargs.o \ mainargs.o \
oserrlist.o \ oserrlist.o \
randomize.o \ randomize.o \
rbascalc.o \
rcout.o \ rcout.o \
read.o \ read.o \
revers.o \ revers.o \
@ -65,7 +64,7 @@ OBJS= _scrsize.o \
rom.o \ rom.o \
rpread.o \ rpread.o \
rrdkey.o \ rrdkey.o \
rsetwnd.o \ rvtabz.o \
systime.o \ systime.o \
sysuname.o \ sysuname.o \
tgi_mode_table.o\ tgi_mode_table.o\

View File

@ -6,7 +6,12 @@
.export screensize .export screensize
.include "apple2.inc"
screensize: screensize:
ldx #40 ldx WNDWDTH
ldy #24 lda WNDBTM
sec
sbc WNDTOP
tay
rts rts

View File

@ -2,11 +2,16 @@
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Zero page stuff ; Zero page stuff
WNDWDTH := $21 ; Right edge of text window WNDLFT := $20 ; Text window left
WNDWDTH := $21 ; Text window width
WNDTOP := $22 ; Text window top
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 BASL := $28 ; Text base address low
BASH := $29 ; Text base address high
INVFLG := $32 ; Normal/inverse(/flash) INVFLG := $32 ; Normal/inverse(/flash)
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
@ -14,11 +19,10 @@ HIMEM := $73 ; Highest available memory address+1
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Vectors ; Vectors
SOFTEV := $03F2 ; Vector for warm start
PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1
DOSWARM := $03D0 ; DOS warmstart vector DOSWARM := $03D0 ; DOS warmstart vector
BRKVec := $03F0 ; Break vector BRKVec := $03F0 ; Break vector
MLI := $BF00 ; ProDOS Machine Language Interface SOFTEV := $03F2 ; Vector for warm start
PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Hardware ; Hardware

View File

@ -1,8 +1,8 @@
; ;
; Ullrich von Bassewitz, 08.08.1998 ; Ullrich von Bassewitz, 08.08.1998
; ;
; void cclearxy (unsigned char x, unsigned char y, unsigned char length); ; void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);
; void cclear (unsigned char length); ; void __fastcall__ cclear (unsigned char length);
; ;
.export _cclearxy, _cclear .export _cclearxy, _cclear

View File

@ -1,10 +1,10 @@
;; ;
;; Kevin Ruland ; Kevin Ruland
;; ;
;; char cgetc (void); ; char cgetc (void);
;; ;
;; If open_apple key is pressed then the high-bit of the ; If open_apple key is pressed then the high-bit of the key is set.
;; key is set. ;
.export _cgetc .export _cgetc
@ -13,13 +13,11 @@
_cgetc: _cgetc:
lda KBD lda KBD
bpl _cgetc ; if < 128, no key pressed bpl _cgetc ; if < 128, no key pressed
;; At this time, the high bit of the key pressed
;; is set ; At this time, the high bit of the key pressed is set
bit KBDSTRB ; clear keyboard strobe bit KBDSTRB ; clear keyboard strobe
bit BUTN0 ; check if OpenApple is down bit BUTN0 ; check if OpenApple is down
bmi pressed bmi :+
and #$7F ; If not down, then clear high bit and #$7F ; If not down, then clear high bit
pressed: : ldx #$00
ldx #$00
rts rts

View File

@ -1,13 +1,15 @@
; ;
; Ullrich von Bassewitz, 08.08.1998 ; Ullrich von Bassewitz, 08.08.1998
; ;
; void chlinexy (unsigned char x, unsigned char y, unsigned char length); ; void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);
; void chline (unsigned char length); ; void __fastcall__ chline (unsigned char length);
; ;
.export _chlinexy, _chline, chlinedirect .export _chlinexy, _chline, chlinedirect
.import popa, _gotoxy, cputdirect .import popa, _gotoxy, cputdirect
.importzp tmp1
.include "zeropage.inc"
.include "apple2.inc"
_chlinexy: _chlinexy:
pha ; Save the length pha ; Save the length
@ -16,6 +18,12 @@ _chlinexy:
pla ; Restore the length and run into _chline pla ; Restore the length and run into _chline
_chline: _chline:
.ifdef __APPLE2ENH__
ldx #'S' ; MouseText character
ldy INVFLG
cpy #$FF ; Normal character display mode?
beq chlinedirect
.endif
ldx #'-' | $80 ; Horizontal line, screen code ldx #'-' | $80 ; Horizontal line, screen code
chlinedirect: chlinedirect:

View File

@ -1,7 +1,8 @@
;; ;
;; Kevin Ruland ; Kevin Ruland
;; ;
;; void clrscr (void); ; void clrscr (void);
;
.export _clrscr .export _clrscr
.import HOME .import HOME

View File

@ -1,35 +1,33 @@
; ;
; Ullrich von Bassewitz, 06.08.1998 ; Ullrich von Bassewitz, 06.08.1998
; ;
; void cputcxy (unsigned char x, unsigned char y, char c); ; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c); ; void __fastcall__ cputc (char c);
; ;
.ifdef __APPLE2ENH__
.constructor initconio .constructor initconio
.endif
.export _cputcxy, _cputc .export _cputcxy, _cputc
.export _gotoxy, cputdirect .export _gotoxy, cputdirect
.export newline, putchar .export newline, putchar
.import popa, SETWND, BASCALC .import popa, VTABZ
.include "apple2.inc" .include "apple2.inc"
; ------------------------------------------------------------------------ .segment "INIT"
; Initialization
.segment "INIT"
.ifdef __APPLE2ENH__
initconio: initconio:
lda #$FF ; Normal character display mode sta SETALTCHAR ; Switch in alternate charset
sta INVFLG rts
lda #$00 .endif
jmp SETWND ; Reset text window to full screen
.code
; ------------------------------------------------------------------------
; Plot a character - also used as internal function ; Plot a character - also used as internal function
.code
_cputcxy: _cputcxy:
pha ; Save C pha ; Save C
jsr popa ; Get Y jsr popa ; Get Y
@ -42,38 +40,65 @@ _cputc:
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__
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
cputdirect: cputdirect:
jsr putchar jsr putchar
inc CH ; Bump to next column inc CH ; Bump to next column
lda CH lda CH
cmp #40 cmp WNDWDTH
bne done bcc :+
left: lda #$00 ; Goto left edge of screen left: lda #$00 ; Goto left edge of screen
sta CH sta CH
done: rts : rts
newline: newline:
inc CV inc CV ; Bump to next line
lda CV lda CV
cmp #24 cmp WNDBTM
bne :+ bcc :+
lda #$00 lda WNDTOP ; Goto top of screen
sta CV sta CV
: jmp BASCALC : jmp VTABZ
putchar: putchar:
and INVFLG ; Apply normal, inverse, flash .ifdef __APPLE2ENH__
ldy CH 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
pha
tya
lsr ; Div by 2
tay
pla
bcs col40 ; Odd cols go in 40 col memory
bit HISCR
sta (BASL),Y sta (BASL),Y
bit LOWSCR
rts
.endif
col40: sta (BASL),Y
rts rts
_gotoxy: _gotoxy:
clc
adc WNDTOP
sta CV ; Store Y sta CV ; Store Y
jsr BASCALC jsr VTABZ
jsr popa ; Get X jsr popa ; Get X
sta CH ; Store X sta CH ; Store X
rts rts

View File

@ -1,13 +1,14 @@
; ;
; Ullrich von Bassewitz, 08.08.1998 ; Ullrich von Bassewitz, 08.08.1998
; ;
; void cvlinexy (unsigned char x, unsigned char y, unsigned char length); ; void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);
; void cvline (unsigned char length); ; void __fastcall__ cvline (unsigned char length);
; ;
.export _cvlinexy, _cvline, cvlinedirect .export _cvlinexy, _cvline, cvlinedirect
.import popa, _gotoxy, putchar, newline .import popa, _gotoxy, putchar, newline
.importzp tmp1
.include "zeropage.inc"
_cvlinexy: _cvlinexy:
pha ; Save the length pha ; Save the length
@ -16,7 +17,11 @@ _cvlinexy:
pla ; Restore the length and run into _cvline pla ; Restore the length and run into _cvline
_cvline: _cvline:
.ifdef __APPLE2ENH__
ldx #'|' | $80 ; Vertical line, screen code
.else
ldx #'!' | $80 ; Vertical line, screen code ldx #'!' | $80 ; Vertical line, screen code
.endif
cvlinedirect: cvlinedirect:
cmp #$00 ; Is the length zero? cmp #$00 ; Is the length zero?

View File

@ -3,45 +3,46 @@
; ;
; Identify DOS version we're running on as one of these: ; Identify DOS version we're running on as one of these:
; ;
; AppleDOS 3.3 $00 ; AppleDOS 3.3 - $00
; ProDOS 1.0.1 $10 ; ProDOS 8 1.0.1 - $10
; ProDOS 1.0.2 $10 ; ProDOS 8 1.0.2 - $10
; ProDOS 1.1.1 $11 ; ProDOS 8 1.1.1 - $11
; ProDOS 1.2 $12 ; ProDOS 8 1.2 - $12
; ProDOS 1.3 $13 ; ProDOS 8 1.3 - $13
; ProDOS 1.4 $14 ; ProDOS 8 1.4 - $14
; ProDOS 1.5 $15 ; ProDOS 8 1.5 - $15
; ProDOS 1.6 $16 ; ProDOS 8 1.6 - $16
; ProDOS 1.7 $17 ; ProDOS 8 1.7 - $17
; ProDOS 1.8 $18 ; ProDOS 8 1.8 - $18
; ProDOS 1.9 $18 ; ProDOS 8 1.9 - $18
; ProDOS 2.0.1 $21 ; ProDOS 8 2.0.1 - $21
; ProDOS 2.0.2 $22 ; ProDOS 8 2.0.2 - $22
; ProDOS 2.0.3 $23 ; ProDOS 8 2.0.3 - $23
;
.constructor initdostype .constructor initdostype
.export __dos_type .export __dos_type
.include "apple2.inc" .include "mli.inc"
; Identify DOS version according to: ; Identify DOS version according to:
; - "Beneath Apple ProDOS", chapter 6-63 ; - "Beneath Apple ProDOS", chapter 6-63
; - "Apple II ProDOS 8 TechNote #023: ProDOS 8 Changes and Minutia" ; - "Apple II ProDOS 8 TechNote #023: ProDOS 8 Changes and Minutia"
; - ProDOS TechRefMan, chapter 5.2.4 ; - ProDOS TechRefMan, chapter 5.2.4
.segment "INIT" .segment "INIT"
initdostype: initdostype:
lda MLI lda ENTRY
cmp #$4C ; Is MLI present? (JMP opcode) cmp #$4C ; Is MLI present? (JMP opcode)
bne done bne done
lda $BFFF ; ProDOS KVERSION lda KVERSION ; ProDOS 8 kernel version
cmp #$10 cmp #$10
bcs :+ bcs :+
ora #$10 ; Make high nibble match major version ora #$10 ; Make high nibble match major version
: sta __dos_type : sta __dos_type
done: rts done: rts
.bss .bss
__dos_type: .res 1 __dos_type: .res 1

View File

@ -10,10 +10,7 @@
; 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"
; Initialization
.segment "INIT"
initostype: initostype:
sec sec
@ -35,18 +32,6 @@ next: inx
bne :- bne :-
beq next ; Branch always beq next ; Branch always
; ------------------------------------------------------------------------
.code
_get_ostype:
lda ostype
ldx #$00
rts
.rodata
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)
@ -73,7 +58,13 @@ value: .byte $38, $10 ; Apple ][
.byte $06, $00, $05, $55 ; Apple //c Plus .byte $06, $00, $05, $55 ; Apple //c Plus
.byte $00 .byte $00
.code
.bss _get_ostype:
lda ostype
ldx #$00
rts
.bss
ostype: .res 1 ostype: .res 1

View File

@ -1,7 +1,7 @@
; ;
; Ullrich von Bassewitz, 2003-05-02 ; Ullrich von Bassewitz, 2003-05-02
; ;
; char* getenv (const char* name); ; char* __fastcall__ getenv (const char* name);
; ;
.export _getenv .export _getenv

View File

@ -10,5 +10,10 @@
.rodata .rodata
_joy_stddrv: .asciiz "A2.STDJOY.JOY" _joy_stddrv:
.ifdef __APPLE2ENH__
.asciiz "A2E.STDJOY.JOY"
.else
.asciiz "A2.STDJOY.JOY"
.endif

View File

@ -1,18 +1,17 @@
;; ;
;; Kevin Ruland ; Kevin Ruland
;; ; Ullrich von Bassewitz, 2005-03-25
;; int kbhit (void); ;
;; ; unsigned char kbhit (void);
;
.export _kbhit .export _kbhit
.import return0, return1
.include "apple2.inc" .include "apple2.inc"
_kbhit: _kbhit: lda KBD ; Reading KBD checks for keypress
bit KBD ; Reading keyboard checks for keypress rol ; if high bit is set, key was pressed
bmi L1 ; if KBD > 127 key was pressed lda #$00
jmp return0 tax
L1: rol
jmp return1 rts

View File

@ -1,8 +1,8 @@
;; ;
;; Kevin Ruland ; Kevin Ruland
;; ;
;; unsigned char __fastcall__ revers (unsigned char onoff) ; unsigned char __fastcall__ revers (unsigned char onoff)
;; ;
.export _revers .export _revers
@ -13,13 +13,11 @@ _revers:
and #$FF ; Test for any bit and #$FF ; Test for any bit
beq normal ; Nothing set beq normal ; Nothing set
lda #~$3F ; Not Inverse lda #~$3F ; Not Inverse
normal: normal: eor #$FF ; Xor Normal
eor #$FF ; Xor Normal
sta INVFLG sta INVFLG
tya ; What was the old value? tya ; What was the old value?
eor #$FF ; Normal = $FF, Inverse = $3F eor #$FF ; Normal = $FF, Inverse = $3F
beq L2 beq :+
lda #$01 lda #$01
L2: : ldx #$00
rts rts

9
libsrc/apple2/rvtabz.s Normal file
View File

@ -0,0 +1,9 @@
;
; Ullrich von Bassewitz, 2004-06-03
;
; Rom VTABZ routine
;
.export VTABZ
VTABZ := $FC24 ; Generate text base address

View File

@ -11,7 +11,7 @@
.export __systime .export __systime
.importzp sreg .include "zeropage.inc"
__systime: __systime:
lda #$FF lda #$FF

105
libsrc/apple2/textframe.s Normal file
View File

@ -0,0 +1,105 @@
;
; Oliver Schmidt, 10.03.2004
;
; void __fastcall__ _textframexy (unsigned char x, unsigned char y,
; unsigned char width, unsigned char height,
; unsigned char style);
; void __fastcall__ _textframe (unsigned char width, unsigned char height);
; unsigned char style);
;
.export __textframexy, __textframe
.import popa, pusha, _gotoxy
.import chlinedirect, cvlinedirect
.include "zeropage.inc"
.include "apple2.inc"
WIDTH = tmp2
HEIGHT = tmp3
XORIGIN = tmp4
YORIGIN = ptr1
__textframexy:
sec
bra :+
__textframe:
clc
: ldx INVFLG
phx ; Save character display mode
ldx #$FF
stx INVFLG ; Set normal character display mode
pha ; Save index
jsr popa ; Get height
sta HEIGHT
jsr popa ; Get width
sta WIDTH
lda CH
ldx CV
bcc noxy
jsr popa ; Get y
tax
jsr popa ; Get x
noxy: sta XORIGIN
stx YORIGIN
plx ; Restore index
loop: lda XOFFS,x
clc
bpl :+ ; Relative to left edge?
adc WIDTH
: adc XORIGIN
jsr pusha
lda YOFFS,x
clc
bpl :+ ; Relative to top?
adc HEIGHT
: adc YORIGIN
jsr _gotoxy ; Call this one, will pop params
txa
tay
lsr ; Get bit 0 (vline) into carry
lda LENGTH,x
phx ; Save index
ldx CHAR,y
bcc hline
clc
adc HEIGHT
jsr cvlinedirect
bra next
hline: adc WIDTH
jsr chlinedirect
next: plx ; Restore index
inx
txa
and #$03 ; Mask style
bne loop
pla
sta INVFLG ; Restore character display mode
rts
.rodata
; 2 styles with 4 lines each make up 8 entries per table
; - even entry numbers mean horizontal lines
; - odd entry numbers mean vertical lines
; x offset for the line starting point
; - a positive value means relative to the frame left edge
; - a negative value menas relative to the frame right edge
XOFFS: .byte 0, 0, 0, -2, 1, 0, 1, -2
; y offset for the line starting point
; - a positive value means relative to the frame top
; - a negative value menas relative to the frame bottom
YOFFS: .byte 0, 1, -2, 1, 0, 0, -2, 0
; length of the line relative to the frame size
; - a negative value for hlines means shorter than the width
; - a negative value for vlines menas shorter than the height
LENGTH: .byte 0, -2, 0, -2, -2, 0, -2, 0
; character to use for drawing the line
; - hibit set means normal printable character
; - hibit clear means MouseText character
CHAR: .byte '_'|$80, '_', 'L', 'Z', 'L', 'Z', '_'|$80, '_'

View File

@ -17,7 +17,13 @@
.rodata .rodata
_tgi_mode_table: _tgi_mode_table:
.ifdef __APPLE2ENH__
.byte TGI_MODE_280_192_6, "A2E.HI.TGI", 0
.byte TGI_MODE_40_40_16, "A2E.LO.TGI", 0
; .byte TGI_MODE_560_192_2, "A2E.DHI.TGI", 0
.else
.byte TGI_MODE_280_192_6, "A2.HI.TGI", 0 .byte TGI_MODE_280_192_6, "A2.HI.TGI", 0
.byte TGI_MODE_40_40_16, "A2.LO.TGI", 0 .byte TGI_MODE_40_40_16, "A2.LO.TGI", 0
; .byte TGI_MODE_560_192_2, "A2.DHI.TGI", 0 ; .byte TGI_MODE_560_192_2, "A2.DHI.TGI", 0
.endif
.byte 0 ; End marker .byte 0 ; End marker

View File

@ -1,7 +1,8 @@
;
;; Keivn Ruland ; Kevin Ruland
;; ;
;; unsigned char wherex( void ); ; unsigned char wherex (void);
;
.export _wherex .export _wherex

View File

@ -1,7 +1,8 @@
;
;; Keivn Ruland ; Kevin Ruland
;; ;
;; unsigned char wherey( void ); ; unsigned char wherey (void);
;
.export _wherey .export _wherey
@ -9,5 +10,7 @@
_wherey: _wherey:
lda CV lda CV
sec
sbc WNDTOP
ldx #$00 ldx #$00
rts rts

View File

@ -13,17 +13,17 @@ AS = ../../src/ca65/ca65
CC = ../../src/cc65/cc65 CC = ../../src/cc65/cc65
LD = ../../src/ld65/ld65 LD = ../../src/ld65/ld65
AFLAGS = -t $(SYS) -I../../asminc AFLAGS = -t $(SYS) -I../apple2 -I../../asminc
CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I ../apple2 -I ../../include
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Rules # Rules
%.o: %.c %.o: ../apple2/%.c
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: ../apple2/%.s
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
%.emd: %.o ../runtime/zeropage.o %.emd: %.o ../runtime/zeropage.o
@ -39,21 +39,50 @@ CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
# Object files # Object files
OBJS= _scrsize.o \ OBJS= _scrsize.o \
break.o \
cclear.o \
cgetc.o \
chline.o \ chline.o \
clrscr.o \
color.o \
cputc.o \ cputc.o \
crt0.o \
ctype.o \
cvline.o \ cvline.o \
textframe.o dosdetect.o \
get_ostype.o \
getenv.o \
joy_stddrv.o \
kbhit.o \
mainargs.o \
oserrlist.o \
randomize.o \
rcout.o \
read.o \
revers.o \
rhome.o \
rom.o \
rpread.o \
rrdkey.o \
rvtabz.o \
systime.o \
sysuname.o \
textframe.o \
tgi_mode_table.o\
wherex.o \
wherey.o \
write.o
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Drivers # Drivers
EMDS = EMDS = apple2-lc.emd
JOYS = JOYS = apple2-stdjoy.joy
SERS = SERS =
TGIS = TGIS = apple2-40-40-16.tgi apple2-280-192-6.tgi
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Targets # Targets

View File

@ -1,14 +0,0 @@
;
; Ullrich von Bassewitz, 26.10.2000
;
; Screen size variables
;
.export screensize
.include "../apple2/apple2.inc"
screensize:
ldx WNDWDTH
ldy #24
rts

View File

@ -1,39 +0,0 @@
;
; Ullrich von Bassewitz, 08.08.1998
;
; void chlinexy (unsigned char x, unsigned char y, unsigned char length);
; void chline (unsigned char length);
;
.export _chlinexy, _chline, chlinedirect
.import popa, _gotoxy, cputdirect
.importzp tmp1
.include "../apple2/apple2.inc"
_chlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _chline
_chline:
ldx #'S' ; MouseText character
ldy INVFLG
cpy #$FF ; Normal character display mode?
beq chlinedirect
ldx #'-' | $80 ; Horizontal line, screen code
chlinedirect:
cmp #$00 ; Is the length zero?
beq done ; Jump if done
sta tmp1
: txa ; Screen code
jsr cputdirect ; Direct output
dec tmp1
bne :-
done: rts

View File

@ -1,89 +0,0 @@
;
; Ullrich von Bassewitz, 06.08.1998
;
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
;
.constructor initconio
.export _cputcxy, _cputc
.export _gotoxy, cputdirect
.export newline, putchar
.import popa, SETWND, BASCALC
.include "../apple2/apple2.inc"
initconio:
lda #$FF ; Normal character display mode
sta INVFLG
sta SETALTCHAR ; Switch in alternate charset
lda #$00
jsr SETWND ; Reset text window to full screen
rts
; Plot a character - also used as internal function
_cputcxy:
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
cputdirect:
jsr putchar
inc CH ; Bump to next column
lda CH
cmp WNDWDTH
bne done
left: stz CH ; Goto left edge of screen
done: rts
newline:
inc CV
lda CV
cmp #24
bne :+
lda #$00
sta CV
: jsr BASCALC
rts
putchar:
ldy INVFLG
cpy #$FF ; Normal character display mode?
beq put
cmp #$E0 ; Lowercase?
bcc mask
and #$7F ; Inverse lowercase
bra put
mask: and INVFLG ; Apply normal, inverse, flash
put: ldy CH
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
sta (BASL),Y
bit LOWSCR
rts
col40: sta (BASL),Y
rts
_gotoxy:
sta CV ; Store Y
jsr BASCALC
jsr popa ; Get X
sta CH ; Store X
rts

View File

@ -1,30 +0,0 @@
;
; Ullrich von Bassewitz, 08.08.1998
;
; void cvlinexy (unsigned char x, unsigned char y, unsigned char length);
; void cvline (unsigned char length);
;
.export _cvlinexy, _cvline, cvlinedirect
.import popa, _gotoxy, putchar, newline
.importzp tmp1
_cvlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
_cvline:
ldx #'|' | $80 ; Vertical line, screen code
cvlinedirect:
cmp #$00 ; Is the length zero?
beq done ; Jump if done
sta tmp1
: txa ; Screen code
jsr putchar ; Write, no cursor advance
jsr newline ; Advance cursor to next line
dec tmp1
bne :-
done: rts

View File

@ -1,106 +0,0 @@
;
; Oliver Schmidt, 10.03.2004
;
; void _textframexy (unsigned char x, unsigned char y,
; unsigned char width, unsigned char height,
; unsigned char style);
; void _textframe (unsigned char width, unsigned char height);
; unsigned char style);
;
.export __textframexy, __textframe
.import popa, pusha, _gotoxy
.import chlinedirect, cvlinedirect
.importzp tmp2, tmp3, tmp4, ptr1
.include "../apple2/apple2.inc"
WIDTH = tmp2
HEIGHT = tmp3
XORIGIN = tmp4
YORIGIN = ptr1
__textframexy:
sec
bra textframe
__textframe:
clc
textframe:
ldx INVFLG
phx ; Save character display mode
ldx #$FF
stx INVFLG ; Set normal character display mode
pha ; Save index
jsr popa ; Get height
sta HEIGHT
jsr popa ; Get width
sta WIDTH
lda CH
ldx CV
bcc noxy
jsr popa ; Get y
tax
jsr popa ; Get x
noxy: sta XORIGIN
stx YORIGIN
plx ; Restore index
loop: lda XOFFS,x
clc
bpl :+ ; Relative to left edge?
adc WIDTH
: adc XORIGIN
jsr pusha
lda YOFFS,x
clc
bpl :+ ; Relative to top?
adc HEIGHT
: adc YORIGIN
jsr _gotoxy ; Call this one, will pop params
txa
tay
lsr ; Get bit 0 (vline) into carry
lda LENGTH,x
phx ; Save index
ldx CHAR,y
bcc hline
clc
adc HEIGHT
jsr cvlinedirect
bra next
hline: adc WIDTH
jsr chlinedirect
next: plx ; Restore index
inx
txa
and #$03 ; Mask style
bne loop
pla
sta INVFLG ; Restore character display mode
rts
.rodata
; 2 styles with 4 lines each make up 8 entries per table
; - even entry numbers mean horizontal lines
; - odd entry numbers mean vertical lines
; x offset for the line starting point
; - a positive value means relative to the frame left edge
; - a negative value menas relative to the frame right edge
XOFFS: .byte 0, 0, 0, -2, 1, 0, 1, -2
; y offset for the line starting point
; - a positive value means relative to the frame top
; - a negative value menas relative to the frame bottom
YOFFS: .byte 0, 1, -2, 1, 0, 0, -2, 0
; length of the line relative to the frame size
; - a negative value for hlines means shorter than the width
; - a negative value for vlines menas shorter than the height
LENGTH: .byte 0, -2, 0, -2, -2, 0, -2, 0
; character to use for drawing the line
; - hibit set means normal printable character
; - hibit clear means MouseText character
CHAR: .byte '_'|$80, '_', 'L', 'Z', 'L', 'Z', '_'|$80, '_'