News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

cpm 2.2 bdos and keyboard

Started by andromedaa92, 17:43, 22 June 24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

andromedaa92

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.

McArti0

#1
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
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

andromedaa92




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

andromedaa92

#3
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.

andromedaa92

#4
commande line:
zcc.exe +cpm -mz80 -compiler=sdcc -DAMALLOC @/src/text.lst -obin/myprog.com

McArti0

Do you want to use the program only on CPC or on any other computer with CPM?
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

andromedaa92

any other computer with cpm with standard bdos call and bios call

McArti0

Check if bdos is definitely 5.
I have a different problem. Very often I have A=1 without pressing a key.
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

Prodatron

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...

GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

andromedaa92

yes i tested it work, thank you.

andromedaa92

do you know a cp/m 2.2 z80 emulator for windows 10 ?

Prodatron

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 ) this one is very useful:

https://github.com/MockbaTheBorg/RunCPM

(builds natively on Visual Studio)

GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

andromedaa92


Powered by SMFPacks Menu Editor Mod