From 889783bedba400a8bb6608d3c95ea278c96603ff Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Tue, 11 Mar 2014 01:17:59 +0100 Subject: [PATCH] add some conio functions --- libsrc/atari/chline.s | 12 +++++++----- libsrc/atari/cvline.s | 11 +++++++---- libsrc/atari5200/cclear.s | 1 + libsrc/atari5200/chline.s | 1 + libsrc/atari5200/clock.s | 35 +++++++++++++++++++++++++++++++++ libsrc/atari5200/cvline.s | 1 + libsrc/atari5200/sysuname.s | 39 +++++++++++++++++++++++++++++++++++++ 7 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 libsrc/atari5200/cclear.s create mode 100644 libsrc/atari5200/chline.s create mode 100644 libsrc/atari5200/clock.s create mode 100644 libsrc/atari5200/cvline.s create mode 100644 libsrc/atari5200/sysuname.s diff --git a/libsrc/atari/chline.s b/libsrc/atari/chline.s index 46eb0f35d..b6ebba936 100644 --- a/libsrc/atari/chline.s +++ b/libsrc/atari/chline.s @@ -9,6 +9,12 @@ .import popa, _gotoxy, cputdirect, setcursor .importzp tmp1 +.ifndef __ATARI5200__ +CHRCODE = $12+64 +.else +CHRCODE = 14 +.endif + _chlinexy: pha ; Save the length jsr popa ; Get y @@ -19,12 +25,8 @@ _chline: cmp #0 ; Is the length zero? beq L9 ; Jump if done sta tmp1 -L1: lda #$12+64 ; Horizontal line, screen code +L1: lda #CHRCODE ; Horizontal line, screen code jsr cputdirect ; Direct output dec tmp1 bne L1 L9: jmp setcursor - - - - diff --git a/libsrc/atari/cvline.s b/libsrc/atari/cvline.s index 608da23de..5b1c3fd09 100644 --- a/libsrc/atari/cvline.s +++ b/libsrc/atari/cvline.s @@ -10,6 +10,12 @@ .import popa, _gotoxy, putchar, setcursor .importzp tmp1 +.ifndef __ATARI5200__ +CHRCODE = $7C ; Vertical bar +.else +CHRCODE = 1 ; exclamation mark +.endif + _cvlinexy: pha ; Save the length jsr popa ; Get y @@ -22,7 +28,7 @@ _cvline: sta tmp1 L1: lda COLCRS pha - lda #$7C ; Vertical bar + lda #CHRCODE ; Vertical bar jsr putchar ; Write, no cursor advance pla sta COLCRS @@ -30,6 +36,3 @@ L1: lda COLCRS dec tmp1 bne L1 L9: jmp setcursor - - - diff --git a/libsrc/atari5200/cclear.s b/libsrc/atari5200/cclear.s new file mode 100644 index 000000000..4bdc8ddf1 --- /dev/null +++ b/libsrc/atari5200/cclear.s @@ -0,0 +1 @@ +.include "../atari/cclear.s" diff --git a/libsrc/atari5200/chline.s b/libsrc/atari5200/chline.s new file mode 100644 index 000000000..d5872f149 --- /dev/null +++ b/libsrc/atari5200/chline.s @@ -0,0 +1 @@ +.include "../atari/chline.s" diff --git a/libsrc/atari5200/clock.s b/libsrc/atari5200/clock.s new file mode 100644 index 000000000..d70794b8d --- /dev/null +++ b/libsrc/atari5200/clock.s @@ -0,0 +1,35 @@ +; +; from Atari computer version by Christian Groessler, 2014 +; +; clock_t clock (void); +; unsigned _clocks_per_sec (void); +; + + .export _clock, __clocks_per_sec + .importzp sreg + + .include "atari5200.inc" + + +.proc _clock + + ldx #5 ; Synchronize with Antic, so the interrupt won't change RTCLOK + stx WSYNC ; while we're reading it. The synchronization is done same as +@L1: dex ; in SETVBLV function in Atari OS. + bne @L1 + stx sreg+1 ; Byte 3 is always zero + stx sreg ; Byte 2 is always zero, too + lda RTCLOK+1 + ldx RTCLOK + rts + +.endproc + + +.proc __clocks_per_sec + + ldx #$00 ; Clear high byte of return value + lda #60 + rts + +.endproc diff --git a/libsrc/atari5200/cvline.s b/libsrc/atari5200/cvline.s new file mode 100644 index 000000000..d987bcb62 --- /dev/null +++ b/libsrc/atari5200/cvline.s @@ -0,0 +1 @@ +.include "../atari/cvline.s" diff --git a/libsrc/atari5200/sysuname.s b/libsrc/atari5200/sysuname.s new file mode 100644 index 000000000..7fd9281a1 --- /dev/null +++ b/libsrc/atari5200/sysuname.s @@ -0,0 +1,39 @@ +; +; 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 '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 + + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 + + ; machine + .asciiz "Atari5200" + + + -- 2.39.5