From d1b5a6632d558c0ffb9b89f1cbf239ae04533b90 Mon Sep 17 00:00:00 2001 From: jede Date: Sun, 29 Jan 2017 21:18:49 +0100 Subject: [PATCH] Adding telemon30 and telemon24 primitives --- asminc/telemon24.inc | 68 ++++++++ asminc/telemon30.inc | 150 ++++++++++++++++++ cfg/telemon24.cfg | 43 +++++ include/telemon30.h | 21 +++ libsrc/telemon30/_close.s | 17 ++ libsrc/telemon30/_open.s | 60 ++----- libsrc/telemon30/_read.s | 46 ++++-- libsrc/telemon30/ch376.s | 307 +++++++++++++++++++++++++++--------- libsrc/telemon30/graphics.s | 13 +- libsrc/telemon30/orixhdr.s | 15 +- libsrc/telemon30/write.s | 22 +++ 11 files changed, 616 insertions(+), 146 deletions(-) create mode 100644 asminc/telemon24.inc create mode 100644 asminc/telemon30.inc create mode 100644 cfg/telemon24.cfg create mode 100644 include/telemon30.h create mode 100644 libsrc/telemon30/_close.s diff --git a/asminc/telemon24.inc b/asminc/telemon24.inc new file mode 100644 index 000000000..0b58d63a6 --- /dev/null +++ b/asminc/telemon24.inc @@ -0,0 +1,68 @@ +; +; 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 + diff --git a/asminc/telemon30.inc b/asminc/telemon30.inc new file mode 100644 index 000000000..acfd7e919 --- /dev/null +++ b/asminc/telemon30.inc @@ -0,0 +1,150 @@ +; +; 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 + + +.struct VIA2 ; Versatile Interface Adapter + .res $0320 +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 + +; 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 + +; --------------------------------------------------------------------------- +; Page $500 + +BUFNOM := $517 +BUFEDT := $590 + +MAX_BUFEDT_LENGTH=110 + +; Hardware +CH376_DATA :=$340 +CH376_COMMAND :=$341 + +; MACRO + + +.macro BRK_TELEMON value + .byte $00,value +.endmacro diff --git a/cfg/telemon24.cfg b/cfg/telemon24.cfg new file mode 100644 index 000000000..b76350868 --- /dev/null +++ b/cfg/telemon24.cfg @@ -0,0 +1,43 @@ +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__; +} diff --git a/include/telemon30.h b/include/telemon30.h new file mode 100644 index 000000000..73b018444 --- /dev/null +++ b/include/telemon30.h @@ -0,0 +1,21 @@ + +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, char display, char display); +void circle(char rayon); + + + diff --git a/libsrc/telemon30/_close.s b/libsrc/telemon30/_close.s new file mode 100644 index 000000000..84bee3a1b --- /dev/null +++ b/libsrc/telemon30/_close.s @@ -0,0 +1,17 @@ + .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 + + \ No newline at end of file diff --git a/libsrc/telemon30/_open.s b/libsrc/telemon30/_open.s index a002bbce1..7ea2d8310 100644 --- a/libsrc/telemon30/_open.s +++ b/libsrc/telemon30/_open.s @@ -1,11 +1,12 @@ .export _open .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" + .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 _open ; Throw away any additional parameters passed through the ellipsis @@ -13,53 +14,18 @@ dey ; ...checked (it generates a c compiler warning) dey dey - beq parmok ; Branch if parameter count ok - jsr addysp ; Fix stack, throw away unused parameters + beq parmok ; Branch if parameter count ok + jsr addysp ; Fix stack, throw away unused parameters ; Parameters ok. Pop the flags and save them into tmp3 -parmok: jsr popax ; Get flagss - sta tmp3 ; save flags - - ;AND #O_RDONLY - ;beq READONLY - ;lda tmp3 - ;AND #O_WRONLY - ;beq WRITEONLY - ;jmp next - -;READONLY: -; lda #'r' -; BRK_TELEMON XWR0 -; jmp next -;WRITEONLY: -; lda #'w' -; BRK_TELEMON XWR0 - -;next: +parmok: jsr popax ; Get flagss + sta tmp3 ; save flags ; Get the filename from stack and parse it. Bail out if is not ok - jsr popax ; Get name - - - ldy tmp3 ; Get flags - - - BRK_TELEMON XOPEN - - ; jsr fnparse ; Parse it - ;tax - ;bne oserror ; Bail out if problem with name - -; Get a free file handle and remember it in tmp2 - - ; jsr freefd - ;lda #EMFILE ; Load error code - ;bcs seterrno ; Jump in case of errors - ;stx tmp2 -; - - + jsr popax ; Get name + ldy tmp3 ; Get flags again + BRK_TELEMON XOPEN ; launch primitive ROM rts .endproc diff --git a/libsrc/telemon30/_read.s b/libsrc/telemon30/_read.s index 8f7a20a58..e8bcc3fd0 100644 --- a/libsrc/telemon30/_read.s +++ b/libsrc/telemon30/_read.s @@ -1,29 +1,45 @@ ; -; Ullrich von Bassewitz, 2003-04-13 +; jede jede@oric.org 2017-01-22 ; -; + .FEATURE c_comments,labels_without_colons,pc_assignment, loose_char_term .export _read .import popax - .importzp ptr1, ptr2, ptr3, tmp1, tmp2 - + + .include "zeropage.inc" .include "telemon30.inc" ; int read (int fd, void* buf, unsigned count); .proc _read - ;jsr popax ; fp pointer don't care - sta tmp1 ; count - stx tmp2 ; count - jsr popax ; get buf - ;lda #$00 - ;ldx #$a0 - sta PTR_READ_DEST - stx PTR_READ_DEST+1 - lda tmp1 ; - ldy tmp2 ; - BRK_TELEMON XFREAD + + 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 diff --git a/libsrc/telemon30/ch376.s b/libsrc/telemon30/ch376.s index 24df14471..97245add9 100644 --- a/libsrc/telemon30/ch376.s +++ b/libsrc/telemon30/ch376.s @@ -1,5 +1,5 @@ - ; For XA65 compatibily in the futur + ; 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 @@ -8,14 +8,16 @@ .export _ch376_check_exist .export _ch376_disk_mount .export _ch376_set_usb_mode - .export _ch376_file_create - .export _ch376_fcreate - + + .export _ch376_file_close + .export _ch376_seek_file + .export _ch376_file_create + .export _ch376_fwrite ; High level function - .export _ch376_fcreate + .import popax - .importzp sp,tmp2,tmp3,tmp1 + .include "zeropage.inc" .include "telemon30.inc" /* @@ -24,10 +26,27 @@ CH376_SET_USB_MODE_CODE_USB_HOST_SOF_PACKAGE_AUTOMATICALLY := $06 -CH376_USB_INT_DISK_READ := $1d -CH376_USB_INT_SUCCESS := $14 -CH376_ERR_MISS_FILE := $42 - +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 @@ -36,80 +55,92 @@ 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_SET_FILE_NAME := $2f +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_RD_GO := $3B CH376_BYTE_WRITE := $3C +CH376_BYTE_WR_GO := $3D CH376_DISK_CAPACITY := $3E CH376_DISK_RD_GO := $55 -.proc _ch376_file_create - lda #CH376_FILE_CREATE - sta CH376_COMMAND - jsr _ch376_wait_response - rts +.proc _ch376_file_close + lda #CH376_FILE_CLOSE + sta CH376_COMMAND + jsr _ch376_wait_response + rts .endproc -; void _ch376_fcreate(char *filename) -.proc _ch376_fcreate - jsr _ch376_set_file_name - jsr _ch376_file_open - jsr _ch376_file_create +.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 tmp1 - stx tmp1+1 - lda #CH376_SET_FILE_NAME ;$2f - sta CH376_COMMAND - ldy #0 + sta ptr1 + stx ptr1+1 + lda #CH376_SET_FILE_NAME ;$2f + sta CH376_COMMAND + ldy #0 loop: - lda (tmp1),y ; replace by bufnom - beq end ; we reached 0 value - sta CH376_DATA + 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 + cpy #13 ; because we don't manage longfilename shortname =11 + bne loop end: - sta CH376_DATA + sta CH376_DATA rts .endproc -; void _ch376_file_open(); +; char _ch376_file_open(); .proc _ch376_file_open - lda #CH376_FILE_OPEN ; $32 - sta CH376_COMMAND - jsr _ch376_wait_response + lda #CH376_FILE_OPEN ; $32 + sta CH376_COMMAND + jsr _ch376_wait_response +; ldx #0 rts .endproc ;CMD_GET_FILE_SIZE .proc _ch376_get_file_size - lda #CH376_GET_FILE_SIZE - sta CH376_COMMAND - lda #$68 - sta CH376_DATA + lda #CH376_GET_FILE_SIZE + sta CH376_COMMAND + lda #$68 + sta CH376_DATA ; store file leng - lda CH376_DATA - sta tmp1 - lda CH376_DATA - sta tmp1+1 - lda CH376_DATA - sta tmp2 - lda CH376_DATA - sta tmp2+1 + lda CH376_DATA + sta tmp1 + lda CH376_DATA + sta tmp1+1 + lda CH376_DATA + sta tmp2 + lda CH376_DATA + sta tmp2+1 rts .endproc @@ -155,35 +186,35 @@ loop: .proc _ch376_set_usb_mode ; CH376_SET_USB_MODE_CODE_USB_HOST_SOF_PACKAGE_AUTOMATICALLY - pha - lda #CH376_SET_USB_MODE ; $15 - sta CH376_COMMAND - pla - sta CH376_DATA + 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 - sta tmp1 - stx tmp1+1 - ldx #CH376_BYTE_WRITE - stx CH376_COMMAND - lda tmp1 - sta CH376_DATA - lda tmp1+1 - sta CH376_DATA - jsr _ch376_wait_response + 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 - ldx #CH376_BYTE_READ - stx CH376_COMMAND - sta CH376_DATA - sty CH376_DATA - jsr _ch376_wait_response + 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 @@ -204,7 +235,7 @@ loop: ; else A contains answer of the controller ldy #$ff loop3: - ldx #$ff ; merci de laisser une valeur importante car parfois en mode non debug, le controleur ne répond pas tout de suite + ldx #$ff ; don't decrease this counter. Because ch376 won't respond if there is a lower value loop: lda CH376_COMMAND and #%10000000 @@ -223,3 +254,137 @@ no_error: 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 +; dec ptr2 + ;bne continue3 + ;dec ptr2+1 + ;bne continue3 +;continue3 +; lda ptr2+1 + ;bne continue2 + ;lda ptr2 + ;beq finished +;continue2 +; 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_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 \ No newline at end of file diff --git a/libsrc/telemon30/graphics.s b/libsrc/telemon30/graphics.s index 1d0beefa5..4f2b09162 100644 --- a/libsrc/telemon30/graphics.s +++ b/libsrc/telemon30/graphics.s @@ -1,7 +1,7 @@ - .export _paper,_hires,_text,_circle,_curset, _switchOffCursor - .importzp sp,tmp2,tmp3,tmp1 - - .include "telemon30.inc" + .export _paper,_hires,_text,_circle,_curset, _switchOffCursor + .importzp sp,tmp2,tmp3,tmp1 + .import popa + .include "telemon30.inc" .proc _paper ldx #0 ; First window @@ -30,8 +30,11 @@ .endproc .proc _curset + jsr popa ; Pixel + jsr popa sta HRSX - sty HRSY + jsr popa + sta HRSY BRK_TELEMON XCURSE rts .endproc diff --git a/libsrc/telemon30/orixhdr.s b/libsrc/telemon30/orixhdr.s index 8744e86b0..1b0351885 100644 --- a/libsrc/telemon30/orixhdr.s +++ b/libsrc/telemon30/orixhdr.s @@ -1,5 +1,5 @@ ; -; Based on code by Debrune Jérôme +; Based on code by Debrune Jérôme ; 2016-03-17, Greg King ; @@ -17,18 +17,17 @@ .segment "ORIXHDR" - .byte $01, $00 ; + .byte $01, $00 ; - .byte "ORI" + .byte "ori" .byte $01 ; version - .byte $00,$00 ; mode - .byte $00,$00 ; cpu type + .byte $00,%00000000 ; 6502 only + .byte $00,$00 ; Extends .byte $00,$00 ; OS - .byte $00 ; reserved - .byte $00 ; auto - + .byte $00 ; reserved + .byte $00 ; auto .word __BASHEAD_START__ ; Address of start of file .word __MAIN_LAST__ - 1 ; Address of end of file diff --git a/libsrc/telemon30/write.s b/libsrc/telemon30/write.s index 32965fe3d..d762eb92c 100644 --- a/libsrc/telemon30/write.s +++ b/libsrc/telemon30/write.s @@ -27,6 +27,28 @@ sta ptr1 stx ptr1+1 jsr popax ; get fd and discard + + ; if fd=0001 then it stdout + + + cpx #0 + beq next + jmp L1 +next: + cmp #1 + beq L1 + + ; Here it's a file opened + lda ptr1 + sta PTR_READ_DEST + lda ptr1+1 + sta PTR_READ_DEST+1 + lda ptr3 + ldy ptr3+1 + BRK_TELEMON XFWRITE + rts + + L1: inc ptr2 bne L2 inc ptr2+1