dflat language update

This is the best place to discuss about the various Oric operating systems like Sedoric, Randos, FT-Dos, and others, as well as serious software, utilities, word processors, disassemblers, etc... that runs on oric computers.
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: dflat language update

Post by iss »

ibisum wrote: Fri Jan 22, 2021 10:59 pm Hey iss, I heard you like port PR's in your PR, so I put Darwin in a PR of your PR for you to submit as a new PR ..
@ibisum: Great! Done.
6502Nerd wrote: Fri Jan 22, 2021 11:29 pmDoes as65 exist on Linux...
Yes, I've downloaded from (bottom of) this PAGE the file
AS65 [1.42] Assembler for R6502/65SC02 microprocessor..
as65_142.zip contains binaries for Windows 'as65.exe' and Linux 'as65'. Some info for the Linux binary:

Code: Select all

$ file as65
as65: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.8, stripped
$ ldd as65
        linux-gate.so.1 (0xf7f23000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xf7ea7000)
        libstdc++.so.6 => /lib/libstdc++.so.6 (0xf7cb6000)
        libm.so.6 => /lib/libm.so.6 (0xf7be5000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf7bc7000)
        libc.so.6 => /lib/libc.so.6 (0xf7a13000)
        /lib/ld-linux.so.2 (0xf7f25000)
I've checked the '/' path separator and it works under Windows 10. :)
User avatar
6502Nerd
Pilot Officer
Posts: 111
Joined: Thu Oct 08, 2020 9:48 pm
Location: Leicestershire, UK
Contact:

Re: dflat language update

Post by 6502Nerd »

iss wrote: Sat Jan 23, 2021 12:41 am
ibisum wrote: Fri Jan 22, 2021 10:59 pm Hey iss, I heard you like port PR's in your PR, so I put Darwin in a PR of your PR for you to submit as a new PR ..
@ibisum: Great! Done.
6502Nerd wrote: Fri Jan 22, 2021 11:29 pmDoes as65 exist on Linux...
Yes, I've downloaded from (bottom of) this PAGE the file
AS65 [1.42] Assembler for R6502/65SC02 microprocessor..
as65_142.zip contains binaries for Windows 'as65.exe' and Linux 'as65'. Some info for the Linux binary:

Code: Select all

$ file as65
as65: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.8, stripped
$ ldd as65
        linux-gate.so.1 (0xf7f23000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xf7ea7000)
        libstdc++.so.6 => /lib/libstdc++.so.6 (0xf7cb6000)
        libm.so.6 => /lib/libm.so.6 (0xf7be5000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf7bc7000)
        libc.so.6 => /lib/libc.so.6 (0xf7a13000)
        /lib/ld-linux.so.2 (0xf7f25000)
I've checked the '/' path separator and it works under Windows 10. :)
Fantastic!
User avatar
6502Nerd
Pilot Officer
Posts: 111
Joined: Thu Oct 08, 2020 9:48 pm
Location: Leicestershire, UK
Contact:

Re: dflat language update

Post by 6502Nerd »

Thanks iss and seclorum for improvements to the build process and utilities to make it compatible for Linux and Apple host machines - excellent work and really appreciate your work! I have now merged this back in to main and tried it on my Win10 machine - works very well!

In addition iss thanks for the fun little post you made on Twitter - very up to date topic! :lol:



Finally, by kind permission of rax, I am delighted to show the first dflat program written by someone other than me! :lol:

I was happy to see what rax did, and it's nicer than I could do (not much good with graphics) plus it uses the inline assembler! 8)

Thanks rax for allowing me to share your creation!



Source code is here (permission of rax):

Code: Select all

; * EXPLORER7 in DFLAT! *
; * 01/2021 rax *
def_start()
	dim code[100]
	dim prtspr[100]
	dim tileset[40*6/2]
	dim level[200,5]
	dim s$[40]
	_asm(2):_asm(2):_asm(2)
	_asm2(2):_asm2(2):_asm2(2)
	_init()
	_hlp()
	repeat
		_game()
		cls
		if gamestate == 2
			_prttxt(2,45,"Congratulations! Mission accomplished.")
		else
			_prttxt(15,45,"GAME OVER")
		endif
		print "          Press any key..."
		wait(100)
		c=get(1)
	until(0)
enddef
def_init()
	text:paper(0):ink(7):cursor(1)
	;;chars
	for a=0,767,1: read v: poke 0xb500+a,v: next
	;;screen
	for a=0,27*40,1:read v: poke 0xbb80+a,v:next
	printat 13,25,"    Wait..."
	poke 0xbb80+25*40+12,12
	;;
	;;tileset
	for y=0,5,1:for i=0,39,1:read v:poke tileset+i*6+y,v:next:next
	;;
	;;level
	for i=0,1999,1:read v: poke level+i,v:next
	;;
	;;done
	printat 13,25,"Press any key..."
	poke 0xbb80+25*40+12,12
	c=get(1)
enddef
def_hlp()
	hires
	dim str$[40]
	str$="-Hello Commander,": poke str$,1
	_prttxt(1,40,str$)
	str$="-The earth is in danger. There is a": poke str$,3
	_prttxt(1,60,str$)
	str$="-galactic war. You and your crew were": poke str$,3
	_prttxt(1,70,str$)
	str$="-on a reconnaissance mission in outer": poke str$,3
	_prttxt(1,80,str$)
	str$="-space. You must return successfully": poke str$,3
	_prttxt(1,90,str$)
	str$="-to base, avoiding obstacles left for": poke str$,3
	_prttxt(1,100,str$)
	str$="-enemy ships.": poke str$,3
	_prttxt(1,110,str$)
	str$="-Use the arrow keys to move the ship": poke str$,2
	_prttxt(1,130,str$)
	str$="-Good luck": poke str$,5
	_prttxt(1,150,str$)
	print "          Press any key..."
	c=get(1)
enddef
def_game()
	hires
	levelx=0
	playery=2
	playerx=5
	coladdr=0xaaf0+playerx+121
	gamestate=0
	play 0,1,0,0
	sound 1,100,5
	poke 0x5a,0
	repeat
		c=stick()
		;;
		_spr(playerx-1,playery,39)
		if c&4
			if playery>0
				_spr(playerx,playery,39)
				playery=playery-1
			endif
		elif c&8
			if playery<4
				_spr(playerx,playery,39)
				playery=playery+1
			endif
		endif
		_moveScreen()
		_spr(playerx-1,playery,27)
		_spr(playerx,playery,28)
		_printlvldata()
		;;
		;;collision check
		if peek(coladdr+playery*240)>64
			gamestate=1
			sound 1,0,0
			;play 7,7,9,5000
		endif
	until(gamestate)
	poke 0x5a,32
	play 0,0,0,0
enddef
def_spr(x,y,e)
	doke psscreen+1, 0xaaf0+x+y*240
	doke psaddr+1, tileset+e*6
	a=call(prtspr,0,0,0)
enddef
def_moveScreen()
	a=call(code,0,0,0)
enddef
def_printlvldata()
	tmplva = level+levelx
	for z=0,4,1
		_spr(39,z,peek(tmplva))
		tmplva = tmplva + 400
	next
	levelx=levelx+1
	if levelx==400
		gamestate=2
	endif
enddef
def_prttxt(x,y,s$)
	l=len(s$)
	for n=0,l,1
		scraddr=0xa000+x+n+y*40
		c=peek(s$+n)
		chraddr=0x9800+c*8
		poke scraddr+280,126
		for i=0,7,1
			if c>31
				poke scraddr+i*40,peek(chraddr+i)|64
			else
				poke scraddr+i*40,c
			endif
		next
		play 700,0,1,200
	next
	poke scraddr+1,64
enddef
;;chars
data 0,0,0,0,0,0,0,0,
data 12,12,12,12,12,0,12,0,
data 54,54,54,0,0,0,0,0,
data 20,20,62,20,62,20,20,0,
data 8,30,44,28,26,60,8,0,
data 48,50,6,12,24,54,38,0,
data 24,44,44,24,46,44,30,0,
data 24,24,24,0,0,0,0,0,
data 12,24,48,48,48,24,12,0,
data 24,12,6,6,6,12,24,0,
data 8,42,28,8,28,42,8,0,
data 0,24,24,62,24,24,0,0,
data 0,0,0,0,0,12,12,24,
data 0,0,0,62,0,0,0,0,
data 0,0,0,0,0,12,12,0,
data 0,2,6,12,24,48,32,0,
data 28,50,54,58,50,50,28,0,
data 12,28,12,12,12,12,30,0,
data 28,54,6,12,24,48,62,0,
data 62,6,12,28,6,54,28,0,
data 4,12,28,44,62,12,12,0,
data 62,48,60,6,6,38,28,0,
data 12,24,48,60,50,50,28,0,
data 62,2,6,12,24,24,24,0,
data 28,50,50,28,50,50,28,0,
data 28,54,54,30,6,12,24,0,
data 0,0,12,0,0,12,0,0,
data 0,0,12,0,0,12,12,24,
data 6,12,24,48,24,12,6,0,
data 0,0,62,0,62,0,0,0,
data 48,24,12,6,12,24,48,0,
data 28,54,6,12,12,0,12,0,
data 28,50,50,54,54,48,30,0,
data 8,28,50,50,62,50,50,0,
data 60,50,50,60,50,50,60,0,
data 28,50,48,48,48,50,28,0,
data 60,50,50,50,50,50,60,0,
data 62,48,48,60,48,48,62,0,
data 62,48,48,60,48,48,48,0,
data 30,48,48,48,54,50,30,0,
data 50,50,50,62,50,50,50,0,
data 30,12,12,12,12,12,30,0,
data 6,6,6,6,6,38,28,0,
data 50,52,56,48,56,60,54,0,
data 48,48,48,48,48,48,62,0,
data 34,54,58,58,50,50,50,0,
data 50,50,50,58,54,50,50,0,
data 28,50,50,50,50,50,28,0,
data 60,34,34,60,48,48,48,0,
data 28,50,50,50,58,52,26,0,
data 60,50,50,60,56,52,50,0,
data 28,50,48,28,6,38,28,0,
data 62,24,24,24,24,24,24,0,
data 50,50,50,50,50,50,28,0,
data 50,50,50,50,50,28,8,0,
data 50,50,50,58,58,54,34,0,
data 54,54,20,8,20,54,54,0,
data 50,50,20,24,24,24,24,0,
data 62,6,12,24,48,48,62,0,
data 60,48,48,48,48,48,60,0,
data 0,32,48,24,12,6,2,0,
data 30,6,6,6,6,6,30,0,
data 8,28,54,34,0,0,0,0,
data 0,0,0,0,0,0,63,0,
data 62,0,28,16,16,28,0,62,
data 0,0,28,2,30,38,30,0,
data 32,32,60,50,50,50,60,0,
data 0,0,30,48,48,48,30,0,
data 2,2,30,38,38,38,30,0,
data 0,0,28,50,62,48,30,0,
data 12,18,16,60,24,24,24,0,
data 0,0,28,38,38,30,6,28,
data 32,32,60,50,50,50,50,0,
data 8,0,56,24,24,24,60,0,
data 4,0,28,12,12,12,44,24,
data 48,48,50,52,56,52,50,0,
data 56,24,24,24,24,24,60,0,
data 0,0,54,58,58,58,50,0,
data 0,0,60,50,50,50,50,0,
data 0,0,28,50,50,50,28,0,
data 0,0,60,50,50,60,48,48,
data 0,0,30,38,38,30,6,6,
data 0,0,46,48,48,48,48,0,
data 0,0,30,48,28,6,60,0,
data 24,24,60,24,24,26,12,0,
data 0,0,50,50,50,54,26,0,
data 0,0,50,50,50,28,8,0,
data 0,0,50,50,58,58,54,0,
data 0,0,54,20,8,20,54,0,
data 0,0,54,54,54,30,6,28,
data 0,0,62,6,12,24,62,0,
data 12,24,24,48,24,24,12,0,
data 12,12,12,12,12,12,12,12,
data 24,12,12,6,12,12,24,0,
data 42,21,42,21,42,21,42,21,
data 63,63,63,63,63,63,63,63
;;screen
data 22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22
data 22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,19,19,19,19,19
data 22,22,17,17,17,22,17,22,17,22,17,17,22,22,17,22,22,22,22,17
data 17,22,17,17,22,22,17,17,17,22,17,17,22,22,22,20,20,20,19,19
data 22,22,17,22,22,22,17,22,17,22,17,22,17,22,17,22,22,22,17,22
data 17,22,17,22,17,22,17,22,22,22,17,22,17,22,22,22,19,20,19,19
data 22,22,17,17,22,22,22,17,22,22,17,17,22,22,17,22,22,22,17,22
data 17,22,17,17,22,22,17,17,22,22,17,17,22,22,22,22,22,20,19,19
data 22,22,17,17,17,22,17,22,17,22,17,22,22,22,17,17,17,22,17,17
data 22,22,17,22,17,22,17,17,17,22,17,22,17,22,22,22,22,20,22,22
data 22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22
data 22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22
data 22,19,19,19,22,19,19,22,22,22,22,22,22,22,22,22,22,22,19,19
data 19,19,19,19,19,19,22,19,19,19,22,19,19,19,22,19,19,22,19,22
data 22,22,22,22,22,22,22,22,22,19,19,19,19,19,19,19,19,19,22,22
data 22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22
data 22,19,19,19,19,19,19,19,19,22,22,22,22,22,22,22,22,22,22,22
data 22,22,22,22,22,18,22,22,22,22,22,22,18,22,18,22,22,18,22,22
data 22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22
data 22,22,18,22,18,18,18,18,22,22,18,18,18,19,18,18,22,18,22,18
data 22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22
data 18,18,18,18,18,18,19,18,18,18,18,18,18,18,19,18,18,18,19,18
data 21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,18
data 19,19,18,18,18,19,18,18,19,18,18,19,18,19,18,18,18,19,18,19
data 22,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,18
data 18,18,19,18,18,18,18,19,18,18,18,19,18,18,18,18,19,18,18,18
data 22,22,22,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22
data 18,18,18,18,18,19,18,18,18,19,19,18,18,18,18,18,18,18,19,19
data 21,21,21,21,21,21,23,23,21,21,21,22,22,22,22,22,22,22,22,22
data 22,22,22,18,18,18,18,18,18,18,18,18,18,18,19,19,18,18,18,18
data 21,21,21,21,21,21,23,23,23,23,21,21,21,21,21,22,22,22,22,22
data 22,22,22,22,21,21,22,22,21,22,21,21,22,21,18,18,18,18,22,21
data 21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22
data 22,22,22,22,21,21,22,22,21,22,21,21,22,21,22,21,21,22,22,21
data 22,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22
data 22,22,22,22,21,21,22,22,21,22,21,21,22,21,22,21,21,22,22,21
data 21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22
data 22,19,19,19,21,21,19,19,19,19,21,21,19,19,19,21,21,19,19,21
data 21,21,21,21,21,20,20,20,20,20,20,20,20,23,23,23,20,20,20,20
data 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,21,21,19,19,19
data 20,20,20,20,20,20,20,23,23,20,20,20,20,20,20,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,19,19,19,19,19,19,19,19,19,19,19
data 20,20,20,20,20,20,20,20,20,20,20,20,23,23,20,20,20,20,23,23
data 20,20,20,20,20,23,23,23,20,20,20,20,20,20,20,20,20,20,23,23
data 23,23,23,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,20,20,20,23,23,23,20,20,20,20,20
data 20,20,20,20,20,20,23,23,20,20,20,20,20,20,20,20,20,20,20,20
data 23,23,23,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,20,20,20,20,23,23,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,23,23,20,20,20,20,20,23,23,20,20
data 20,20,20,23,23,23,20,20,20,20,20,20,20,20,20,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
data 20,23,23,23,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
;;sprites
data 0x06, 0x7f, 0x41, 0x60, 0x7f, 0x7f, 0x4c, 0x7f, 0x50, 0x7f, 0x43 
data 0x69, 0x70, 0xc0, 0xc1, 0xc0, 0x7f, 0x7e, 0x7f, 0x6a, 0x40, 0x5e 
data 0x5e, 0x40, 0x40, 0x40, 0x40, 0xe0, 0x40, 0x43, 0x70, 0x40, 0x61 
data 0x4c, 0x4c, 0x4c, 0xc0, 0x40, 0x40, 0x40, 0x03, 0x7f, 0x47, 0x78 
data 0x5f, 0x7e, 0x4c, 0x7f, 0x7d, 0x7f, 0x4f, 0x7f, 0x7c, 0x6a, 0x6a 
data 0x6a, 0xd5, 0xd5, 0xd5, 0x5c, 0xff, 0xc0, 0x7f, 0x40, 0x48, 0x48 
data 0x40, 0x47, 0x70, 0x46, 0x78, 0x48, 0x52, 0x44, 0x5e, 0x5e, 0x5e 
data 0x5e, 0x5e, 0x40, 0x06, 0x7f, 0x57, 0x7a, 0x7f, 0x7f, 0x56, 0x5e 
data 0x7f, 0x7f, 0x77, 0x7f, 0x7f, 0xc0, 0xc1, 0xc0, 0x7f, 0x7e, 0x7f 
data 0x7e, 0x67, 0x7f, 0xc0, 0x5e, 0x5c, 0x5c, 0x40, 0x43, 0xf3, 0x4d 
data 0x7c, 0x54, 0x40, 0x4c, 0x48, 0x4c, 0xc0, 0xd0, 0xdc, 0x40, 0x03 
data 0x7f, 0x7f, 0x7f, 0x57, 0x7a, 0x5e, 0x56, 0x7f, 0x7f, 0x7f, 0x7f 
data 0x7b, 0x6a, 0x6a, 0x6e, 0xd5, 0xd5, 0xd1, 0x5c, 0xff, 0xc0, 0x7f 
data 0xc0, 0x6a, 0xd5, 0x4e, 0x47, 0xc0, 0x4d, 0x7c, 0x48, 0x40, 0x48 
data 0x4c, 0x5e, 0x5e, 0xd0, 0xd8, 0x40, 0x06, 0x7f, 0x5f, 0x7e, 0x47 
data 0x78, 0x7f, 0x4c, 0x7f, 0x6f, 0x4f, 0x7f, 0x7c, 0xc0, 0xc1, 0xcc 
data 0x7f, 0x7e, 0x73, 0x6a, 0x7c, 0x4c, 0x4c, 0x5e, 0xc1, 0x7e, 0x40 
data 0xe0, 0x7c, 0x4f, 0x7c, 0x40, 0x52, 0x5e, 0x44, 0x4c, 0xc0, 0xdc 
data 0xd0, 0x40, 0x03, 0x7f, 0x7f, 0x7f, 0x41, 0x60, 0x7f, 0x4c, 0x7f 
data 0x42, 0x43, 0x65, 0x70, 0x6a, 0x6a, 0x72, 0xd5, 0xd5, 0xcd, 0x40 
data 0xff, 0x4c, 0x4c, 0x40, 0x6a, 0xd5, 0x40, 0x7f, 0x60, 0xe8, 0xc5 
data 0x40, 0x61, 0x4c, 0x4c, 0x5e, 0x5e, 0x5e, 0x5e, 0x40
;;level
data 39,39,39,39,39,39,39,39,39,19,39,39,39,39,39,39
data 39,39,39,39,39,39,19,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,19,39,39,39,39
data 39,39,39,39,39,39,39,39,39,19,39,39,39,39,39,39
data 39,39,19,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,19,39,39,39,39,39,39,39,39,39,39,39,39,39
data 19,39,39,39,39,39,39,4,9,9,9,1,1,1,1,1
data 1,1,1,1,1,1,1,1,9,9,1,9,1,9,1,1
data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
data 1,1,9,9,5,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,4,9,1,9,9,9,1,9,1,9
data 5,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,19,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,19,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,4,1,1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9
data 9,9,1,9,1,9,5,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,19,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,24,39
data 24,39,24,39,19,19,19,39,39,19,19,39,19,19,39,39
data 39,39,39,39,39,39,19,39,39,39,39,39,39,39,39,39
data 39,19,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,19,39,39,39,39,39,39,39,39
data 39,39,39,19,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,19,39,39,39
data 39,39,39,39,39,39,39,39,39,39,19,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,4,9,9,1,1
data 1,9,9,9,5,34,4,5,39,39,33,39,7,39,4,9
data 9,9,9,1,1,1,1,5,7,4,9,1,1,1,1,1
data 9,5,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,2,8,8,8,8,8,3,39,21,39,2,8,8
data 8,8,3,39,39,39,39,39,33,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,21,22,29,30,34,29,30
data 22,39,39,39,39,39,39,39,39,39,39,39,39,19,39,19
data 39,39,39,39,39,39,39,39,39,39,39,19,39,39,39,39
data 39,39,39,39,24,39,39,39,39,39,39,39,39,25,39,39
data 39,39,39,39,39,39,39,4,9,9,9,5,7,4,9,1
data 9,1,1,1,1,1,1,1,9,9,1,1,1,1,5,39
data 39,39,7,39,33,39,39,39,39,39,39,39,39,39,39,19
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,15,14,39,34,39,18,17,21,34,15,14,39,39,39
data 39,39,39,39,39,39,39,39,2,8,8,8,11,11,8,8
data 8,8,8,11,11,8,8,11,12,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,29,30,39,39,39,39,39,13,13
data 13,13,14,39,19,39,39,39,19,39,19,39,19,39,19,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,19,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,19,39
data 39,39,39,39,39,39,39,39,39,39,39,39,19,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,19,39,39,39,39
data 39,39,39,39,39,19,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,2,3,33,2,3,39,39,39,39,39,4,9
data 5,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,4,9,9,5,39,39,39,39,4,9,9,9,5
data 39,39,39,39,39,39,39,10,11,11,11,11,11,11,11,11
data 11,11,11,1,1,1,1,1,1,1,1,1,1,1,1,1
data 1,1,1,8,8,3,39,39,39,39,39,2,8,8,1,11
data 11,12,39,39,39,39,39,10,11,11,9,9,9,9,9,9
data 9,11,11,12,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,24,35,39,39,39,24,39,39,25,29,30,25
data 39,39,39,39,14,39,24,35,39,29,30,23,39,17,39,39
data 23,39,39,39,39,39,39,39,39,39,39,39,39,39,39,33
data 39,36,4,9,9,9,5,33,39,39,4,9,9,5,39,39
data 39,39,39,39,39,39,39,39,39,39,19,39,39,39,39,39
data 39,39,39,39,29,30,13,15,14,18,17,21,39,39,39,39
data 10,11,9,9,11,9,11,9,9,9,9,9,9,11,12,39
data 39,39,39,39,39,10,11,11,9,9,9,5,39,39,4,9
data 9,9,5,39,39,33,33,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,16,17,39,39,39,39,39,13,13
data 13,13,14,39,19,19,39,39,19,39,19,39,19,39,19,39
data 39,39,19,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,19,39,39,39,39,39,39,39,39,35,39,39
data 29,30,22,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,19,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 19,39,39,39,39,39,39,39,39,39,39,39,39,39,39,6
data 39,29,30,39,35,39,19,39,39,39,39,29,30,39,39,39
data 39,39,39,2,1,1,1,1,1,3,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,2,8,6,8,3,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,4,9,9,9,5,4,9,9,9,5,33,4,9
data 5,9,9,9,9,9,11,11,11,11,11,9,9,9,5,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,29,30,39,39,39,39
data 39,39,39,13,13,14,39,29,30,13,14,39,16,16,16,17
data 39,39,39,13,13,13,13,13,39,13,13,14,16,17,39,39
data 13,14,39,39,39,39,39,17,17,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,10,9,9,9,9,9,9,9,9,11,12,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 33,39,39,39,39,39,39,39,39,39,39,21,22,21,22,29
data 30,29,30,22,39,39,39,18,17,29,30,39,21,21,13,15
data 13,15,14,39,19,19,19,39,19,39,19,39,19,19,39,39
data 39,39,39,39,39,39,39,19,39,39,39,39,39,39,39,39
data 19,39,39,39,39,39,39,39,39,39,39,2,8,1,8,8
data 1,1,1,8,20,20,20,20,20,20,20,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,20,20,20,20,8,8,1
data 8,1,1,8,1,8,8,8,8,8,8,1,1,8,8,8
data 8,8,8,1,1,1,1,1,1,1,8,8,8,8,8,8
data 8,8,8,8,8,8,8,8,8,1,1,1,1,1,3,20
data 20,20,20,20,20,20,2,8,8,8,8,8,8,8,8,8
data 8,8,8,8,8,8,3,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39
data 39,39,39,39,2,8,8,8,8,8,8,8,8,8,8,8
data 8,8,8,8,8,8,8,8,8,8,1,1,8,3,39,39
data 39,21,39,13,15,14,39,15,14,15,14,39,16,16,18,17
data 21,39,22,13,13,15,13,13,39,15,13,14,18,17,22,39
data 15,14,39,22,22,22,39,18,17,22,22,22,22,39,18,17
data 14,14,39,39,2,8,8,8,8,20,20,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
data 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20
data 20,20,20,8,8,8,8,8,8,8,8,1,1,1,1,1
data 1,1,1,1,8,8,8,1,1,1,1,8,1,1,1,1
data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
;;asm move screen
def_asm(option)
	.opt option
	.org code
	.lda #0xf1
	.sta addr1+1
	.lda #0xf0
	.sta addr2+1
	.lda #0xAA
	.sta addr1+2
	.sta addr2+2
	.ldy #5
	.ldx #0
.loop
.addr1
	.lda 1234,x
.addr2
	.sta 1234,x
	.inx
	.bne loop
	.inc addr1+2
	.inc addr2+2
	.dey
	.bne loop
.color
	.lda #6
	.sta 43760
	.sta 43840
	.sta 43920
	.sta 44000
	.sta 44080
	.sta 44160
	.sta 44240
	.sta 44320
	.sta 44400
	.sta 44480
	.sta 44560
	.sta 44640
	.sta 44720
	.sta 44800
	.sta 44880
	.lda #3
	.sta 43800
	.sta 43880
	.sta 43960
	.sta 44040
	.sta 44120
	.sta 44200
	.sta 44280
	.sta 44360
	.sta 44440
	.sta 44520
	.sta 44600
	.sta 44680
	.sta 44760
	.sta 44840
	.rts
enddef
;; asm  print sprite
def_asm2(option)
	.opt option
	.org prtspr
	.ldx #0
	.ldy #0
.psloop
.psaddr
	.lda 1234,x 
.psscreen
	.sta 1234,y	
	.clc
	.tya
	.adc #40
	.tay
	.inx
	.cpx #6
	.bne psloop
	.rts
enddef
Last edited by 6502Nerd on Mon Jan 25, 2021 5:02 pm, edited 1 time in total.
User avatar
jbperin
Flight Lieutenant
Posts: 480
Joined: Wed Nov 06, 2019 11:00 am
Location: Valence, France

Re: dflat language update

Post by jbperin »

I must admit I haven't taken the time to explore dflat for now, I visited the hackaday site and saw that you built your own computer (Oric similar ) and now you're creating a very nice language to operate it. This is so crazy. What an incredible odyssey. You're walking the steps of these incredible inventors that brought computer science to every one of us. What an amazing trip. Stunning achievement !! Congratulations !!
User avatar
6502Nerd
Pilot Officer
Posts: 111
Joined: Thu Oct 08, 2020 9:48 pm
Location: Leicestershire, UK
Contact:

Re: dflat language update

Post by 6502Nerd »

jbperin wrote: Mon Jan 25, 2021 10:11 am I must admit I haven't taken the time to explore dflat for now, I visited the hackaday site and saw that you built your own computer (Oric similar ) and now you're creating a very nice language to operate it. This is so crazy. What an incredible odyssey. You're walking the steps of these incredible inventors that brought computer science to every one of us. What an amazing trip. Stunning achievement !! Congratulations !!
Thank you jbperin for your very kind words! Indeed, this was my purpose - to get a feeling for what the pioneers did (much easier for me as they paved the way and so much information on the www).

It has and continues to be a very satisfying hobby and an interesting learning experience. dflat was invented for my homebrew computer first, but then later on last year I thought maybe I can port it to Oric, which is what you see now.

I am quite proud of my homebrew computer (which is all still in breadboard form!), and will go back to it at some point as it has more to show off - 5.4MHz 65c02, 128K RAM, 64K ROM. It is more like an MSX machine I think because I use the same video (TMS9918a) and sound chip (AY-3-8910) as them but with the 65c02 as the CPU. [ Of course Oric also used the same AY-3 chip :-) ]

Once again, I really appreciate your very kind compliments! :D :D :D
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: dflat language update

Post by rax »

Hi :),

I have a question. How rnd works?

This doesn't seem to work for me:

Code: Select all

10 def_start()
20 repeat
30  println rnd(0)
40 until (0)
And how to create an arbitrary number up to a certain value. Range 1 to 40 for example.
User avatar
6502Nerd
Pilot Officer
Posts: 111
Joined: Thu Oct 08, 2020 9:48 pm
Location: Leicestershire, UK
Contact:

Re: dflat language update

Post by 6502Nerd »

rax wrote: Mon Jan 25, 2021 10:25 pm Hi :),

I have a question. How rnd works?

This doesn't seem to work for me:

Code: Select all

10 def_start()
20 repeat
30  println rnd(0)
40 until (0)
And how to create an arbitrary number up to a certain value. Range 1 to 40 for example.
Hi rax :-)

My documentation is woeful - apologies. rnd(n) is of course just a pseudo random number. It must be seeded..

if n is not zero, it is treated as the seed e.g. rnd(1234)

What I do is use the system timer feature: "reset t" (this loads the var t with the low bytes of the timer, which ticks in the IRQ)

Then rnd(0) will return the next 'random' number between 0..255

To get a certain number range - simply use the 'remainder' function or mask bits your want e.g.

r=rnd(0)\10 (this will return a number between 0..9)
r=rnd(0)&7 (this will return a number between 0..7)

So the code snippet is this:

Code: Select all

;seed the random number generator once
reset r:r=rnd(r)
;get number from generator and put in range 1..40
r=rnd(0)\40+1
Hope that makes sense :-)
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: dflat language update

Post by rax »

6502Nerd wrote: Mon Jan 25, 2021 11:13 pm
So the code snippet is this:

Code: Select all

;seed the random number generator once
reset r:r=rnd(r)
Hope that makes sense :-)
Ty 6502Nerd. Тhis works :)
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: dflat language update

Post by rax »

Hi all :)

Today I had free time and I am still trying to test DFLAT "in battle".
This is the result:

Code: Select all

; * DEFENDER in DFLAT! *
; * 01/2021 rax *
def_start()
	reset r:r=rnd(r)
	cursor(1)
	;spr
	spPlayerNormal=33: spPlayerNormalSeq=44
	spPlayerStone=34: spPlayerStoneSeq=46
	spBug=37: spBugSeq=38
	spLadder=36+128
	spBrick=35+128
	spStone=42
	;animator
	animatorState = 0
	animatorSpeed = 3
	animatorPlayerState=0
	animatorBugState=0
	animatorPlayerNormalAddr = 0xb800+spPlayerNormal*8
	animatorPlayerNormalSeqAddr = 0xb800+spPlayerNormalSeq*8
	animatorPlayerStoneAddr = 0xb800+spPlayerStone*8
	animatorPlayerStoneSeqAddr = 0xb800+spPlayerStoneSeq*8
	animatorBugAddr=0xb800+spBug*8
	animatorBugSeqAddr=0xb800+spBugSeq*8
	;
	playerX = 15
	playerY = 9
	playerArmed=0
	bugsState = 0
	score = 0
	gameSpeed = 0
	hiScore = 0
	;
	dim enemies[40]
	gameState=0
	src1=6: src2=20: src3=34
	_init()
	_title()
	_hlp()
	repeat
		_game()
		if score > hiScore: hiScore = score: endif
		cls
		printat 15,8,"GAME OVER"
		printat 15,13,"Score: "
		printat 22,13,score
		printat 13,16,"Hi-score: "
		printat 23,16,hiScore
		c=get(1)
	until 0
enddef
def_init()
	paper 0: ink 6: cls
	i=0
	repeat
		read,v
		poke 0xb900+i,v
		i=i+1
	until v>250
enddef
def_title()
	i=0
	repeat
		read v
		poke 0xbba8+i,v
		i=i+1
	until v>200
	printat 2,27,"Press any key..."
	plot 1,27,12
	c=get(1)
enddef
def_game()
	poke 0x5a,0
	_board()
	gameState = 0
	playerArmed=0
	gameSpeed = 5
	score = 0
	;;set strites
	sprchar 1,spPlayerNormal
	repeat
		;c=get(1)
		_animator()
		_enemy(rnd(0)\29+6)
		_player()
		sprupd
		wait 2
	until gameState
	poke 0x5a,32
enddef
def_player()
	s=stick()
	if (s&1) & (playerX>6) : playerX = playerX - 1:endif
	if (s&2) & (playerX<34) : playerX = playerX + 1:endif
	if s&24
		if playerArmed == 1
			sprchar 1,spPlayerNormal
			sprupd
			_shoot(playerX)
			playerArmed = 0
		endif
		_printScore()
	endif
	if s&4
		if playerX == src1: playerArmed = 1: endif
		if playerX == src2: playerArmed = 1: endif
		if playerX == src3: playerArmed = 1: endif
		if playerArmed: sprchar 1,spPlayerStone: endif
	endif
	sprpos 1, playerX, playerY
enddef
def_enemy(n)
	if bugsState > 0
		bugsState = bugsState-1
		return
	endif
	bugsState = gameSpeed
	play 1,0,4,100
	if enemies[n] == 0: printat 0,0, n :endif
	plot n,enemies[n],spLadder
	enemies[n] = enemies[n]-1
	plot n,enemies[n],spBug
	if (enemies[n]==10): gameState=1: endif
enddef
def_board()
	cls
	;;lores
	for y=1,27,1:plot 3,y,9:next
	;; stars
	for a=1,50,1:x=rnd(0)\30+5: y=rnd(0)\7+1: plot x,y,"+":next
	;;wall
	for y=10,23,1:for x=5,35,1:plot x,y,163:next:next
	plot 5,9,163:plot 35,9,163
	plot 5,8,163:plot 35,8,163
	plot src1,8,163: plot src2,8,163: plot src3,8,163
	;; init enemies
	for i=0,40,1: enemies[i]=23: next
	;;moon
	_moon(30,2)
enddef
def_hlp()
	cls
	printat 1,4,"Hello Captain,"
	printat 1,6,"A year ago, strange creatures crawled"
	printat 1,7,"out of the ground and began attacking"
	printat 1,8,"cities. All cities have built"
	printat 1,9,"firewalls to protect people."
	printat 1,11,"You are the last survivor of the"
	printat 1,12,"northern defense. The only weapons"
	printat 1,13,"left are stones from the catapults."
	printat 1,14,"The stones are at both ends of the"
	printat 1,15,"wall and in the middle. You have to"
	printat 1,16,"take a stone with an 'arrow up' and"
	printat 1,17,"throw it with an 'space'."
	printat 1,19,"Good luck"
	printat 1,27,"Press any key..."
	c= get(1)
enddef
def_moon(x,y)
	printat x,y,"01"
	printat x,y+1,"23"
enddef
def_printScore()
	printat 28,0,"Score:"
	printat 35,0,score
enddef
def_shoot(n)
	play 0,1,3,2345
	if (enemies[n]) < 23
		score = score + 10
		if (score == 100) | (score == 400) | (score == 800) | (score == 2000) 
			gameSpeed = gameSpeed - 1
		endif
	endif
	enemies[n]=23
	for y=10,22,1:plot n,y,spBrick:plot n,y+1,spStone:wait 2:next
	plot n,23,spBrick
enddef
def_animator()
	if animatorState > 0
		animatorState = animatorState-1
		return
	endif
	animatorState = animatorSpeed
	for i=0,7,1
		poke animatorPlayerNormalAddr+i, peek(animatorPlayerNormalSeqAddr+i+animatorPlayerState*8)
		poke animatorPlayerStoneAddr+i, peek(animatorPlayerStoneSeqAddr+i+animatorPlayerState*8)
		poke animatorBugAddr+i, peek(animatorBugSeqAddr+i+animatorBugState*8)
	next
	animatorPlayerState=animatorPlayerState+1
	animatorBugState=animatorBugState+1
	if animatorPlayerState == 2: animatorPlayerState = 0:endif
	if animatorBugState == 2: animatorBugState = 0:endif
enddef
data 0,0,0,0,0,0,0,0
data 0,12,12,30,45,12,18,51
data 63,63,45,30,12,12,18,51
data 0,62,62,62,0,55,55,55
data 0,54,58,54,0,59,55,59
data 0,12,18,2,12,0,8,0
data 18,44,30,13,44,30,13,0
data 18,13,30,44,13,30,44,0
data 18,45,30,12,45,30,12,0
data 18,44,30,13,44,30,13,0
data 0,12,22,47,63,30,12,0
data 0,0,0,0,4,0,0,0
data 0,12,12,30,45,28,50,3
data 0,12,12,30,45,14,19,48
data 63,63,45,30,12,28,50,3
data 63,63,45,30,12,14,19,48
data 0,0,2,0,0,0,0,32
data 0,0,24,28,14,14,7,7
data 0,32,24,31,15,3,0,0
data 15,15,62,62,60,48,0,0
data 255
data 18,18,18,21,19,19,21,21,19,19,19,21,19,19,19,21,19,19,19,21
data 21,19,19,21,19,19,21,21,19,19,19,21,19,19,21,21,18,18,18,18
data 18,18,18,21,19,21,19,21,19,21,21,21,19,21,21,21,19,21,21,21
data 19,21,19,21,19,21,19,21,19,21,21,21,19,21,19,21,21,23,23,18
data 18,18,21,21,19,21,19,21,19,19,21,21,19,19,21,21,19,19,21,21
data 19,21,19,21,19,21,19,21,19,19,21,21,19,19,21,21,21,23,23,23
data 18,18,21,21,19,19,21,21,19,19,19,21,19,21,21,21,19,19,19,21
data 19,21,19,21,19,19,21,21,19,19,19,21,19,21,19,21,21,23,17,17
data 18,18,18,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21
data 21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,17,17,17,17
data 18,18,18,18,18,18,16,22,22,22,22,23,23,23,23,18,18,16,23,23
data 23,23,23,23,23,23,23,17,17,17,17,17,22,17,17,17,17,22,17,17
data 18,16,23,23,23,16,22,22,20,22,22,22,22,23,23,23,23,23,23,23
data 23,17,17,17,17,17,17,17,17,22,17,17,17,17,22,17,17,17,17,17
data 18,16,23,16,22,22,22,22,20,20,20,22,20,22,22,17,17,17,22,17
data 17,17,22,17,17,17,17,17,17,17,17,17,17,17,17,17,22,17,17,17
data 16,23,16,22,22,20,20,22,22,22,22,22,20,20,22,22,17,17,17,17
data 17,22,17,17,17,22,17,17,17,17,17,22,17,17,17,17,17,17,17,22
data 23,16,22,22,20,20,22,22,20,20,22,22,22,22,22,17,17,17,22,17
data 17,17,17,17,17,17,17,17,22,17,17,17,17,17,16,23,23,17,16,23
data 17,16,22,22,22,22,22,22,22,22,17,17,17,17,17,17,22,17,17,17
data 17,22,17,17,17,17,17,17,17,17,17,17,17,17,16,23,23,23,16,23
data 22,17,16,22,22,22,17,17,17,17,17,17,16,21,21,17,17,17,17,22
data 17,17,17,17,16,23,23,23,23,17,22,17,17,16,23,23,23,23,23,23
data 17,17,17,17,17,17,17,17,16,21,17,17,16,21,21,21,17,22,17,17
data 17,17,17,22,16,23,23,23,23,17,16,23,23,23,23,23,23,23,23,20
data 17,17,16,21,21,21,17,16,21,21,21,17,17,16,21,21,17,17,17,17
data 17,17,17,16,23,23,23,23,23,23,23,23,23,23,23,20,23,20,20,23
data 17,22,16,21,21,21,17,16,21,21,19,17,17,16,21,21,17,16,23,23
data 23,23,16,23,23,23,23,23,23,23,23,20,20,23,20,20,23,23,23,17
data 17,17,17,16,21,21,17,16,21,21,21,21,21,21,21,21,16,23,23,23
data 23,23,23,23,23,23,23,23,20,20,20,20,23,23,23,23,17,17,23,17
data 17,17,22,16,21,21,21,21,21,21,21,21,21,21,17,17,16,23,23,23
data 23,23,23,23,23,20,20,20,20,23,23,23,17,17,17,17,17,17,23,17
data 17,17,17,17,16,21,21,21,21,21,21,21,17,17,16,23,23,23,23,23
data 23,20,20,20,20,23,23,23,23,17,17,17,17,17,17,17,19,17,17,17
data 17,17,17,16,23,23,23,16,21,21,21,21,23,23,23,23,23,23,23,20
data 20,20,23,23,23,23,17,17,17,17,17,17,17,23,16,19,19,19,23,23
data 22,17,16,23,23,23,23,16,21,23,23,23,23,23,23,20,20,20,20,23
data 23,23,23,17,17,17,17,17,23,23,17,17,17,17,17,16,19,19,19,17
data 17,17,16,23,23,23,23,23,23,23,23,23,23,23,20,20,23,23,23,17
data 17,17,17,23,17,17,17,23,23,17,16,19,19,19,17,23,16,19,19,19
data 17,16,23,23,23,23,23,23,23,20,20,20,23,23,23,23,17,17,17,17
data 17,23,23,23,17,17,17,17,17,16,19,19,19,18,19,17,16,19,19,19
data 23,23,23,23,23,23,23,23,20,20,23,23,23,17,17,17,17,17,23,17
data 17,17,17,17,17,17,17,23,23,16,19,18,19,19,19,19,19,19,19,19
data 23,23,20,20,23,20,23,23,23,23,17,17,17,17,17,23,23,23,23,17
data 17,17,17,17,23,23,16,19,17,17,16,19,19,19,19,19,19,19,19,17
data 20,20,20,23,23,23,17,17,17,23,23,23,17,17,17,17,17,17,17,17
data 23,23,23,17,16,19,19,19,19,19,23,16,19,19,19,19,19,19,19,17
data 23,23,23,23,17,17,17,23,23,23,17,17,17,17,17,23,17,17,17,23
data 23,17,17,17,17,17,16,19,19,19,19,19,19,19,19,19,19,19,19,19
data 17,17,17,17,23,23,17,17,17,17,17,17,17,23,23,17,17,17,17,17
data 17,17,23,23,17,17,23,16,19,19,19,19,19,17,16,19,19,19,19,19
data 255
defender.tap
(9.6 KiB) Downloaded 195 times

Please forgive my poor experience for 3D title screen :)
Last edited by rax on Tue Jan 26, 2021 6:55 pm, edited 1 time in total.
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: dflat language update

Post by iss »

Cool little game!
Some help from me:
- left/right arrows move the hero;
- when standing under a brick (left/middle/right) use up arrow to pick a stone;
- and space to trow it :).

To speed-up TAP loading in Oricutron press F6.
User avatar
6502Nerd
Pilot Officer
Posts: 111
Joined: Thu Oct 08, 2020 9:48 pm
Location: Leicestershire, UK
Contact:

Re: dflat language update

Post by 6502Nerd »

Hello rax!

Bravo on the defender game! I am very impressed with your proficiency in using dflat. I read through the source code a little bit, I can see you decided to use the software sprite system, plus disabled ctrl-c scanning and also it runs quite nice without any ASM. Really good! 8)

You are showing me up - I have only done one example game but rax already has done two! :)

Also learned something (or at least re-remembered!).. I thought there was a bug where you use 'return' to end a procedure but without a value. I thought a value was required but I just tried it and yes it works fine... this is amazing considering that I did actually design and code it that way :-D

Nice tips from iss - thanks for trying out rax's new creation! :D

I have not many bytes in the ROM free, but I am doing three things for the next release of dflat;
- Looking at opportunities to save a few bytes
- Looking at bugs (already see that return keyword works without a value, so this is ok!)
- Looking at speed up of the core interpreter (I think it's not much without a complete overhaul, but checking anyway)
- Possibilities to add missing feature or enhance a feature (e.g. in hires, want to set attributes not only pixels without poke)

Any suggestions welcome :-)
[Edit: I found a quite big bug in the parser - keywords requiring 1 parameter still get tokenised with no parameters! Not sure when/how this came in but it means that rax your games with return having no value and also data statements with comma and nothing afterwards will have syntax errors in the next release! Sorry about that, but it's an easy fix to your program luckily..]
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: dflat language update

Post by rax »

Hi :)

I decided to test the some of graphics commands:

Code: Select all

; * PIX in DFLAT! *
; * 01/2020 rax *
def_s()
    poke 0x5a,0
    paper 4: ink 7: hires: cursor(1)
    x=120: y=100
    dim s$[40]
    dim modetxt$[10,5]
    modetxt$[0]="none"
    modetxt$[1]="point"
    modetxt$[2]="circle"
    modetxt$[3]="line"
    modetxt$[4]="text"
    _draw()
enddef
def_draw()
    pixmode 1
    plot x-2,y-3,43
    pixmode 2
    type = 1
    x0=0:y0=0
    _setOldPos()
    repeat
        st = stick()
        c= get(1)
        plot x-2,y-3,43
        if type >1: _action(type,2): endif
        if (st&1): x=x-1: endif
        if (st&2): x=x+1: endif
        if (st&4): y=y-1: endif
        if (st&8): y=y+1: endif
        if (st&16)
            _action(type,1)
            if type > 1
                type = 1
                _setOldPos()
            endif
        endif
        if (c=='1'): type=1 : _setOldPos()
        elif (c=='2'): type=2 : _setOldPos()
        elif (c=='3'): type=3 : _setOldPos()
        elif (c=='4'): _printText(): _setOldPos(): type = 1
        endif
        if type >1: _action(type,2): endif
        plot x-2,y-3,43
    until c==27
enddef
def_setOldPos()
    cls
    print "mode: ":print modetxt$[type] 
    println 
    println "1:Point   2:Circle   3:Line   4:Text"
    print "PIX | keys: arrows, space, 1, 2, 3, 4"
    poke 49080,22
    poke 49081,0
    x0=x:y0=y
enddef
def_action(type,mode)
    if type==1 
        pixmode mode
        point x,y
        pixmode 2
    elif type==2
        l=x-x0
        if l<0:l=x0-x:endif
        pixmode mode
        circle x0,y0,l
        pixmode 2
    elif type==3
        pixmode mode
        line x0,y0,x,y
        pixmode 2
    endif
enddef
def_printText()
    cls
    cursor(0)
    print "Text:"
    input s$
    plot x,y,s$
    cursor(1)
enddef
pix.tap
(2.29 KiB) Downloaded 182 times

I like how the 'plot' works in hi-res mode.

I will soon make a list of the things I found about the language :)
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: dflat language update

Post by iss »

Screenshot_20210129_183929.png
Cool! It reminds me of Turtle Graphics :)
User avatar
6502Nerd
Pilot Officer
Posts: 111
Joined: Thu Oct 08, 2020 9:48 pm
Location: Leicestershire, UK
Contact:

Re: dflat language update

Post by 6502Nerd »

Very nice rax! Yes I wanted the plot command to work in lores and hires, glad you spotted that..there is a secret poke which changes the pitch e.g. you can make the text be 5 pixels (or some other value than 6) apart!

Also, you can save the screen with bsave 0xa000,8000,"name.tap" (restore using bload 0xa000,"name.tap") :-)

Hope you see the line drawing is a lot faster than the usual draw command - also due to the way I calculate circles, when it gets more than about 70 pixels radius, doesn't look very round (this was a speed/space trade off)!
User avatar
jbperin
Flight Lieutenant
Posts: 480
Joined: Wed Nov 06, 2019 11:00 am
Location: Valence, France

Re: dflat language update

Post by jbperin »

* The syntax of the language is very light
* It is structured programming
* Possibility to give long name to variables
* I couldn't test but it looks far faster than usual basic (or even C)
* Inline assembly !!

This language definitely has some massive pros
rax wrote: Fri Jan 29, 2021 4:25 pm

Code: Select all

; * PIX in DFLAT! *
; * 01/2020 rax *
By the way .. I think I found a bug on the second line of comment. 🤣
Post Reply