1
ASM / Z80 ASM Help
« on: September 02, 2012, 07:35:33 pm »
Alright Iv been programming in various (higher level) languages for years.
After messing around with my calculator and creating a large basic program (~500 lines without a computer), I felt I would try my hand at asm.
Hopefully some of the gurus here such as thepenguin77 or calc84maniac will be able to answer my questions better than google has.
1) What is the best way to input a float (Op1) from the user?
Both
Will I have to code my own keypress interpreter that then parses the string into a floating number, or is there a bcall() for this kind of thing.
The only thing I found is http://eeems.omnimaga.org/Files/Resources/Tutorials/ASMin28Days/lesson/day27.html#inp however wabbitcode doesn't appear to like the ".module" command.
Any guidance on this task would be awesome.
2) I know this loop is most likely horribly written, but why is the text displayed so slow?
Is it the loop, the repeated _vPutMap rom call, or something else?
After messing around with my calculator and creating a large basic program (~500 lines without a computer), I felt I would try my hand at asm.
Hopefully some of the gurus here such as thepenguin77 or calc84maniac will be able to answer my questions better than google has.
1) What is the best way to input a float (Op1) from the user?
Both
Code: [Select]
Input "X: ",X
in Basic and the input boxes in PlySmlt2 are good examples.Will I have to code my own keypress interpreter that then parses the string into a floating number, or is there a bcall() for this kind of thing.
The only thing I found is http://eeems.omnimaga.org/Files/Resources/Tutorials/ASMin28Days/lesson/day27.html#inp however wabbitcode doesn't appear to like the ".module" command.
Any guidance on this task would be awesome.
2) I know this loop is most likely horribly written, but why is the text displayed so slow?
Is it the loop, the repeated _vPutMap rom call, or something else?
Code: [Select]
menu:
LD HL,$0000
LD (curRow),HL
LD HL,menuA
set textInverse,(IY+textFlags)
call putC
res textInverse,(IY+textFlags)
LD HL,$0201
push HL
LD B,9
menuLoop:
pop HL
push BC
LD a,$06
LD b,H
add a,b
LD H,a
pop BC
push HL
LD (penCol),HL
ld de,menuA
ld A,10
sub b
ld H,0
LD L,A
add hl,hl
add hl,hl
add hl,hl
add hl,hl
add hl,hl
add hl,de
call vPutMap
djnz menuLoop
vPutMap:
ld a,(hl)
inc hl
or a;
ret z
bcall(_VPutMap)
jr vPutMap
putC:
ld a,(hl)
inc hl
or a;
ret z
bcall(_PutC)
jr putC
menuA:
.db " TITLE ",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.db "1. Item A ",0,0,0,0,0,0,0,0
.db "2. Item A ",0,0,0,0,0,0,0,0
.db "3. Item A ",0,0,0,0,0,0,0,0
.db "4. Item A ",0,0,0,0,0,0,0,0
.db "5. Item A ",0,0,0,0,0,0,0,0
.db "6. Item A ",0,0,0,0,0,0,0,0
.db "7. Item A ",0,0,0,0,0,0,0,0
.db "8. Item A ",0,0,0,0,0,0,0,0
.db "9. EXIT ",0,0,0,0,0,0,0,0