CPCWiki forum

General Category => Programming => Topic started by: andromedaa92 on 17:43, 22 June 24

Title: cpm 2.2 bdos and keyboard
Post by: andromedaa92 on 17:43, 22 June 24
Hi,
how to do the equivalent of kbhit() or wait key pressed with cpm assembler.

function 1 of bdos read, waits for a character to be pressed then displays it on the screen.

I would like the same thing but without displaying it on the screen (echo off)

thanks for your help.
Title: Re: cpm 2.2 bdos and keyboard
Post by: McArti0 on 19:53, 22 June 24
https://turpas3.angelfire.com/unifirm.pas

Cpm 2.2
CALL #BE9B
DW #BB18 <- Each firmware procedure address

Cpm 3.1
CALL #FC5A
DW #BB18

But its for CPC only
Title: Re: cpm 2.2 bdos and keyboard
Post by: andromedaa92 on 20:07, 22 June 24



for _kbd_kbhit i use this

_kbd_kbhit:
    call wait_k
    ret

 wait_k:
    LD C, 11 ; C_STAT
    LD DE,0
    call bdos
    OR A
    JR Z, wait_k
    ret


but it don't work, it always loop
Title: Re: cpm 2.2 bdos and keyboard
Post by: andromedaa92 on 20:22, 22 June 24
my code is for CP/M for agon original CP/M Z80.
i use zcc from z88dk (zcc +cpm .....)

i search equivalent to kbhit() from c language, but don't find anything on internet.
Title: Re: cpm 2.2 bdos and keyboard
Post by: andromedaa92 on 20:33, 22 June 24
commande line:
zcc.exe +cpm -mz80 -compiler=sdcc -DAMALLOC @/src/text.lst -obin/myprog.com
Title: Re: cpm 2.2 bdos and keyboard
Post by: McArti0 on 21:07, 22 June 24
Do you want to use the program only on CPC or on any other computer with CPM?
Title: Re: cpm 2.2 bdos and keyboard
Post by: andromedaa92 on 21:09, 22 June 24
any other computer with cpm with standard bdos call and bios call
Title: Re: cpm 2.2 bdos and keyboard
Post by: McArti0 on 05:39, 23 June 24
Check if bdos is definitely 5.
I have a different problem. Very often I have A=1 without pressing a key.
Title: Re: cpm 2.2 bdos and keyboard
Post by: Prodatron on 12:26, 23 June 24
Quote from: andromedaa92 on 20:07, 22 June 24wait_k:
    LD C, 11 ; C_STAT
    LD DE,0
    call bdos
    OR A
    JR Z, wait_k
    ret


but it don't work, it always loop


Did you try BDOS function 6 C_RAWIO?
https://www.seasip.info/Cpm/bdos.html#6

LD C,6
LD E,255
CALL 5

This will return in A the char or 0, if no char is available. And it will not echo anything.
But it's strange, that you have this behaviour with C_STAT...
Title: Re: cpm 2.2 bdos and keyboard
Post by: andromedaa92 on 13:00, 23 June 24
yes i tested it work, thank you.
Title: Re: cpm 2.2 bdos and keyboard
Post by: andromedaa92 on 13:03, 23 June 24
do you know a cp/m 2.2 z80 emulator for windows 10 ?
Title: Re: cpm 2.2 bdos and keyboard
Post by: Prodatron on 15:26, 23 June 24
Quote from: andromedaa92 on 13:03, 23 June 24do you know a cp/m 2.2 z80 emulator for windows 10 ?

According to Prevtenet (author of CPvM (http://www.symbos.org/cpvm.htm) ) this one is very useful:

https://github.com/MockbaTheBorg/RunCPM

(builds natively on Visual Studio)
Title: Re: cpm 2.2 bdos and keyboard
Post by: andromedaa92 on 15:34, 23 June 24
thanks for the link
Powered by SMFPacks Menu Editor Mod