Jump to content





dCalc - On Your Mark

Posted by k-Pack, 06 April 2014 · 1,113 views

dCalc diamond
I have at least 75% of the code for dCalc (the Diamond GOS calculator .APP) written but it's all in my head.  As I run the code in my memory I am not finding any routines that would cause me to scrape it and start over.  I just have to fill in the rest.  I'm going to write a series of subroutine that can be tested as the program progresses. This is what I have so far,
10 REM dGOS - ATARI BASIC PROGRAM LINK
20 REM 
50 REM 
100 REM INIT DIAMOND GOS CART
120 REM GOSUB 30000 INIT VARIBLES AND SCREEN
140 REM DETECT EVENT
200 REM ON EVENT GOSUB - LIST
1000 REM DATA ENTRY 0-9,.
2000 REM ENTER KEY - MOVE X TO A
3000 REM A+X
4000 REM A-X
5000 REM A*X
6000 REM A/X
7000 REM SWAP A AND X
8000 REM BACK SPACE
9000 REM -/+
10000 REM CLEAR A AND X
11000 REM EXIT DIAMOND PROGRAM
28000 REM PRINT X
29000 REM PRINT A
30000 REM SETUP SCREEN AND VARIABLES
30100 REM *** DRAW LINES
30200 REM *** INSTALL ICONS
30300 REM RETURN FROM SETUP
DIABASIC.BAS is being used to supply the link between the Diamond Cartridge and BASIC.  This program is much larger then it need be.  Variables have been  defined for every Diamond function (0 – 55)  as well as data addresses and location pointers needed by the functions.  Using the Variable names will make the program a lot easier to read and follow.
10 REM Diamond GOS Atari Basic
11 REM Programming Link
12 REM 
13 REM Please note that this program
14 REM REQUIRES the file DIABASIC.OBJ
15 REM to be loaded in in order to
16 REM function as it contains the
17 REM routines used to call Diamond.
18 REM 
20 CLOSE #1:OPEN #1,4,0,"D:DIABASIC.OBJ":TRAP 30
21 GET #1,A:GET #1,B:GET #1,C:GET #1,D
22 IF A<>255 OR B<>255 THEN 24
23 A=C:B=D:GET #1,C:GET #1,D
24 FOR X=A+B*256 TO C+D*256:GET #1,Y:POKE X,Y:NEXT X
25 GOTO 21
30 W0=1539:W1=1541:W2=1543:W3=1545
31 W4=1547:W5=1549:W6=1551:W7=1553
32 B0=1555:B1=1556:B2=1557:B3=1558
33 B4=1559:B5=1560:B6=1561:B7=1562
34 INIT=0:EXIT=1:PARAPRNT=2:TOGGLEZERO=3:INSTALLICON=4:MOVEICON=5:LET REMOVEICON=6:SHAPEICON=7:SETMENU=8
35 MENUCHECK=9:MENUENABLE=10:MOUSEON=11:MOUSEOFF=12:DEFMOUSE=13:DODIALOG=14:UPDATEDIALOG=15:EVENTDIALOG=16
36 RELEASEDIALOG=17:TEXTDIALOG=18:WINDOPEN=19:WINDCLOSE=20:WINDMOVE=21:WINDDRAW=22:EVENT=23:LET PLOTPOINT=24
37 LET PLOTLINE=25:LET PLOTBOX=26:MOVETOSCREEN=27:MOVEFROMSCREEN=28:CLEARSCREEN=29:INVERTSCREEN=30:MOVE=31
38 ZERO=32:SWAP=33:CURSORON=34:CURSOROFF=35:DEFCURSOR=36:MOVECURSOR=37:ADDQUE=38:MULTIPLY=39:DIVIDE=40
39 SWAPSCREEN=41:WINDCLEAR=42:WINDGET=43:SYSDRAW=44:DRAGBOX=45:OVERLAPICON=46:OVERLAPWINDOW=47
40 EXECDESKTOP=48:INVERTTOUCH=49:WINDSET=50:WINDTITLE=51:WINDACTIVATE=52:BINLOAD=53:MUL40=54:FILLSCREEN=55
45 EVENTTYPE=39571
50 DIAMOND=1536
This BASIC program requires that an object file containing the PAGE 6 machine language routine be loaded each time it is run.  The ml routine passes the information to the Diamond functions.  The file needs to be located in the drive specified in the program. (The ml routine was de-compiled for a previous blog).
 
 A short BASIC program has been included that will create the  DIABASIC.OBJ file.
10 REM Program to write DIABASIC.OBJ
20 CLOSE #1:OPEN #1,8,0,"D:DIABASIC.OBJ":TRAP 100
30 RESTORE 150
40 FOR X=150 TO 500 STEP 1
50 READ A
60 PUT #1,A
70 NEXT X
100 CLOSE #1:STOP 
150 DATA 255,255,0,6,2,6,76,51,6,51,6,107,6,104,162
160 DATA 0,181,128,157,27,6,189,3,6,149,128,232,224,24,208
170 DATA 241,173,1,211,9,2,141,1,211,104,104,32,0,142,173
180 DATA 1,211,41,253,141,1,211,162,0,181,128,157,3,6,189
190 DATA 27,6,149,128,232,224,24,208,241,96
  
Once you have the link program and object file on the computer, the following program segment can be added for testing.  The program will put a blank desktop on the screen and allow the mouse to be moved around.  Press the keyboard or click the mouse to exit the Diamond environment. Add these lines after line 50.
100 REM INIT diamond desktop
110 POKE B0,0:D=USR(DIAMOND,INIT)
130 REM LOOP UNTIL EVENT DETECTED
140 D=USR(DIAMOND,EVENT)
150 IF PEEK(EVENTTYPE)=0 THEN 140
160 D=USR(DIAMOND,EXIT)
170 END
Now there are two more tasks for the to-do list.  One is to design and program the screen display for the calculator.  The second is to figure out why my null modem setup isn't working and fix it.
 
Or is that four tasks? 
 
 
 
 




November 2018

S M T W T F S
    123
45678910
111213141516 17
18192021222324
252627282930 

My Picture

Latest Visitors