6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Apr 27, 2024 7:42 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: MSBASIC on a 6502 SBC
PostPosted: Fri Feb 23, 2024 10:20 pm 
Offline

Joined: Tue Jan 23, 2024 6:06 pm
Posts: 2
I've fabricated a 6502 SBC based on the Ben Eater videos. My board integrates four LED's on PIA PORTA bits 0-3. I've got MSBasic running as Ben demonstrated in his last video. I've added some assembly routines to the Wozmon monitor to control the 2x16 LCD and the LED's.

I ran into an unexpected hitch when when writing a BASIC program to control the LED's. Here's the output from the serial interface:

Code:
OK
1 DDRB = 32770
2 DDRA = 32771
3 PORTB = 32768
4 PORTA = 32771
5 LCDTRIGGER = 47
RUN

?SYNTAX ERROR IN  3
OK
POR = 4

?SYNTAX ERROR
OK
PO = 4

OK
POB=4

OK


The SYNTAX ERROR occurs both in the program and when entered directly anytime I try to assign "POR" or "PORxxxx" to a number. It seems that "POR" and derivatives starting with "POR" are reserved for some reason in MSBasic.

Has anyone seen this that can explain what's going on.


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 23, 2024 10:39 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1398
Location: Scotland
mikewm wrote:
The SYNTAX ERROR occurs both in the program and when entered directly anytime I try to assign "POR" or "PORxxxx" to a number. It seems that "POR" and derivatives starting with "POR" are reserved for some reason in MSBasic.

Has anyone seen this that can explain what's going on.


One thing to note is that MS basic only uses the FIRST 2 letters of a variable name, so PORTA is the same as PORTB.

The reason you're getting an error is due to PORTB having the OR keyword inside it. It's interpreted as P OR TB which is a syntax error on the left side of the = sign...


Try just DA, DB, PA, PB and so on.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 24, 2024 3:08 am 
Offline

Joined: Tue Jan 23, 2024 6:06 pm
Posts: 2
Thanks Gordon!
Code:
OK
1 PDDRB = 32770
2 PDDRA = 32771
3 PRTB = 32768
4 PRTA = 32769
5 LCDTRIGGER = 47
6 REM
10 PRINT PDDRB, PDDRA
20 PRINT PRTB, PRTA
30 END
RUN
 32771          32771
 32769          32769

OK


Interestingly, the code above worked without generating the SYNTAX ERROR. However, the variables sharing the common first two letters took on the latter of the assignments.

It's been a long time since I've programmed in Basic, as in early '80s on an Apple II. I wonder if Applesoft Basic had the same restriction and I just forgot. Will need to check on that.


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 24, 2024 4:16 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1926
Location: Sacramento, CA, USA
Attachment:
a2p.PNG
a2p.PNG [ 5.95 KiB | Viewed 2490 times ]

Attachment:
a2i.PNG
a2i.PNG [ 6.1 KiB | Viewed 2490 times ]

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 24, 2024 6:18 am 
Offline

Joined: Mon Jan 19, 2004 12:49 pm
Posts: 660
Location: Potsdam, DE
The classic BASIC confusion I was taught many many years ago was 'FORD=STOP' which does _not_ copy from one variable to another :mrgreen:

Neil


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 24, 2024 7:11 am 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 133
Location: Texas
Goes to show how very loose the BASIC parser was compared to more modern languages.


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 24, 2024 8:16 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1398
Location: Scotland
mikewm wrote:
It's been a long time since I've programmed in Basic, as in early '80s on an Apple II. I wonder if Applesoft Basic had the same restriction and I just forgot. Will need to check on that.


All 8-bit MS Basics are like that. Just use 2 character variable names.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: