FastBasic Questyions RESERVE and other POINTERS needed

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2027
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

FastBasic Questyions RESERVE and other POINTERS needed

Postby charles » Mon Apr 09, 2012 3:36 am

so i really like fast basic
its more like gfa and asm combined
here is a small demo code
nothing dropjaw spectacular

Code: Select all

 
\
\
RESERVE Malloc%,24
RESERVE Mfree%,24
PROCMfree
PROCMalloc

D0=-1
GOSUB Malloc
PRINT D0

bytes%=D0
IF D0<bytes% THEN
Dum&=ALERT("[0][Program Memory Low.|Try A Smaller File. ][ OK ]",1)
  ELSE
D0=bytes%
GOSUB Malloc
PRINT D0
GOSUB Mfree
ENDIF

PROCFileLength
CLS
END
\\\\\\\\\\\\\\\\\\\\\\\\\
Mfree:
CALL Mfree%
RETURN

Malloc:
CALL Malloc%
RETURN

DEF PROCMalloc
LOCAL Pass%
FOR Pass%=1TO2
[
OPT Pass%,"L-"
ORG Malloc%
MOVE.L D0,-(SP)
MOVE.W #72,-(SP)
TRAP #1
ADDQ.L #6,SP
RTS
]
NEXT
ENDPROC

DEF PROCMfree
LOCAL Pass%
FOR Pass%=1TO2
[
OPT Pass%,"L-,W+"
ORG Mfree%
MOVE.L D0,-(SP)
MOVE.W #73,-(SP)
TRAP #1
ADDQ.L #6,SP
RTS
]
NEXT
ENDPROC


DEF PROCFileLength:
LOCAL Path$,File$,Dum&,Temp$,Handle&
  Path$=PATH$+"*.*"
  File$=""
  FSELECT Path$,File$,Dum&
  IF Dum&<0 THEN
  WHILE RIGHT$(Path$,1)<>"\"
  Path$=LEFT$(Path$,LEN(Path$)-1)
  WEND
  Temp$=PATH$
  PATH$=Path$
  Handle&=OPENIN(File$)
  IF Handle&>-1 THEN
  Dum&=ALERT("[0][Length of file is "+STR$(EXT#Handle&)+" bytes.][OK]",1)
  CLOSE#Handle&
  PATH$=Temp$
  ELSE
  Dum&=ALERT("[1][File does not exist!][OK]",1)
  ENDIF
  ENDIF
ENDPROC



few questions
how reserve memory for program
how have boolean variable
how release mem from program
how pointers are imployed
how tell amount each asm will take in mem?

how how how
chow
charles
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

Social Media

     

Return to “Other BASIC”

Who is online

Users browsing this forum: No registered users and 2 guests

cron