Prevent printing of the asm routine

Discussions about the BBC BASIC language, with particular reference to BB4W and BBCSDL
funkheld
Posts: 30
Joined: Sun 12 Feb 2023, 10:16

Prevent printing of the asm routine

Post by funkheld »

Hi good afternoon.
How can you please prevent the ASM code from being printed out when starting the program?

Thanks.

Code: Select all

  10 REM Hello World in Assembler
   20 :
   22 REM Check if we are running in 24-bit BASIC
   24 :
   25 IF HIMEM < &10000 PRINT "This code will only run on BBC BASIC for eZ80": STOP
   30 :
   40 DIM code% 1024
   50 :
   60 REM Z80 code
   70 :
   80 FOR I%=0 TO 3 STEP 3
   90   P%=code%
  100   [
  110   OPT I%
  120   :
  200   LD HL, data ; Address of the message
  210   CALL print
  220   RET
  290   :
  300   .print ; The print routine
  310   LD A,(HL)
  320   OR A
  330   RET Z
  340   RST.LIL &10 ; Print a character (in A)
  350   INC HL
  360   JR print
  390   :
  400   .data ; The message, zero terminated
  410   DEFM "Hello World": DEFB 13: DEFB 10: DEFB 0
  960   ]
  970 NEXT
  980 :
  985 PRINT
  990 CALL code%
  
jgharston
Posts: 37
Joined: Thu 05 Apr 2018, 14:08

Re: Prevent printing of the asm routine

Post by jgharston »

Turn the listing off before any instructions. In your code you have one instruction before the first OPT - a blank line. When the assembler is entered the default is to show a listing, that won't change until an OPT is specified. So specify an OPT *BEFORE* any assembler instructions.

Code: Select all

   80 FOR I%=0 TO 3 STEP 3
   90   P%=code%
  100   [OPT I%
  120   :
funkheld
Posts: 30
Joined: Sun 12 Feb 2023, 10:16

Re: Prevent printing of the asm routine

Post by funkheld »

hello thanks for help.