Re: A85: Progamming in USGARD
[Prev][Next][Index][Thread]
Re: A85: Progamming in USGARD
;Greets dude. Lol :-))
;also, replying to humberto, remember, he asked usgard, and standard usgard
;dist. includes funcpak, with an input string function. make this file a .asm
;file and it will compile verbatim.
;some necessary stuff
#include "usgard.h"
.db "test input prog",0
;ok. first, we need to print a nice prompt message (good to be polite :)
ld a,5 ;y character position
ld (CURSOR_ROW),a
ld a,5 ;x character position
ld (CURSOR_COL),a
ld hl,&PromptMessage ;where to get the message text from
call D_ZT_STR ;put the message
;then, we need the input stuff. We can do this using a funcpak function:
ld ix,&EmptyBuffer ;where to put the text. OP1 is also used often
ld c,20 ;if his name is longer than 20 characters... jsut use a bigger #
ld a,%00010000 ;mode byte: start with uppercase alpha
#fncall INP_ST
;now IX->the name, and C would be set had the user pressed EXIT, but that
;doesnt
;matter right now.
;then, we can put the new message on the screen right under the old:
ld a,(CURSOR_ROW) ;these 3 lines insure that we will go under the last
inc a ; line used by the input stuff
ld (CURSOR_ROW),a ;and not over write it
ld a,5
ld (CURSOR_COL),a ;here we reset the x pos to 5, even with before
ld hl,&ReplyMessage ;where we get the 1st part of the reply message from
call D_ZT_STR ;display the first part of the message
push ix ;ix holds where we put the text
pop hl ;so now hl does.
call D_ZT_STR ;and now display the name data.
call OTH_PAUSE ;now we wait for the user to press enter before we quit
call OTH_EXIT
;and the data section will be like this:
PromptMessage:
.db "What is your name? ",0
ReplyMessage:
.db "Hello ",0
EmptyBuffer:
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;you get the point. logn
;enough for your input
.end ;dumb thing, but necessary
References: