Jump to content

Recommended Posts

I have been trying to do some of the chapter exercises in the Molesworth book, and have run into trouble on the BARGRAPH program that mixes Assembly with XB. The program wants you to load a file from an Editor/Assembler disk DSK1.BSCSUP and an object file DSK1.BGRAPH/O "from your "practice disk" that has the typed-in BARCODE basic program on it. I copied the E/A file over to the practice disk to avoid disk-swapping. I got an error in line 320. It was the same error when I actually did swap out the disks when prompted, so that should not be an issue. Other particulars are the BARGRAPH program was in TI BASIC and I tried to convert it to XB, the object file DSK1.BGRAPH has something to do with drawing the bar graph on screen, I assembled DSK1.BGRAPH/S in the E/A and got zero errors. Here is the current listing at the bottom. Any suggestions appreciated.

 

10 !BARGRAPH

100 REM BAR GRAPH DEMONSTRATION

110 REM TI BASIC W/MINI-MEMORY OR

120 REM EDITOR/ASSEMBLER MODULE

130 REM BY PHIL WEST AND BERNIE ELSNER

140 CALL CLEAR

150 RANDOMIZE

160 PRINT "PLACE FILE BGRAPH/O IN"

170 PRINT "DISK DRIVE ONE THEN PRESS ENTER"

180 INPUT E$

190 PRINT "LOADING MACHINE LANGUAGE PLEASE WAIT"

200 CALL INIT

210 CALL LOAD(28706,0,0,0,0,0,0,0,0)

220 CALL LOAD("DSK1.BGRAPH/O")

230 PRINT "WHICH MODULE ARE YOU USING? ENTER"

240 PRINT " E - FOR EDITOR/ASSEMBLER M - FOR MINI-MEMORY"

250 INPUT E$

260 IF E$="M" THEN 350

270 IF E$<>"E" THEN 250

280 PRINT "PLACE EDITOR/ASSEMBLER"

290 PRINT "DISK A IN DRIVE ONE THEN PRESS ENTER"

300 INPUT E$

310 CALL CLEAR

320 CALL LOAD("DSK1.BSCSUP")

330 REM RESERVE SPACE FOR CHARACTER DEFINITION

340 REM IN MACHINE LANGUAGE ROUTINE

350 FOR I=104 TO 159

360 CALL CHAR(I,"")

370 NEXT I

380 CALL CLEAR

390 CALL SCREEN(15)

400 PRINT "MICRO RETAIL PROFITS 1982-84"

410 PRINT " (Q)UIT OR ®EPEAT"

420 F=L

430 FOR 1=1 TO 28

440 F=F*1.195

450 CALL LINK("BGRAPH",I,1,F)

460 NEXT I

470 FOR D=L TO 800

480 NEXT D

490 FOR 1=1 TO 28

500 CALL VCHAR(1,1+2,32,20)

510 CALL LINK("BGRAPH",I,6,F)

520 F=F/1.195

530 NEXT I

540 FOR D=L TO 800

550 NEXT D

560 CALL HCHAR(1,1,32,640)

570 REM GENERATE RANDOM PARAMETERS

580 FOR 1=1 TO 28

590 B=INT(RND*7+1)

600 C=INT(RND*160+1)

610 REM DRAW BAR WITH M/L ROUTINE

620 CALL LINK("BGRAPH",I,B,C)

630 NEXT I

640 CALL KEY(0,K,S)

650 IF K=82 THEN 380

660 IF K<>81 THEN 640

670 END

post-19460-0-23569900-1374709124_thumb.jpg

post-19460-0-59683000-1374709132_thumb.jpg

Link to comment
https://forums.atariage.com/topic/214815-ralph-molesworth-assembly-book-question/
Share on other sites

XB and TI Basic do not use the same INIT routines.

 

TI BASIC uses EA INIT version

 

XB uses the XB version

 

So you need to look at the back of the EA manual to convert the values in Assembly to the right address for it to work.

  • Like 1

The XB loader also can't handle compressed object files, IIRC the Editor/Assembler one can. But all the linked subroutines (if it uses any) will be wrong. Porting a mixed application from BASIC to XB will require modifying the assembly in most cases, too.

The XB loader also can't handle compressed object files, IIRC the Editor/Assembler one can. But all the linked subroutines (if it uses any) will be wrong. Porting a mixed application from BASIC to XB will require modifying the assembly in most cases, too.

That's interesting to know - so no 'C' option for assembling something you want to run from XB?

Not that I know of.

When C99 was being distributed I talked to the Author of C99 and asked about XB vs EA and his reply was "Only EA".

 

He's talking about the C=Compressed Object File option of Editor/Assembler. :)

 

Although, that statement was true. The original C99 startup code explicitly required the Editor/Assembler cartridge as it manually loaded the E/A subroutines. You could use your own startup code to get around that. :)

I used the RL options. Here is the source, Any specific thoughts on what to change? Where are the INIT routines i need to change the addresses of? The right ones are on the last page or back cover of the e/a?

 

 

* BAR-GRAPH ROUTINE

* FOR USE WITH MINI-MEMORY FROM TI BASIC

* BY PHIL WEST AND BERNIE ELSNER

*

DEF BGRAPH

VSBW EQU >2020

VMBW EQU >2024

NUMREF EQU >200C

XMLLNK EQU >2018

ERR EQU >2034

 

*

D1 DATA >0000

DATA >0000

DATA >0000

DATA >003C

DATA >3C3C

DATA >3C3C

DATA >3C3C

DATA >3C3C

D2 DATA >1040

DATA >60A0

DATA >C0D0

DATA >F000

BGRAPH CLR R0

LI R1,>0001

BLWP @NUMREF

BLWP @XMLLNK

DATA >1200

MOV @>834A,R3

CI R3,>0000

JGT C

B @E

C CI R3,>001D

JLT F

B @E

F INC R1

BLWP @NUMREF

BLWP @XMLLNK

DATA >1200

MOV @>834A,R4

CI R4,>0000

JGT G

B @E

G CI R4,>0008

JLT H

B @E

H INC R1

BLWP @NUMREF

BLWP @XMLLNK

DATA >1200

MOV @>834A,R5

CI R5,>0000

JGT J

B *R11

J CI R5,>00A1

JLT K

B @E

K LI R2,>0008

LI R0,>0640

B LI R1,D1

A BLWP @VMBW

A R2,R0

INC R1

CI R1,D1+8

JLT A

CI R0,>0800

JLT B

LI R0,>0319

LI R1,D2

LI R2,>0007

BLWP @VMBW

SLA R4,3

AI R4,>00C0

SWPB R4

LI R6,>0020

LI R0,>0261

A R3,R0

N CLR R7

MOV R4,R1

M BLWP @VSBW

DEC R5

P CI R5,>0000

JGT L

B *R11

L AI R1,>0100

INC R7

CI R7,>0008

JLT M

S R6,R0

JMP N

E LI R0,>1300

BLWP @ERR

END

 

."!. ....

.

99/4 ASSEMBLER

VERSION 1.2 PAGE 0001

0001 * BAR-GRAPH ROUTINE

0002 * FOR USE WITH MINI-MEMORY FROM TI BASIC

0003 * BY PHIL WEST AND BERNIE ELSNER

0004 *

0005 DEF BGRAPH

0006 2020 VSBW EQU >2020

0007 2024 VMBW EQU >2024

0008 200C NUMREF EQU >200C

0009 2018 XMLLNK EQU >2018

0010 2034 ERR EQU >2034

0011

0012 *

0013 0000 0000 D1 DATA >0000

0014 0002 0000 DATA >0000

0015 0004 0000 DATA >0000

0016 0006 003C DATA >003C

0017 0008 3C3C DATA >3C3C

0018 000A 3C3C DATA >3C3C

0019 000C 3C3C DATA >3C3C

0020 000E 3C3C DATA >3C3C

0021 0010 1040 D2 DATA >1040

0022 0012 60A0 DATA >60A0

0023 0014 C0D0 DATA >C0D0

0024 0016 F000 DATA >F000

0025 0018 04C0 BGRAPH CLR R0

0026 001A 0201 LI R1,>0001

001C 0001

0027 001E 0420 BLWP @NUMREF

0020 200C

0028 0022 0420 BLWP @XMLLNK

0024 2018

0029 0026 1200 DATA >1200

0030 0028 C0E0 MOV @>834A,R3

002A 834A

0031 002C 0283 CI R3,>0000

002E 0000

0032 0030 1502 JGT C

0033 0032 0460 B @E

0034 00EA'

0034 0036 0283 C CI R3,>001D

0038 001D

0035 003A 1102 JLT F

0036 003C 0460 B @E

003E 00EA'

0037 0040 0581 F INC R1

0038 0042 0420 BLWP @NUMREF

0044 200C

0039 0046 0420 BLWP @XMLLNK

0048 2018

0040 004A 1200 DATA >1200

0041 004C C120 MOV @>834A,R4

004E 834A

0042 0050 0284 CI R4,>0000

0052 0000

0043 0054 1502 JGT G

0044 0056 0460 B @E

0058 00EA'

0045 005A 0284 G CI R4,>0008

005C 0008

.

99/4 ASSEMBLER

VERSION 1.2 PAGE 0002

0046 005E 1102 JLT H

0047 0060 0460 B @E

0062 00EA'

0048 0064 0581 H INC R1

0049 0066 0420 BLWP @NUMREF

0068 200C

0050 006A 0420 BLWP @XMLLNK

006C 2018

0051 006E 1200 DATA >1200

0052 0070 C160 MOV @>834A,R5

0072 834A

0053 0074 0285 CI R5,>0000

0076 0000

0054 0078 1501 JGT J

0055 007A 045B B *R11

0056 007C 0285 J CI R5,>00A1

007E 00A1

0057 0080 1102 JLT K

0058 0082 0460 B @E

0084 00EA'

0059 0086 0202 K LI R2,>0008

0088 0008

0060 008A 0200 LI R0,>0640

008C 0640

0061 008E 0201 B LI R1,D1

0090 0000'

0062 0092 0420 A BLWP @VMBW

0094 2024

0063 0096 A002 A R2,R0

0064 0098 0581 INC R1

0065 009A 0281 CI R1,D1+8

009C 0008'

0066 009E 11F9 JLT A

0067 00A0 0280 CI R0,>0800

00A2 0800

0068 00A4 11F4 JLT B

0069 00A6 0200 LI R0,>0319

00A8 0319

0070 00AA 0201 LI R1,D2

00AC 0010'

0071 00AE 0202 LI R2,>0007

00B0 0007

0072 00B2 0420 BLWP @VMBW

00B4 2024

0073 00B6 0A34 SLA R4,3

0074 00B8 0224 AI R4,>00C0

00BA 00C0

0075 00BC 06C4 SWPB R4

0076 00BE 0206 LI R6,>0020

00C0 0020

0077 00C2 0200 LI R0,>0261

00C4 0261

0078 00C6 A003 A R3,R0

0079 00C8 04C7 N CLR R7

0080 00CA C044 MOV R4,R1

0081 00CC 0420 M BLWP @VSBW

00CE 2020

0082 00D0 0605 DEC R5

0083 00D2 0285 P CI R5,>0000

.

99/4 ASSEMBLER

VERSION 1.2 PAGE 0003

00D4 0000

0084 00D6 1501 JGT L

0085 00D8 045B B *R11

0086 00DA 0221 L AI R1,>0100

00DC 0100

0087 00DE 0587 INC R7

0088 00E0 0287 CI R7,>0008

00E2 0008

0089 00E4 11F3 JLT M

0090 00E6 6006 S R6,R0

0091 00E8 10EF JMP N

0092 00EA 0200 E LI R0,>1300

00EC 1300

0093 00EE 0420 BLWP @ERR

00F0 2034

0094 END

0000 ERRORS

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

."!. .. 0091 00E8 10EF JMP N

0092 00EA 0200 E LI R0,>1300

00EC 1300

0093 00EE 0420 BLWP @ERR

00F0 2034

0094 END

0003 ERRORS

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

."!. .

Rich, what page in the E/A were you referring to? I'm just a novice less than a beginner in Assembly. What is a simplified explanation of what I must do to make the program work? Do I just need to change the CALL INIT statement? Where are the values in the program that should be changed to make it an XB INIT instead of a TI BASIC E/A INIT?

Rich, what page in the E/A were you referring to? I'm just a novice less than a beginner in Assembly. What is a simplified explanation of what I must do to make the program work? Do I just need to change the CALL INIT statement? Where are the values in the program that should be changed to make it an XB INIT instead of a TI BASIC E/A INIT?

 

As Rich said, CALL INIT loads different utility routines in TI Basic than what it does in XB. The chapter you want in the E/A manual is §24.4, p. 410. Among other things, it gives you the EQUates you need for any ALC you want to write. Your EQUates at the beginning of BGRAPH are correct for XB referencing.

 

Also, there is no difference between TIB and XB regarding the actual call to INIT—it takes no parameters. It is the same statement in your program in both languages. It happens to load different utilities in TIB than it does in XB and those utilities that perform the same functions, such as VMBW, are loaded at different addresses—hence, the need to consult §24.4.

 

In an earlier post, you got an error in line 320 of your XB program. I'm not really sure what's going on, but my guess is that the error is during the loading of BSCSUP—that there may be an error in the file you're attempting to load. If it's trying to load in high memory, it may be stepping on your XB program and causing the error. I think that ALC for XB is limited to the lower 8KB of the memory expansion unit unless it's AORGed to high memory, in which case you need to exercise extreme care that you don't step on the XB program.

 

...lee

@orion1052003...

 

I know what the problem is with line 320—BSCSUP contains the TI Basic support utilities and they probably are stepping all over your XB program. You should remove that statement because those utilities are useless to XB and XB versions are already loaded by XB's "CALL INIT".

 

...lee

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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...