flat assembler
Message board for the users of flat assembler.

Index > Main > Output ONLY via ports

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Imagine you are in state when you can't use any BIOS, OS, or anything. Just plain port I/O.

You need to debug code like this. For that, you need to get at least some feedback from code, like displaying character or beeping PC-speaker.

How would you solve this? What is easiest way to notice user using ports?

I was thinking about PC-speaker, but i don't know if my notebook has it. Another possiblity was to set VGA text mode via registers (no int 10h), but i don't know how to do it.

Any ideas?
Post 04 Jul 2007, 02:31
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Well, you're either going to beep your speaker, flash the screen, or flash the buttons on the keyboard last time i checked, but since the person will be using the computer, i think throwing something on the screen will be more obvious than anything, especially if they're def or if they can type without looking, though i have little experience with working with things outside of an os environment.
Post 04 Jul 2007, 05:19
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
> Imagine you are in state when you can't use any BIOS, OS, or anything. Just plain port I/O

COOL.

> What is easiest way to notice user using ports? I was thinking about PC-speaker

YES. As long as your PC has one Very Happy

> Another possiblity was to set VGA text mode via registers (no int 10h), but i don't know how to do it

Code exists, have seen it somewhere. Searched "OS construction" ? Dex4u or Bubach will have some Wink

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 04 Jul 2007, 05:51
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
You can get info on seting VGA mode via in / out on bubach site here:
http://bos.asmhackers.net/docs/vga_without_bios/

You could also send debug info to com ports using in / out,

If you have a floppy drive, you could do this:
Code:
;====================================================;; Fdd motor off         ;TURNS MOTOR AND LIGHT OFF . ;;====================================================;Fdd_motor_off: push  edx     push  eax     mov   dx,0x3f2        mov   al,0    out   dx,al   pop   eax     pop   edx     ret;====================================================;; Fdd Motor On           ;TURNS MOTOR AND LIGHT ON ;;====================================================;FddMotorOn:  push  edx     push  eax     mov   dx,0x3f2        mov   al,00011100b    out   dx,al   pop   eax     pop   edx     ret    


Also if your in text mode you can print a number/letter without using bios or OS .
Post 04 Jul 2007, 09:42
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
i am in some highres graphic mode, without floppy Sad

I will look at bubachs site about turning display to text mode. Didn't someone of you have some code to enter text mode via ports?

I was also thinking about flashing LEDs, i know i did it in DOS and it was pretty simple. But i don't remember which ports to sue
Post 04 Jul 2007, 10:28
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
I'd like to mention now that in and out aren't really documented much. They don't talk about which I/O port is connected to what, just that you can send or receive from a certain i/o port. They have documented a lot on interrupts, but i havn't seen much on commonly used I/O ports. Perhaps in answering vid some one could write or find some examples or documentation using these ports? Especially because some of us are probably afraid of accidentally writing to the HD.
Post 04 Jul 2007, 11:10
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Here some keyboard led code, from DexOS
Code:
;some code        mov   [keyBoardStatus],7 ; set first 3bit to 1 for all leds on        call  SetKeyBoardLeds;some code;====================================================;; Set keyboard leds                                  ;;====================================================;SetKeyBoardLeds:        push  eax       mov   al,0xed out   60h,alKeyBoardWait:       in    al,64h  test  al,10b  jne   KeyBoardWait    mov   al,byte [keyBoardStatus]        and   al,111b out   60h,al        pop   eax       retkeyBoardStatus db 0    

1 = scroll
4 = cap lock
2 = num
7 = all leds
0 = leds off
Post 04 Jul 2007, 15:39
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Thanks a lot Dex
Post 04 Jul 2007, 18:15
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
handyman



Joined: 04 Jun 2007
Posts: 40
Location: USA - KS
handyman
kohlrak wrote:
Quote:

I'd like to mention now that in and out aren't really documented much. They don't talk about which I/O port is connected to what, just that you can send or receive from a certain i/o port.



here is a downloadable port list I found that may help.

http://bochs.sourceforge.net/techspec/PORTS.LST
Post 04 Jul 2007, 23:32
View user's profile Send private message Reply with quote
hckr83



Joined: 12 Nov 2006
Posts: 86
Location: usa
hckr83
I have found some code for switching video only using ports...it was something by John Fine, I'll post it later if I can find it...

_________________
x86 CPU Emulation library: http://sourceforge.net/projects/x86lib
Post 05 Jul 2007, 04:27
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Ralph brown has a port list as well, iirc. And of course intel aren't documenting ports in their instruction list, since those are specific to the rest of the platform, not the CPU.

I wonder just how VGA compatible graphics cards are today, especially those in laptops... personally I'd flash the keyboard LEDs if I had a kernel in a panic state.
Post 05 Jul 2007, 09:04
View user's profile Send private message Visit poster's website Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Quote:
here is a downloadable port list I found that may help.

http://bochs.sourceforge.net/techspec/PORTS.LST


Quite handy, handy man. Thank you.
Post 05 Jul 2007, 11:34
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
El Tangas



Joined: 11 Oct 2003
Posts: 120
Location: Sunset Empire
El Tangas
Here is a link I found with info about the keyboard.

http://www.subfrequenz.net/linker/index.php?cat=26

If you had a floppy in the system, you could also spin the motor on and off as a diagnostic signal.
Post 05 Jul 2007, 18:16
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
El Tangas wrote:

If you had a floppy in the system, you could also spin the motor on and off as a diagnostic signal.

Not a very good idea, imho... mechanical wear & tear, and if there's a floppy in the drive, you might end up trashing it?
Post 06 Jul 2007, 10:42
View user's profile Send private message Visit poster's website Reply with quote
El Tangas



Joined: 11 Oct 2003
Posts: 120
Location: Sunset Empire
El Tangas
f0dder wrote:

Not a very good idea, imho... mechanical wear & tear, and if there's a floppy in the drive, you might end up trashing it?


I don't think that turning the motor on and off would do any damage, but it would of course cause some wear. I wasn't recomending this, just reminding that the possibility exists...
Post 06 Jul 2007, 15:33
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
doesn't someone have some ready code that will beep PC speaker using ports? I found this link http://fly.cc.fer.hr/GDM/articles/sndmus/speaker1.html, but if someone happens to have tested code, please post it
Post 09 Jul 2007, 00:16
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
None of the PC Speaker examples at http://board.flatassembler.net/topic.php?t=2528 helps?
Post 09 Jul 2007, 00:24
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
forgot about these, thanks
Post 09 Jul 2007, 00:26
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
LED code, and PC speaker worked for me, thank you lot guys.

But now i moved to phase where i need text output. I found lot of useful code on bos.asmhackers, mostly all that i need: setting up text mode, and setting up font.

I will start in Windows environment, i will completely disable rest of windows from driver, and continue only with my code. I plan to switch display to text mode, and print few messages. I just want to make sure there aren't any other problems about doing this...
Post 17 Jul 2007, 00:54
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto
Hi Vid Very Happy
simply set 80*25 text mode from dosbox under windows and read all vga register , next to set 80*25 text mode write same value to vga.. Wink
this is valid for every vga mode.
don't waste your time to search stupid source ,asm programmer is first of all a hacker.
Have fun Exclamation
Post 17 Jul 2007, 09:26
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.