Tested Oric-1 joystk and lgtpen modules

This commit is contained in:
Curtis F Kaylor 2018-09-16 20:53:34 -04:00
parent 3f9b4484c1
commit 967d2c01e3
14 changed files with 161 additions and 23 deletions

30
include/oric/joystk.a02 Normal file
View File

@ -0,0 +1,30 @@
;Joystick Assembly Language Library for Oric-1
JYSTKS EQU $02 ;Number of Joysticks
;Joystick Bit Masks
JOYUP EQU $10 ;Bit 4 - Up
JOYDN EQU $08 ;Bit 3 - Down
JOYLF EQU $01 ;Bit 0 - Left
JOYRT EQU $02 ;Bit 1 - Right
JOYB0 EQU $20 ;Bit 5 - Button
;Read Joystick (ALTAI)
;http://wiki.defence-force.org/doku.php?id=oric:hardware:altai_drivers
JOYSTK: CMP #JYSTKS ;If Joystick# >= Maximum
BCS JOYSTZ ; Return Error
TAX ;Copy Joystick# to X
LDY JOYSTT,X ;Load Y from Table
LDA #%11000000
STA $0303 ;Set Data Direction Register A
STY $0301 ;Select Joystick
LDA $0301 ;Read Joystick
LDY #%11111111
STY $0303 ;Restore Data Direction Register A
AND #%00111111 ;Mask Bits
EOR #%00111111 ;and Invert Them
RTS
JOYSTZ: LDA #$FF ;Return Error
RTS
JOYSTT: DC #%10000000,#%01000000

16
include/oric/joystk.h02 Normal file
View File

@ -0,0 +1,16 @@
/* Joystick Library Header File for Oric-1 *
* with ALTAI Joystick Adapter - UNTESTED! */
#define JYSTKS $02 //Number of Joysticks
#define JOYUP $10 //Bit 4 - Up
#define JOYDN $08 //Bit 3 - Down
#define JOYLF $01 //Bit 0 - Left
#define JOYRT $02 //Bit 1 - Right
#define JOYB0 $20 //Bit 5 - Button
/* Read Joystick State *
* Args: n = Joystick Number *
* Returns: Joystick Status *
* $FF = Invalid Argument */
char joystk();

9
include/oric/lgtpen.a02 Normal file
View File

@ -0,0 +1,9 @@
;Lightpen Assembly Language Module for Oric-1
LGTPNS EQU #$FF ;Light Pen Status (Supported)
;Read Light Pen
LGTPEN LDA $03E0 ;Load X Position into A
LDY $03E1 ;Load Y Position into Y
LDX #0 ;Set Trigger to 0
RTS

5
include/oric/lgtpen.h02 Normal file
View File

@ -0,0 +1,5 @@
/* Lightpen Module Header File for Oric-1 */
#define LGTPNS $FF //Light Pen Status (Supported)
char lgtpen(); //Read Light Pen

View File

@ -6,7 +6,7 @@ IF EXIST %1.c02 GOTO COMPILE
:COMPILE
ECHO Compiling File %1.c02
..\c02.exe -h apple1 %1 >%1.dbg
..\c02.exe -h apple1 -s apple1 %1 >%1.dbg
IF ERRORLEVEL 1 EXIT /B
ECHO Assembling File %1.asm

18
test/c64.bat Normal file
View File

@ -0,0 +1,18 @@
@ECHO OFF
IF EXIST %1.c02 GOTO COMPILE
ECHO File %1.c02 not found
GOTO EOF
:COMPILE
ECHO Compiling File %1.c02 for Commodore 64
..\c02.exe -h c64 -s c64 %1 >%1.dbg
IF %ERRORLEVEL% NEQ 0 GOTO EOF
ECHO Assembling File %1.asm
C:\Programs\dasm %1.asm -f1 -o%1.prg -l%1.lst -s%1.sym
IF %ERRORLEVEL% NEQ 0 GOTO EOF
ECHO Starting Emulator
@start C:\Programs\WinVICE\x64.exe -config x64.ini %1.prg
:EOF

View File

@ -12,11 +12,11 @@ char key; //Key value
main:
while() {
key = getkey();
key = getchr();
select (key) {
case #DELKEY: delchr();
case #RTNKEY: newlin();
case #ESCKEY: goto exit;
default: prchr(key);
default: putchr(key);
}
}

View File

@ -10,8 +10,8 @@ char key; //Key value
main:
while() {
key = rdkey();
key = getchr();
prbyte(key);
prchr(' ');
putchr(' ');
if (key==#ESCKEY) goto exit;
}

View File

@ -3,6 +3,7 @@
*************************************/
//use -h option on command line
#include <screen.h02>
#include <joystk.h02>
char i,j,r;

View File

@ -3,6 +3,7 @@
************************************/
//use -h option on command line
#include <screen.h02>
#include <lgtpen.h02>
char aa,xx,yy;
@ -18,6 +19,7 @@ void prtbyt(aa,yy,xx) {
}
char px,py,pt;
char lx,ly,lt;
main:
clrscr();
@ -27,11 +29,11 @@ main:
prtlbl(1,1,'X');
prtlbl(1,2,'Y');
prtlbl(1,3,'T');
loop:
if (getkey() == #ESCKEY) goto exit;
px,py,pt = lgtpen();
prtbyt(4,1,px);
prtbyt(4,2,py);
prtbyt(4,3,pt);
if (px<>lx) {prtbyt(4,1,px); lx=px;}
if (py<>ly) {prtbyt(4,2,py); ly=py;}
if (pt<>lt) {prtbyt(4,3,pt); lt=pt;}
goto loop;

View File

@ -6,7 +6,7 @@ IF EXIST %1.c02 GOTO COMPILE
:COMPILE
ECHO Compiling File %1.c02
..\c02.exe -h oric %1 >%1.dbg
..\c02.exe -h oric -s oric %1 >%1.dbg
IF ERRORLEVEL 1 EXIT /B
ECHO Assembling File %1.asm
@ -15,8 +15,9 @@ IF ERRORLEVEL 1 EXIT /B
ECHO Building Tape Image
python ..\util\orictap.py %1
COPY %1.tap C:\Programs\Oricutron\tapes
IF ERRORLEVEL 1 EXIT /B
DEL %1.obj
DEL %1.obj %1.tap
REM ECHO Starting Emulator
REM START C:\Programs\Oricutron\oricutron.exe -m1 -t%1.tap

View File

@ -3,6 +3,7 @@
************************************/
//use -h option on command line
#include <screen.h02>
#include <paddle.h02>
char i,b,p;

View File

@ -1,21 +1,53 @@
/**************************************************
* TESTHDR - Test C02 system specific Header file *
**************************************************/
/************************************
* TESTHDR - Test C02 screen module *
************************************/
//use -h amd -s options on command line
#include <screen.h02>
//use -h option on command line
char col, row, wdth, hght;
char c, f, i, aa, yy;
void prtaxy(aa,yy) {
if (aa & $F0) prbyte(aa); else prhex(aa);
putchr('X');
if (yy & $F0) prbyte(yy); else prhex(yy);
}
main:
prchr('P');
prchr('R');
prchr('C');
prchr('H');
prchr('R');
newlin();
wdth, hght = getsiz(); //Get Screen Width & Height
prtaxy(wdth,hght); newlin();
for (i=1; i<6; i++) putchr('.');
col, row = getpos(); //Get Cursor Position
prtaxy(col,row);
crsrhm(); prtaxy(getpos());
getchr(); newlin(); //Wait For keypress
clrscr(); //Clear Screen
col, row = getpos(); //Get Cursor Position
prtaxy(col, row);
f = (col == 255) ? 0 : $FF;
getchr();
if (f) clrscr(); else newlin();
getkey();
if (wdth:- or hght:-) goto exit;
for (c='@'; c<'`'; c++) {
if (!f) newlin();
for (row=hght-2; row; row--) {
if (!f) putchr(' ');
for (col=wdth-2; col; col--) {
if (f) setpos(col,row);
putchr(c);
}
if (!f) newlin();
if (getkey() == #ESCKEY) goto exit;
}
if (!f) getchr();
}
if (f) getchr(); //Wait For keypress
newlin();
goto exit;

23
test/x64.ini Normal file
View File

@ -0,0 +1,23 @@
[C64]
Window0Xpos=572
Window0Ypos=19
FullscreenWidth=640
FullscreenHeight=480
SaveResourcesOnExit=1
ConfirmOnExit=0
SoundDeviceName="dx"
SoundBufferSize=100
VICIIVideoCache=1
VICIIPaletteFile="frodo"
VICIIExternalPalette=1
VICIIFilter=0
SidEngine=1
SidModel=1
IECDevice8=1
AutostartBasicLoad=1
AutostartRunWithColon=1
AutostartWarp=0
DriveTrueEmulation=0
ETHERNETCARTBase=56832
Acia1Base=56832