Jump to content
IGNORED

basm?


Recommended Posts

I found this from Analogue Magazine, starts at page 60:-

https://archive.org/details/analog-computing-magazine-11/page/n77/mode/2up

 

You may be wondering why I haven't yet men- 
tioned BASM, the third "BASIC compiler" listed at 
the beginning of this article. The reason is simple: 
BASM isn't really a BASIC compiler at all. It's a 
BASIC assembler — an entirely new programming 
environment for the ATARI that looks like BASIC 
but acts like assembly language. 

Take a look at Listing 5. This is the BASM equi- 
valent of the speed benchmark used to test the ABC 
and Datasoft compilers. Notice that some of the 
lines look like ordinary BASIC, while others look 
like 6502 mnemonics. REM statements are included 
in those places where the BASM code differs sig- 
nificantly from the original BASIC. 

BASM programs are composed using a text editor 
supplied with the software. Then the source file is 
saved onto a disk and assembled into machine lan- 
guage. A very small run-time library is linked to the 
code, and your application is ready to run. 

The BASM system understands a very usable sub- 
set of ATARI BASIC, along with a number of state- 
ments and conditionals not found in the cartridge 
(see Listing 6). "Primitive" commands like PEEK 
and POKE must be replaced with their assembly- 
language equivalents, LDA (Load Accumulator) and 
STA (Store Accumulator). READ/DATA 
structures are implemented by using the 6502 X - 
and Y-registers as indexes. 

BASM allows you to mix BASIC and assembly 
statements freely, even on the same logical line. This 
arrangement combines the simplicity of BASIC with 
the power of machine language in a most ingenious 
manner. 

Because BASM programs have an assembly-like 
syntax, the efficiency of compilation is much greater 
than either ABC or Datasoft. Only the pure BASIC 
statements are actually "compiled" — the assembly- 
language sections are incorporated into the program 
as in-line machine code. This means that the speed of 
a BASM program can approach the limits of the 
hardware. I compiled and executed the BASM 
program in Listing 5 and obtained an execution time 
of 18 jiffies or less than 1/3 of a second. This is 231 
times faster than the ATARI BASIC equivalent! 
Computer Alliance claims a more conservative 
speed improvement of up to 130 times. 

Not For Beginners 

BASM is not as straightforward to use as the ABC 
or the Datasoft compilers. You'll have a hard time 
following the 72-page reference manual unless you 
know something about 6502 architecture and 
assembly-language programming. It took me a while 
to grasp the syntax required for certain types of 
BASIC variables and addressing modes. More com- 
plete documentation is definitely called for — even if 
it means raising the price a bit. 

I also ran across a bug in the disk interface. My 



PAGE 64 



A.N.A.L.O.G. COMPUTING 
Listing 5 



8188 REM * PROGRAM EQUATES 

811BSCREEf4=88 

8!2eTIHER-28 

0138T]HER256=1? 

3148 REM * POKE 19,8:P0KE 28.8 

8158 LET TIMER256 = 8 ; LET TIMER = 8 

81i8 GRAPHICS 2A 

8178 SETCOLOR 5 , 8 , 14 : SETCOLOR 6.8,8 

8188 FOR I = 8 TO 191 : FOR J = 8 TO 3^ 

8198 REM ♦ POKE SCREEN+J.255 

8288 LI» «255 : LDY J : STA (SCREEN) ,Y : f-CxT J 

8218 REN « SCREEN=SCREEN+48 

8228 REM * THIS IS A 16-BIT BUtftRY ADDITION 

8238 CLC : LDA SCREEN : ADC tt48 ; STA SCREEN 

8248 LDA SCREEN+1 : ADC «8 : STA SCREEN+I 

8258 NEXT 1 

3388 REM « GRAPHICS 8 

0318 FILE 8 

8328 BPRINT TIMER ! PRINT " Ji{+ies" 

8338 BPRINT T1MER256 : PRINT ■ jiffies x 256" 

3348 RETURN : REM * BACK TO BASH 

8358 REM » LINE 368 INITIALIZES THE VARIABLES I & J 

3368 DIM I , J 



ISSUE 11 



A.N.A.L.O.G. COMPUTING 



PAGE 65 



Listing 6. BASM keywords. 



BINI'UT 


BPRINT 


CLOSE 


COLOR 


DATA 


DEF/ENDDEF 


DIM 


DRAWTO 


FILE 


FILL 


FOR/NEXT 


GET 


GOSUB 


GOTO 


GRAPHICS 


IF 


INPUT 


LET 


LOCATE 


OPEN 


PLOT 


POSITION 


PRINT 


PUT 


REM 


RETURN 


SETCOLOR 


SOUND 


STOP 


TR 


TRAP 


WHILE 

  • Thanks 2
Link to comment
Share on other sites

  • 10 months later...

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