carlsson Posted June 26, 2017 Share Posted June 26, 2017 (edited) Small snag: The WAV files generated by MAME can not be loaded on the real computer, even after reducing the volume. The WAV files recorded from the computer also can't be loaded back by MAME, even after increasing the volume. The waves are similar, except that MAME produces a strict square wave while the computer signals have a bit more rounded edges. I didn't measure the length of each sample to ensure they're the exact same frequency, but visually comparing the two in Audacity suggests they're close. However, the WAV files recorded from the Laser computer to my PC are possible to load back to the Laser again, so loading and saving per se are working which is good to know. Edit 1: I measured, and the generated samples from MAME are about 10-20% shorter than the ones recorded from the computer. I tried to slow the sample by the same amount, but it made no difference. Edit 2: I tried once more, making sure to slow the MAME WAV by 20% which actually made it load on the Laser 500 computer! Perhaps slowing it by 25% would be even more on the safe side. Well then, I'm still rolling. Edited June 26, 2017 by carlsson Quote Link to comment Share on other sites More sharing options...
carlsson Posted June 26, 2017 Share Posted June 26, 2017 Quote Link to comment Share on other sites More sharing options...
carlsson Posted July 1, 2017 Share Posted July 1, 2017 (edited) Both in the MAME emulator and on my real Laser 500, one needs to OUT &H43,7 before writing to the video memory. It produces some garbage at the bottom of the screen and locks up the computer at first, but if you issue a soft reset it kind of works. OUT &H43,5 to restore the memory map. Perhaps PRINT is a safer way to work with the screen matrix than POKE, at least until I understand exactly what it happening. I didn't realize the CLEAR command is supposed to take a leading comma, so if one calls CLEAR ,49151 before OUT, the garbage doesn't appear. It sets off the upper 16K from BASIC usage, effectively lowering the amount of usable memory from 29797 to 13415 bytes, but gives one full access to the segmented 2K video memory (and other parts of that area, if one needs own machine code programs). I'm taking my very first steps in Z80 right now, we'll see what it becomes. Edit: It seems CLEAR ,61439 is well enough, as it reserves the top 4K whileas the screen matrix is at &F800. Even CLEAR ,63487 would be enough for that purpose. Edited July 1, 2017 by carlsson Quote Link to comment Share on other sites More sharing options...
carlsson Posted July 1, 2017 Share Posted July 1, 2017 Ok, this one scrolls along at a decent speed. More game code will surely slow it down quite a bit, but compared to doing it entirely in BASIC, it is way faster to use a machine code routine for the scrolling bit: CLEAR ,61439:OUT 67,7 10 DATA &H06,39,&H2E,80,&H1E,82,&H0E,8,&H26,&HF8,&H16,&HF8,&H1A,&H77,&H24,&H14,&H0D,&H20,&HF9,&H2C,&H2C,&H1C,&H1C,&H05,&H20,&HEC,&HC9,-1:W=&HF000:SD=W 12 READ M:IF M<>-1 THEN POKE W,M:W=W+1:GOTO 12 14 DEF FN P$(X,Y)=CHR$(27)+CHR$(161)+CHR$(31+X)+CHR$(31+Y):L=7:A(1)=32:A(2)=160:CLS:PRINT FN P$(1,17);"SCORE: 00000" 20 FOR I=0 TO 7:POKE &HF89E+I*256,A(1+ABS(I>=L)):NEXT:CALL SD 30 L=L+(RND(1)>0.4 AND L>1)-(RND(1)>0.4 AND L<7):GOTO 20 Quote Link to comment Share on other sites More sharing options...
JamesD Posted July 1, 2017 Share Posted July 1, 2017 I didn't realize the CLEAR command is supposed to take a leading comma, so if one calls CLEAR ,49151 before OUT, the garbage doesn't appear. It sets off the upper 16K from BASIC usage, effectively lowering the amount of usable memory from 29797 to 13415 bytes, but gives one full access to the segmented 2K video memory (and other parts of that area, if one needs own machine code programs). I'm taking my very first steps in Z80 right now, we'll see what it becomes. Edit: It seems CLEAR ,61439 is well enough, as it reserves the top 4K whileas the screen matrix is at &F800. Even CLEAR ,63487 would be enough for that purpose. I'm guessing there is an optional additional parameter for string space, files, or something along those lines Quote Link to comment Share on other sites More sharing options...
carlsson Posted July 1, 2017 Share Posted July 1, 2017 The programs I've seen use the syntax CLEAR 5000 without the comma, but I don't know which part of memory it sets off and PRINT FRE(0) makes no difference with this syntax. I seem to recall that on Commodore BASIC, which is a Microsoft version just like this appears to be, regular variables start right after the listing while strings start at MEMTOP and work backwards. It is possible this works the same The details I know so far is that some system variables are in the range &H8030 - &H8604 and that BASIC programs start at &H8995. How much of that area inbetween is free for own use is hard to say without a complete memory map. But hey, it prompted me to download Usborne's book on machine code programming for beginners, just to get an entry in how Z80 is similar & different to 6502. Previously I've never touched Z80 code, now I'm a little curious to dig deeper into it. Quote Link to comment Share on other sites More sharing options...
JamesD Posted July 2, 2017 Share Posted July 2, 2017 Watch differences in how status bits are set, and instructions that only deal with specific registers.That's the most annoying part of going back and forth between different CPUs. 1 Quote Link to comment Share on other sites More sharing options...
carlsson Posted July 7, 2017 Share Posted July 7, 2017 Coming soon to a VTech Laser 500 computer near you! I still need to do a little more testing and optimization, in particular take advantage of the ML sound routines in the Flipper game that don't slow down the game to a halt, as well as testing the game on real hardware. I will also consider how many points a jellyfish should be worth, comparing to the penalty to be paralyzed for 20 frames. 2 Quote Link to comment Share on other sites More sharing options...
Platis Posted February 15, 2018 Share Posted February 15, 2018 (edited) Nice Anders! I have finally come across a manual! Pretty comprehensive, about 325 pages Includes BASIC, technical, display modes, subroutines, monitor, schematics, etc. Not so easy to scan without destroying it unfortunately, but is it something special you wonder about, just ask! I have two 500 and have noticed a thin crack or a cut in the plastic shell in the upper right corner, ca 10 cm long in both my computers, look very strange indeed. Defective mold or something? Somebody else notice? Not Laser 200/300/500, but I saw a new video on youtube yesterday about the Vtech IQ Unlimited(mentioned earlier in the tread)! Not 100% accurate, but interesting anyway! The lack of BASIC commands for sound, color and graphics is the major drawback in my opinion, but the inbuilt applications(and the 80 column mode) rise it above "just a toy" I think! Usually very cheap on ebay(...and collectible?)!! Edited February 15, 2018 by Platis 1 Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 15, 2018 Share Posted February 15, 2018 (edited) You could look up a couple of things for me: * Does the manual at all talk about custom graphics? Are those possible, or only drawing in hires mode? I never quite figured that out myself. * How about accessing the video memory directly? As you saw I managed to find a way with CLEAR and OUT to redirect access but as those commands don't seem to work from within a listing, I wonder if there is another way to do it. Asking the user to issue a couple of commands before loading a program has happened elsewhere before, but it isn't quite so nice. * What is the correct syntax for CLEAR, as I've seen it both with and without a leading comma? Frankly I haven't been finishing up my game I was working on last summer. I suppose that is yet one more project for the back burner to return to when I get the motivation. Edited February 15, 2018 by carlsson Quote Link to comment Share on other sites More sharing options...
Platis Posted February 15, 2018 Share Posted February 15, 2018 (edited) Nope, can't find any mention about custom graphics in the manual! But it seems no obvious reason why not(if not a design choice?)! The custom VLSI chip does the video, memory mapping(even bank switching) and I/O decoding. Separate external character ROM. I think it uses the regular/main RAM so possible you can POKE it if you get the right location!? It uses bank switching, 16 pages a' 16K in a 256K space, page 3 and 7 are used as video RAM! Some I/O locations to control modes etc. Screen map adresses does not really seems direct to correlate to this(maybe as page 7 adresses ?). Let me read this more carefully and come back later! Says it uses 40/80 bytes per display line in all modes, do not know if this mean that all modes use same memory locations versus screen location?? Should simplify things alot. Also it seems to be some overshoot(empty memory space after each line). Syntax for CLEAR is; CLEAR, M, N M=set the highest memory in use for BASIC N=set aside stack space for BASIC (default 512 bytes) Edited February 15, 2018 by Platis 1 Quote Link to comment Share on other sites More sharing options...
JamesD Posted February 15, 2018 Share Posted February 15, 2018 I wonder if graphics memory is like the Samsung SG-1000.It's video RAM is addressed with the Z80 I/O interface. Quote Link to comment Share on other sites More sharing options...
Platis Posted February 15, 2018 Share Posted February 15, 2018 (edited) Only control codes to switch modes, background color etc uses the I/O space I think! Z80 I/O space can only adress 256 different locations(8 bits)! Do you mean Sega SG-1000? Edited February 15, 2018 by Platis Quote Link to comment Share on other sites More sharing options...
Platis Posted February 15, 2018 Share Posted February 15, 2018 Memory map! 1 Quote Link to comment Share on other sites More sharing options...
JamesD Posted February 16, 2018 Share Posted February 16, 2018 Only control codes to switch modes, background color etc uses the I/O space I think! Z80 I/O space can only adress 256 different locations(8 bits)! Do you mean Sega SG-1000? LOL, it's the SPC-1000... I just mixed up the model numbers. Looks like it's just paged from the memory map. Quote Link to comment Share on other sites More sharing options...
Platis Posted February 16, 2018 Share Posted February 16, 2018 Yes, and I am more and more convinced that it also uses the main RAM memory after checking schematics! The memory map is for all three version of Laser 350, 500 and 700 so it can appear little confusing. 350 has 16K RAM at page 3 500 and 700 has 64K RAM at page 4-7 700 has a total 128K RAM=more RAM can be bank switched in under program control! Quote Link to comment Share on other sites More sharing options...
Platis Posted February 16, 2018 Share Posted February 16, 2018 Display modes: Lowest memory location is in left upper screen corner, highest in the right lower corner, All addresses are from the screen maps. Text modes 2K; 80 bytes/row 24 rows F800-FFFF(FFA0H=beginning of row 24) 40 character, 16 colors (even byte=character code, odd byte=color) 80 character, 2 of 16 colors (back and foreground color is written to I/O port 45H) Character= 5x7 dots in a 8x8 grid Graphic modes 8K; All modes 40 bytes/line E000-FFFF(FFA0=beginning of last line) GR0 160H x 96V, 16 colors, (vertical resolution is in fact 192, but every odd line is a duplication of the last even line) GR1 160 x 192, 2 of 16 colors GR2 320x192, 2 colors Graphics modes 16K; All modes 80 bytes/line C000-FFFF(FFA0H=beginning last line) GR3 160x192, 16 colors GR4 320x192, 2 of 16 colors(even byte=8 pixels(1=foreground color , 0=background color), odd byte=back and foreground color info for the 8 pixels) GR5 640x192, 2 colors, every bit is an pixel(80 bytes=80x8=640 pixels), back and foreground color info written to I/O port 45H 1 Quote Link to comment Share on other sites More sharing options...
Platis Posted February 16, 2018 Share Posted February 16, 2018 Both in the MAME emulator and on my real Laser 500, one needs to OUT &H43,7 before writing to the video memory. It produces some garbage at the bottom of the screen and locks up the computer at first, but if you issue a soft reset it kind of works. OUT &H43,5 to restore the memory map. Perhaps PRINT is a safer way to work with the screen matrix than POKE, at least until I understand exactly what it happening. This is one of the four I/O ports (40-43H) that control the bank-switching! 1 Quote Link to comment Share on other sites More sharing options...
carlsson Posted February 16, 2018 Share Posted February 16, 2018 (edited) So if I switch in 16K block #7 into the memory map at $C000, would that be 16K VRAM or 16K all purpose RAM that the graphics subsystem also has access to? Apparently I can store and execute machine code at $F000 (*), so perhaps it is fine to CLEAR ,61439 ($EFFF) and let BASIC use the lower 12K of this block for variables as long as I don't switch graphics mode to one that uses more VRAM. Does it say which I/O port is toggled by the TEXT and GR commands, or perhaps it doesn't work that way? How does one read the current bank switching setup? We know that OUT will change it. Edit: This page answers some of those questions. http://www.razzmoket.esy.es/memoire.htm (*) Well, at least in MAME emulation as I haven't tried my own program on real hardware yet Edited February 16, 2018 by carlsson Quote Link to comment Share on other sites More sharing options...
Platis Posted February 16, 2018 Share Posted February 16, 2018 (edited) I think the hole bank-switching scheme and memory addressing is little confusing to fully understand, also little different between 350 and the 500/700. C000-FFFFH screen map addresses is mapped in at 4000-7FFFH in the logic 64K memory space(as the cpu sees it) and can be C000-FFFH(page 3) or 1C000-1FFFFH(page 7) of the physical 256K memory space(determined by bit 3 at I/O port 44H). The logic 64K memory space is divided in to four 16K "windows" by ports 40-43H(43H=C000-FFFF). Then some different memory pages can be flipped in and out of some of this 16K windows. Page 1(4000-8000H) that is 16K ROM at start up can be flipped out with page 3 or 7(display RAM) or page 2(memory mapped I/O) temporarily. Page 0, the first 16K(BASIC ROM) can not be flipped and therefore also always = window 0000-4000H! Edit; The memory map for Laser 500 here; http://www.razzmoket.esy.es/memoire.htm, seems to be much more logic and correct,with page 7(video RAM) placed in the top 16K. I think page 3 are only availably on Laser 350 that has RAM in this lower area!? Logic memory space RAM between 8000-C000H in the left picture, marked as page 3 is probably a miss print and should be 4. I/O port 44H controls the display modes; In textmode; Bit 0: 0=40 column, 1=80 column Bit 1: x Bit 2: x In graphics mode; GR0 Bit 0=x Bit 1=0 Bit 2=1 GR1 Bit 0=1 Bit 1=1 Bit 2=1 GR2 Bit 0=0 Bit 1=1 Bit 1=1 GR3 Bit 0=1 Bit 1=1 Bit 2=0 GR4 Bit 0=0 Bit 1=1 Bit 2=0 GR5 Bit 0=x Bit 1=0 Bit 2=0 Bit 3; 0=page 3 and 1=page 7 in all modes Bit 4-7, is the backdrop color, 4=Blue, 5=Green, 6=Red, 7=Brightness The ports are write only and can not be read back if I understand things right! The difference between "2 of 16 colors" and "2 colors"(also of a 16 color palette) graphic modes is that in "2 of 16 colors" you can change color after every 8 pixels(every odd byte holds the info of the two colors) in the other case you can only change for the hole screen at once(write color info to port 45H)! Edited February 16, 2018 by Platis 1 Quote Link to comment Share on other sites More sharing options...
Platis Posted February 17, 2018 Share Posted February 17, 2018 (edited) Sorry for all typos, trying to do better! Tell me if something is not understandable! Okay, I read little more on bank-switching, this is my conclusion so far; The logical memory address space of the Z80, 64K, is divided in to four 16K windows. The physical memory space is 256K=16 by 16K shunks/banks/pages or whatever you want to call it. Each of the four windows of the logical memory space can be assigned with anyone of the 16 different pages/banks of the physical memory space( in theory, there are probably some limitations). The logical 64K memory space that the CPU see is divided like this and is assigned to four I/O ports; Window/bank 0, 0000-3FFF, port 40H Window/bank 1, 4000-7FFF, port 41H Window/bank 2, 8000-BFFF, port 42H Window/bank 3, C000-FFFF, port 43H You simply write the bank/page number(1-16) to the right I/O port of the window you want to assign it with! Ex. Out &H43, 7 (swapping in 16K video RAM page 7 in the top 16K logical memory map, C000-FFFF) Out &H43, 5 (swapping in 16K RAM page 5 in the same area) Machine language LD A, 7 OUT (43H), A So if I switch in 16K block #7 into the memory map at $C000, would that be 16K VRAM or 16K all purpose RAM that the graphics subsystem also has access to? Page 7(or 3) is tied to the video circuits at all time and constantly update your screen with its contents. When you switch it in, in one of the four 16K windows, you can access it and change it contents at those window addresses. All do, access time is shared between CPU and video circuits, which perhaps explain garbage on the screen and possible limitation. It would have been a nice feature if it really was possible to switch between two VRAM pages(3 and 7) on the fly. The manual states the VLSI chip is the same in all Laser 350/500/700 and that it is possible to switch between page 3 and 7 when writing to bit 3 in port 44H. But I suspect there is no RAM at page 3 on a 500 because it is mapped differently than the 350, a 350 with RAM expansion could possible reach both pages. The 500 64K RAM is said to be at page 4 to 7. The bank-switching on Laser 350/500/700 seem to be very dynamic. It seems to switch in and out pages very regularly/frequently to do even basic things like for example reading the keyboard(page 2=memory mapped I/O) or write to the video memory. I am not to familiar with bank-switching before but usually I associate it with extended RAM or other expansion, here the computer wouldn't work on basic level without it----only my reflection! There are of course a clear parallel to the VLSI chip on the LASER 128 which also have a crisp video/80 column and does a tons of things. But also to Sinclair(ULA), Acorn and Amstrad. Probably this was a major achievement for VTECH in 1984-85 to produce its own custom ASIC chip. In Laser 350/500/700 it says to compromise hundreds of regular ICs. Be aware that nothing above is tested on real hardware, but be welcome to verify whats working or not! Edited February 17, 2018 by Platis Quote Link to comment Share on other sites More sharing options...
Bonstra Posted February 28, 2018 Share Posted February 28, 2018 (edited) So if I switch in 16K block #7 into the memory map at $C000, would that be 16K VRAM or 16K all purpose RAM that the graphics subsystem also has access to? On the Laser 500, the 8 64Kb DRAM chips are shared between the CPU and the video hardware. The CPU accesses RAM through the VLSI IC, which acts as a proxy and can insert wait states for the CPU if the RAM is already in use by the video hardware. As seen by the VLSI, the 64 KB RAM occupies banks 4 to 7, the video hardware uses the RAM at the top of bank 7 as video memory for both text and graphic modes (it can be configured to use bank 3 instead, but it is unpopulated on the Laser 500/700). Depending on the mode you're using, you may or may not use the lower area of bank 7 as general-purpose RAM. Video Mode Video RAM Free for user TEXT40/80 3800-3FFF 0000-37FF GR0/1/2 2000-3FFF 0000-1FFF GR3/4/5 0000-3FFF None The offsets in the above table are given relative to the start of bank 7. The corresponding CPU address space range depends on what window the bank 7 is assigned to (if at all). Edited February 28, 2018 by Bonstra 1 Quote Link to comment Share on other sites More sharing options...
carlsson Posted March 1, 2018 Share Posted March 1, 2018 I suppose routines like PRINT in the ROM will do an OUT to change the memory layout, plot the characters and then OUT to switch to original layout? I'm considering whether writing a small machine code routine VPOKE that does the same would be better than me manually clearing off a memory area and changing the memory map before loading/running a program. Since I already wrote a scrolling routine in machine code that does the majority of screen updates, the potential slow down from POKE an address and value to a safe location and then pick up those values in the called machine code routine would be reasonably little. In theory I suppose some C compiler might be repurposed to output binaries, perhaps with a BASIC stub followed by machine code. Quote Link to comment Share on other sites More sharing options...
Bonstra Posted March 1, 2018 Share Posted March 1, 2018 In theory I suppose some C compiler might be repurposed to output binaries, perhaps with a BASIC stub followed by machine code. I'm using sdcc to compile for a z80 target. I suppose the BASIC stub could be added as part of a custom crt0.s Quote Link to comment Share on other sites More sharing options...
nippur72 Posted June 13, 2018 Share Posted June 13, 2018 I just bought a (hopefully) working unit on eBay... couldn't resist Who is still active on this machine? I need to gather as much info as possible (memory map, cross compiling tools, interfaces with pc...) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.