How is basic stored in the memory? (Development MSX Fora)MSX Resource Center PassionMSX MSX2 contest           
            
English Nederlands Español Português Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 129 gasten en 6 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - How is basic stored in the memory?

Ga naar pagina ( Vorige pagina 1 | 2 )
Schrijver

How is basic stored in the memory?

Vampier
msx addict
Berichten: 493
Geplaatst: 15 Oktober 2007, 06:56   
That's the goal... the idea isn't new though
MOA
msx freak
Berichten: 148
Geplaatst: 15 Oktober 2007, 21:30   
nitpick mode:

Why are you converting the peeked value to a hexadecimal string and compare those, instead of just doing:

1 DEFINT A
120 A=PEEK(&H8000+I)
130 'PRINT HEX$(A)+"|"+CHR$(VAL("&h"+A$)),S
140 IF A=&HEF THEN PRINT"=";:NEXT
(etc.)

Isn't that much faster?

Vampier
msx addict
Berichten: 493
Geplaatst: 17 Oktober 2007, 06:05   
Ok I'm not doing this in basic but in TCL:

I'm really busy with work during the week but have time in the weekends to work on it. It'll work with openMSX only since it supports TCL. If someone wants to code the same for blueMSX just take a look at the TCL code.

(ps it's not working for a long shot but it's a start)

#*****************************************
#* Basic Reader
#*****************************************

# Helper Functions
proc base {base} {
	set base [expr {[peek [expr $base+1]]*256+[peek $base]}]
	return $base
}

proc getEnd {} {
	for {set i [base 0xf676]} {$i < 0xffff} {incr i} {
		if {[base $i]=="0"} {return $i}
	}
}

proc getInit {addr} {
	return [concat [format %x [base $addr]] " :: " [base [expr $addr+2]]]
}

# Main Function
proc getBasic {} {
	set startBasic [base 0xf676]
	set endBasic [getEnd]

	set listing ""

	puts $startBasic
	puts $endBasic

	set newLine 1

	if {$startBasic == $endBasic} {return "No Listing in Memory"}

	for {set addr [expr $startBasic]} {$addr < $endBasic} {incr addr} {
		
		if {$newLine==1} {
			set com [getInit $addr]
			append listing $com
			incr addr 4
			set newLine 0
			
		}

		set addrVal [peek $addr]
	
		set com ""


		if {$addrVal==0x97} {set com "DEF"}
		if {$addrVal==0x8F} {set com "REM"}



		if {$addrVal==0xf1} {set com "+"}
		if {$addrVal==0xf2} {set com "-"}
		if {$addrVal==0xf3} {set com "*"}
		if {$addrVal==0xf4} {set com "/"}
		if {$addrVal==0xf5} {set com "^"}
		if {$addrVal==0xfc} {set com "\\"}

		if {$addrVal==0x20} {set com " "}
		if {$addrVal==0x22} {set com "\""}
		if {$addrVal==0x91} {set com "print"}

		if {$addrVal==0x11} {set com "1"}
		if {$addrVal==0x12} {set com "2"}
		if {$addrVal==0x13} {set com "3"}
		if {$addrVal==0x14} {set com "4"}
		if {$addrVal==0x15} {set com "5"}
		if {$addrVal==0x16} {set com "6"}
		if {$addrVal==0x17} {set com "7"}
		if {$addrVal==0x18} {set com "8"}
		if {$addrVal==0x19} {set com "9"}
		if {$addrVal==0x1a} {set com "0"}
		if {$addrVal==0xef} {set com "="}
		if {$addrVal==0x3a} {set com ":"}

		#BASIC COMMANDS
	if {$addrVal==0xFF || $addrVal==0x3A} {
		#incr addr 1
		#set addrVal [peek $addr]

                                [I cut tokenized BASIC stuff out]

} else {
		if {$addrVal>=0x20 && $addrVal<=0x5A} {set com [format %c $addrVal]}
		if {$addrVal>=0x61 && $addrVal<=0x7A} {set com [format %c $addrVal]}
}

append listing $com

		puts [concat [format %x $addr] " - " [format %x $addrVal] " - " $com]
		if {$addrVal=="0"} {set newLine 1; append listing "\n"}
	}

puts $listing
}

Vampier
msx addict
Berichten: 493
Geplaatst: 18 Oktober 2007, 06:18   
http://openmsx.pastebin.com/f7a4253a3

and done (for now... with 3 todos) Thanks to JoyRex




NYYRIKKI
msx master
Berichten: 1503
Geplaatst: 18 Oktober 2007, 07:49   
That problem is weird... SCREEN 3 works, but SCREEN 0 doesn't !?

[edit]

Ah...

I don't know anything about TCL, but...

if {$addrVal==0x1a} {set com "0"}

Shouldn't this be...

if {$addrVal==0x10} {set com "0"}

?
Vampier
msx addict
Berichten: 493
Geplaatst: 18 Oktober 2007, 08:09   
that was my bad...

- if {[byte $addr]>0x11 && [byte $addr]<0x1a} {set tok [expr [byte $addr]-0x11]; set forward 1}
+ if {[byte $addr]>=0x11 && [byte $addr]<=0x1a} {set tok [expr [byte $addr]-0x11]; set forward 1}

The code is now based on JoyRex's script.
 
Ga naar pagina ( Vorige pagina 1 | 2 )
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.