PrintLogo

Scrolling Through Icons on the Odyssey 2




Here is a program that will scroll through the various graphics icons that are built into the Odyssey 2 system ROM:

cpu     8048
org     0400h
jmp     02C3h           ;system start or reset - select game 
jmp     0009h           ;external IRQ - vblank routine  
jmp     timer           ;timer IRQ
jmp     001Ah           ;vblank service - vblank (collision and clock) 
jmp     start
jmp     0044h           ;continuation of vblank service - vblank (tune)
timer   retr                    ; we don't do anything with timer IRQs 
start
call    011Ch
mov     r2,#31h
inp     call    013dh
mov     a, r2           ; r5 is destructive on vid call
mov     r5,a
inc r2
add     a, #0c1h
jnc     vid
mov     r2,#31h 
vid     mov     r0,#10h         ; starting char in VDC 
mov     r3,#20h         ; x-position
mov     r4,#20h         ; y-position
mov     r6,#09h         ; color
call    03eah           ; display char  
call    0127h           ; start display
jmp     inp 

The program starts with 31h, which, as you can see in this article, is a ball. C1h is added until there is a carry, which tests for the last graphics character of 3Fh by adding 31h to r2, which is copied to r5 for the dislay routine and is destructive to r5. To assemble this program and run with o2em:

usr-1@wrk-1 kb $ asl k.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 k.asm
PASS 1                    
k.asm(29)                    
PASS 2                    
k.asm(29)                    
0.03 seconds assembly time                    
29 lines source file                    
2 passes                    
0 errors                    
0 warnings                    
usr-1@wrk-1 kb $
usr-1@wrk-1 kb $ p2bin k.p k.bin -r \$0400-\$0bff -l 0
P2BIN/C V1.41r8
(C) 1992,1998 Alfred Arnold
k.p==>>k.bin  (42 Byte)
usr-1@wrk-1 kb $
usr-1@wrk-1 kb $ o2em k.bin
O2EM v1.16 (Dec/2004)  -  Linux binary
Free 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: "k.bin"  Size: 2K  CRC: 2341BC85
Loading voice samples...  0 samples loaded

Here is what the screen looks like:



Just press any key on the keyboard, and the character changes and makes a beep. It wouldn't take too much more to make this into a simple keyboard banger.



This article comes from Coprolite:
http://coprolite.com/

The URL for this story is:
http://coprolite.com/art56.html

Copyright 1997-2006 Coprolite.com. Read our Terms of Use.