Go to advanced search

by gertk
Sun Nov 18, 2012 3:05 pm
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Re: Bare Metal ZX81 emulator

Added ZXpand compatible joystick interface on GPIO pins: very_small_2012-11-18 15.54.01.jpg Initialization: // initialize IO pins for joystick void joystick_init() { // set pins to input SetPinFunction(21,GPIO_INPUT); // Fire button SetPinFunction(22,GPIO_INPUT); // Right SetPinFunction(23,GPIO_INPU...
by gertk
Sun Nov 18, 2012 12:06 pm
Forum: Bare metal, Assembly language
Topic: Interrupt programming
Replies: 11
Views: 7175

Re: Interrupt programming

This is from the bootloader I use from dwelch67: It sets up (copies) the vectors at adress 0x00000000, you will need add your own c_irq_handler in which you need to find out what caused the interrupt. (I use it to receive a serial input character from the mini_uart and to respond to the Vsync interr...
by gertk
Tue Nov 13, 2012 6:53 am
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Re: Bare Metal ZX81 emulator

That's true, although traditionally it was never done that way... I seem to recall always having to write little machine code things in a REM statement to do the OUT instruction! :lol: Whichever memory locations you choose, they won't be available for RAM any more (obviously). If you were cunning, ...
by gertk
Mon Nov 12, 2012 6:33 pm
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Re: Bare Metal ZX81 emulator

Goody!!! This is great stuff. Concerning the shortage of GPIO pins for use with a membrane keyboard, I wouldn't worry much about that. As long as the keyboard is put through something like a MCP23017 chip, which is just a wiring job really, it will magically transform into an i2c device that requir...
by gertk
Mon Nov 12, 2012 6:27 am
Forum: Bare metal, Assembly language
Topic: [BareMetal] USB
Replies: 31
Views: 11743

Re: [BareMetal] USB

I am also very much interested in your USB code. Framebuffer is already working fine, SDcard initializes but that is about it :) Programming in C or assembler itself is not a problem, just the lack of proper documentation and examples on the Pi's hardware.
by gertk
Sun Nov 11, 2012 10:14 pm
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Re: Bare Metal ZX81 emulator

very_small_2012-11-11 23.41.07.jpg Could not resist... I have made some progress in emulating the ULA chip, the screen is now 'built' with the original INT and NMI interrupts for the active and blank lines. Fast and slow modes are also working. Alas none of the Hires programs are working, it still ...
by gertk
Thu Nov 08, 2012 5:40 pm
Forum: Bare metal, Assembly language
Topic: Simple printf and sprintf
Replies: 5
Views: 3825

Re: Simple printf and sprintf

For a full-featured yet small code size (s)printf library I can recommend format . Doesn't do any floating point yet, as I haven't yet had time to work on that part. Looks good also, floating point is no direct priority for me, just needed to have a sprintf and for debugging printf is very handy. :)
by gertk
Wed Nov 07, 2012 9:46 pm
Forum: Bare metal, Assembly language
Topic: Starting bare metal...
Replies: 3
Views: 2038

Re: Starting bare metal...

This is what my setup looks like: MicroSD adapter with massive 8GB card (left over from my G1...) formatted in two partitions: one small 100 Mb FAT16 boot partition and a bigger FAT32 storage partition (for later use) Powerswitch in between the cable to the micro USB connector (positive line) and th...
by gertk
Wed Nov 07, 2012 9:29 pm
Forum: Bare metal, Assembly language
Topic: Simple printf and sprintf
Replies: 5
Views: 3825

Re: Simple printf and sprintf

How is this, converted to fixed number of shifts so speed should be improved now. Tested on gcc (Ubuntu): A=100 B=3 A div B=33 A=100 B=3 A mod B=1 A=-100 B=3 A div B=-33 A=-100 B=3 A mod B=-1 A=100 B=-3 A div B=-33 A=100 B=-3 A mod B=1 A=-100 B=-3 A div B=33 A=-100 B=-3 A mod B=-1 tested mymod and m...
by gertk
Wed Nov 07, 2012 5:29 pm
Forum: Bare metal, Assembly language
Topic: Simple printf and sprintf
Replies: 5
Views: 3825

Re: Simple printf and sprintf

Well, thanks for nothing. I did say it has a crude div and mod function. For Bare Metal simple debugging without including huge stdlib stuff it works fine for me. Just replace mydiv and mymod by the routines of your choice.
Instead of ranting why not put an improved version here yourself ? :?:
by gertk
Tue Nov 06, 2012 10:53 pm
Forum: Bare metal, Assembly language
Topic: Starting bare metal...
Replies: 3
Views: 2038

Re: Starting bare metal...

It does not matter how you program 'Bare Metal' in C or assembler. For ease of writing C is definitely easier and should you get into performance issues you can always add assembler routines if needed. With gcc you can mix them without problems. For programming the GPU you will have to dig in deep, ...
by gertk
Tue Nov 06, 2012 10:41 pm
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Re: Bare Metal ZX81 emulator

Ahhhh... at the risk of being pedantic... no no no! Emulating the electron beam timings is a big part of the challenge of the ZX81. It really shouldn't be much more work than what you have already, you "just" have to determine whether a signal (including vsync, hsync) is actually coming from the "Z...
by gertk
Tue Nov 06, 2012 10:24 pm
Forum: Bare metal, Assembly language
Topic: Simple printf and sprintf
Replies: 5
Views: 3825

Simple printf and sprintf

I added some crude divide and module functions to this but it works fine. A simple printf and sprintf function by Georges Menie /* Copyright 2001, 2002 Georges Menie (http://www.menie.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser Gener...
by gertk
Tue Nov 06, 2012 5:39 pm
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Re: Bare Metal ZX81 emulator

Wow this is superb, only just noticed it here. Don't worry about the keyboard line handling - a ZX81 keyboard membrane is a tenner off eBay! Even if you get it working via a USB keyboard, you should retain the possibility of connecting a real membrane as an option! :lol: Due to limited IO pins this...
by gertk
Sat Nov 03, 2012 2:23 pm
Forum: Bare metal, Assembly language
Topic: Bare metal framebuffer in C
Replies: 43
Views: 18395

Re: Bare metal framebuffer in C

I gave a try to the howto and succeeded. Cool! So what's the different between the way of the howto used and the way of your "bare metal"? The difference is the OS :) In bare metal mode there is no OS active, just the program you have named kernel.img The boot time is nearly instant (aside from the...
by gertk
Thu Nov 01, 2012 6:53 am
Forum: Bare metal, Assembly language
Topic: Cannot make dwelch's uart examples work
Replies: 4
Views: 1697

Re: Cannot make dwelch's uart examples work

When in doubt you can always insert a resistor of 100 to 500 ohms in series with the TX and RX lines and remove if necessary when it is working.
by gertk
Wed Oct 31, 2012 12:13 am
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Re: Bare Metal ZX81 emulator

DrPinball wrote:Let me know how you get on with it!
After some testing it seems that the Vsync interrupt is occuring midscreen ?
(at least that is where there is visible tearing during motion)
Maybe because of double buffering of the GPU ? (or simply because my display routine is till too slow :o )
by gertk
Tue Oct 30, 2012 11:46 pm
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Re: Bare Metal ZX81 emulator

And got a decent speed now also, enabled the L1 cache and optimized the display routine a bit.
Progress!
by gertk
Tue Oct 30, 2012 10:37 pm
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Re: Bare Metal ZX81 emulator

It works ! Thanks!

Had to puzzle a bit to get both the uart interrupt and the 'new'SMI' interrupt working until I found out they were handed to the same handler :D
by gertk
Tue Oct 30, 2012 6:37 am
Forum: Bare metal, Assembly language
Topic: Cannot make dwelch's uart examples work
Replies: 4
Views: 1697

Re: Cannot make dwelch's uart examples work

I also tried to power the Pi from the USB port of the host computer but it did not work, at least not when I got a power switch in between the +5 of the USB serial adapter and the Pi. Everytime I switched on the Pi the USB port got reset and the serial adapter quit working. At the moment I use the R...
by gertk
Tue Oct 30, 2012 6:26 am
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Re: Bare Metal ZX81 emulator

Great ! Will try this tonight!
by gertk
Mon Oct 29, 2012 7:21 am
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Re: Bare Metal ZX81 emulator

I bet it's fast. I hope you take advantage of the multiple of memory to do a lot of pre-decoding of the Z80 bytecode. :) I suppose cross compiling it to ARM code in 4* the bytes could be expensive in memory? The nightmare of self modifying code with entry to the instruction stream half way through ...
by gertk
Sun Oct 28, 2012 11:22 pm
Forum: Bare metal, Assembly language
Topic: Bare Metal ZX81 emulator
Replies: 30
Views: 10018

Bare Metal ZX81 emulator

Just to get the hang of this Bare Metal stuff I ported my mbed ZX81 emulator to the Pi :) No SDcard or USB keyboard yet alas.. A (ZX81) program binary can been uploaded through the serial port (xmodem) and keyboard emulation is a crude serial to ZX keyrow conversion. Need a Vsync or other 50/60 Hz t...
by gertk
Sun Oct 28, 2012 5:27 pm
Forum: Bare metal, Assembly language
Topic: uart rx with interupts
Replies: 5
Views: 2402

Re: uart rx with interupts

Is there an updated version about the AUX_MU_IER_REG In the example bits 0 and 2 are set in this register but according to the manual for receive interrupts it should be bit 1 ?? In the Errata I could not find an edited description only: Bits 3:2 are marked as don't care, but are actually required i...
by gertk
Fri Oct 26, 2012 8:23 pm
Forum: Bare metal, Assembly language
Topic: Bare metal framebuffer in C
Replies: 43
Views: 18395

Re: Bare metal framebuffer in C

For 16 bit depth I modified the DrawPixel routine to this: VOID DrawPixel(UINT32 x, UINT32 y, UINT16 colour) { VUINT16 *ptr; UINT32 offset; offset = (y * fb_info.Pitch) + (x<<1); ptr = (UINT16 *)(fb_info.Pointer + offset); *ptr = colour; return; } The (X<<1) multiplies the X offset by two otherwise ...

Go to advanced search