PrintLogo

Counting In Place With the Odyssey 2




Here is a program that will count from 0 to 9, and start over again at 0:

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     r6,#09h         ; color
mov     r5,#00h
mov     r2,#00h
vid     mov     r0,#10h         ; starting char in VDC 
mov     r3,#20h         ; x-position
mov     r4,#20h         ; y-position
call    03eah           ; display char  
call    0127h           ; start display
mov     r1,#0ffh
lpo     mov     r7,#0ffh
lpi     djnz    r7,lpi
djnz    r1,lpo
inc     r2
mov     a,r2
mov     r5,a
add     a,#0f6h
jnc     vid
mov     r2,#00h
mov     r5,#00h
jmp     vid





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

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

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