1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

Merge pull request #1729 from jedeoric/fix_fd_cleaning_telestrat

[Telestrat] missing fd_management and cleaning
This commit is contained in:
Bob Andrews 2022-05-04 02:34:58 +02:00 committed by GitHub
commit b8f7167dcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 50 deletions

View File

@ -1,7 +1,7 @@
; ;
; Oric TELEMON definition ; Oric TELEMON definition
; TELEMON 2.4 & TELEMON 3.x ; TELEMON 2.4 & Orix
; For TELEMON 3.x check http://orix.oric.org ; For Orix check http://orix.oric.org
; ;
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -59,7 +59,7 @@ SCRNB := $28 ; Id of the current window
ADKBD := $2A ; Address ASCII conversion table ADKBD := $2A ; Address ASCII conversion table
PTR_READ_DEST := $2C ; Used for XFREAD and XWRITE only in TELEMON 3.x PTR_READ_DEST := $2C ; Used for XFREAD and XWRITE only in Orix
ADCLK := $40 ; Address for clock display ADCLK := $40 ; Address for clock display
TIMEUS := $42 TIMEUS := $42
@ -249,10 +249,10 @@ XHIRES = $1A
XEFFHI = $1B ; Clear hires screen XEFFHI = $1B ; Clear hires screen
XFILLM = $1C XFILLM = $1C
XMINMA = $1F XMINMA = $1F
XVARS = $24 ; Only in TELEMON 3.x, in TELEMON 2.4, it's XNOMFI ($24) XVARS = $24 ; Only in Orix, in TELEMON 2.4, it's XNOMFI ($24)
XCRLF = $25 ; Jump a line and return to the beginning of the line XCRLF = $25 ; Jump a line and return to the beginning of the line
XDECAY = $26 XDECAY = $26
XFREAD = $27 ; Only in TELEMON 3.x (bank 7 of Orix) XFREAD = $27 ; Only in Orix
XBINDX = $28 ; Convert a number into hex and displays on channel 0 XBINDX = $28 ; Convert a number into hex and displays on channel 0
XDECIM = $29 XDECIM = $29
XHEXA = $2A ; Convert a number into hex XHEXA = $2A ; Convert a number into hex
@ -261,7 +261,7 @@ XEDT = $2D ; Launch editor
XINSER = $2E XINSER = $2E
XSCELG = $2F ; Search a line in editor mode XSCELG = $2F ; Search a line in editor mode
XOPEN = $30 ; Only in TELEMON 3.x (bank 7 of Orix) XOPEN = $30 ; Only in Orix
XECRPR = $33 ; Displays prompt XECRPR = $33 ; Displays prompt
XCOSCR = $34 ; Switch off cursor XCOSCR = $34 ; Switch off cursor
XCSSCR = $35 ; Switch on cursor XCSSCR = $35 ; Switch on cursor
@ -269,8 +269,8 @@ XSCRSE = $36
XSCROH = $37 ; Scroll up text screen XSCROH = $37 ; Scroll up text screen
XSCROB = $38 ; Scroll down text screen XSCROB = $38 ; Scroll down text screen
XSCRNE = $39 ; Load charset from rom to ram XSCRNE = $39 ; Load charset from rom to ram
XCLOSE = $3A ; Only in TELEMON 3.x close file (bank 7 of Orix) XCLOSE = $3A ; Only in Orix close file
XFWRITE = $3B ; Only in TELEMON 3.x write file (bank 7 of Orix) XFWRITE = $3B ; Only in Orix write file
; Clock primitive ; Clock primitive
XRECLK = $3C ; Reset clock XRECLK = $3C ; Reset clock
@ -291,14 +291,14 @@ XGETCWD = $48 ; Get current CWD
XPUTCWD = $49 ; Chdir XPUTCWD = $49 ; Chdir
; File management ; File management
XMKDIR = $4B ; Create a folder. Only available in TELEMON 3.x (bank 7 of Orix) XMKDIR = $4B ; Create a folder. Only available in Orix
XHCHRS = $4C ; Hard copy hires XHCHRS = $4C ; Hard copy hires
; File management ; File management
XRM = $4D ; Remove a folder or a file. Only available in TELEMON 3.x (bank 7 of Orix) XRM = $4D ; Remove a folder or a file. Only available in Orix
XFWR = $4E ; Put a char on the first screen. Only available in TELEMON 3.x (bank 7 of Orix) XFWR = $4E ; Put a char on the first screen. Only available in Orix
; Keyboard primitives ; Keyboard primitives
XALLKB = $50 ; Read Keyboard, and populate KBDCOL XALLKB = $50 ; Read Keyboard, and populate KBDCOL
@ -314,7 +314,7 @@ XINIBU = $58 ; Initialize the buffer X
XDEFBU = $59 ; Reset all value of the buffer XDEFBU = $59 ; Reset all value of the buffer
XBUSY = $5A ; Test if the buffer is empty XBUSY = $5A ; Test if the buffer is empty
XMALLOC = $5B ; Only in TELEMON 3.x (bank 7 of Orix) XMALLOC = $5B ; Only in Orix
; RS232 primitives ; RS232 primitives
XSDUMP = $5C ; RS232 input dump XSDUMP = $5C ; RS232 input dump
@ -326,7 +326,9 @@ XSSAVE = $5F ; Write a file to RS232
XMLOAD = $60 ; Read a file from Minitel XMLOAD = $60 ; Read a file from Minitel
XMSAVE = $61 ; Write a file to Minitel XMSAVE = $61 ; Write a file to Minitel
XFREE = $62 ; Only in TELEMON 3.x (bank 7 of Orix) XFREE = $62 ; Only in Orix
XEXEC = $63 ; Only in Orix
; Next Minitel primitives ; Next Minitel primitives
XWCXFI = $63 ; Wait connection XWCXFI = $63 ; Wait connection
@ -334,7 +336,7 @@ XLIGNE = $64 ;
XDECON = $65 ; Minitel disconnection XDECON = $65 ; Minitel disconnection
XMOUT = $66 ; Send a byte to minitel (from A) XMOUT = $66 ; Send a byte to minitel (from A)
XSOUT = $67 ; Send accumulator value (A) to RS232, available in TELEMON 2.4 & 3.x : if RS232 buffer is full, the Oric Telestrat freezes XSOUT = $67 ; Send accumulator value (A) to RS232, available in TELEMON 2.4 : if RS232 buffer is full, the Oric Telestrat freezes
XHRSSE = $8C ; Set hires position cursor XHRSSE = $8C ; Set hires position cursor
XDRAWA = $8D ; Draw a line absolute XDRAWA = $8D ; Draw a line absolute

View File

@ -1,16 +1,16 @@
; jede jede@oric.org 2017-01-22 ; jede jede@oric.org 2017-01-22
.export _close .export _close
.import addysp,popax .import addysp,popax
.include "zeropage.inc" .include "zeropage.inc"
.include "telestrat.inc" .include "telestrat.inc"
.include "errno.inc" .include "errno.inc"
.include "fcntl.inc" .include "fcntl.inc"
; int open (const char* name, int flags, ...); /* May take a mode argument */ ; int __fastcall__ close (int fd);
.proc _close .proc _close
BRK_TELEMON XCLOSE ; launch primitive ROM BRK_TELEMON XCLOSE ; Launch primitive ROM
rts rts
.endproc .endproc

View File

@ -2,38 +2,41 @@
; jede jede@oric.org 2017-01-22 ; jede jede@oric.org 2017-01-22
; ;
.export _read .export _read
.import popax .import popax
.include "zeropage.inc" .include "zeropage.inc"
.include "telestrat.inc" .include "telestrat.inc"
;int read (int fd, void* buf, unsigned count); ;int read (int fd, void* buf, unsigned count);
.proc _read .proc _read
sta ptr1 ; Count sta ptr1 ; count
stx ptr1+1 ; Count stx ptr1+1 ; count
jsr popax ; Get buf jsr popax ; get buf
sta PTR_READ_DEST sta PTR_READ_DEST
stx PTR_READ_DEST+1 stx PTR_READ_DEST+1
sta ptr2 ; In order to calculate nb of bytes read sta ptr2 ; in order to calculate nb of bytes read
stx ptr2+1 ; stx ptr2+1
jsr popax ; get FD
lda ptr1 ; tax ; send FD to X
ldy ptr1+1 ;
BRK_TELEMON XFREAD ; calls telemon30 routine lda ptr1
; Compute nb of bytes read ldy ptr1+1
lda PTR_READ_DEST+1 BRK_TELEMON XFREAD
sec ; compute nb of bytes read
sbc ptr2+1 lda PTR_READ_DEST+1
tax sec
lda PTR_READ_DEST sbc ptr2+1
sec tax
sbc ptr2 lda PTR_READ_DEST
; Here A and X contains number of bytes read sec
rts sbc ptr2
; here A and X contains number of bytes read
rts
.endproc .endproc

View File

@ -3,8 +3,8 @@
.export _write .export _write
.import popax, popptr1 .import popax, popptr1
.importzp ptr1, ptr2, ptr3, tmp1
.include "zeropage.inc"
.include "telestrat.inc" .include "telestrat.inc"
; int write (int fd, const void* buf, int count); ; int write (int fd, const void* buf, int count);
@ -20,7 +20,10 @@
stx ptr2 ; save count with each byte incremented separately stx ptr2 ; save count with each byte incremented separately
jsr popptr1 ; get buf jsr popptr1 ; get buf
jsr popax ; get fd and discard
jsr popax ; get fd
sta tmp1 ; save fd
; if fd=0001 then it stdout ; if fd=0001 then it stdout
cpx #0 cpx #0
@ -37,6 +40,7 @@ next:
sta PTR_READ_DEST+1 sta PTR_READ_DEST+1
lda ptr3 lda ptr3
ldy ptr3+1 ldy ptr3+1
ldx tmp1 ; send fd in X
BRK_TELEMON XFWRITE BRK_TELEMON XFWRITE
; compute nb of bytes written ; compute nb of bytes written
@ -74,7 +78,7 @@ L3:
inc ptr1+1 inc ptr1+1
jmp L1 jmp L1
; No error, return count ; no error, return count
L9: lda ptr3 L9: lda ptr3
ldx ptr3+1 ldx ptr3+1