Re: BASIC loaders for machine language (Re: FORTH in ROM for CBM 8032?)

From: Greg King (gngking_at_erols.com)
Date: 2005-01-05 07:26:23

From: Marko Mäkelä; on Date: December 29, 2004, at 05:44 PM -0500
>
> ... A simpler version is in the Veni Vidi Vic! source code
> (http://www.funet.fi/pub/cbm/vic20/demos/VVV-src.tar.gz), file basic.i
> (written for DASM 2.12.04, also available from the FUNET CBM archive):
>
> #mac basicline
>   org {1}
>   word 0$ ; link to next line
>   word {2} ; line number
>   byte $9E ; SYS token
>
> ; SYS digits
>
>   if (* + 8) / 10000
>     byte $30 + (* + 8) / 10000
>   endif
>   if (* + 7) / 1000
>     byte $30 + (* + 7) % 10000 / 1000
>   endif
>   if (* + 6) / 100
>     byte $30 + (* + 6) % 1000 / 100
>   endif
>   if (* + 5) / 10
>     byte $30 + (* + 5) % 100 / 10
>   endif
>   byte $30 + (* + 4) % 10
>   byte 0 ; end of BASIC line
> 0$:
>   word 0 ; end of BASIC program
> #endm

That macro can be shorter:

#mac basicline
  org {1}
  word 0$  ; link to next line
  word {2} ; line number
  byte $9E ; SYS token
;   SYS digits
  if (* + 8) / 10000
    byte $30 + (* + 8) / 10000
  endif
  if (* + 7) / 1000
    byte $30 + (* + 7) /  1000 % 10
  endif
    byte $30 + (* + 6) /   100 % 10
    byte $30 + (* + 5) /    10 % 10
    byte $30 + (* + 4) /     1 % 10
  byte 0   ; end of BASIC line
0$:
  word 0   ; end of BASIC program
#endm


       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.