Jump to content
  • entries
    46
  • comments
    9
  • views
    48,144

dCalc - On Your Mark


k-Pack

1,431 views

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 LINK20 REM 50 REM 100 REM INIT DIAMOND GOS CART120 REM GOSUB 30000 INIT VARIBLES AND SCREEN140 REM DETECT EVENT200 REM ON EVENT GOSUB - LIST1000 REM DATA ENTRY 0-9,.2000 REM ENTER KEY - MOVE X TO A3000 REM A+X4000 REM A-X5000 REM A*X6000 REM A/X7000 REM SWAP A AND X8000 REM BACK SPACE9000 REM -/+10000 REM CLEAR A AND X11000 REM EXIT DIAMOND PROGRAM28000 REM PRINT X29000 REM PRINT A30000 REM SETUP SCREEN AND VARIABLES30100 REM *** DRAW LINES30200 REM *** INSTALL ICONS30300 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 Basic11 REM Programming Link12 REM 13 REM Please note that this program14 REM REQUIRES the file DIABASIC.OBJ15 REM to be loaded in in order to16 REM function as it contains the17 REM routines used to call Diamond.18 REM 20 CLOSE #1:OPEN #1,4,0,"D:DIABASIC.OBJ":TRAP 3021 GET #1,A:GET #1,B:GET #1,C:GET #1,D22 IF A<>255 OR B<>255 THEN 2423 A=C:B=D:GET #1,C:GET #1,D24 FOR X=A+B*256 TO C+D*256:GET #1,Y:POKE X,Y:NEXT X25 GOTO 2130 W0=1539:W1=1541:W2=1543:W3=154531 W4=1547:W5=1549:W6=1551:W7=155332 B0=1555:B1=1556:B2=1557:B3=155833 B4=1559:B5=1560:B6=1561:B7=156234 INIT=0:EXIT=1:PARAPRNT=2:TOGGLEZERO=3:INSTALLICON=4:MOVEICON=5:LET REMOVEICON=6:SHAPEICON=7:SETMENU=835 MENUCHECK=9:MENUENABLE=10:MOUSEON=11:MOUSEOFF=12:DEFMOUSE=13:DODIALOG=14:UPDATEDIALOG=15:EVENTDIALOG=1636 RELEASEDIALOG=17:TEXTDIALOG=18:WINDOPEN=19:WINDCLOSE=20:WINDMOVE=21:WINDDRAW=22:EVENT=23:LET PLOTPOINT=2437 LET PLOTLINE=25:LET PLOTBOX=26:MOVETOSCREEN=27:MOVEFROMSCREEN=28:CLEARSCREEN=29:INVERTSCREEN=30:MOVE=3138 ZERO=32:SWAP=33:CURSORON=34:CURSOROFF=35:DEFCURSOR=36:MOVECURSOR=37:ADDQUE=38:MULTIPLY=39:DIVIDE=4039 SWAPSCREEN=41:WINDCLEAR=42:WINDGET=43:SYSDRAW=44:DRAGBOX=45:OVERLAPICON=46:OVERLAPWINDOW=4740 EXECDESKTOP=48:INVERTTOUCH=49:WINDSET=50:WINDTITLE=51:WINDACTIVATE=52:BINLOAD=53:MUL40=54:FILLSCREEN=5545 EVENTTYPE=3957150 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.OBJ20 CLOSE #1:OPEN #1,8,0,"D:DIABASIC.OBJ":TRAP 10030 RESTORE 15040 FOR X=150 TO 500 STEP 150 READ A60 PUT #1,A70 NEXT X100 CLOSE #1:STOP 150 DATA 255,255,0,6,2,6,76,51,6,51,6,107,6,104,162160 DATA 0,181,128,157,27,6,189,3,6,149,128,232,224,24,208170 DATA 241,173,1,211,9,2,141,1,211,104,104,32,0,142,173180 DATA 1,211,41,253,141,1,211,162,0,181,128,157,3,6,189190 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 desktop110 POKE B0,0:D=USR(DIAMOND,INIT)130 REM LOOP UNTIL EVENT DETECTED140 D=USR(DIAMOND,EVENT)150 IF PEEK(EVENTTYPE)=0 THEN 140160 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?

 

 

 

 

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...