1983 program listing

Discussions related to using the integrated assembler
Post Reply
colinhoad
Posts: 5
Joined: Sun 03 Feb 2019, 17:29

1983 program listing

Post by colinhoad » Sun 03 Feb 2019, 17:34

Hi,

I've been attempting to run an old 1983 BBC Micro User program taken from a listing in said magazine. I've typed it all in, but it contains a PROC that jumps into assembly code (which I freely confess I don't understand). The problem I have is that the program is throwing up syntax errors when it gets to that PROC, but I don't know where to start in terms of debugging it. Is there anyone here who might be able to shed some light on (a) what this assembly language is doing and (b) what might be wrong with it and/or if there's a way to achieve the same goal but without having to go into assembly code?

(Apologies if this sounds like a dim-witted question, I'm still learning.)

The PROC in question is defined below:

Code: Select all

  780 DEFPROCAS : DIM ZZ%352 : FOR C%=0 TO 2 STEP 2 : P%=ZZ% : [OPT C%
  790 .RT LDA&71:CMP#3:BMIR1:BEQR2:RTS
  800 .R2 LDA&70:CMP#72:BMIR1:RTS
  810 .R1 LDA&70:CLC:ADC#20:STA&70:LDA&71:ADC#0:STA&71:LDA#128:STA&7F:JSRM1
  820 JSRG1:LDA#20:STA&7F:JSRM2:LDA#4:STA&7F:JSRM3:LDA#85:STA&7F:JSRM4
  830 LDA#88:STA&7F:JSRM1:LDA#18:JSR&FFEE:LDA#0:JSR&FFEE:LDA#0:JSR&FFEE:LDA#60
  840 STA&7F:JSRM2:LDA#4:STA&7F:JSRM3:LDA#40:STA&7F:JSRM2:LDA#85:STA&7F:JSRM3:RTS
  850 .LT LDA#1:CMP&71:BMIL1:BEQL2:RTS
  860 .L2 LDA#174:CMP&70:BMIL1:RTS
  870 .L1 LDA&70:SEC:SBC#20:STA&70:LDA&71:SBC#0:STA&71:LDA#88:STA&7F:JSRM1:JSRG1
  880 LDA#40:STA&7F:JSRM2:LDA#4:STA&7F:JSRM3:LDA#20:STA&7F:JSRM2:LDA#85:STA&7F
  890 JSRM3:JSRG1:LDA#128:STA&7F:JSRM1
  900 LDA#18:JSR&FFEE:LDA#0:JSR&FFEE:JSR&FFEE:LDA#4:STA&7F:JSRM4
  910 LDA&70:CLC:ADC#20:STA&80:LDA&71:ADC#0:STA&81:LDA#85:STA&7F:JSRM3:RTS
  920 .M1 LDA#25:JSR&FFEE:LDA#4:JSR&FFEE:LDA&7F:JSR&FFEE:LDA#2:JSR&FFEE:LDA#0:JSR&FFEE:JSR&FFEE:RTS
  930 .G1 LDA#18:JSR&FFEE:LDA#0:JSR&FFEE:LDA#15:JSR&FFEE:RTS
  940 .M2 LDA&70:SEC:SBC&7F:STA&B0:LDA&71:SBC#0:STA&81:RTS
  950 .M3 LDA#25:JSR&FFEE:LDA&7F:JSR&FFEE:LDA&80:JSR&FFEE:LDA&81:JSR&FFEE:LDA#160:JSR&FFEE:LDA#0:JSR&FFEE:RTS
  960 .M4 LDA#25:JSR&FFEE:LDA&7F:JSR&FFEE:LDA&70:JSR&FFEE:LDA&71:JSR&FFEE:LDA#160:JSR&FFEE:LDA#0:JSR&FFEE:RTS
  970 ] : NEXT : ENDPROC
 

David Williams
Posts: 74
Joined: Wed 04 Jul 2018, 16:23

Re: 1983 program listing

Post by David Williams » Mon 04 Feb 2019, 01:31

What version of BBC BASIC are you trying to run that program under?

If you are trying to run the program under 'BBC BASIC for Windows' or 'BBC BASIC for SDL 2.0' then it couldn't possibly work because their built-in assemblers don't understand 6502 assembly language (the BBC Micro is based on the 6502 CPU, whereas PCs and Macs are based on Intel or ARM processors which use entirely different, mutually incompatible instruction sets).

If you want that program to run on a PC or Mac, then you will need an BBC Micro emulator (my personal favourite is BeebEm, although B-em is also excellent).

BeebEm: http://www.mkw.me.uk/beebem/


David.
--

colinhoad
Posts: 5
Joined: Sun 03 Feb 2019, 17:29

Re: 1983 program listing

Post by colinhoad » Mon 04 Feb 2019, 08:38

Thank you for clearing this up for me, David. I was indeed attempting to run the program under BB4W and so your explanation makes perfect sense. I'll try it using BeebEm (which I agree is a very good emulator) and see how I get on.

Thanks again.

Post Reply