Re: A86: I need help...
[Prev][Next][Index][Thread]
Re: A86: I need help...
In a message dated Sat, 11 Dec 1999 12:32:14 PM Eastern Standard Time, "Chris Remo" writes:
>
> I am an absolute newbie asm programmer in every way, and I have written a
> simple program so I can try to understand loops... It's supposed to display
> string: five times, but it doesn't really work... Could someone offer any
> advice? Thanks
>
>
>
>
> #include "ti86asm.inc"
> #include "asm86.h"
>
> .org _asm_exec_ram
>
> nop
> jp ProgStart
> .dw 0
> .dw ShellTitle
>
> ShellTitle:
> .db "Chris Remo's Program",0
>
> ProgStart:
>
> _homeup EQU 4A95h ; 0 to curCol and 0 to curRow
>
> call _clrLCD ; clears screen
>
> call _homeup ; 0 to curCol and 0 to curRow
> ld b,5 ; puts 5 in b register
> ld a,0
you can change the above line of code to sub a or xor a, always 0
> subby_loop: ; my awesome loop
> dec b ; decrements b
> inc a ; increments a
> ld (_curRow),a ; loads value of b into curRow
> ld (_curCol),0 ; loads value of b into curCol
> ld hl,string ; puts string in hl
> call _puts ; displays string
> call _getkey
the _getkey is unneeded, unless you want the user to be able to exit
> jr nz,subby_loop ; continued until b is zero
you can also change this to djnz subby_loop. djnz means Decrement, Jump if Not Zero. It uses reg. b, which also means you can take out the dec b statement above.
> ret ; return to shell or homescreen
> ret
only one ret is necessary here...
>
> string:
> .db "SHOULD show 5 times",0 ; creates string, terminated with 0
>
>
>
> .end