1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-24 11:31:31 +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,21 +57,20 @@ 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 \
rhome.o \ rhome.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\
wherex.o \ wherex.o \
wherey.o \ wherey.o \
write.o write.o
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Drivers # Drivers

View File

@ -4,9 +4,14 @@
; Screen size variables ; Screen size variables
; ;
.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,43 +2,47 @@
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Zero page stuff ; Zero page stuff
WNDWDTH := $21 ; Right edge of text window WNDLFT := $20 ; Text window left
CH := $24 ; Cursor horizontal position WNDWDTH := $21 ; Text window width
CV := $25 ; Cursor vertical position WNDTOP := $22 ; Text window top
BASL := $28 ; Text base address WNDBTM := $23 ; Text window bottom+1
INVFLG := $32 ; Normal/inverse(/flash) CH := $24 ; Cursor horizontal position
RNDL := $4E ; Random counter low CV := $25 ; Cursor vertical position
RNDH := $4F ; Random counter high BASL := $28 ; Text base address low
HIMEM := $73 ; Highest available memory address+1 BASH := $29 ; Text base address high
INVFLG := $32 ; Normal/inverse(/flash)
PROMPT := $33 ; Used by GETLN
RNDL := $4E ; Random counter low
RNDH := $4F ; Random counter high
HIMEM := $73 ; Highest available memory address+1
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Vectors ; Vectors
SOFTEV := $03F2 ; Vector for warm start DOSWARM := $03D0 ; DOS warmstart vector
PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1 BRKVec := $03F0 ; Break vector
DOSWARM := $03D0 ; DOS warmstart vector SOFTEV := $03F2 ; Vector for warm start
BRKVec := $03F0 ; Break vector PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1
MLI := $BF00 ; ProDOS Machine Language Interface
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; 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 CLRALTCHAR := $C00E ; Normal Apple II char set
SETALTCHAR := $C00F ; Norm/inv LC, no flash SETALTCHAR := $C00F ; Norm/inv LC, no flash
ALTCHARSET := $C01E ; >127 if alt charset switched in ALTCHARSET := $C01E ; >127 if alt charset switched in
RD80VID := $C01F ; >127 if 80 column video enabled 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
; 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

@ -1,19 +1,19 @@
; ;
; 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
.import popa, _gotoxy, chlinedirect .import popa, _gotoxy, chlinedirect
_cclearxy: _cclearxy:
pha ; Save the length pha ; Save the length
jsr popa ; Get y jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cclear pla ; Restore the length and run into _cclear
_cclear: _cclear:
ldx #' ' | $80 ; Blank, screen code ldx #' ' | $80 ; Blank, screen code
jmp chlinedirect jmp chlinedirect

View File

@ -1,25 +1,23 @@
;; ;
;; 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
.include "apple2.inc" .include "apple2.inc"
_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
bit KBDSTRB ; clear keyboard strobe
bit BUTN0 ; check if OpenApple is down
bmi pressed
and #$7F ; If not down, then clear high bit
pressed:
ldx #$00
rts
; At this time, the high bit of the key pressed is set
bit KBDSTRB ; clear keyboard strobe
bit BUTN0 ; check if OpenApple is down
bmi :+
and #$7F ; If not down, then clear high bit
: ldx #$00
rts

View File

@ -1,29 +1,37 @@
; ;
; 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
jsr popa ; Get y jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _chline pla ; Restore the length and run into _chline
_chline: _chline:
ldx #'-' | $80 ; Horizontal line, screen code .ifdef __APPLE2ENH__
ldx #'S' ; MouseText character
ldy INVFLG
cpy #$FF ; Normal character display mode?
beq chlinedirect
.endif
ldx #'-' | $80 ; Horizontal line, screen code
chlinedirect: chlinedirect:
cmp #$00 ; Is the length zero? cmp #$00 ; Is the length zero?
beq done ; Jump if done beq done ; Jump if done
sta tmp1 sta tmp1
: txa ; Screen code : txa ; Screen code
jsr cputdirect ; Direct output jsr cputdirect ; Direct output
dec tmp1 dec tmp1
bne :- bne :-
done: rts done: rts

View File

@ -1,9 +1,10 @@
;; ;
;; Kevin Ruland ; Kevin Ruland
;; ;
;; void clrscr (void); ; void clrscr (void);
;
.export _clrscr .export _clrscr
.import HOME .import HOME
_clrscr := HOME _clrscr := HOME

View File

@ -1,79 +1,104 @@
; ;
; 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);
; ;
.constructor initconio .ifdef __APPLE2ENH__
.export _cputcxy, _cputc .constructor initconio
.export _gotoxy, cputdirect .endif
.export newline, putchar .export _cputcxy, _cputc
.export _gotoxy, cputdirect
.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
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
cmp #$E0 ; Test for lowercase .ifndef __APPLE2ENH__
bcc cputdirect cmp #$E0 ; Test for lowercase
and #$DF ; Convert to uppercase bcc cputdirect
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
sta (BASL),Y cpy #$FF ; Normal character display mode?
rts 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
bit LOWSCR
rts
.endif
col40: sta (BASL),Y
rts
_gotoxy: _gotoxy:
sta CV ; Store Y clc
jsr BASCALC adc WNDTOP
jsr popa ; Get X sta CV ; Store Y
sta CH ; Store X jsr VTABZ
rts jsr popa ; Get X
sta CH ; Store X
rts

View File

@ -1,30 +1,35 @@
; ;
; 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
jsr popa ; Get y jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline pla ; Restore the length and run into _cvline
_cvline: _cvline:
ldx #'!' | $80 ; Vertical line, screen code .ifdef __APPLE2ENH__
ldx #'|' | $80 ; Vertical line, screen code
.else
ldx #'!' | $80 ; Vertical line, screen code
.endif
cvlinedirect: cvlinedirect:
cmp #$00 ; Is the length zero? cmp #$00 ; Is the length zero?
beq done ; Jump if done beq done ; Jump if done
sta tmp1 sta tmp1
: txa ; Screen code : txa ; Screen code
jsr putchar ; Write, no cursor advance jsr putchar ; Write, no cursor advance
jsr newline ; Advance cursor to next line jsr newline ; Advance cursor to next line
dec tmp1 dec tmp1
bne :- bne :-
done: rts done: rts

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

@ -4,76 +4,67 @@
; 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"
; Initialization
.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 ][
.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
.code 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: _get_ostype:
lda ostype lda ostype
ldx #$00 ldx #$00
rts rts
.bss
.rodata ostype: .res 1
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
.bss
ostype: .res 1

View File

@ -1,12 +1,12 @@
; ;
; 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
.import return0 .import return0
_getenv = return0 ; "not found" _getenv = return0 ; "not found"

View File

@ -6,9 +6,14 @@
; const char joy_stddrv[]; ; const char joy_stddrv[];
; ;
.export _joy_stddrv .export _joy_stddrv
.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: lda KBD ; Reading KBD checks for keypress
rol ; if high bit is set, key was pressed
_kbhit: lda #$00
bit KBD ; Reading keyboard checks for keypress tax
bmi L1 ; if KBD > 127 key was pressed rol
jmp return0 rts
L1:
jmp return1

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

@ -9,9 +9,9 @@
; */ ; */
; ;
.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

@ -4,9 +4,9 @@
; Apple II mode table for tgi_map_mode ; Apple II mode table for tgi_map_mode
; ;
.export _tgi_mode_table .export _tgi_mode_table
.include "tgi-mode.inc" .include "tgi-mode.inc"
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; Mode table. Contains entries of mode and driver name, the driver name being ; Mode table. Contains entries of mode and driver name, the driver name being
@ -17,7 +17,13 @@
.rodata .rodata
_tgi_mode_table: _tgi_mode_table:
.byte TGI_MODE_280_192_6, "A2.HI.TGI", 0 .ifdef __APPLE2ENH__
.byte TGI_MODE_40_40_16, "A2.LO.TGI", 0 .byte TGI_MODE_280_192_6, "A2E.HI.TGI", 0
; .byte TGI_MODE_560_192_2, "A2.DHI.TGI", 0 .byte TGI_MODE_40_40_16, "A2E.LO.TGI", 0
.byte 0 ; End marker ; .byte TGI_MODE_560_192_2, "A2E.DHI.TGI", 0
.else
.byte TGI_MODE_280_192_6, "A2.HI.TGI", 0
.byte TGI_MODE_40_40_16, "A2.LO.TGI", 0
; .byte TGI_MODE_560_192_2, "A2.DHI.TGI", 0
.endif
.byte 0 ; End marker

View File

@ -1,13 +1,14 @@
;
; Kevin Ruland
;
; unsigned char wherex (void);
;
;; Keivn Ruland .export _wherex
;;
;; unsigned char wherex( void );
.export _wherex .include "apple2.inc"
.include "apple2.inc"
_wherex: _wherex:
lda CH lda CH
ldx #$00 ldx #$00
rts rts

View File

@ -1,13 +1,16 @@
;
; Kevin Ruland
;
; unsigned char wherey (void);
;
;; Keivn Ruland .export _wherey
;;
;; unsigned char wherey( void );
.export _wherey .include "apple2.inc"
.include "apple2.inc"
_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
@ -38,22 +38,51 @@ CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Object files # Object files
OBJS= _scrsize.o \ OBJS= _scrsize.o \
chline.o \ break.o \
cclear.o \
cgetc.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, '_'