diff --git a/include/oric/joystk.a02 b/include/oric/joystk.a02 new file mode 100644 index 0000000..3fda08e --- /dev/null +++ b/include/oric/joystk.a02 @@ -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 + diff --git a/include/oric/joystk.h02 b/include/oric/joystk.h02 new file mode 100644 index 0000000..936c374 --- /dev/null +++ b/include/oric/joystk.h02 @@ -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(); diff --git a/include/oric/lgtpen.a02 b/include/oric/lgtpen.a02 new file mode 100644 index 0000000..635d374 --- /dev/null +++ b/include/oric/lgtpen.a02 @@ -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 diff --git a/include/oric/lgtpen.h02 b/include/oric/lgtpen.h02 new file mode 100644 index 0000000..593c01f --- /dev/null +++ b/include/oric/lgtpen.h02 @@ -0,0 +1,5 @@ +/* Lightpen Module Header File for Oric-1 */ + +#define LGTPNS $FF //Light Pen Status (Supported) + +char lgtpen(); //Read Light Pen diff --git a/test/a1.bat b/test/a1.bat index 1bcfbe9..aff950d 100644 --- a/test/a1.bat +++ b/test/a1.bat @@ -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 diff --git a/test/c64.bat b/test/c64.bat new file mode 100644 index 0000000..5c620fe --- /dev/null +++ b/test/c64.bat @@ -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 diff --git a/test/echo.c02 b/test/echo.c02 index b6ead48..f38e4c9 100644 --- a/test/echo.c02 +++ b/test/echo.c02 @@ -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); } } diff --git a/test/echohex.c02 b/test/echohex.c02 index c9438e4..8a7b8f5 100644 --- a/test/echohex.c02 +++ b/test/echohex.c02 @@ -10,8 +10,8 @@ char key; //Key value main: while() { - key = rdkey(); + key = getchr(); prbyte(key); - prchr(' '); + putchr(' '); if (key==#ESCKEY) goto exit; } diff --git a/test/joystick.c02 b/test/joystick.c02 index dd5485e..16c254f 100644 --- a/test/joystick.c02 +++ b/test/joystick.c02 @@ -3,6 +3,7 @@ *************************************/ //use -h option on command line +#include #include char i,j,r; diff --git a/test/lightpen.c02 b/test/lightpen.c02 index c57fa05..439bd03 100644 --- a/test/lightpen.c02 +++ b/test/lightpen.c02 @@ -3,6 +3,7 @@ ************************************/ //use -h option on command line +#include #include 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; diff --git a/test/o1.bat b/test/o1.bat index 0fb5832..96afa36 100644 --- a/test/o1.bat +++ b/test/o1.bat @@ -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 diff --git a/test/paddles.c02 b/test/paddles.c02 index 518b4dc..9fe7592 100644 --- a/test/paddles.c02 +++ b/test/paddles.c02 @@ -3,6 +3,7 @@ ************************************/ //use -h option on command line +#include #include char i,b,p; diff --git a/test/testscrn.c02 b/test/testscrn.c02 index ca6cc38..5820dd2 100644 --- a/test/testscrn.c02 +++ b/test/testscrn.c02 @@ -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 -//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; - diff --git a/test/x64.ini b/test/x64.ini new file mode 100644 index 0000000..1f93db2 --- /dev/null +++ b/test/x64.ini @@ -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 +