mirror of
https://github.com/cc65/cc65.git
synced 2024-12-26 08:32:00 +00:00
Merge telemon24 and telemon30 into telestrat target.
Cleaning, and replace tab to spaces Converting hex lowercase value into uppercase char. Changing := and = when it was needed
This commit is contained in:
parent
06b2b83ab2
commit
b5fef66f37
@ -1,68 +0,0 @@
|
||||
;
|
||||
; Oric Telemon definition
|
||||
; Telemon 2.4
|
||||
;
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
SCREEN_XSIZE = 40 ; screen columns
|
||||
SCREEN_YSIZE = 28 ; screen rows
|
||||
|
||||
FUNCTKEY = $A5
|
||||
|
||||
FNAME_LEN = 11 ; maximum length of file-name
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Zero page
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Low memory
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; I/O locations
|
||||
|
||||
; 6522
|
||||
.struct VIA ; Versatile Interface Adapter
|
||||
.res $0300
|
||||
PRB .byte ; Port Register B
|
||||
PRA .byte ; Port Register A
|
||||
DDRB .byte ; Data Direction Register B
|
||||
DDRA .byte ; Data Direction Register A
|
||||
T1 .word ; Timer 1
|
||||
T1L .word ; Timer 1 Latch
|
||||
T2 .word ; Timer 2
|
||||
SR .byte ; Shift Register
|
||||
ACR .byte ; Auxiliary Control Register
|
||||
PCR .byte ; Peripheral Control Register
|
||||
IFR .byte ; Interrupt Flags Register
|
||||
IER .byte ; Interrupt Enable Register
|
||||
PRA2 .byte ; Port Register A without handshaking
|
||||
.endstruct
|
||||
|
||||
; 6551
|
||||
.struct ACIA ; Asynchronous Communications Interface Adapter
|
||||
.res $031C
|
||||
DATA .byte
|
||||
STATUS .byte
|
||||
CMD .byte ; Command register
|
||||
CTRL .byte ; Control register
|
||||
.endstruct
|
||||
|
||||
SCREEN := $BB80
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; ROM entries
|
||||
|
||||
XWR0 := $10
|
||||
XWSTR0 := $14
|
||||
|
@ -1,6 +1,7 @@
|
||||
;
|
||||
; Oric Telemon definition
|
||||
; Telemon 2.4
|
||||
; Telemon 2.4 & Telemon 3.0
|
||||
; For telemon 3.0 check http://orix.oric.org
|
||||
;
|
||||
|
||||
|
||||
@ -18,6 +19,24 @@ FNAME_LEN = 11 ; maximum length of file-name
|
||||
; ---------------------------------------------------------------------------
|
||||
; Zero page
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Page 00
|
||||
RES := $00
|
||||
RESB := $02
|
||||
|
||||
TR0 := $0C
|
||||
TR1 := $0D
|
||||
|
||||
PTR_READ_DEST := $2D ; used for XFREAD and XWRITE only in telemon 3.0
|
||||
|
||||
HRSX := $46
|
||||
HRSY := $47
|
||||
|
||||
HRS1 := $4D
|
||||
HRS2 := $4F
|
||||
HRS3 := $51
|
||||
HRS4 := $53
|
||||
HRS5 := $55
|
||||
|
||||
|
||||
|
||||
@ -82,69 +101,47 @@ SCREEN := $BB80
|
||||
; ROM entries
|
||||
|
||||
; primitives telemon 2.4
|
||||
XRD0 := $08
|
||||
XRDW0 := $0c
|
||||
XWR0 := $10
|
||||
XWSTR0 := $14
|
||||
XTEXT := $19
|
||||
XHIRES := $1A
|
||||
XMINMA := $1f
|
||||
XFREAD := $27 ; only in TELEMON 3.0
|
||||
XOPEN := $30 ; only in TELEMON 3.0
|
||||
XCOSCR := $34 ; switch off cursor
|
||||
XCSSCR := $35 ; switch on cursor
|
||||
XCLOSE := $3a ; Close file
|
||||
XFWRITE:= $3b ; write
|
||||
|
||||
XSONPS := $40
|
||||
XOUPS := $42
|
||||
XPLAY := $43
|
||||
XSOUND := $44
|
||||
XMUSIC := $45
|
||||
XZAP := $46
|
||||
XSHOOT := $47
|
||||
XCIRCL := $8f
|
||||
XCURSE := $90
|
||||
XEXPLO := $9c
|
||||
XPING := $9d
|
||||
XPAPER := $92
|
||||
XINK := $93
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Page 00
|
||||
RES := $00
|
||||
RESB := $02
|
||||
|
||||
TR0 := $0c
|
||||
TR1 := $0d
|
||||
|
||||
PTR_READ_DEST := $2c ; used for XFREAD and XWRITE
|
||||
|
||||
HRSX := $46
|
||||
HRSY := $47
|
||||
|
||||
HRS1 := $4D
|
||||
HRS2 := $4F
|
||||
HRS3 := $51
|
||||
HRS4 := $53
|
||||
HRS5 := $55
|
||||
XRD0 = $08
|
||||
XRDW0 = $0C
|
||||
XWR0 = $10
|
||||
XWSTR0 = $14
|
||||
XTEXT = $19
|
||||
XHIRES = $1A
|
||||
XMINMA = $1F
|
||||
XFREAD = $27 ; only in TELEMON 3.0
|
||||
XOPEN = $30 ; only in TELEMON 3.0
|
||||
XCOSCR = $34 ; switch off cursor
|
||||
XCSSCR = $35 ; switch on cursor
|
||||
XCLOSE = $3A ; only in TELEMON 3.0 Close file
|
||||
XFWRITE = $3B ; only in TELEMON 3.0 write file
|
||||
XSONPS = $40
|
||||
XOUPS = $42
|
||||
XPLAY = $43
|
||||
XSOUND = $44
|
||||
XMUSIC = $45
|
||||
XZAP = $46
|
||||
XSHOOT = $47
|
||||
XCIRCL = $8F
|
||||
XCURSE = $90
|
||||
XEXPLO = $9C
|
||||
XPING = $9D
|
||||
XPAPER = $92
|
||||
XINK = $93
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Page $500
|
||||
|
||||
BUFNOM := $517
|
||||
BUFEDT := $590
|
||||
BUFNOM := $517
|
||||
BUFEDT := $590
|
||||
|
||||
MAX_BUFEDT_LENGTH=110
|
||||
|
||||
; Hardware
|
||||
CH376_DATA :=$340
|
||||
CH376_COMMAND :=$341
|
||||
CH376_DATA :=$340
|
||||
CH376_COMMAND :=$341
|
||||
|
||||
; MACRO
|
||||
|
||||
|
||||
.macro BRK_TELEMON value
|
||||
.byte $00,value
|
||||
.endmacro
|
@ -1,43 +0,0 @@
|
||||
SYMBOLS {
|
||||
|
||||
__ORIXHDR__: type = import;
|
||||
|
||||
__STACKSIZE__: type = weak, value = $0800; # 2K stack
|
||||
|
||||
__RAMEND__: type = weak, value = $9800 + $1C00 ;
|
||||
}
|
||||
MEMORY {
|
||||
ZP: file = "", define = yes, start = $00E2, size = $001A;
|
||||
ORIXHDR: file = %O, type = ro, start = $0000, size = $001F;
|
||||
BASHEAD: file = %O, define = yes, start = $0801, size = $000D;
|
||||
MAIN: file = %O, define = yes, start = __BASHEAD_LAST__, size = __RAMEND__ - __MAIN_START__;
|
||||
BSS: file = "", start = __ONCE_RUN__, size = __RAMEND__ - __STACKSIZE__ - __ONCE_RUN__;
|
||||
}
|
||||
SEGMENTS {
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
ORIXHDR: load = ORIXHDR, type = ro;
|
||||
STARTUP: load = MAIN, type = ro;
|
||||
LOWCODE: load = MAIN, type = ro, optional = yes;
|
||||
CODE: load = MAIN, type = ro;
|
||||
RODATA: load = MAIN, type = ro;
|
||||
DATA: load = MAIN, type = rw;
|
||||
INIT: load = MAIN, type = rw;
|
||||
ONCE: load = MAIN, type = ro, define = yes;
|
||||
BASTAIL: load = MAIN, type = ro, optional = yes;
|
||||
BSS: load = BSS, type = bss, define = yes;
|
||||
}
|
||||
FEATURES {
|
||||
CONDES: type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__,
|
||||
segment = ONCE;
|
||||
CONDES: type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__,
|
||||
segment = RODATA;
|
||||
CONDES: type = interruptor,
|
||||
label = __INTERRUPTOR_TABLE__,
|
||||
count = __INTERRUPTOR_COUNT__,
|
||||
segment = RODATA,
|
||||
import = __CALLIRQ__;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
<!doctype linuxdoc system>
|
||||
|
||||
<article>
|
||||
|
||||
<title>Oric Telemon 2.4 -specific information for cc65
|
||||
<author>
|
||||
|
||||
<url url="mailto:greg.king5@verizon.net" name="Greg King">
|
||||
<date>2017-01-22
|
||||
|
||||
<abstract>
|
||||
An overview over the Telemon 3.0 runtime system as it is implemented for the cc65 C
|
||||
compiler.
|
||||
</abstract>
|
||||
|
||||
<!-- Table of contents -->
|
||||
<toc>
|
||||
|
||||
|
||||
|
||||
<sect>License<p>
|
||||
|
||||
This software is provided 'as-is', without any expressed or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
@ -1,58 +0,0 @@
|
||||
|
||||
void print (char *);
|
||||
|
||||
void hires();
|
||||
void text();
|
||||
void oups();
|
||||
void ping();
|
||||
void zap();
|
||||
void shoot();
|
||||
void explode();
|
||||
|
||||
void paper(char color);
|
||||
void ink(char color);
|
||||
|
||||
void kbdclick1();
|
||||
|
||||
|
||||
|
||||
void curset(char x,char y);
|
||||
void circle(char rayon);
|
||||
|
||||
char key(void);
|
||||
|
||||
|
||||
/* PEEK, POKE, DEEK, DOKE */
|
||||
|
||||
#define POKE(addr,val) (*(unsigned char*) (addr) = (val))
|
||||
|
||||
|
||||
#define PCHN_1 001
|
||||
#define PCHN_2 002
|
||||
#define PCHN_12 003
|
||||
#define PCHN_3 004
|
||||
#define PCHN_13 005
|
||||
#define PCHN_23 006
|
||||
#define PCHN_123 007
|
||||
|
||||
#define ENV_DECAY 001 /* \_________ envelope */
|
||||
#define ENV_ATTACK_CUT 002 /* /_________ envelope */
|
||||
#define ENV_SAW_DOWN 003 /* \\\\\\\\\\ envelope */
|
||||
#define ENV_WAVE 004 /* /\/\/\/\/\ envelope */
|
||||
#define ENV_DECAY_CONT 005 /* \~~~~~~~~~ envelope */
|
||||
#define ENV_SAW_UP 006 /* ////////// envelope */
|
||||
#define ENV_ATTACK_CONT 007 /* /~~~~~~~~~ envelope */
|
||||
|
||||
#define VOL_ENVELOPE 0x0
|
||||
#define VOL_QUIETEST 0x1
|
||||
#define VOL_LOUDEST 0xe
|
||||
|
||||
extern int play(int soundchanels,int noisechanels,int envelop,int volume);
|
||||
|
||||
|
||||
/* Play a musical tone through the selected channel. */
|
||||
|
||||
#define CHAN_1 1
|
||||
#define CHAN_2 2
|
||||
#define CHAN_3 3
|
||||
|
@ -31,8 +31,7 @@ TARGETS = apple2 \
|
||||
sim6502 \
|
||||
sim65c02 \
|
||||
supervision\
|
||||
telemon24\
|
||||
telemon30
|
||||
telestrat
|
||||
|
||||
DRVTYPES = emd \
|
||||
joy \
|
||||
|
@ -1,101 +0,0 @@
|
||||
;
|
||||
; Startup code for cc65 (Oric version)
|
||||
;
|
||||
; By Debrune Jérôme <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org>
|
||||
; 2016-03-18, Greg King
|
||||
;
|
||||
|
||||
.export _exit
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
|
||||
.import initlib, donelib
|
||||
.import callmain, zerobss
|
||||
.import __MAIN_START__, __MAIN_SIZE__
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "telemon24.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Place the startup code in a special segment.
|
||||
|
||||
.segment "STARTUP"
|
||||
|
||||
tsx
|
||||
stx spsave ; Save system stk ptr
|
||||
|
||||
; Save space by putting some of the start-up code in a segment
|
||||
; that will be re-used.
|
||||
|
||||
jsr init
|
||||
|
||||
; Clear the BSS variables (after the constructors have been run).
|
||||
|
||||
jsr zerobss
|
||||
|
||||
; Push the command-line arguments; and, call main().
|
||||
|
||||
jsr callmain
|
||||
|
||||
; Call the module destructors. This is also the exit() entry.
|
||||
|
||||
_exit: jsr donelib
|
||||
|
||||
; Restore the system stuff.
|
||||
|
||||
ldx spsave
|
||||
txs
|
||||
; lda stsave
|
||||
; sta STATUS
|
||||
|
||||
; Copy back the zero-page stuff.
|
||||
|
||||
ldx #zpspace - 1
|
||||
L2: lda zpsave,x
|
||||
sta sp,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
; Back to BASIC.
|
||||
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Put this code in a place that will be re-used by BSS, the heap,
|
||||
; and the C stack.
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
; Save the zero-page area that we're about to use.
|
||||
|
||||
init: ldx #zpspace - 1
|
||||
L1: lda sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
|
||||
; Currently, color isn't supported on the text screen.
|
||||
; Unprotect screen columns 0 and 1 (where each line's color codes would sit).
|
||||
|
||||
; lda STATUS
|
||||
; sta stsave
|
||||
; and #%11011111
|
||||
; sta STATUS
|
||||
|
||||
; Set up the C stack.
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
|
||||
sta sp
|
||||
stx sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
jmp initlib
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "INIT"
|
||||
|
||||
spsave: .res 1
|
||||
stsave: .res 1
|
||||
zpsave: .res zpspace
|
@ -1,22 +0,0 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2003-04-13
|
||||
;
|
||||
; void hires(void);
|
||||
;
|
||||
; This function is a hack!
|
||||
;
|
||||
|
||||
.export _hires
|
||||
|
||||
|
||||
.include "telemon24.inc"
|
||||
|
||||
|
||||
; can be optimized with a macro
|
||||
.proc _hires
|
||||
brk
|
||||
.byt $1a
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
;
|
||||
; 2003-03-07, Ullrich von Bassewitz
|
||||
; 2011-01-28, Stefan Haubenthal
|
||||
; 2014-09-10, Greg King
|
||||
;
|
||||
; Set up arguments for main
|
||||
;
|
||||
|
||||
.constructor initmainargs, 24
|
||||
.import __argc, __argv
|
||||
|
||||
.include "telemon24.inc"
|
||||
.macpack generic
|
||||
|
||||
MAXARGS = 10 ; Maximum number of arguments allowed
|
||||
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
.proc initmainargs
|
||||
|
||||
.endproc
|
||||
|
||||
.segment "INIT"
|
||||
|
||||
term: .res 1
|
||||
name: .res FNAME_LEN + 1
|
||||
args: .res SCREEN_XSIZE * 2 - 1
|
||||
|
||||
.data
|
||||
|
||||
; This array has zeroes when initmainargs starts.
|
||||
; char* argv[MAXARGS+1]={name};
|
||||
|
||||
argv: .addr name
|
||||
.res MAXARGS * 2
|
@ -1,25 +0,0 @@
|
||||
;
|
||||
; Jede
|
||||
;
|
||||
; print (char * str);
|
||||
;
|
||||
; This function is a hack!
|
||||
;
|
||||
|
||||
.export _print
|
||||
.import popax
|
||||
.importzp tmp1
|
||||
.include "telemon24.inc"
|
||||
|
||||
.proc _print
|
||||
|
||||
jsr popax ; get buf
|
||||
stx tmp1
|
||||
ldy tmp1
|
||||
brk
|
||||
.byte $14
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
;
|
||||
; Based on code by Debrune Jérôme <jede@oric.org>
|
||||
; 2016-03-17, Greg King
|
||||
;
|
||||
|
||||
; The following symbol is used by the linker config. file
|
||||
; to force this module to be included into the output file.
|
||||
.export __ORIXHDR__:abs = 1
|
||||
|
||||
; These symbols, also, come from the configuration file.
|
||||
.import __AUTORUN__, __PROGFLAG__
|
||||
.import __BASHEAD_START__, __MAIN_LAST__
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Oric cassette-tape header
|
||||
|
||||
.segment "ORIXHDR"
|
||||
|
||||
.byte $01, $00 ;
|
||||
|
||||
.byte "ORI"
|
||||
|
||||
.byte $01 ; version
|
||||
.byte $00,$00 ; mode
|
||||
.byte $00,$00 ; cpu type
|
||||
.byte $00,$00 ; OS
|
||||
|
||||
.byte $00 ; reserved
|
||||
.byte $00 ; auto
|
||||
|
||||
|
||||
.dbyt __BASHEAD_START__ ; Address of start of file
|
||||
.dbyt __MAIN_LAST__ - 1 ; Address of end of file
|
||||
.dbyt __BASHEAD_START__ ; Address of start of file
|
||||
|
@ -1,59 +0,0 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2003-04-13
|
||||
;
|
||||
; int write (int fd, const void* buf, int count);
|
||||
;
|
||||
; This function is a hack!
|
||||
;
|
||||
|
||||
.export _write
|
||||
.import popax
|
||||
.importzp ptr1, ptr2, ptr3, tmp1
|
||||
|
||||
.include "telemon24.inc"
|
||||
|
||||
.proc _write
|
||||
|
||||
sta ptr3
|
||||
stx ptr3+1 ; save count as result
|
||||
|
||||
eor #$FF
|
||||
sta ptr2
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr2+1 ; Remember -count-1
|
||||
|
||||
jsr popax ; get buf
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
jsr popax ; get fd and discard
|
||||
L1: inc ptr2
|
||||
bne L2
|
||||
inc ptr2+1
|
||||
beq L9
|
||||
L2: ldy #0
|
||||
lda (ptr1),y
|
||||
tax
|
||||
cpx #$0A ; Check for \n
|
||||
bne L3
|
||||
brk
|
||||
.byt $10
|
||||
|
||||
ldx #$0D
|
||||
L3:
|
||||
brk
|
||||
.byt $10
|
||||
inc ptr1
|
||||
bne L1
|
||||
inc ptr1+1
|
||||
jmp L1
|
||||
|
||||
; No error, return count
|
||||
|
||||
L9: lda ptr3
|
||||
ldx ptr3+1
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
.export _close
|
||||
.import addysp,popax
|
||||
.importzp sp,tmp2,tmp3,tmp1
|
||||
|
||||
; int open (const char* name, int flags, ...); /* May take a mode argument */
|
||||
.include "telemon30.inc"
|
||||
.include "errno.inc"
|
||||
.include "fcntl.inc"
|
||||
|
||||
.proc _close
|
||||
; Throw away any additional parameters passed through the ellipsis
|
||||
|
||||
BRK_TELEMON XCLOSE ; launch primitive ROM
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
@ -1,41 +0,0 @@
|
||||
;
|
||||
; jede jede@oric.org 2017-01-22
|
||||
;
|
||||
|
||||
|
||||
.FEATURE c_comments,labels_without_colons,pc_assignment, loose_char_term
|
||||
.export _read
|
||||
.import popax
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "telemon30.inc"
|
||||
; int read (int fd, void* buf, unsigned count);
|
||||
|
||||
.proc _read
|
||||
sta ptr1 ; count
|
||||
stx ptr1+1 ; count
|
||||
jsr popax ; get buf
|
||||
|
||||
sta PTR_READ_DEST
|
||||
stx PTR_READ_DEST+1
|
||||
sta ptr2 ; in order to calculate nb of bytes read
|
||||
stx ptr2+1 ;
|
||||
|
||||
; jsr popax ; fp pointer don't care in this version
|
||||
|
||||
lda ptr1 ;
|
||||
ldy ptr1+1 ;
|
||||
BRK_TELEMON XFREAD ; calls telemon30 routine
|
||||
; compute nb of bytes read
|
||||
lda PTR_READ_DEST+1
|
||||
sec
|
||||
sbc ptr2+1
|
||||
tax
|
||||
lda PTR_READ_DEST
|
||||
sec
|
||||
sbc ptr2
|
||||
; Here A and X contains number of bytes read
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
;
|
||||
; 2003-04-13, Ullrich von Bassewitz
|
||||
; 2013-07-16, Greg King
|
||||
;
|
||||
; Screen size variables
|
||||
;
|
||||
|
||||
.export screensize
|
||||
.include "telemon30.inc"
|
||||
|
||||
.proc screensize
|
||||
|
||||
ldx #SCREEN_XSIZE
|
||||
ldy #SCREEN_YSIZE
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
@ -1,366 +0,0 @@
|
||||
|
||||
; For XA65 compatibily in the future
|
||||
.FEATURE c_comments,labels_without_colons,pc_assignment, loose_char_term
|
||||
.export _ch376_set_file_name
|
||||
.export _ch376_file_open
|
||||
.export _ch376_ic_get_version
|
||||
.export _ch376_reset
|
||||
.export _ch376_check_exist
|
||||
.export _ch376_disk_mount
|
||||
.export _ch376_set_usb_mode
|
||||
|
||||
.export _ch376_file_close
|
||||
.export _ch376_seek_file
|
||||
.export _ch376_file_create
|
||||
.export _ch376_fwrite
|
||||
; High level function
|
||||
|
||||
|
||||
.import popax
|
||||
.include "zeropage.inc"
|
||||
.include "telemon30.inc"
|
||||
/*
|
||||
|
||||
*/
|
||||
; CODE FOR CH376_SET_USB_MODE *************************************************
|
||||
|
||||
CH376_SET_USB_MODE_CODE_USB_HOST_SOF_PACKAGE_AUTOMATICALLY := $06
|
||||
|
||||
CH376_USB_INT_SUCCESS := $14
|
||||
CH376_USB_INT_CONNECT := $15
|
||||
CH376_USB_INT_DISCONNECT := $16
|
||||
CH376_USB_INT_BUF_OVER := $17
|
||||
CH376_USB_INT_USB_READY := $18
|
||||
CH376_USB_INT_DISK_READ := $1D
|
||||
CH376_USB_INT_DISK_WRITE := $1E
|
||||
CH376_USB_INT_DISK_ERR := $1F
|
||||
|
||||
|
||||
CH376_ERR_OPEN_DIR := $41
|
||||
CH376_ERR_MISS_FILE := $42
|
||||
CH376_ERR_FOUND_NAME := $43
|
||||
CH376_ERR_DISK_DISCON := $82
|
||||
CH376_ERR_LARGE_SECTOR := $84
|
||||
CH376_ERR_TYPE_ERROR := $92
|
||||
CH376_ERR_BPB_ERROR := $A1
|
||||
CH376_ERR_DISK_FULL := $B1
|
||||
CH376_ERR_FDT_OVER := $B2
|
||||
CH376_ERR_FILE_CLOSE := $B4
|
||||
|
||||
|
||||
|
||||
CH376_GET_IC_VER := $01
|
||||
CH376_SET_BAUDRATE := $02
|
||||
CH376_GET_ENTER_SLEEP := $03
|
||||
CH376_RESET_ALL := $05
|
||||
CH376_CHECK_EXIST := $06
|
||||
CH376_GET_FILE_SIZE := $0C
|
||||
|
||||
CH376_SET_USB_MODE := $15
|
||||
CH376_GET_STATUS := $22
|
||||
CH376_RD_USB_DATA0 := $27
|
||||
CH376_CMD_WR_REQ_DATA := $2d
|
||||
CH376_SET_FILE_NAME := $2F
|
||||
|
||||
CH376_DISK_CONNECT := $30 ; check the disk connection status
|
||||
CH376_DISK_MOUNT := $31
|
||||
CH376_FILE_OPEN := $32
|
||||
CH376_FILE_ENUM_GO := $33
|
||||
CH376_FILE_CREATE := $34
|
||||
CH376_FILE_CLOSE := $36
|
||||
CH376_BYTE_LOCATE := $39
|
||||
CH376_BYTE_READ := $3A
|
||||
CH376_BYTE_RD_GO := $3B
|
||||
CH376_BYTE_WRITE := $3C
|
||||
CH376_BYTE_WR_GO := $3D
|
||||
CH376_DISK_CAPACITY := $3E
|
||||
CH376_DISK_RD_GO := $55
|
||||
|
||||
.proc _ch376_file_close
|
||||
lda #CH376_FILE_CLOSE
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ch376_seek_file
|
||||
ldx #CH376_BYTE_LOCATE
|
||||
stx CH376_COMMAND
|
||||
sta CH376_DATA
|
||||
sty CH376_DATA
|
||||
lda #$00 ; Don't manage 32 bits length
|
||||
sta CH376_DATA
|
||||
sta CH376_DATA
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; void ch376_set_file_name(char *filename)
|
||||
.proc _ch376_set_file_name
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
lda #CH376_SET_FILE_NAME ;$2f
|
||||
sta CH376_COMMAND
|
||||
ldy #0
|
||||
loop:
|
||||
lda (ptr1),y ; replace by bufnom
|
||||
beq end ; we reached 0 value
|
||||
BRK_TELEMON XMINMA
|
||||
sta CH376_DATA
|
||||
iny
|
||||
cpy #13 ; because we don't manage longfilename shortname =11
|
||||
bne loop
|
||||
end:
|
||||
sta CH376_DATA
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; char _ch376_file_open();
|
||||
|
||||
.proc _ch376_file_open
|
||||
lda #CH376_FILE_OPEN ; $32
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
.proc _ch376_get_file_size
|
||||
lda #CH376_GET_FILE_SIZE
|
||||
sta CH376_COMMAND
|
||||
lda #$68
|
||||
sta CH376_DATA
|
||||
; store file length 32 bits
|
||||
lda CH376_DATA
|
||||
sta tmp1
|
||||
lda CH376_DATA
|
||||
sta tmp1+1
|
||||
lda CH376_DATA
|
||||
sta tmp2
|
||||
lda CH376_DATA
|
||||
sta tmp2+1
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; void ch376_reset();
|
||||
|
||||
.proc _ch376_reset
|
||||
lda #CH376_RESET_ALL ; 5
|
||||
sta CH376_COMMAND
|
||||
; waiting
|
||||
ldy #0
|
||||
ldx #0
|
||||
loop:
|
||||
nop
|
||||
inx
|
||||
bne loop
|
||||
iny
|
||||
bne loop
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; char ch376_check_exist(char value);
|
||||
|
||||
.proc _ch376_check_exist
|
||||
sta tmp1
|
||||
lda #CH376_CHECK_EXIST ;
|
||||
sta CH376_COMMAND
|
||||
lda tmp1
|
||||
sta CH376_DATA
|
||||
lda CH376_DATA
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; char ch376_ic_get_version(void)
|
||||
.proc _ch376_ic_get_version
|
||||
lda #CH376_GET_IC_VER
|
||||
sta CH376_COMMAND
|
||||
ldx #0
|
||||
lda CH376_DATA
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; void ch376_set_usb_mode(char mode)
|
||||
|
||||
.proc _ch376_set_usb_mode
|
||||
; CH376_SET_USB_MODE_CODE_USB_HOST_SOF_PACKAGE_AUTOMATICALLY
|
||||
ldx #CH376_SET_USB_MODE ; $15
|
||||
stx CH376_COMMAND
|
||||
sta CH376_DATA
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; void ch376_set_bytes_write(int value);
|
||||
.proc _ch376_set_bytes_write
|
||||
ldy #CH376_BYTE_WRITE
|
||||
sty CH376_COMMAND
|
||||
sta CH376_DATA
|
||||
stx CH376_DATA
|
||||
lda #0
|
||||
sta CH376_DATA
|
||||
sta CH376_DATA
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ch376_set_bytes_read
|
||||
ldy #CH376_BYTE_READ
|
||||
sty CH376_COMMAND
|
||||
; Storing 32 bits value
|
||||
sta CH376_DATA
|
||||
stx CH376_DATA
|
||||
lda #0
|
||||
sta CH376_DATA
|
||||
sta CH376_DATA
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; char ch376_disk_mount();
|
||||
.proc _ch376_disk_mount
|
||||
lda #CH376_DISK_MOUNT ; $31
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
; if we read data value, we have then length of the volume name
|
||||
ldx #0
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
||||
; char ch376_wait_response();
|
||||
.proc _ch376_wait_response
|
||||
; 1 return 1 if usb controller does not respond
|
||||
; else A contains answer of the controller
|
||||
ldy #$ff
|
||||
loop3:
|
||||
ldx #$ff ; don't decrease this counter. Because ch376 won't respond if there is a lower value
|
||||
loop:
|
||||
lda CH376_COMMAND
|
||||
and #%10000000
|
||||
cmp #128
|
||||
bne no_error
|
||||
dex
|
||||
bne loop
|
||||
dey
|
||||
bne loop3
|
||||
; error is here
|
||||
rts
|
||||
no_error:
|
||||
lda #CH376_GET_STATUS
|
||||
sta CH376_COMMAND
|
||||
lda CH376_DATA
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ch376_fread
|
||||
; use ptr1 to count bytes
|
||||
jsr _ch376_set_bytes_read
|
||||
|
||||
continue:
|
||||
cmp #CH376_USB_INT_DISK_READ ; something to read
|
||||
beq we_read
|
||||
cmp #CH376_USB_INT_SUCCESS ; finished
|
||||
beq finished
|
||||
; TODO in A : $ff X: $ff
|
||||
lda #0
|
||||
tax
|
||||
rts
|
||||
we_read:
|
||||
lda #CH376_RD_USB_DATA0
|
||||
sta CH376_COMMAND
|
||||
|
||||
lda CH376_DATA ; contains length read
|
||||
sta tmp2; Number of bytes to read
|
||||
|
||||
ldy #0
|
||||
loop:
|
||||
lda CH376_DATA ; read the data
|
||||
sta (PTR_READ_DEST),y
|
||||
|
||||
iny
|
||||
cpy tmp2
|
||||
bne loop
|
||||
tya
|
||||
clc
|
||||
adc PTR_READ_DEST
|
||||
bcc next
|
||||
inc PTR_READ_DEST+1
|
||||
next:
|
||||
sta PTR_READ_DEST
|
||||
|
||||
lda #CH376_BYTE_RD_GO
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
jmp continue
|
||||
finished:
|
||||
; TODO return bytes read
|
||||
lda tmp1
|
||||
ldx tmp1+1
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; void _ch376_fwrite(void *ptr,int number)
|
||||
.proc _ch376_fwrite
|
||||
; use ptr1 to count bytes
|
||||
sta ptr2
|
||||
stx ptr2+1
|
||||
|
||||
jsr popax
|
||||
sta PTR_READ_DEST
|
||||
stx PTR_READ_DEST+1
|
||||
|
||||
lda ptr2
|
||||
ldx ptr2+1
|
||||
jsr _ch376_set_bytes_write
|
||||
;cmp #CH376_USB_INT_SUCCESS
|
||||
;beq finished
|
||||
;jsr popax
|
||||
|
||||
;jsr _ch376_wait_response
|
||||
|
||||
continue:
|
||||
cmp #CH376_USB_INT_DISK_WRITE ; something to read
|
||||
beq we_read
|
||||
cmp #CH376_USB_INT_SUCCESS ; finished
|
||||
beq finished
|
||||
; TODO in A : $ff X: $ff
|
||||
lda #0
|
||||
tax
|
||||
rts
|
||||
we_read:
|
||||
lda #CH376_CMD_WR_REQ_DATA
|
||||
sta CH376_COMMAND
|
||||
|
||||
lda CH376_DATA ; contains length read
|
||||
sta tmp2; Number of bytes to read
|
||||
|
||||
|
||||
;ldy #0
|
||||
loop:
|
||||
;lda (PTR_READ_DEST),y
|
||||
lda #65
|
||||
sta CH376_DATA ; read the data
|
||||
dec tmp2
|
||||
bne loop
|
||||
|
||||
|
||||
lda #CH376_BYTE_WR_GO
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
jmp continue
|
||||
finished:
|
||||
; TODO return bytes read
|
||||
lda tmp1
|
||||
;lda #<8000
|
||||
ldx tmp1+1
|
||||
;ldx #>8000
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ch376_file_create
|
||||
lda #CH376_FILE_CREATE
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
@ -1,299 +0,0 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2003-04-13
|
||||
;
|
||||
; Character specification table.
|
||||
;
|
||||
|
||||
; The tables are readonly, put them into the rodata segment
|
||||
|
||||
.rodata
|
||||
|
||||
; The following 256 byte wide table specifies attributes for the isxxx type
|
||||
; of functions. Doing it by a table means some overhead in space, but it
|
||||
; has major advantages:
|
||||
;
|
||||
; * It is fast. If it were'nt for the slow parameter passing of cc65, one
|
||||
; could even define macros for the isxxx functions (this is usually
|
||||
; done on other platforms).
|
||||
;
|
||||
; * It is highly portable. The only unportable part is the table itself,
|
||||
; all real code goes into the common library.
|
||||
;
|
||||
; * We save some code in the isxxx functions.
|
||||
;
|
||||
;
|
||||
; Bit assignments:
|
||||
;
|
||||
; 0 - Lower case char
|
||||
; 1 - Upper case char
|
||||
; 2 - Numeric digit
|
||||
; 3 - Hex digit (both, lower and upper)
|
||||
; 4 - Control character
|
||||
; 5 - The space character itself
|
||||
; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v')
|
||||
; 7 - Space or tab character
|
||||
|
||||
.export __ctype
|
||||
|
||||
__ctype:
|
||||
.byte $10 ; 0/00 ___ctrl_@___
|
||||
.byte $10 ; 1/01 ___ctrl_A___
|
||||
.byte $10 ; 2/02 ___ctrl_B___
|
||||
.byte $10 ; 3/03 ___ctrl_C___
|
||||
.byte $10 ; 4/04 ___ctrl_D___
|
||||
.byte $10 ; 5/05 ___ctrl_E___
|
||||
.byte $10 ; 6/06 ___ctrl_F___
|
||||
.byte $10 ; 7/07 ___ctrl_G___
|
||||
.byte $10 ; 8/08 ___ctrl_H___
|
||||
.byte $D0 ; 9/09 ___ctrl_I___
|
||||
.byte $50 ; 10/0a ___ctrl_J___
|
||||
.byte $50 ; 11/0b ___ctrl_K___
|
||||
.byte $50 ; 12/0c ___ctrl_L___
|
||||
.byte $50 ; 13/0d ___ctrl_M___
|
||||
.byte $10 ; 14/0e ___ctrl_N___
|
||||
.byte $10 ; 15/0f ___ctrl_O___
|
||||
.byte $10 ; 16/10 ___ctrl_P___
|
||||
.byte $10 ; 17/11 ___ctrl_Q___
|
||||
.byte $10 ; 18/12 ___ctrl_R___
|
||||
.byte $10 ; 19/13 ___ctrl_S___
|
||||
.byte $10 ; 20/14 ___ctrl_T___
|
||||
.byte $10 ; 21/15 ___ctrl_U___
|
||||
.byte $10 ; 22/16 ___ctrl_V___
|
||||
.byte $10 ; 23/17 ___ctrl_W___
|
||||
.byte $10 ; 24/18 ___ctrl_X___
|
||||
.byte $10 ; 25/19 ___ctrl_Y___
|
||||
.byte $10 ; 26/1a ___ctrl_Z___
|
||||
.byte $10 ; 27/1b ___ctrl_[___
|
||||
.byte $10 ; 28/1c ___ctrl_\___
|
||||
.byte $10 ; 29/1d ___ctrl_]___
|
||||
.byte $10 ; 30/1e ___ctrl_^___
|
||||
.byte $10 ; 31/1f ___ctrl_____
|
||||
.byte $A0 ; 32/20 ___SPACE___
|
||||
.byte $00 ; 33/21 _____!_____
|
||||
.byte $00 ; 34/22 _____"_____
|
||||
.byte $00 ; 35/23 _____#_____
|
||||
.byte $00 ; 36/24 _____$_____
|
||||
.byte $00 ; 37/25 _____%_____
|
||||
.byte $00 ; 38/26 _____&_____
|
||||
.byte $00 ; 39/27 _____'_____
|
||||
.byte $00 ; 40/28 _____(_____
|
||||
.byte $00 ; 41/29 _____)_____
|
||||
.byte $00 ; 42/2a _____*_____
|
||||
.byte $00 ; 43/2b _____+_____
|
||||
.byte $00 ; 44/2c _____,_____
|
||||
.byte $00 ; 45/2d _____-_____
|
||||
.byte $00 ; 46/2e _____._____
|
||||
.byte $00 ; 47/2f _____/_____
|
||||
.byte $0C ; 48/30 _____0_____
|
||||
.byte $0C ; 49/31 _____1_____
|
||||
.byte $0C ; 50/32 _____2_____
|
||||
.byte $0C ; 51/33 _____3_____
|
||||
.byte $0C ; 52/34 _____4_____
|
||||
.byte $0C ; 53/35 _____5_____
|
||||
.byte $0C ; 54/36 _____6_____
|
||||
.byte $0C ; 55/37 _____7_____
|
||||
.byte $0C ; 56/38 _____8_____
|
||||
.byte $0C ; 57/39 _____9_____
|
||||
.byte $00 ; 58/3a _____:_____
|
||||
.byte $00 ; 59/3b _____;_____
|
||||
.byte $00 ; 60/3c _____<_____
|
||||
.byte $00 ; 61/3d _____=_____
|
||||
.byte $00 ; 62/3e _____>_____
|
||||
.byte $00 ; 63/3f _____?_____
|
||||
|
||||
.byte $00 ; 64/40 _____@_____
|
||||
.byte $0A ; 65/41 _____A_____
|
||||
.byte $0A ; 66/42 _____B_____
|
||||
.byte $0A ; 67/43 _____C_____
|
||||
.byte $0A ; 68/44 _____D_____
|
||||
.byte $0A ; 69/45 _____E_____
|
||||
.byte $0A ; 70/46 _____F_____
|
||||
.byte $02 ; 71/47 _____G_____
|
||||
.byte $02 ; 72/48 _____H_____
|
||||
.byte $02 ; 73/49 _____I_____
|
||||
.byte $02 ; 74/4a _____J_____
|
||||
.byte $02 ; 75/4b _____K_____
|
||||
.byte $02 ; 76/4c _____L_____
|
||||
.byte $02 ; 77/4d _____M_____
|
||||
.byte $02 ; 78/4e _____N_____
|
||||
.byte $02 ; 79/4f _____O_____
|
||||
.byte $02 ; 80/50 _____P_____
|
||||
.byte $02 ; 81/51 _____Q_____
|
||||
.byte $02 ; 82/52 _____R_____
|
||||
.byte $02 ; 83/53 _____S_____
|
||||
.byte $02 ; 84/54 _____T_____
|
||||
.byte $02 ; 85/55 _____U_____
|
||||
.byte $02 ; 86/56 _____V_____
|
||||
.byte $02 ; 87/57 _____W_____
|
||||
.byte $02 ; 88/58 _____X_____
|
||||
.byte $02 ; 89/59 _____Y_____
|
||||
.byte $02 ; 90/5a _____Z_____
|
||||
.byte $00 ; 91/5b _____[_____
|
||||
.byte $00 ; 92/5c _____\_____
|
||||
.byte $00 ; 93/5d _____]_____
|
||||
.byte $00 ; 94/5e _____^_____
|
||||
.byte $00 ; 95/5f _UNDERLINE_
|
||||
.byte $00 ; 96/60 ___grave___
|
||||
.byte $09 ; 97/61 _____a_____
|
||||
.byte $09 ; 98/62 _____b_____
|
||||
.byte $09 ; 99/63 _____c_____
|
||||
.byte $09 ; 100/64 _____d_____
|
||||
.byte $09 ; 101/65 _____e_____
|
||||
.byte $09 ; 102/66 _____f_____
|
||||
.byte $01 ; 103/67 _____g_____
|
||||
.byte $01 ; 104/68 _____h_____
|
||||
.byte $01 ; 105/69 _____i_____
|
||||
.byte $01 ; 106/6a _____j_____
|
||||
.byte $01 ; 107/6b _____k_____
|
||||
.byte $01 ; 108/6c _____l_____
|
||||
.byte $01 ; 109/6d _____m_____
|
||||
.byte $01 ; 110/6e _____n_____
|
||||
.byte $01 ; 111/6f _____o_____
|
||||
.byte $01 ; 112/70 _____p_____
|
||||
.byte $01 ; 113/71 _____q_____
|
||||
.byte $01 ; 114/72 _____r_____
|
||||
.byte $01 ; 115/73 _____s_____
|
||||
.byte $01 ; 116/74 _____t_____
|
||||
.byte $01 ; 117/75 _____u_____
|
||||
.byte $01 ; 118/76 _____v_____
|
||||
.byte $01 ; 119/77 _____w_____
|
||||
.byte $01 ; 120/78 _____x_____
|
||||
.byte $01 ; 121/79 _____y_____
|
||||
.byte $01 ; 122/7a _____z_____
|
||||
.byte $00 ; 123/7b _____{_____
|
||||
.byte $00 ; 124/7c _____|_____
|
||||
.byte $00 ; 125/7d _____}_____
|
||||
.byte $00 ; 126/7e _____~_____
|
||||
.byte $40 ; 127/7f ____DEL____
|
||||
|
||||
.byte $00 ; 128/80 ___________
|
||||
.byte $00 ; 129/81 ___________
|
||||
.byte $00 ; 130/82 ___________
|
||||
.byte $00 ; 131/83 ___________
|
||||
.byte $00 ; 132/84 ___________
|
||||
.byte $00 ; 133/85 ___________
|
||||
.byte $00 ; 134/86 ___________
|
||||
.byte $00 ; 135/87 ___________
|
||||
.byte $00 ; 136/88 ___________
|
||||
.byte $00 ; 137/89 ___________
|
||||
.byte $00 ; 138/8a ___________
|
||||
.byte $00 ; 139/8b ___________
|
||||
.byte $00 ; 140/8c ___________
|
||||
.byte $00 ; 141/8d ___________
|
||||
.byte $00 ; 142/8e ___________
|
||||
.byte $00 ; 143/8f ___________
|
||||
.byte $00 ; 144/90 ___________
|
||||
.byte $00 ; 145/91 ___________
|
||||
.byte $00 ; 146/92 ___________
|
||||
.byte $10 ; 147/93 ___________
|
||||
.byte $00 ; 148/94 ___________
|
||||
.byte $00 ; 149/95 ___________
|
||||
.byte $00 ; 150/96 ___________
|
||||
.byte $00 ; 151/97 ___________
|
||||
.byte $00 ; 152/98 ___________
|
||||
.byte $00 ; 153/99 ___________
|
||||
.byte $00 ; 154/9a ___________
|
||||
.byte $00 ; 155/9b ___________
|
||||
.byte $00 ; 156/9c ___________
|
||||
.byte $00 ; 157/9d ___________
|
||||
.byte $00 ; 158/9e ___________
|
||||
.byte $00 ; 159/9f ___________
|
||||
|
||||
.byte $00 ; 160/a0 ___________
|
||||
.byte $00 ; 161/a1 ___________
|
||||
.byte $00 ; 162/a2 ___________
|
||||
.byte $00 ; 163/a3 ___________
|
||||
.byte $00 ; 164/a4 ___________
|
||||
.byte $00 ; 165/a5 ___________
|
||||
.byte $00 ; 166/a6 ___________
|
||||
.byte $00 ; 167/a7 ___________
|
||||
.byte $00 ; 168/a8 ___________
|
||||
.byte $00 ; 169/a9 ___________
|
||||
.byte $00 ; 170/aa ___________
|
||||
.byte $00 ; 171/ab ___________
|
||||
.byte $00 ; 172/ac ___________
|
||||
.byte $00 ; 173/ad ___________
|
||||
.byte $00 ; 174/ae ___________
|
||||
.byte $00 ; 175/af ___________
|
||||
.byte $00 ; 176/b0 ___________
|
||||
.byte $00 ; 177/b1 ___________
|
||||
.byte $00 ; 178/b2 ___________
|
||||
.byte $00 ; 179/b3 ___________
|
||||
.byte $00 ; 180/b4 ___________
|
||||
.byte $00 ; 181/b5 ___________
|
||||
.byte $00 ; 182/b6 ___________
|
||||
.byte $00 ; 183/b7 ___________
|
||||
.byte $00 ; 184/b8 ___________
|
||||
.byte $00 ; 185/b9 ___________
|
||||
.byte $00 ; 186/ba ___________
|
||||
.byte $00 ; 187/bb ___________
|
||||
.byte $00 ; 188/bc ___________
|
||||
.byte $00 ; 189/bd ___________
|
||||
.byte $00 ; 190/be ___________
|
||||
.byte $00 ; 191/bf ___________
|
||||
|
||||
.byte $02 ; 192/c0 ___________
|
||||
.byte $02 ; 193/c1 ___________
|
||||
.byte $02 ; 194/c2 ___________
|
||||
.byte $02 ; 195/c3 ___________
|
||||
.byte $02 ; 196/c4 ___________
|
||||
.byte $02 ; 197/c5 ___________
|
||||
.byte $02 ; 198/c6 ___________
|
||||
.byte $02 ; 199/c7 ___________
|
||||
.byte $02 ; 200/c8 ___________
|
||||
.byte $02 ; 201/c9 ___________
|
||||
.byte $02 ; 202/ca ___________
|
||||
.byte $02 ; 203/cb ___________
|
||||
.byte $02 ; 204/cc ___________
|
||||
.byte $02 ; 205/cd ___________
|
||||
.byte $02 ; 206/ce ___________
|
||||
.byte $02 ; 207/cf ___________
|
||||
.byte $02 ; 208/d0 ___________
|
||||
.byte $02 ; 209/d1 ___________
|
||||
.byte $02 ; 210/d2 ___________
|
||||
.byte $02 ; 211/d3 ___________
|
||||
.byte $02 ; 212/d4 ___________
|
||||
.byte $02 ; 213/d5 ___________
|
||||
.byte $02 ; 214/d6 ___________
|
||||
.byte $02 ; 215/d7 ___________
|
||||
.byte $02 ; 216/d8 ___________
|
||||
.byte $02 ; 217/d9 ___________
|
||||
.byte $02 ; 218/da ___________
|
||||
.byte $02 ; 219/db ___________
|
||||
.byte $02 ; 220/dc ___________
|
||||
.byte $02 ; 221/dd ___________
|
||||
.byte $02 ; 222/de ___________
|
||||
.byte $00 ; 223/df ___________
|
||||
.byte $01 ; 224/e0 ___________
|
||||
.byte $01 ; 225/e1 ___________
|
||||
.byte $01 ; 226/e2 ___________
|
||||
.byte $01 ; 227/e3 ___________
|
||||
.byte $01 ; 228/e4 ___________
|
||||
.byte $01 ; 229/e5 ___________
|
||||
.byte $01 ; 230/e6 ___________
|
||||
.byte $01 ; 231/e7 ___________
|
||||
.byte $01 ; 232/e8 ___________
|
||||
.byte $01 ; 233/e9 ___________
|
||||
.byte $01 ; 234/ea ___________
|
||||
.byte $01 ; 235/eb ___________
|
||||
.byte $01 ; 236/ec ___________
|
||||
.byte $01 ; 237/ed ___________
|
||||
.byte $01 ; 238/ee ___________
|
||||
.byte $01 ; 239/ef ___________
|
||||
.byte $01 ; 240/f0 ___________
|
||||
.byte $01 ; 241/f1 ___________
|
||||
.byte $01 ; 242/f2 ___________
|
||||
.byte $01 ; 243/f3 ___________
|
||||
.byte $01 ; 244/f4 ___________
|
||||
.byte $01 ; 245/f5 ___________
|
||||
.byte $01 ; 246/f6 ___________
|
||||
.byte $01 ; 247/f7 ___________
|
||||
.byte $01 ; 248/f8 ___________
|
||||
.byte $01 ; 249/f9 ___________
|
||||
.byte $01 ; 250/fa ___________
|
||||
.byte $01 ; 251/fb ___________
|
||||
.byte $01 ; 252/fc ___________
|
||||
.byte $01 ; 253/fd ___________
|
||||
.byte $01 ; 254/fe ___________
|
||||
.byte $00 ; 255/ff ___________
|
||||
|
@ -1,54 +0,0 @@
|
||||
.export _paper,_hires,_text,_circle,_curset, _switchOffCursor
|
||||
.importzp sp,tmp2,tmp3,tmp1
|
||||
.import popa
|
||||
.include "telemon30.inc"
|
||||
|
||||
.proc _paper
|
||||
ldx #0 ; First window
|
||||
; A contains the paper
|
||||
BRK_TELEMON XPAPER
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; XINK is bugged, it corrupt memory : removing from export
|
||||
.proc _ink
|
||||
ldx #0 ; First window
|
||||
; A contains the ink
|
||||
BRK_TELEMON XINK
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; can be optimized with a macro
|
||||
.proc _hires
|
||||
BRK_TELEMON XHIRES
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _text
|
||||
BRK_TELEMON XTEXT
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _curset
|
||||
jsr popa ; Pixel
|
||||
jsr popa
|
||||
sta HRSX
|
||||
jsr popa
|
||||
sta HRSY
|
||||
BRK_TELEMON XCURSE
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _circle
|
||||
sta HRS1
|
||||
BRK_TELEMON XCIRCL
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _switchOffCursor
|
||||
ldx #0
|
||||
BRK_TELEMON XCOSCR
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
.export _key
|
||||
.importzp sp,tmp2,tmp3,tmp1
|
||||
|
||||
.include "telemon30.inc"
|
||||
|
||||
|
||||
; char key(void);
|
||||
|
||||
.proc _key
|
||||
BRK_TELEMON XRDW0 ; read keyboard
|
||||
rts
|
||||
.endproc
|
||||
|
@ -1,75 +0,0 @@
|
||||
;
|
||||
; Stefan Haubenthal, 2004-05-25
|
||||
; Ullrich von Bassewitz, 18.07.2002
|
||||
;
|
||||
; Defines the platform specific error list.
|
||||
;
|
||||
; The table is built as a list of entries
|
||||
;
|
||||
; .byte entrylen
|
||||
; .byte errorcode
|
||||
; .asciiz errormsg
|
||||
;
|
||||
; and terminated by an entry with length zero that is returned if the
|
||||
; error code could not be found.
|
||||
;
|
||||
|
||||
.export __sys_oserrlist
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Macros used to generate the list (may get moved to an include file?)
|
||||
|
||||
; Regular entry
|
||||
.macro sys_oserr_entry code, msg
|
||||
.local Start, End
|
||||
Start: .byte End - Start
|
||||
.byte code
|
||||
.asciiz msg
|
||||
End:
|
||||
.endmacro
|
||||
|
||||
; Sentinel entry
|
||||
.macro sys_oserr_sentinel msg
|
||||
.byte 0 ; Length is always zero
|
||||
.byte 0 ; Code is unused
|
||||
.asciiz msg
|
||||
.endmacro
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; The error message table
|
||||
|
||||
.rodata
|
||||
|
||||
__sys_oserrlist:
|
||||
sys_oserr_entry 1, "File not found"
|
||||
sys_oserr_entry 2, "Invalid command end"
|
||||
sys_oserr_entry 3, "No drive number"
|
||||
sys_oserr_entry 4, "Bad drive number"
|
||||
sys_oserr_entry 5, "Invalid filename"
|
||||
sys_oserr_entry 6, "fderr=(error number)"
|
||||
sys_oserr_entry 7, "Illegal attribute"
|
||||
sys_oserr_entry 8, "Wildcard(s) not allowed"
|
||||
sys_oserr_entry 9, "File already exists"
|
||||
sys_oserr_entry 10, "Insufficient disc space"
|
||||
sys_oserr_entry 11, "File open"
|
||||
sys_oserr_entry 12, "Illegal quantity"
|
||||
sys_oserr_entry 13, "End address missing"
|
||||
sys_oserr_entry 14, "Start address > end address"
|
||||
sys_oserr_entry 15, "Missing 'to'"
|
||||
sys_oserr_entry 16, "Renamed file not on same disc"
|
||||
sys_oserr_entry 17, "Unknown array"
|
||||
sys_oserr_entry 18, "Target drive not source drive"
|
||||
sys_oserr_entry 19, "Destination not specified"
|
||||
sys_oserr_entry 20, "Cannot merge and overwrite"
|
||||
sys_oserr_entry 21, "Single target file illegal"
|
||||
sys_oserr_entry 22, "Syntax"
|
||||
sys_oserr_entry 23, "Filename missing"
|
||||
sys_oserr_entry 24, "Source file missing"
|
||||
sys_oserr_entry 25, "Type mismatch"
|
||||
sys_oserr_entry 26, "Disc write-protected"
|
||||
sys_oserr_entry 27, "Incompatible drives"
|
||||
sys_oserr_entry 28, "File not open"
|
||||
sys_oserr_entry 29, "File end"
|
||||
sys_oserr_sentinel "Unknown error"
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
;
|
||||
; Stefan Haubenthal, 2011-04-18
|
||||
;
|
||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
||||
; /* Map a system specific error into a system independent code */
|
||||
;
|
||||
|
||||
.include "errno.inc"
|
||||
.export __osmaperrno
|
||||
|
||||
.proc __osmaperrno
|
||||
|
||||
lda #<EUNKNOWN
|
||||
ldx #>EUNKNOWN
|
||||
rts
|
||||
|
||||
.endproc
|
@ -1,21 +0,0 @@
|
||||
;
|
||||
; Jede
|
||||
;
|
||||
; print (char * str);
|
||||
;
|
||||
; This function is a hack!
|
||||
;
|
||||
|
||||
.export _print
|
||||
.import popax
|
||||
.importzp tmp1
|
||||
.include "telemon30.inc"
|
||||
|
||||
.proc _print
|
||||
stx tmp1
|
||||
ldy tmp1
|
||||
BRK_TELEMON XWSTR0
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
@ -1,45 +0,0 @@
|
||||
.export _kbdclick1,_oups,_ping,_explode,_shoot,_zap
|
||||
.include "telemon30.inc"
|
||||
|
||||
.proc _kbdclick1
|
||||
LDX #<sound_bip_keyboard
|
||||
LDY #>sound_bip_keyboard
|
||||
BRK_TELEMON XSONPS
|
||||
rts
|
||||
sound_bip_keyboard:
|
||||
.byte $1f,$00,$00,$00,$00,$00,$00,$3e,$10,$00,$00,$1f,$00,$00
|
||||
.endproc
|
||||
|
||||
.proc _explode
|
||||
BRK_TELEMON XEXPLO
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _oups
|
||||
BRK_TELEMON XOUPS
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ping
|
||||
BRK_TELEMON XPING
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _shoot
|
||||
BRK_TELEMON XSHOOT
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _zap
|
||||
BRK_TELEMON XZAP
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
; XPLAY := $43
|
||||
; XSOUND := $44
|
||||
; XMUSIC := $45
|
||||
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2003-08-12
|
||||
;
|
||||
; unsigned char __fastcall__ _sysuname (struct utsname* buf);
|
||||
;
|
||||
|
||||
.export __sysuname, utsdata
|
||||
|
||||
.import utscopy
|
||||
|
||||
__sysuname = utscopy
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
; Data. We define a fixed utsname struct here and just copy it.
|
||||
|
||||
.rodata
|
||||
|
||||
utsdata:
|
||||
; sysname
|
||||
.asciiz "cc65"
|
||||
|
||||
; nodename
|
||||
.asciiz ""
|
||||
|
||||
; release
|
||||
.byte ((.VERSION >> 8) & $0F) + '0'
|
||||
.byte '.'
|
||||
.if ((.VERSION >> 4) & $0F) > 9
|
||||
.byte ((.VERSION >> 4) & $0F) / 10 + '0'
|
||||
.byte ((.VERSION >> 4) & $0F) .MOD 10 + '0'
|
||||
.else
|
||||
.byte ((.VERSION >> 4) & $0F) + '0'
|
||||
.endif
|
||||
.byte $00
|
||||
|
||||
; version
|
||||
.if (.VERSION & $0F) > 9
|
||||
.byte (.VERSION & $0F) / 10 + '0'
|
||||
.byte (.VERSION & $0F) .MOD 10 + '0'
|
||||
.else
|
||||
.byte (.VERSION & $0F) + '0'
|
||||
.endif
|
||||
.byte $00
|
||||
|
||||
; machine
|
||||
.asciiz "Oric Telestrat"
|
344
libsrc/telestrat/ch376.s
Normal file
344
libsrc/telestrat/ch376.s
Normal file
@ -0,0 +1,344 @@
|
||||
|
||||
; jede jede@oric.org 2017-01-22
|
||||
|
||||
; For XA65 compatibily in the future
|
||||
.FEATURE c_comments,labels_without_colons,pc_assignment, loose_char_term
|
||||
.export _ch376_set_file_name
|
||||
.export _ch376_file_open
|
||||
.export _ch376_ic_get_version
|
||||
.export _ch376_reset
|
||||
.export _ch376_check_exist
|
||||
.export _ch376_disk_mount
|
||||
.export _ch376_set_usb_mode
|
||||
.export _ch376_file_close
|
||||
.export _ch376_seek_file
|
||||
.export _ch376_file_create
|
||||
.export _ch376_fwrite
|
||||
|
||||
.import popax
|
||||
.include "zeropage.inc"
|
||||
.include "telestrat.inc"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CH376_SET_USB_MODE_CODE_USB_HOST_SOF_PACKAGE_AUTOMATICALLY = $06
|
||||
|
||||
CH376_USB_INT_SUCCESS = $14
|
||||
CH376_USB_INT_CONNECT = $15
|
||||
CH376_USB_INT_DISCONNECT = $16
|
||||
CH376_USB_INT_BUF_OVER = $17
|
||||
CH376_USB_INT_USB_READY = $18
|
||||
CH376_USB_INT_DISK_READ = $1D
|
||||
CH376_USB_INT_DISK_WRITE = $1E
|
||||
CH376_USB_INT_DISK_ERR = $1F
|
||||
|
||||
|
||||
CH376_ERR_OPEN_DIR = $41
|
||||
CH376_ERR_MISS_FILE = $42
|
||||
CH376_ERR_FOUND_NAME = $43
|
||||
CH376_ERR_DISK_DISCON = $82
|
||||
CH376_ERR_LARGE_SECTOR = $84
|
||||
CH376_ERR_TYPE_ERROR = $92
|
||||
CH376_ERR_BPB_ERROR = $A1
|
||||
CH376_ERR_DISK_FULL = $B1
|
||||
CH376_ERR_FDT_OVER = $B2
|
||||
CH376_ERR_FILE_CLOSE = $B4
|
||||
|
||||
CH376_GET_IC_VER = $01
|
||||
CH376_SET_BAUDRATE = $02
|
||||
CH376_GET_ENTER_SLEEP = $03
|
||||
CH376_RESET_ALL = $05
|
||||
CH376_CHECK_EXIST = $06
|
||||
CH376_GET_FILE_SIZE = $0C
|
||||
|
||||
CH376_SET_USB_MODE = $15
|
||||
CH376_GET_STATUS = $22
|
||||
CH376_RD_USB_DATA0 = $27
|
||||
CH376_CMD_WR_REQ_DATA = $2D
|
||||
CH376_SET_FILE_NAME = $2F
|
||||
|
||||
CH376_DISK_CONNECT = $30 ; check the disk connection status
|
||||
CH376_DISK_MOUNT = $31
|
||||
CH376_FILE_OPEN = $32
|
||||
CH376_FILE_ENUM_GO = $33
|
||||
CH376_FILE_CREATE = $34
|
||||
CH376_FILE_CLOSE = $36
|
||||
CH376_BYTE_LOCATE = $39
|
||||
CH376_BYTE_READ = $3A
|
||||
CH376_BYTE_RD_GO = $3B
|
||||
CH376_BYTE_WRITE = $3C
|
||||
CH376_BYTE_WR_GO = $3D
|
||||
CH376_DISK_CAPACITY = $3E
|
||||
CH376_DISK_RD_GO = $55
|
||||
|
||||
.proc _ch376_file_close
|
||||
lda #CH376_FILE_CLOSE
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ch376_seek_file
|
||||
ldx #CH376_BYTE_LOCATE
|
||||
stx CH376_COMMAND
|
||||
sta CH376_DATA
|
||||
sty CH376_DATA
|
||||
lda #$00 ; Don't manage 32 bits length
|
||||
sta CH376_DATA
|
||||
sta CH376_DATA
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; void ch376_set_file_name(char *filename)
|
||||
.proc _ch376_set_file_name
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
lda #CH376_SET_FILE_NAME ;$2f
|
||||
sta CH376_COMMAND
|
||||
ldy #0
|
||||
loop:
|
||||
lda (ptr1),y ; replace by bufnom
|
||||
beq end ; we reached 0 value
|
||||
BRK_TELEMON XMINMA
|
||||
sta CH376_DATA
|
||||
iny
|
||||
cpy #13 ; because we don't manage longfilename shortname =11
|
||||
bne loop
|
||||
end:
|
||||
sta CH376_DATA
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; char _ch376_file_open();
|
||||
.proc _ch376_file_open
|
||||
lda #CH376_FILE_OPEN ; $32
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ch376_get_file_size
|
||||
lda #CH376_GET_FILE_SIZE
|
||||
sta CH376_COMMAND
|
||||
lda #$68
|
||||
sta CH376_DATA
|
||||
; store file length 32 bits
|
||||
lda CH376_DATA
|
||||
sta tmp1
|
||||
lda CH376_DATA
|
||||
sta tmp1+1
|
||||
lda CH376_DATA
|
||||
sta tmp2
|
||||
lda CH376_DATA
|
||||
sta tmp2+1
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; void ch376_reset();
|
||||
.proc _ch376_reset
|
||||
lda #CH376_RESET_ALL ; 5
|
||||
sta CH376_COMMAND
|
||||
; waiting
|
||||
ldy #0
|
||||
ldx #0
|
||||
loop:
|
||||
nop
|
||||
inx
|
||||
bne loop
|
||||
iny
|
||||
bne loop
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; char ch376_check_exist(char value);
|
||||
|
||||
.proc _ch376_check_exist
|
||||
sta tmp1
|
||||
lda #CH376_CHECK_EXIST ;
|
||||
sta CH376_COMMAND
|
||||
lda tmp1
|
||||
sta CH376_DATA
|
||||
lda CH376_DATA
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; char ch376_ic_get_version(void)
|
||||
.proc _ch376_ic_get_version
|
||||
lda #CH376_GET_IC_VER
|
||||
sta CH376_COMMAND
|
||||
ldx #0
|
||||
lda CH376_DATA
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; void ch376_set_usb_mode(char mode)
|
||||
.proc _ch376_set_usb_mode
|
||||
ldx #CH376_SET_USB_MODE ; $15
|
||||
stx CH376_COMMAND
|
||||
sta CH376_DATA
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; void ch376_set_bytes_write(int value);
|
||||
.proc _ch376_set_bytes_write
|
||||
ldy #CH376_BYTE_WRITE
|
||||
sty CH376_COMMAND
|
||||
sta CH376_DATA
|
||||
stx CH376_DATA
|
||||
lda #0
|
||||
sta CH376_DATA
|
||||
sta CH376_DATA
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ch376_set_bytes_read
|
||||
ldy #CH376_BYTE_READ
|
||||
sty CH376_COMMAND
|
||||
; Storing 32 bits value
|
||||
sta CH376_DATA
|
||||
stx CH376_DATA
|
||||
lda #0
|
||||
sta CH376_DATA
|
||||
sta CH376_DATA
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; char ch376_disk_mount();
|
||||
.proc _ch376_disk_mount
|
||||
lda #CH376_DISK_MOUNT ; $31
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
; if we read data value, we have then length of the volume name
|
||||
ldx #0
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
||||
; char ch376_wait_response();
|
||||
.proc _ch376_wait_response
|
||||
; return 1 if usb controller does not respond
|
||||
; else A contains answer of the controller
|
||||
ldy #$FF ; We have to wait 35 ms, but well, this loop is broken when controler is OK
|
||||
loop3:
|
||||
ldx #$FF ; don't decrease this counter. Because ch376 won't respond if there is a lower value
|
||||
loop:
|
||||
lda CH376_COMMAND
|
||||
and #%10000000
|
||||
cmp #128
|
||||
bne no_error
|
||||
dex
|
||||
bne loop
|
||||
dey
|
||||
bne loop3
|
||||
; error is here
|
||||
rts
|
||||
no_error:
|
||||
lda #CH376_GET_STATUS
|
||||
sta CH376_COMMAND
|
||||
lda CH376_DATA
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ch376_fread
|
||||
; use ptr1 to count bytes
|
||||
jsr _ch376_set_bytes_read
|
||||
continue:
|
||||
cmp #CH376_USB_INT_DISK_READ ; something to read
|
||||
beq we_read
|
||||
cmp #CH376_USB_INT_SUCCESS ; finished
|
||||
beq finished
|
||||
; TODO in A : $ff X: $ff
|
||||
lda #0
|
||||
tax
|
||||
rts
|
||||
we_read:
|
||||
lda #CH376_RD_USB_DATA0
|
||||
sta CH376_COMMAND
|
||||
|
||||
lda CH376_DATA ; contains length read
|
||||
sta tmp2; Number of bytes to read
|
||||
|
||||
ldy #0
|
||||
loop:
|
||||
lda CH376_DATA ; read the data
|
||||
sta (PTR_READ_DEST),y
|
||||
iny
|
||||
cpy tmp2
|
||||
bne loop
|
||||
tya
|
||||
clc
|
||||
adc PTR_READ_DEST
|
||||
bcc next
|
||||
inc PTR_READ_DEST+1
|
||||
next:
|
||||
sta PTR_READ_DEST
|
||||
|
||||
lda #CH376_BYTE_RD_GO
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
jmp continue
|
||||
finished:
|
||||
; TODO return bytes read
|
||||
lda tmp1
|
||||
ldx tmp1+1
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; void _ch376_fwrite(void *ptr,int number)
|
||||
.proc _ch376_fwrite
|
||||
; use ptr1 to count bytes
|
||||
sta ptr2
|
||||
stx ptr2+1
|
||||
|
||||
jsr popax
|
||||
sta PTR_READ_DEST
|
||||
stx PTR_READ_DEST+1
|
||||
|
||||
lda ptr2
|
||||
ldx ptr2+1
|
||||
jsr _ch376_set_bytes_write
|
||||
continue:
|
||||
cmp #CH376_USB_INT_DISK_WRITE ; something to read
|
||||
beq we_read
|
||||
cmp #CH376_USB_INT_SUCCESS ; finished
|
||||
beq finished
|
||||
|
||||
lda #0
|
||||
tax
|
||||
rts
|
||||
we_read:
|
||||
lda #CH376_CMD_WR_REQ_DATA
|
||||
sta CH376_COMMAND
|
||||
|
||||
lda CH376_DATA ; contains length read
|
||||
sta tmp2; Number of bytes to read
|
||||
|
||||
ldy #0
|
||||
loop:
|
||||
lda (PTR_READ_DEST),y
|
||||
sta CH376_DATA ; read the data
|
||||
dec tmp2
|
||||
bne loop
|
||||
|
||||
|
||||
lda #CH376_BYTE_WR_GO
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
jmp continue
|
||||
finished:
|
||||
lda tmp1
|
||||
ldx tmp1+1
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ch376_file_create
|
||||
lda #CH376_FILE_CREATE
|
||||
sta CH376_COMMAND
|
||||
jsr _ch376_wait_response
|
||||
rts
|
||||
.endproc
|
18
libsrc/telestrat/close.s
Normal file
18
libsrc/telestrat/close.s
Normal file
@ -0,0 +1,18 @@
|
||||
; jede jede@oric.org 2017-01-22
|
||||
|
||||
.export _close
|
||||
|
||||
.import addysp,popax
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "telestrat.inc"
|
||||
.include "errno.inc"
|
||||
.include "fcntl.inc"
|
||||
|
||||
; int open (const char* name, int flags, ...); /* May take a mode argument */
|
||||
.proc _close
|
||||
BRK_TELEMON XCLOSE ; launch primitive ROM
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
; Startup code for cc65 (Oric version)
|
||||
;
|
||||
; By Debrune Jérôme <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org>
|
||||
; 2016-03-18, Greg King
|
||||
;
|
||||
|
||||
.export _exit
|
||||
@ -13,7 +12,7 @@
|
||||
.import __MAIN_START__, __MAIN_SIZE__
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "telemon30.inc"
|
||||
.include "telestrat.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Place the startup code in a special segment.
|
||||
@ -44,8 +43,6 @@ _exit: jsr donelib
|
||||
|
||||
ldx spsave
|
||||
txs
|
||||
; lda stsave
|
||||
; sta STATUS
|
||||
|
||||
; Copy back the zero-page stuff.
|
||||
|
||||
@ -73,13 +70,6 @@ L1: lda sp,x
|
||||
dex
|
||||
bpl L1
|
||||
|
||||
; Currently, color isn't supported on the text screen.
|
||||
; Unprotect screen columns 0 and 1 (where each line's color codes would sit).
|
||||
|
||||
; lda STATUS
|
||||
; sta stsave
|
||||
; and #%11011111
|
||||
; sta STATUS
|
||||
|
||||
; Set up the C stack.
|
||||
|
58
libsrc/telestrat/graphics.s
Normal file
58
libsrc/telestrat/graphics.s
Normal file
@ -0,0 +1,58 @@
|
||||
; jede jede@oric.org 2017-01-22
|
||||
|
||||
.export _paper,_hires,_text,_circle,_curset, _switchOffCursor
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "telestrat.inc"
|
||||
.import popa
|
||||
|
||||
|
||||
.proc _paper
|
||||
ldx #0 ; First window
|
||||
; A contains the paper
|
||||
BRK_TELEMON XPAPER
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; XINK is bugged, it corrupt memory : removing from export
|
||||
.proc _ink
|
||||
ldx #0 ; First window
|
||||
; A contains the ink
|
||||
BRK_TELEMON XINK
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; can be optimized with a macro
|
||||
.proc _hires
|
||||
BRK_TELEMON XHIRES
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _text
|
||||
BRK_TELEMON XTEXT
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _curset
|
||||
jsr popa ; Pixel
|
||||
jsr popa
|
||||
sta HRSX
|
||||
jsr popa
|
||||
sta HRSY
|
||||
BRK_TELEMON XCURSE
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _circle
|
||||
sta HRS1
|
||||
BRK_TELEMON XCIRCL
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _switchOffCursor
|
||||
ldx #0
|
||||
BRK_TELEMON XCOSCR
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
14
libsrc/telestrat/keyboard.s
Normal file
14
libsrc/telestrat/keyboard.s
Normal file
@ -0,0 +1,14 @@
|
||||
; jede jede@oric.org 2017-01-22
|
||||
|
||||
.export _key
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "telestrat.inc"
|
||||
|
||||
; char key(void);
|
||||
|
||||
.proc _key
|
||||
BRK_TELEMON XRDW0 ; read keyboard
|
||||
rts
|
||||
.endproc
|
||||
|
@ -9,7 +9,7 @@
|
||||
.constructor initmainargs, 24
|
||||
.import __argc, __argv
|
||||
.import ptr1
|
||||
.include "telemon30.inc"
|
||||
.include "telestrat.inc"
|
||||
.macpack generic
|
||||
|
||||
MAXARGS = 10 ; Maximum number of arguments allowed
|
||||
@ -23,8 +23,6 @@ MAXARGS = 10 ; Maximum number of arguments allowed
|
||||
initmainargs:
|
||||
|
||||
ldx #0 ; Limit the length
|
||||
; lda #0 ; The terminating NUL character
|
||||
; beq L1 ; Branch always
|
||||
L0: lda BUFEDT,x
|
||||
beq L3
|
||||
cmp #' '
|
||||
@ -40,9 +38,6 @@ L3:
|
||||
sta name,x
|
||||
inc __argc ; argc always is equal to, at least, 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ldy #1 * 2 ; Point to second argv slot
|
||||
|
||||
@ -52,31 +47,24 @@ next: lda BUFEDT,x
|
||||
cmp #' ' ; Skip leading spaces
|
||||
beq next
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
found: cmp #'"' ; Is the argument quoted?
|
||||
beq setterm ; Jump if so
|
||||
dex ; Reset pointer to first argument character
|
||||
|
||||
|
||||
|
||||
lda #' ' ; A space ends the argument
|
||||
setterm:sta term ; Set end of argument marker
|
||||
|
||||
; Now, store a pointer, to the argument, into the next slot.
|
||||
|
||||
txa ; Get low byte
|
||||
clc
|
||||
adc #<BUFEDT
|
||||
bcc L4
|
||||
clc
|
||||
adc #<BUFEDT
|
||||
bcc L4
|
||||
inc L5+1
|
||||
L4:
|
||||
;add #<args
|
||||
L4:
|
||||
sta argv,y ; argv[y]=&arg
|
||||
L5:
|
||||
lda #>BUFEDT
|
||||
;adc #>args
|
||||
sta argv+1,y
|
||||
iny
|
||||
iny
|
||||
@ -106,8 +94,6 @@ argloop:lda BUFEDT,x
|
||||
cmp #MAXARGS ; Maximum number of arguments reached?
|
||||
bcc next ; Parse next one if not
|
||||
|
||||
|
||||
|
||||
|
||||
done: lda #<argv
|
||||
ldx #>argv
|
||||
@ -116,7 +102,6 @@ done: lda #<argv
|
||||
rts
|
||||
|
||||
|
||||
|
||||
.segment "INIT"
|
||||
|
||||
term: .res 1
|
||||
@ -127,8 +112,6 @@ term: .res 1
|
||||
name: .res FNAME_LEN + 1
|
||||
args: .res SCREEN_XSIZE * 2 - 1
|
||||
|
||||
ptr_current:
|
||||
.res 2
|
||||
param_found:
|
||||
.res 1
|
||||
; char* argv[MAXARGS+1]={name};
|
@ -1,7 +1,7 @@
|
||||
.export _Mym_MusicStart
|
||||
.importzp sp,tmp2,tmp3,tmp1,ptr1
|
||||
|
||||
.include "telemon30.inc"
|
||||
.include "telestrat.inc"
|
||||
|
||||
; To check: AYC
|
||||
; http://cpcwiki.eu/index.php/AYC
|
@ -1,12 +1,13 @@
|
||||
.export _open
|
||||
.import addysp,popax
|
||||
.importzp sp,tmp2,tmp3,tmp1
|
||||
.import addysp,popax
|
||||
.importzp sp,tmp2,tmp3,tmp1
|
||||
|
||||
; int open (const char* name, int flags, ...); /* May take a mode argument */
|
||||
.include "telemon30.inc"
|
||||
.include "errno.inc"
|
||||
.include "fcntl.inc"
|
||||
|
||||
|
||||
.include "telestrat.inc"
|
||||
.include "errno.inc"
|
||||
.include "fcntl.inc"
|
||||
|
||||
; int open (const char* name, int flags, ...); /* May take a mode argument */
|
||||
.proc _open
|
||||
; Throw away any additional parameters passed through the ellipsis
|
||||
|
||||
@ -24,9 +25,9 @@ parmok: jsr popax ; Get flagss
|
||||
; Get the filename from stack and parse it. Bail out if is not ok
|
||||
|
||||
jsr popax ; Get name
|
||||
ldy tmp3 ; Get flags again
|
||||
BRK_TELEMON XOPEN ; launch primitive ROM
|
||||
rts
|
||||
ldy tmp3 ; Get flags again
|
||||
BRK_TELEMON XOPEN ; launch primitive ROM
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
;
|
||||
; Based on code by Debrune Jérôme <jede@oric.org>
|
||||
; 2016-03-17, Greg King
|
||||
; By Debrune Jérôme <jede@oric.org>
|
||||
|
||||
;
|
||||
|
||||
; The following symbol is used by the linker config. file
|
||||
@ -13,23 +13,23 @@
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Oric cassette-tape header
|
||||
; Orix header see http://orix.oric.org/doku.php?id=orix:header for specs
|
||||
|
||||
.segment "ORIXHDR"
|
||||
|
||||
.byte $01, $00 ;
|
||||
|
||||
.byte "ori"
|
||||
.byte "ori"
|
||||
|
||||
.byte $01 ; version
|
||||
.byte $00,%00000000 ; 6502 only
|
||||
.byte $00,$00 ; Extends
|
||||
.byte $00,$00 ; OS
|
||||
.byte $01 ; version
|
||||
.byte $00,%00000000 ; 6502 only
|
||||
.byte $00,$00 ; Extends
|
||||
.byte $00,$00 ; OS
|
||||
|
||||
.byte $00 ; reserved
|
||||
.byte $00 ; auto
|
||||
|
||||
.word __BASHEAD_START__ ; Address of start of file
|
||||
.word __MAIN_LAST__ - 1 ; Address of end of file
|
||||
.word __BASHEAD_START__ ; Address of start of file
|
||||
.word __BASHEAD_START__ ; Address of start of file
|
||||
.word __MAIN_LAST__ - 1 ; Address of end of file
|
||||
.word __BASHEAD_START__ ; Address of start of file
|
||||
|
16
libsrc/telestrat/print.s
Normal file
16
libsrc/telestrat/print.s
Normal file
@ -0,0 +1,16 @@
|
||||
; jede jede@oric.org 2017-01-22
|
||||
|
||||
; void print (char * str);
|
||||
.export _print
|
||||
.import popax
|
||||
.importzp tmp1
|
||||
.include "telestrat.inc"
|
||||
|
||||
.proc _print
|
||||
stx tmp1
|
||||
ldy tmp1
|
||||
BRK_TELEMON XWSTR0
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
43
libsrc/telestrat/read.s
Normal file
43
libsrc/telestrat/read.s
Normal file
@ -0,0 +1,43 @@
|
||||
;
|
||||
; jede jede@oric.org 2017-01-22
|
||||
;
|
||||
|
||||
|
||||
.FEATURE c_comments,labels_without_colons,pc_assignment, loose_char_term
|
||||
.export _read
|
||||
|
||||
.import popax
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "telestrat.inc"
|
||||
|
||||
; int read (int fd, void* buf, unsigned count);
|
||||
|
||||
.proc _read
|
||||
sta ptr1 ; count
|
||||
stx ptr1+1 ; count
|
||||
jsr popax ; get buf
|
||||
|
||||
sta PTR_READ_DEST
|
||||
stx PTR_READ_DEST+1
|
||||
sta ptr2 ; in order to calculate nb of bytes read
|
||||
stx ptr2+1 ;
|
||||
|
||||
; jsr popax ; fp pointer don't care in this version
|
||||
|
||||
lda ptr1 ;
|
||||
ldy ptr1+1 ;
|
||||
BRK_TELEMON XFREAD ; calls telemon30 routine
|
||||
; compute nb of bytes read
|
||||
lda PTR_READ_DEST+1
|
||||
sec
|
||||
sbc ptr2+1
|
||||
tax
|
||||
lda PTR_READ_DEST
|
||||
sec
|
||||
sbc ptr2
|
||||
; Here A and X contains number of bytes read
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
;
|
||||
|
||||
.export screensize
|
||||
.include "telemon24.inc"
|
||||
.include "telestrat.inc"
|
||||
|
||||
.proc screensize
|
||||
|
42
libsrc/telestrat/sound.s
Normal file
42
libsrc/telestrat/sound.s
Normal file
@ -0,0 +1,42 @@
|
||||
;
|
||||
; jede jede@oric.org 2017-01-22
|
||||
|
||||
.export _kbdclick1,_oups,_ping,_explode,_shoot,_zap
|
||||
.include "telestrat.inc"
|
||||
|
||||
.proc _kbdclick1
|
||||
ldx #<sound_bip_keyboard
|
||||
ldy #>sound_bip_keyboard
|
||||
BRK_TELEMON XSONPS
|
||||
rts
|
||||
sound_bip_keyboard:
|
||||
.byte $1f,$00,$00,$00,$00,$00,$00,$3e,$10,$00,$00,$1f,$00,$00
|
||||
.endproc
|
||||
|
||||
.proc _explode
|
||||
BRK_TELEMON XEXPLO
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _oups
|
||||
BRK_TELEMON XOUPS
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _ping
|
||||
BRK_TELEMON XPING
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _shoot
|
||||
BRK_TELEMON XSHOOT
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc _zap
|
||||
BRK_TELEMON XZAP
|
||||
rts
|
||||
.endproc
|
||||
|
||||
|
||||
|
@ -1,17 +1,13 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2003-04-13
|
||||
;
|
||||
; int write (int fd, const void* buf, int count);
|
||||
;
|
||||
; This function is a hack!
|
||||
;
|
||||
; jede jede@oric.org 2017-01-22
|
||||
|
||||
.export _write
|
||||
.import popax
|
||||
.importzp ptr1, ptr2, ptr3, tmp1
|
||||
|
||||
.include "telemon30.inc"
|
||||
.include "telestrat.inc"
|
||||
|
||||
; int write (int fd, const void* buf, int count);
|
||||
.proc _write
|
||||
|
||||
sta ptr3
|
||||
@ -58,8 +54,8 @@ L2: ldy #0
|
||||
tax
|
||||
cpx #$0A ; Check for \n
|
||||
bne L3
|
||||
BRK_TELEMON XWR0 ; Macro
|
||||
lda #$0d ; return to the beggining of the line
|
||||
BRK_TELEMON XWR0 ; Macro send char to screen (channel 0 in telemon terms)
|
||||
lda #$0D ; return to the beggining of the line
|
||||
BRK_TELEMON XWR0 ; Macro ;
|
||||
|
||||
|
@ -291,12 +291,8 @@ static void SetSys (const char* Sys)
|
||||
NewSymbol ("__ATMOS__", 1);
|
||||
break;
|
||||
|
||||
case TGT_TELEMON24:
|
||||
NewSymbol ("__TELEMON24__", 1);
|
||||
break;
|
||||
|
||||
case TGT_TELEMON30:
|
||||
NewSymbol ("__TELEMON30__", 1);
|
||||
case TGT_TELESTRAT:
|
||||
NewSymbol ("__TELESTRAT__", 1);
|
||||
break;
|
||||
|
||||
case TGT_NES:
|
||||
|
@ -243,14 +243,10 @@ static void SetSys (const char* Sys)
|
||||
DefineNumericMacro ("__ATMOS__", 1);
|
||||
break;
|
||||
|
||||
case TGT_TELEMON24:
|
||||
DefineNumericMacro ("__TELEMON24__", 1);
|
||||
case TGT_TELESTRAT:
|
||||
DefineNumericMacro ("__TELESTRAT__", 1);
|
||||
break;
|
||||
|
||||
case TGT_TELEMON30:
|
||||
DefineNumericMacro ("__TELEMON30__", 1);
|
||||
break;
|
||||
|
||||
case TGT_NES:
|
||||
DefineNumericMacro ("__NES__", 1);
|
||||
break;
|
||||
|
@ -171,8 +171,7 @@ static const TargetEntry TargetMap[] = {
|
||||
{ "sim6502", TGT_SIM6502 },
|
||||
{ "sim65c02", TGT_SIM65C02 },
|
||||
{ "supervision", TGT_SUPERVISION },
|
||||
{ "telemon24", TGT_TELEMON24 },
|
||||
{ "telemon30", TGT_TELEMON30 },
|
||||
{ "telestrat", TGT_TELESTRAT },
|
||||
{ "vic20", TGT_VIC20 },
|
||||
};
|
||||
#define MAP_ENTRY_COUNT (sizeof (TargetMap) / sizeof (TargetMap[0]))
|
||||
@ -201,8 +200,7 @@ static const TargetProperties PropertyTable[TGT_COUNT] = {
|
||||
{ "geos-apple", CPU_65C02, BINFMT_BINARY, CTNone },
|
||||
{ "lunix", CPU_6502, BINFMT_O65, CTNone },
|
||||
{ "atmos", CPU_6502, BINFMT_BINARY, CTNone },
|
||||
{ "telemon24", CPU_6502, BINFMT_BINARY, CTNone },
|
||||
{ "telemon30", CPU_6502, BINFMT_BINARY, CTNone },
|
||||
{ "telestrat", CPU_6502, BINFMT_BINARY, CTNone },
|
||||
{ "nes", CPU_6502, BINFMT_BINARY, CTNone },
|
||||
{ "supervision", CPU_65SC02, BINFMT_BINARY, CTNone },
|
||||
{ "lynx", CPU_65SC02, BINFMT_BINARY, CTNone },
|
||||
|
@ -73,8 +73,7 @@ typedef enum {
|
||||
TGT_GEOS_APPLE,
|
||||
TGT_LUNIX,
|
||||
TGT_ATMOS,
|
||||
TGT_TELEMON24,
|
||||
TGT_TELEMON30,
|
||||
TGT_TELESTRAT,
|
||||
TGT_NES,
|
||||
TGT_SUPERVISION,
|
||||
TGT_LYNX,
|
||||
|
Loading…
Reference in New Issue
Block a user