Coprolite.com
Google
 
Web Coprolite.com
SignalQ Sites:
NetAdminTools - Coprolite - NoNIC - SpotBridge - NAW
RoboCoop - AreWeDown - SolarPower - SysAdminTools
Xfig - Gold Loaf - GeekPapa - FixGMC - MCJ - FixRambler
Categories:
GNU/Linux | Homebrew designs | Perl | Microcontrollers | Graphics | Z-80 | FreeDOS | Electronics | Odyssey 2 | 8048 | Other/Msc.

Last 30 Days | Last 60 Days | Last 90 Days | All Articles/Links


Categories:
·GNU/Linux
·Homebrew Designs
·Perl
·Microcontrollers
·Graphics
·Z-80
·FreeDOS
·Other/Msc.
·Electronics
·8048
·All Categories
·Other SignalQ Websites




Creating a Hello World ROM for the Odyssey 2
Topic: Odyessey 2   Posted:2004-04-13
Printer Friendly: Print

spacer
In this article, I showed how to use your own ROM in an Odyssey 2. You can use AS (asl) to create a binary file to burn onto an EPROM. I showed how to compile AS in this article. With this knowledge, you can put a colorful "HELLO-WORLD" on you TV screen. I put a dash in there, because I'm rotating through the colors. Here is the comented code:

cpu     8048            ; asl needs this to know how to assemble
org     0410h           ; start of ROM, but bypass interrupts, etc.
call    00f1h           ; BIOS reset
call    011ch           ; BIOS display off      
mov     r1,#0f5h        ; pointer to string "hello world"
mov     r0,#10h         ; starting character pointer for VDC 
mov     r2,#0bh         ; 11 characters
mov     r3,#28h         ; x position
mov     r4,#70h         ; y position
mov     r6,#00h         ; color start with grey
putc    mov     a,r1            ; grab current pointer to string 
movp    a,@a            ; move mem at r1 to accumulator                 
mov     r5,a            ; set r5 to character
inc     r1              ; increment pointer to character
call    03eah           ; print character BIOS routine
inc     r6              ; go to next color need to add 2
inc     r6              ; go to next color
mov     a,r6            ; let's prove the location bits
anl     a,#0eh          ; and make sure we use only valid colors
mov     r6,a            ; 0eh grabs bits 1-3 (bit 0 far right)
djnz    r2, putc        ; continue for 11 characters
call    0127h           ; start display
sixnen  jmp     sixnen          ; while 6 ne 9 (loop forever, i don't mind)
org     04f5h           ; force the location of hello world
db      1Dh,12h,0eh,0eh ; text to be at the end of the page 
db      17h,28h,11h,17h
db      13h,0eh,1ah

I use org statements in a couple of places. The first time, I use it to set the start of the machine code at 0x410h. I do this because there are a variety of interrupts and other BIOS routines that use these locations. I just want to print "HELLO-WORLD", not service a Vblank or timer call. For more info on this, see Daniel Boris' Odyssey 2 Tech Manual. The second org statement sets the text at the end of the page. The AND stuff (anl) is to prove that the location of the valid 8 colors are in bits 1-3. Let's assemble this:

usr-1@wrk-1 o2 $ asl first.asm
macro assembler 1.41r8
(i386-unknown-linux)
(C) 1992,1998 Alfred Arnold
Mitsubishi M16C-Generator also (C) 1999 RMS
TMS320C2x-Generator (C) 1994/96 Thomas Sailer
TMS320C5x-Generator (C) 1995/96 Thomas Sailer
assembling first.asm
PASS 1                    
first.asm(31)                    
0.00 seconds assembly time                    
31 lines source file                    
1 pass                    
0 errors                    
0 warnings                    
usr-1@wrk-1 o2 $

That is all good.

Let's create a binary ROM using p2bin, which comes with AS. I need to specify that I want exactly 2K, since the default size is 32K. Further, I want the ROM to start at 0x0400, which is the first byte of the ROM pack on the Odyssey 2. Note that the ROM itself starts at 0x000. This is just from the perspective of the whole system. I have to escape the $ because I'm using BASH. Let's do it:

usr-1@wrk-1 o2 $ p2bin first.p first.bin -r \$0400-\$0bff -l 0
P2BIN/C V1.41r8
(C) 1992,1998 Alfred Arnold
first.p==>>first.bin  (45 Byte)
usr-1@wrk-1 o2 $ 

Before we burn this to an EPROM, let's check it out on o2em, an emulator for the Odyssey 2:

root@wrk-1 O2EM101-src # ./o2em /home/usr-1/o2/first.bin
O2EM v1.01 (October/2002)  -  Linux binary
Freeware Odyssey2 / Videopac+ Emulator - http://o2em.sourceforge.net
Developed by Andre de la Rocha
Created by Daniel Boris (c)1996/1998
Starting emulation ...
Initializing sound system...
Sound system initialized ok
Sound driver [Open Sound System] detected
Using Allegro Allegro 4.0.3, Unix
Odyssey2 bios ROM loaded
Loading: "/home/usr-1/o2/first.bin"  Size: 2K  CRC: CDD12B19
Loading voice samples...  0 samples loaded
root@wrk-1 O2EM101-src #

The screen shot of the emulator:



Now, we just burn first.bin on to a 2716 EPROM, and run it:



It isn't real, until you can see it on a TV screen. :)




Please read our Terms of Use
Microsoft, Windows, Windows XP, Windows 2000, and NT are either trademarks or registered trademarks of Microsoft Corporation. Coprolite.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2008 Coprolite.com

Created by:
MCJ
MCJ CMS