{"id":927,"date":"2020-01-15T22:51:07","date_gmt":"2020-01-15T21:51:07","guid":{"rendered":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/?p=927"},"modified":"2024-05-14T16:34:20","modified_gmt":"2024-05-14T15:34:20","slug":"68k-sbc-programming-on-linux","status":"publish","type":"post","link":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/?p=927","title":{"rendered":"68k SBC Programming on Linux"},"content":{"rendered":"\n<h2>68k SBC Programming on Linux<\/h2>\n\n\n\n<p>Having grown up using computers based on Motorola&#8217;s 68k family of microprocessors, I have been considering trying to build a simple 68k processor computer of my own. Given how long it took me to get around to build a breadboard Z80 computer, and with a growing sense that I really should learn how to program a GAL or CPLD to reduce the chip count&#8230; I decided to buy one of <a href=\"http:\/\/kswichit.net\/68008\/68008.htm\">Wichit Sirichote&#8217;s single board computers based on the 68008 processor<\/a> (URL updated 2024 to new website).<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter columns-1 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"977\" height=\"1024\" src=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/68008_Board_2-977x1024.jpg\" alt=\"\" data-id=\"959\" data-full-url=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/68008_Board_2.jpg\" data-link=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/?attachment_id=959\" class=\"wp-image-959\" srcset=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/68008_Board_2-977x1024.jpg 977w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/68008_Board_2-286x300.jpg 286w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/68008_Board_2.jpg 1251w\" sizes=\"(max-width: 977px) 100vw, 977px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\"><em>68008 Single Board Computer<\/em><\/figcaption><\/figure>\n\n\n\n<p>The Motorola 68008 is a slightly odd chip which has 32 bit internal functionality, coupled to an 8 bit data bus instead of the 16 bit data bus of the regular 68000. It was designed to be a cheaper \/ simpler alternative to the 68000 processor.<\/p>\n\n\n\n<p>The following page details how I got to the point that I could run my own software written on a Debian-ish Linux machine, on the 68008 board.<\/p>\n\n\n\n<h4>Step 1 &#8211; Get the Assembler and Compile it<\/h4>\n\n\n\n<p>I decided to use the <a href=\"http:\/\/sun.hasenbraten.de\/vasm\/\">vasm assembler<\/a>. It runs on multiple platforms and can assemble code for a large number of processors including the Z80, 6502 and 68008, all of which are of interest to me for various computers \/ projects. I downloaded the latest release source, which at the time of writing is v1.8g (<a href=\"http:\/\/elephantandchicken.co.uk\/downloads\/vasm.tar.gz\">locally hosted here<\/a>).<\/p>\n\n\n\n<p>I extracted the source code into a folder called vasm (using the GUI archive tool because I&#8217;m lazy), before navigating to within the folder in a terminal. To decompress from the command line you should use the command &#8220;tar -xvf .\/vasm.tar.gz&#8221; from within the same directory &#8211; note this is &#8220;-xvf&#8221; not &#8220;-xvzf&#8221; as the file appears to be only a tar and not zipped, but misnamed. Given that I&#8217;m running linux, I figured I could use the default make file and so all I had to do was run the command :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make CPU=m68k SYNTAX=mot<\/code><\/pre>\n\n\n\n<p>This tells the compiler what our target CPU family is, as well as the assembly language syntax \/ style we plan to use (in this case Motorola, rather than the GCC syntax which is a little different).<\/p>\n\n\n\n<p>Once the compiler had finished building the project, I was able to copy the new program called &#8220;vasmm68k_mot&#8221; from the current directory to where I wanted to run it from &#8211; note I didn&#8217;t bother installing it and am just running it from a folder in my home directory.<\/p>\n\n\n\n<h4>Step 2 &#8211; Writing a Test Program in Assembly Language<\/h4>\n\n\n\n<p><a href=\"http:\/\/www.kswichit.com\/68008\/68008.htm\">Wichit Sirichote&#8217;s webpage<\/a> includes a <a href=\"http:\/\/www.kswichit.com\/68008\/testcode.rar\">download<\/a> of several example programs, which are also listed in the manual. The following simple program loads the number 12345678 into a register (d0) and then displays part of it on the LEDs (memory mapped at f0000).  The fist line identifies where in memory the program should be located. A copy of this program in assembly can be <a href=\"http:\/\/elephantandchicken.co.uk\/downloads\/FirstTest.asm\">downloaded here<\/a>. This is a text file and can be opened and edited in any text editor.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>         org       $400\nstart    move.l    #$12345678,d0\n         move.b    d0,$f0000<\/code><\/pre>\n\n\n\n<p>I have saved this assembly program as &#8220;FirstTest.asm&#8221; in the same location that I have placed the vasm application. After a bit of fiddling, I was able to work out the required parameters to assemble my files into a correctly formatted hex file and settled on the format <em>vasmm68k_mot -m68008 -Fsrec -s19 -o &lt;outputfile.hex&gt; &lt;inputfile.asm&gt;<\/em>. The -Fsrec parameter uses the Motorola S Record output format, with the -s19 parameter using 16bit S Record mode. So, to assemble the FirstTest.asm file into FirstTest.hex, all in the same folder as the vasmm68k_mot application, I use the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/vasmm68k_mot -m68008 -Fsrec -s19 -o .\/FirstTest.hex .\/FirstTest.asm<\/code><\/pre>\n\n\n\n<p>This gives the following feedback that doesn&#8217;t indicate there were any errors (if you get errors, double check you pointed it to the correct files and didn&#8217;t make any typos in your assembly &#8211; also, check that tabs are used between columns).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vasm 1.8g (c) in 2002-2019 Volker Barthelmann\nvasm M68k\/CPU32\/ColdFire cpu backend 2.3f (c) 2002-2019 Frank Wille\nvasm motorola syntax module 3.13 (c) 2002-2019 Frank Wille\nvasm motorola srecord output module 1.0 (c) 2015 Joseph Zatarski\nCODE(acrx2):\t          12 bytes<\/code><\/pre>\n\n\n\n<p>Opening the resultant FirstTest.hex file in a text editor shows the following, which is the assembled program in Motorola hex.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>S009000073656734303023\nS10F0400203C1234567813C0000F00009A\nS9030000FC<\/code><\/pre>\n\n\n\n<p>If you&#8217;ve got this far, congratulations, you&#8217;ve cross-assembled a 68k program. Now it is time to load your creation into the 68k Computer.<\/p>\n\n\n\n<h4>Step 4 &#8211; Connecting the SBC to a Computer<\/h4>\n\n\n\n<p>Programs can be loaded directly into RAM on the 68008 board over serial. To connect the 68008 board to a modern computer it is most likely that you&#8217;ll need a USB to RS232 adapter, but it is worth noting that since both devices being connected are computers (rather than a computer and a peripheral), both ports are likely to be male. As such, we&#8217;ll need a &#8220;null modem&#8221; cable, which is similar to an ethernet crossover cable in that the TX and RX wires are switched so that you&#8217;re not connecting TX to TX and RX to RX. I have been using a cable similar to <a href=\"https:\/\/www.amazon.co.uk\/Serial-Adapter-Prolific-Chipset-Windows\/dp\/B0753HBT12\">this linked item<\/a>, as well as a bodge using a USB to UART and a UART to RS232 adapter to get up and running while I waited for a null modem cable in the post. I have had issues with cheap cables failing in the past and so have ordered a 4 port RS232 box with a USB interface as a replacement. The box hasn&#8217;t arrived yet.<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter columns-1 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"1024\" height=\"489\" src=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Cables-1024x489.jpg\" alt=\"\" data-id=\"947\" data-full-url=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Cables.jpg\" data-link=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/?attachment_id=947\" class=\"wp-image-947\" srcset=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Cables-1024x489.jpg 1024w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Cables-300x143.jpg 300w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Cables-1536x733.jpg 1536w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Cables.jpg 1894w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\"><em>Cables<\/em><\/figcaption><\/figure>\n\n\n\n<p>Note it is possible to get &#8220;gender changer&#8221; adapters which do not cross over the TX and RX pins, meaning that while you can physically connect your computer and the 68008 board, they will not communicate.<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter columns-1 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"698\" height=\"548\" src=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Gender_Changer.jpg\" alt=\"\" data-id=\"948\" data-full-url=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Gender_Changer.jpg\" data-link=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/?attachment_id=948\" class=\"wp-image-948\" srcset=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Gender_Changer.jpg 698w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Gender_Changer-300x236.jpg 300w\" sizes=\"(max-width: 698px) 100vw, 698px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\"><em>Gender Changer &#8211; Note this didn&#8217;t work for me<\/em><\/figcaption><\/figure>\n\n\n\n<p>Once you have all the right cables, with the 68008 board powered down, connect the null modem cable to the 68008 board and the USB RS232 adapter, plug the USB RS232 adapter into your computer and run the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ls \/dev\/tty*<\/code><\/pre>\n\n\n\n<p>There will likely be an item listed as ttyUSB0, or similar. If no serial device is clearly obvious, unplug the USB RS232 adapter and run the command again. Compare the two lists and identify what has changed. This is your serial port. Next, make sure that the software &#8220;screen&#8221; is installed on your Linux machine by running the following command at the command line and following on screen prompts (either telling you it is already installed and is the latest version, or asking if you would like to install it).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install screen<\/code><\/pre>\n\n\n\n<p>Note that some users on Linux do not have permissions to access serial ports. Running the following command (substituting &#8220;MY_USER_NAME&#8221; for your user name) and restarting your computer should fix this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo usermod -a -G dialout MY_USER_NAME<\/code><\/pre>\n\n\n\n<p>Next, run the following command at the command line on your Linux computer (substitute ttyUSB0 for the correct serial port name if you found it to be different earlier).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>screen \/dev\/ttyUSB0 2400<\/code><\/pre>\n\n\n\n<p>This command connects to the USB RS232 adapter at a baud rate of 2400. Now turn on the 68008 board and you should see the text &#8220;68008 MICROPROCESSOR KIT (C)2016 rev2.1&#8221; or similar. This shows that communications are working. If you don&#8217;t see this, check your connections and cables. Make sure you didn&#8217;t have any permissions errors. Try running the &#8220;screen&#8221; command using sudo.<\/p>\n\n\n\n<h4>Step 5 &#8211; Loading the Program<\/h4>\n\n\n\n<p>Assuming you were able to establish the connection between your Linux computer and the 68008 board, press the &#8220;LOAD&#8221; button on the 68008 board. You should now see the message &#8220;Load Motorola s-record&#8221; in the window.<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter columns-1 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"814\" height=\"530\" src=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Load.png\" alt=\"\" data-id=\"950\" data-full-url=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Load.png\" data-link=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/?attachment_id=950\" class=\"wp-image-950\" srcset=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Load.png 814w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Load-300x195.png 300w\" sizes=\"(max-width: 814px) 100vw, 814px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\"><em>Ready to Upload<\/em><\/figcaption><\/figure>\n\n\n\n<p>Copy the entire contents of the FirstTest.hex to the clipboard,  and then paste the copied text into the terminal window in which &#8220;screen&#8221; is running (often right click in the terminal window and select the option &#8220;Paste&#8221;). If everything works correctly, once the program is loaded, you should see a message saying that there were no errors.<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter columns-1 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"814\" height=\"530\" src=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/NoError.png\" alt=\"\" data-id=\"949\" data-full-url=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/NoError.png\" data-link=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/?attachment_id=949\" class=\"wp-image-949\" srcset=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/NoError.png 814w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/NoError-300x195.png 300w\" sizes=\"(max-width: 814px) 100vw, 814px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\"><em>Upload Successful<\/em><\/figcaption><\/figure>\n\n\n\n<h4>Step 6 &#8211; Stepping Through the Program<\/h4>\n\n\n\n<p>To check that the program is now in memory, press the &#8220;PC&#8221; button (PC stands for Program Counter) on the 68008 board. If the 7 segment display now shows 00400 20, this is a very good sign. The 00400 is the Program Counter address, where the machine will start running a program from. The &#8220;20&#8221; is the first byte of the program that was loaded over serial. If it says anything other than &#8220;20&#8221;, then something isn&#8217;t right. Press the &#8220;+&#8221; key repeatedly, and you should see the following sequence 3C, 12, 34, 56, 78. These are the next few bytes of the program. Press &#8220;PC&#8221; again to return to the start of your program.<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter columns-1 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"1024\" height=\"858\" src=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/PC_400-1024x858.jpg\" alt=\"\" data-id=\"951\" data-full-url=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/PC_400.jpg\" data-link=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/?attachment_id=951\" class=\"wp-image-951\" srcset=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/PC_400-1024x858.jpg 1024w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/PC_400-300x251.jpg 300w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/PC_400-1536x1286.jpg 1536w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/PC_400.jpg 1698w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\"><em>Ready<\/em><\/figcaption><\/figure>\n\n\n\n<p>If the &#8220;STEP&#8221; button is pressed, the 68008 board will execute the first command in the program &#8211; in this case, load 12345678 into the register D0. You can check this by pressing the &#8220;REG&#8221; key, followed by the &#8220;0&#8221; (zero) key. The 7 segment display should show 12345678. Press &#8220;PC&#8221; to return to displaying the current location in the program.<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter columns-1 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"1024\" height=\"702\" src=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Display_D0-1024x702.jpg\" alt=\"\" data-id=\"952\" data-full-url=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Display_D0.jpg\" data-link=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/?attachment_id=952\" class=\"wp-image-952\" srcset=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Display_D0-1024x702.jpg 1024w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Display_D0-300x206.jpg 300w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Display_D0-1536x1053.jpg 1536w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/Display_D0.jpg 1978w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\"><em>View Data Register D0<\/em><\/figcaption><\/figure>\n\n\n\n<p>Press &#8220;STEP&#8221; again, and part of this number will be shown on the eight LEDs on the right hand side of the 68008 board.<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter columns-1 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"1024\" height=\"768\" src=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/LED_Output-1024x768.jpg\" alt=\"\" data-id=\"953\" data-full-url=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/LED_Output.jpg\" data-link=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/?attachment_id=953\" class=\"wp-image-953\" srcset=\"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/LED_Output-1024x768.jpg 1024w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/LED_Output-300x225.jpg 300w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/LED_Output-1536x1152.jpg 1536w, https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/LED_Output.jpg 1984w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\"><em>LED Output<\/em><\/figcaption><\/figure>\n\n\n\n<p>Congratulations, you&#8217;ve completed loading and stepping through the tiny example program.<\/p>\n\n\n\n<h4>Step 7 &#8211; Trying Another Program<\/h4>\n\n\n\n<p>The following program is based on one of the other provided examples, modified to alternatively flash every second LED, rather than count in binary as the provided example does.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gpio1\tequ\t$f0000\n\torg\t$400\nstart\tmove.l\t#service_level2,$68\n\tmove.l\t#stack,a7\n\tmove.w\t#$2100,sr\n\tmove.l\t#$0,d0\n\tmove.l\t#$55,d1\nhere\tbra\there\nservice_level2\n\taddi.b\t#1,d0\n\tcmpi.b\t#20,d0\n\tblt\tskip\n\tclr.b\td0\n\teori.b\t#$ff,d1\n\tmove.b\td1,gpio1\nskip\trte\nram\tds.b\t32\nstack\tequ\t*<\/code><\/pre>\n\n\n\n<p>The code uses the 10 ms tick feature on the board (a 100hz pulse) and an interrupt to time the changes. The (inverse of the) initial state of the LEDs is set in the line &#8220;move.l    #$55,d1&#8221;. Changing the number #$55 (remember this is in hex as indicated by the &#8220;$&#8221; sign) will change the initial state of the LEDs. For example, replacing it with #$00 will cause all eight LEDs to flash together.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"jetpack-video-wrapper\"><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe class='youtube-player' width='640' height='360' src='https:\/\/www.youtube.com\/embed\/tIN6TSBGflU?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-GB&#038;autohide=2&#038;wmode=transparent' allowfullscreen='true' style='border:0;' sandbox='allow-scripts allow-same-origin allow-popups allow-presentation'><\/iframe><\/span><\/div>\n<\/div><\/figure>\n\n\n\n<p>The speed at which the LEDs flash can be changed by modifying the line &#8220;cmpi.b   #20,d0&#8221;. #20 is (in decimal, as there is no &#8220;$&#8221; sign) the maximum number the code will count to before changing the state of the LEDs. In the example above, #20 means that when the value in d0 reaches 20, the LEDs will be inverted and d0 will be reset to 0. Otherwise, d0 will be increased by 1 and the program will wait for the next 10ms tick to trigger an interrupt. &#8220;service_level2&#8221; is triggered each time one of these 10ms ticks occur, otherwise the processor runs in the infinite loop &#8220;here   bra   here&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>68k SBC Programming on Linux Having grown up using computers based on Motorola&#8217;s 68k family of microprocessors, I have been considering trying to build a simple 68k processor computer of my own. Given how long it took me to get around to build a breadboard Z80 computer, and with a growing sense that I really [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":960,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[13,42,12,152],"tags":[240,239,244,241,243,242],"jetpack_featured_media_url":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/wp-content\/uploads\/2020\/01\/68008_Board_3.jpg","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7g9vY-eX","_links":{"self":[{"href":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/index.php?rest_route=\/wp\/v2\/posts\/927"}],"collection":[{"href":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=927"}],"version-history":[{"count":28,"href":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/index.php?rest_route=\/wp\/v2\/posts\/927\/revisions"}],"predecessor-version":[{"id":2170,"href":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/index.php?rest_route=\/wp\/v2\/posts\/927\/revisions\/2170"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/index.php?rest_route=\/wp\/v2\/media\/960"}],"wp:attachment":[{"href":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=927"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elephantandchicken.co.uk\/stuffandnonsense\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}