Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

88 Key Keyboards

150 views
Skip to first unread message

Corey...@gmail.com

unread,
Sep 8, 2006, 8:46:07 PM9/8/06
to
A full sized piano has 88 keys, and a normaly keyboard that you use on
your computer also has 88 functional keys that are in common usage.
Minus he scroll lock key, which isn't used for anything, and the
function keys, the escape key, and the touch-pad. There are exactly 88
keys. So it would be perfect to sit down and use an 88 key electronic
piano for typing! And so much more fun! You would still need to use a
shift key to capitalize letters, but every other key would have its own
unique features. And if you added shift functions to the rest of the
keys, you could still include all of the function keys, escape key, and
scroll lock. Plus anymore you can think of. And with modern midi
controllers, you could add hundreds of other features to the
controller. Including a mouse, joystick, or writing pad. You just use
a touch sensitive mouse like you find on a laptop.

Someone should get to work designing one of these, because it would add
a whole new dimension to computers that would bring enjoyment to
everyone and my guess is put a stop to flame wars, spam, and nasty
e-mails. Because if we all had real keyboards, we wouldn't get
frustrated with the informalities, anti-asthetics, clostrophobia,
paranoia, anti-socialism, and everything else that goes along with
computers. Plus we could all make music!

Annie

unread,
Sep 9, 2006, 5:31:30 PM9/9/06
to


On 2006-09-08 Corey...@gmail.com said:

;
; PIANO3.ASM [ For true DOS ]
; One-Octave 'Piano' Program
; Free from Annie
;
; Use keyboard number keys 1 through 8 to play the notes.
; Space bar toggles the 'sustain' function. ESC exits.
;
; This code assembles, as-is, with the A86 assembler.
;
; To assemble: A86 PIANO3.ASM
;
code segment
org 100h ;DOS .COM file
jmp start ;go start the program
;
tog db 0 ;our 'sustain' flag
;
start:
mov dx,offset msg ;point DX to sign-on message
call prt_str ;print it
;
; Get user keypress.
;
get_key:
mov ah,0 ;function 0 - wait for keypress
int 16h ;call ROM BIOS keyboard services
cmp al,27 ;was ESC pressed?
jz quit ;yes, so go exit
cmp al,32 ;was SPACE pressed?
jz toggle ;yes, so go toggle 'sustain' mode
;
; Filter out all keys except '1' through '8' by checking the scan code.
;
cmp ah,02h ;less than '1'?
jl get_key ;yes, so ignore it
cmp ah,09h ;greater than '8'?
jg get_key ;yes, so ignore it
;
; Set up the tone parameters.
;
sub al,21h ;change scan code to to digit (0-9)
and al,00000111xb ;mask off upper 5 bits
shl al,1 ;* by 2 (2 bytes/word)
cbw ;byte --> word in AX
mov bx,ax ;put in BX (for table)
mov ax,0 ;numerator (low word)
mov dx,12h ;(high word)
div word ptr [table] + bx ;divisor from table
mov bx,ax ;save quotient in BX
;
; Set 1/pitch into timer, then turn on tone.
;
mov al,10110110xb ;the magic number...
mov dx,43h ;
out dx,al ;
mov ax,bx ;1/pitch into AX
mov dx,42h ;
out dx,al ;
mov al,ah ;MSB to AL, then...
out dx,al ;
mov dx,61h ;
in al,dx ;
or al,3 ;turn on bits 0 and 1...
out dx,al ;
call clr_buf ;yes, so go clear keyboard buffer
cmp tog,1 ;is 'sustain' on?
je get_key ;go get another keypress
;
; Delay for 2/18ths of a second.
;
delay:
mov ah,00h ;function 0 - get system timer tick
int 01Ah ;call ROM BIOS time-of-day services
add dx,2 ;add our delay value to DX
mov bx,dx ;store result in BX
pozz:
int 01Ah ;call ROM BIOS time-of-day services
cmp dx,bx ;has the delay duration passed?
jl pozz ;no, so go check again
call stopnote ;go turn off the note
jmp get_key ;go get another keypress
;
quit:
jmp exit ;'lilypad' to exit
;
; Toggle 'sustain' mode.
;
toggle:
cmp tog,0 ;'sustain' mode currently off?
je turn_on ;yes, so go turn it on
mov tog,0 ;no, so set 'sustain' flag to 'off'
call stopnote ;turn off note
call clr_buf ;go clear keyboard buffer
mov dx,offset off ;point DX to appropriate screen msg
call prt_str ;print it
jmp get_key ;go get another keypress
turn_on:
mov tog,1 ;set 'sustain' flag to 'on'
call clr_buf ;go clear keyboard buffer
mov dx,offset onn ;point DX to appropriate screen msg
call prt_str ;print it
jmp get_key ;go get another keypress
;
; Clear the keyboard buffer.
;
clr_buf:
push es ;preserve ES
push di ;preserve DI
mov ax,40h ;BIOS segment in AX
mov es,ax ;transfer to ES
mov ax,1Ah ;keyboard head pointer in AX
mov di,ax ;transfer to DI
mov ax,1Eh ;keyboard buffer start in AX
mov es: word ptr [di],ax ;transfer to head pointer
inc di ;bump pointer to...
inc di ;...keyboard tail pointer
mov es: word ptr [di],ax ;transfer to tail pointer
pop di ;restore DI
pop es ;restore ES
ret
;
; Turn off speaker.
;
stopnote:
push dx ;preserve DX
mov dx,61h ;
in al,dx ;
and al,11111100xb ;mask lower 2 bits
out dx,al ;
pop dx ;restore DX
ret ;return to caller
;
; ESC pressed, so exit.
;
exit:
call stopnote ;go silence the speaker
mov al,10 ;linefeed in AL
int 29h ;quick-print it
int 20h ;exit to DOS
;
; Our 'print string' routine.
;
prt_str:
mov ah,9 ;function 9 - print string
int 21h ;call DOS services
ret ;return to caller
;
msg db 13,10,'PIANO3'
db 13,10,'Keyboard number keys 1 through 8 play the notes.'
db 13,10,'ESC exits. SPACE BAR toggles sustain -- now OFF$'
onn db 08,08,'N ',08,'$'
off db 08,'FF$'
;
;frequencies of notes
;
table dw 262 ;middle C
dw 294 ;D
dw 330 ;E
dw 347 ;F
dw 392 ;G
dw 440 ;A
dw 494 ;B
dw 524 ;C
end

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Evenbit

unread,
Sep 9, 2006, 10:01:15 PM9/9/06
to

Annie wrote:

[a tune]

...but neglected to display her 'toon!

\gasp\

Nathan.

Betov

unread,
Sep 10, 2006, 2:53:41 AM9/10/06
to
"Annie" <m...@privacy.net> écrivait
news:11578374...@sp6iad.superfeed.net:


Do you know the trick for playing _two_ notes on the beeper?

;)

Betov.

< http://rosasm.org >


Annie

unread,
Sep 10, 2006, 10:26:42 PM9/10/06
to

On 2006-09-09 Nate Baker said:

> Annie wrote:
> [a tune]
> ....but neglected to display her 'toon!
> \gasp\
> Nathan.

Yeah, well...don't sweat it, N8. 95 per cent of the folks out there
are WinDoze weenies, and read the newsgroups using the default WinDoze
bit-mapped proportional "font" (rather than the video BIOS character
set). So ASCII art doesn't render properly for them, anyway.

Bill Gates has a LOT to answer for!

Annie

unread,
Sep 10, 2006, 10:26:44 PM9/10/06
to

On 2006-09-10 be...@free.fr said:

> "Annie" écrivait:
>
> > ...


>
> Do you know the trick for playing _two_ notes on the beeper? ;)
>
> Betov.

Yes; I have code which generates true polyphonic music through the
PC speaker.

There is also the trick that was used by the old DOS-based PIANOMAN
program. That was terrible!

zahe...@gmail.com

unread,
Feb 19, 2014, 4:23:04 AM2/19/14
to
can not run this program in flat asswmbler because that find very eror in that like :
first this
and al,00000111xb
if delete up:
mov al,10110110xb
AGAIN if delete up:
and al,11111100xb
if delete up:
code segment

PLEASE HELPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
I NEED RUN THAT

Rod Pemberton

unread,
Feb 19, 2014, 6:18:20 AM2/19/14
to
On Wed, 19 Feb 2014 04:23:04 -0500, <zahe...@gmail.com> wrote:

> PLEASE HELPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
> I NEED RUN THAT

This is not a Google Group.
You've posted to an old 2006 Usenet post from alt.lang.asm:

https://groups.google.com/forum/#!msg/alt.lang.asm/UXdXUth8TG8/h7O9rrafmq8J

> can not run this program in flat asswmbler because that find very eror
> in that like :
> first this
> and al,00000111xb
> if delete up:
> mov al,10110110xb
> AGAIN if delete up:
> and al,11111100xb
> if delete up:
> code segment
>

Well, have you checked the fasm manual? It's here:

flat assembler (fasm) manual
http://flatassembler.net/docs.php?article=manual

In section 1.2.4:

"The numbers in the expression are by default treated as a decimal,
binary numbers should have the b letter attached at the end, octal
number should end with o letter, hexadecimal numbers should begin
with 0x characters (like in C language) or with the $ character
(like in Pascal language) or they should end with h letter. Also
quoted string, when encountered in expression, will be converted
into number - the first character will become the least significant
byte of number."


In other words, you probably need to delete the 'x' letter from
all the binary constants:

0000011xb -> 00000111b

You may need to change other syntax as well. IIRC, FASM uses
NASM style syntax. So, the three lines like this one which
use 'ptr' will need changing also:

div word ptr [table] + bx


Rod Pemberton

Rod Pemberton

unread,
Feb 19, 2014, 6:42:40 AM2/19/14
to
On Wed, 19 Feb 2014 04:23:04 -0500, <zahe...@gmail.com> wrote:

You can compile the following code with either FASM or NASM.

fasm piano3.asm

nasm -f bin piano3.com piano3.asm


; PIANO3.ASM [ For true DOS ]
; One-Octave 'Piano' Program
; Free from Annie
;
; Use keyboard number keys 1 through 8 to play the notes.
; Space bar toggles the 'sustain' function. ESC exits.
;
; This code assembles, as-is, with the A86 assembler.
;
; To assemble: A86 PIANO3.ASM
;
use16

org 100h ;DOS .COM file
jmp start ;go start the program
;
tog db 0 ;our 'sustain' flag
;
start:
mov dx, msg ;point DX to sign-on message
call prt_str ;print it
;
; Get user keypress.
;
get_key:
mov ah,0 ;function 0 - wait for keypress
int 16h ;call ROM BIOS keyboard services
cmp al,27 ;was ESC pressed?
jz quit ;yes, so go exit
cmp al,32 ;was SPACE pressed?
jz toggle ;yes, so go toggle 'sustain' mode
;
; Filter out all keys except '1' through '8' by checking the scan code.
;
cmp ah,02h ;less than '1'?
jl get_key ;yes, so ignore it
cmp ah,09h ;greater than '8'?
jg get_key ;yes, so ignore it
;
; Set up the tone parameters.
;
sub al,21h ;change scan code to to digit (0-9)
and al,00000111b ;mask off upper 5 bits
shl al,1 ;* by 2 (2 bytes/word)
cbw ;byte --> word in AX
mov bx,ax ;put in BX (for table)
mov ax,0 ;numerator (low word)
mov dx,12h ;(high word)
div word [table+bx] ;divisor from table
mov bx,ax ;save quotient in BX
;
; Set 1/pitch into timer, then turn on tone.
;
mov al,10110110b ;the magic number...
mov dx,43h ;
out dx,al ;
mov ax,bx ;1/pitch into AX
mov dx,42h ;
out dx,al ;
mov al,ah ;MSB to AL, then...
out dx,al ;
mov dx,61h ;
in al,dx ;
or al,3 ;turn on bits 0 and 1...
out dx,al ;
call clr_buf ;yes, so go clear keyboard buffer
cmp byte [tog],1 ;is 'sustain' on?
je get_key ;go get another keypress
;
; Delay for 2/18ths of a second.
;
delay:
mov ah,00h ;function 0 - get system timer tick
int 01Ah ;call ROM BIOS time-of-day services
add dx,2 ;add our delay value to DX
mov bx,dx ;store result in BX
pozz:
int 01Ah ;call ROM BIOS time-of-day services
cmp dx,bx ;has the delay duration passed?
jl pozz ;no, so go check again
call stopnote ;go turn off the note
jmp get_key ;go get another keypress
;
quit:
jmp exit ;'lilypad' to exit
;
; Toggle 'sustain' mode.
;
toggle:
cmp byte [tog],0 ;'sustain' mode currently off?
je turn_on ;yes, so go turn it on
mov byte [tog],0 ;no, so set 'sustain' flag to 'off'
call stopnote ;turn off note
call clr_buf ;go clear keyboard buffer
mov dx, off ;point DX to appropriate screen msg
call prt_str ;print it
jmp get_key ;go get another keypress
turn_on:
mov byte [tog],1 ;set 'sustain' flag to 'on'
call clr_buf ;go clear keyboard buffer
mov dx, onn ;point DX to appropriate screen msg
call prt_str ;print it
jmp get_key ;go get another keypress
;
; Clear the keyboard buffer.
;
clr_buf:
push es ;preserve ES
push di ;preserve DI
mov ax,40h ;BIOS segment in AX
mov es,ax ;transfer to ES
mov ax,1Ah ;keyboard head pointer in AX
mov di,ax ;transfer to DI
mov ax,1Eh ;keyboard buffer start in AX
mov [es:di],ax ;transfer to head pointer
inc di ;bump pointer to...
inc di ;...keyboard tail pointer
mov [es:di],ax ;transfer to tail pointer
pop di ;restore DI
pop es ;restore ES
ret
;
; Turn off speaker.
;
stopnote:
push dx ;preserve DX
mov dx,61h ;
in al,dx ;
and al,11111100b ;mask lower 2 bits
HTH (hope that helps),


Rod Pemberton
0 new messages