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 \
oserrlist.o \
randomize.o \
rbascalc.o \
rcout.o \
read.o \
read.o \
revers.o \
rhome.o \
rom.o \
rpread.o \
rrdkey.o \
rsetwnd.o \
rvtabz.o \
systime.o \
sysuname.o \
tgi_mode_table.o\
wherex.o \
wherey.o \
write.o
wherey.o \
write.o
#--------------------------------------------------------------------------
# Drivers

View File

@ -4,9 +4,14 @@
; Screen size variables
;
.export screensize
.export screensize
.include "apple2.inc"
screensize:
ldx #40
ldy #24
ldx WNDWDTH
lda WNDBTM
sec
sbc WNDTOP
tay
rts

View File

@ -2,43 +2,47 @@
;-----------------------------------------------------------------------------
; Zero page stuff
WNDWDTH := $21 ; Right edge of text window
CH := $24 ; Cursor horizontal position
CV := $25 ; Cursor vertical position
BASL := $28 ; Text base address
INVFLG := $32 ; Normal/inverse(/flash)
RNDL := $4E ; Random counter low
RNDH := $4F ; Random counter high
HIMEM := $73 ; Highest available memory address+1
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
CV := $25 ; Cursor vertical position
BASL := $28 ; Text base address low
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
SOFTEV := $03F2 ; Vector for warm start
PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1
DOSWARM := $03D0 ; DOS warmstart vector
BRKVec := $03F0 ; Break vector
MLI := $BF00 ; ProDOS Machine Language Interface
DOSWARM := $03D0 ; DOS warmstart vector
BRKVec := $03F0 ; Break vector
SOFTEV := $03F2 ; Vector for warm start
PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1
;-----------------------------------------------------------------------------
; Hardware
; Keyboard input
KBD := $C000 ; Read keyboard
KBDSTRB := $C010 ; Clear keyboard strobe
KBD := $C000 ; Read keyboard
KBDSTRB := $C010 ; Clear keyboard strobe
; 80 column card switches
CLRALTCHAR := $C00E ; Normal Apple II char set
SETALTCHAR := $C00F ; Norm/inv LC, no flash
ALTCHARSET := $C01E ; >127 if alt charset switched in
RD80VID := $C01F ; >127 if 80 column video enabled
CLRALTCHAR := $C00E ; Normal Apple II char set
SETALTCHAR := $C00F ; Norm/inv LC, no flash
ALTCHARSET := $C01E ; >127 if alt charset switched in
RD80VID := $C01F ; >127 if 80 column video enabled
; Video soft switches
MIXCLR := $C052 ; Disable 4 lines of text
MIXSET := $C053 ; Enable 4 lines of text
LOWSCR := $C054 ; Page 1
HISCR := $C055 ; Page 2
MIXCLR := $C052 ; Disable 4 lines of text
MIXSET := $C053 ; Enable 4 lines of text
LOWSCR := $C054 ; Page 1
HISCR := $C055 ; Page 2
; Game controller
BUTN0 := $C061 ; Open-Apple Key
BUTN1 := $C062 ; Closed-Apple Key
BUTN0 := $C061 ; Open-Apple Key
BUTN1 := $C062 ; Closed-Apple Key

View File

@ -1,19 +1,19 @@
;
; Ullrich von Bassewitz, 08.08.1998
;
; void cclearxy (unsigned char x, unsigned char y, unsigned char length);
; void cclear (unsigned char length);
; void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);
; void __fastcall__ cclear (unsigned char length);
;
.export _cclearxy, _cclear
.import popa, _gotoxy, chlinedirect
.export _cclearxy, _cclear
.import popa, _gotoxy, chlinedirect
_cclearxy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cclear
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cclear
_cclear:
ldx #' ' | $80 ; Blank, screen code
jmp chlinedirect
ldx #' ' | $80 ; Blank, screen code
jmp chlinedirect

View File

@ -1,25 +1,23 @@
;;
;; Kevin Ruland
;;
;; char cgetc (void);
;;
;; If open_apple key is pressed then the high-bit of the
;; key is set.
.export _cgetc
;
; Kevin Ruland
;
; char cgetc (void);
;
; If open_apple key is pressed then the high-bit of the key is set.
;
.include "apple2.inc"
.export _cgetc
.include "apple2.inc"
_cgetc:
lda KBD
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
lda KBD
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 :+
and #$7F ; If not down, then clear high bit
: ldx #$00
rts

View File

@ -1,29 +1,37 @@
;
; Ullrich von Bassewitz, 08.08.1998
;
; void chlinexy (unsigned char x, unsigned char y, unsigned char length);
; void chline (unsigned char length);
; void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);
; void __fastcall__ chline (unsigned char length);
;
.export _chlinexy, _chline, chlinedirect
.import popa, _gotoxy, cputdirect
.importzp tmp1
.export _chlinexy, _chline, chlinedirect
.import popa, _gotoxy, cputdirect
.include "zeropage.inc"
.include "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
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 #'-' | $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:
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
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,9 +1,10 @@
;;
;; Kevin Ruland
;;
;; void clrscr (void);
;
; Kevin Ruland
;
; void clrscr (void);
;
.export _clrscr
.import HOME
.export _clrscr
.import HOME
_clrscr := HOME

View File

@ -1,79 +1,104 @@
;
; Ullrich von Bassewitz, 06.08.1998
;
; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c);
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
; void __fastcall__ cputc (char c);
;
.constructor initconio
.export _cputcxy, _cputc
.export _gotoxy, cputdirect
.export newline, putchar
.ifdef __APPLE2ENH__
.constructor initconio
.endif
.export _cputcxy, _cputc
.export _gotoxy, cputdirect
.export newline, putchar
.import popa, SETWND, BASCALC
.import popa, VTABZ
.include "apple2.inc"
.include "apple2.inc"
; ------------------------------------------------------------------------
; Initialization
.segment "INIT"
.segment "INIT"
.ifdef __APPLE2ENH__
initconio:
lda #$FF ; Normal character display mode
sta INVFLG
lda #$00
jmp SETWND ; Reset text window to full screen
sta SETALTCHAR ; Switch in alternate charset
rts
.endif
.code
; ------------------------------------------------------------------------
; Plot a character - also used as internal function
.code
_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
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 #40
bne done
left: lda #$00 ; Goto left edge of screen
sta CH
done: rts
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
lda CV
cmp #24
bne :+
lda #$00
sta CV
: jmp BASCALC
inc CV ; Bump to next line
lda CV
cmp WNDBTM
bcc :+
lda WNDTOP ; Goto top of screen
sta CV
: jmp VTABZ
putchar:
and INVFLG ; Apply normal, inverse, flash
ldy CH
sta (BASL),Y
rts
.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
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:
sta CV ; Store Y
jsr BASCALC
jsr popa ; Get X
sta CH ; Store X
rts
clc
adc WNDTOP
sta CV ; Store Y
jsr VTABZ
jsr popa ; Get X
sta CH ; Store X
rts

View File

@ -1,30 +1,35 @@
;
; Ullrich von Bassewitz, 08.08.1998
;
; void cvlinexy (unsigned char x, unsigned char y, unsigned char length);
; void cvline (unsigned char length);
; void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);
; void __fastcall__ cvline (unsigned char length);
;
.export _cvlinexy, _cvline, cvlinedirect
.import popa, _gotoxy, putchar, newline
.importzp tmp1
.export _cvlinexy, _cvline, cvlinedirect
.import popa, _gotoxy, putchar, newline
.include "zeropage.inc"
_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
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
.ifdef __APPLE2ENH__
ldx #'|' | $80 ; Vertical line, screen code
.else
ldx #'!' | $80 ; Vertical line, screen code
.endif
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
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

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

View File

@ -4,76 +4,67 @@
; 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"
; ------------------------------------------------------------------------
; Initialization
.segment "INIT"
.segment "INIT"
initostype:
sec
jsr $FE1F
bcs nogs
tya
ora #$80
done: sta ostype
rts
nogs: ldx #$FF
next: inx
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
sec
jsr $FE1F
bcs nogs
tya
ora #$80
done: sta ostype
rts
nogs: ldx #$FF
next: inx
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
; ------------------------------------------------------------------------
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:
lda ostype
ldx #$00
rts
lda ostype
ldx #$00
rts
.bss
.rodata
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
ostype: .res 1

View File

@ -1,12 +1,12 @@
;
; Ullrich von Bassewitz, 2003-05-02
;
; char* getenv (const char* name);
; char* __fastcall__ getenv (const char* name);
;
.export _getenv
.import return0
.export _getenv
.import return0
_getenv = return0 ; "not found"
_getenv = return0 ; "not found"

View File

@ -6,9 +6,14 @@
; const char joy_stddrv[];
;
.export _joy_stddrv
.export _joy_stddrv
.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
;;
;; int kbhit (void);
;;
;
; Kevin Ruland
; Ullrich von Bassewitz, 2005-03-25
;
; unsigned char kbhit (void);
;
.export _kbhit
.export _kbhit
.import return0, return1
.include "apple2.inc"
.include "apple2.inc"
_kbhit:
bit KBD ; Reading keyboard checks for keypress
bmi L1 ; if KBD > 127 key was pressed
jmp return0
L1:
jmp return1
_kbhit: lda KBD ; Reading KBD checks for keypress
rol ; if high bit is set, key was pressed
lda #$00
tax
rol
rts

View File

@ -1,8 +1,8 @@
;;
;; Kevin Ruland
;;
;; unsigned char __fastcall__ revers (unsigned char onoff)
;;
;
; Kevin Ruland
;
; unsigned char __fastcall__ revers (unsigned char onoff)
;
.export _revers
@ -13,13 +13,11 @@ _revers:
and #$FF ; Test for any bit
beq normal ; Nothing set
lda #~$3F ; Not Inverse
normal:
eor #$FF ; Xor Normal
normal: eor #$FF ; Xor Normal
sta INVFLG
tya ; What was the old value?
eor #$FF ; Normal = $FF, Inverse = $3F
beq L2
beq :+
lda #$01
L2:
: ldx #$00
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:
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
;
.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
@ -17,7 +17,13 @@
.rodata
_tgi_mode_table:
.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
.byte 0 ; End marker
.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_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
;;
;; unsigned char wherex( void );
.export _wherex
.export _wherex
.include "apple2.inc"
.include "apple2.inc"
_wherex:
lda CH
lda CH
ldx #$00
rts
rts

View File

@ -1,13 +1,16 @@
;
; Kevin Ruland
;
; unsigned char wherey (void);
;
;; Keivn Ruland
;;
;; unsigned char wherey( void );
.export _wherey
.export _wherey
.include "apple2.inc"
.include "apple2.inc"
_wherey:
lda CV
lda CV
sec
sbc WNDTOP
ldx #$00
rts
rts

View File

@ -13,17 +13,17 @@ AS = ../../src/ca65/ca65
CC = ../../src/cc65/cc65
LD = ../../src/ld65/ld65
AFLAGS = -t $(SYS) -I../../asminc
CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
AFLAGS = -t $(SYS) -I../apple2 -I../../asminc
CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I ../apple2 -I ../../include
#--------------------------------------------------------------------------
# Rules
%.o: %.c
%.o: ../apple2/%.c
@$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s
%.o: ../apple2/%.s
@$(AS) -g -o $@ $(AFLAGS) $<
%.emd: %.o ../runtime/zeropage.o
@ -38,22 +38,51 @@ CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
#--------------------------------------------------------------------------
# Object files
OBJS= _scrsize.o \
chline.o \
OBJS= _scrsize.o \
break.o \
cclear.o \
cgetc.o \
chline.o \
clrscr.o \
color.o \
cputc.o \
crt0.o \
ctype.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
EMDS =
EMDS = apple2-lc.emd
JOYS =
JOYS = apple2-stdjoy.joy
SERS =
TGIS =
TGIS = apple2-40-40-16.tgi apple2-280-192-6.tgi
#--------------------------------------------------------------------------
# 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, '_'