Could Anyone help me with the codes . Perhaps i can give you the ones for hard drives and keyboards laters coz i have 'em

depends on the operating system. MS-Windows will not permit a program access to the hardware ports directly, and neither will *nix running on intell-based computers unless you are writing a kernel-level device driver. In MS-DOS 6.X and earlier I've used int 16 but never accessed the ports directly.

This index lists the VGA's I/O ports in numerical order, making looking up a specific I/O port access simpler.
3B4h -- CRTC Controller Address Register
3B5h -- CRTC Controller Data Register
3BAh Read -- Input Status #1 Register
3BAh Write -- Feature Control Register
3C0h -- Attribute Address/Data Register
3C1h -- Attribute Data Read Register
3C2h Read -- Input Status #0 Register
3C2h Write -- Miscellaneous Output Register
3C4h -- Sequencer Address Register
3C5h -- Sequencer Data Register
3C7h Read -- DAC State Register
3C7h Write -- DAC Address Read Mode Register
3C8h -- DAC Address Write Mode Register
3C9h -- DAC Data Register
3CAh Read -- Feature Control Register
3CCh Read -- Miscellaneous Output Register
3CEh -- Graphics Controller Address Register
3CFh -- Graphics Controller Data Register
3D4h -- CRTC Controller Address Register
3D5h -- CRTC Controller Data Register
3DAh Read -- Input Status #1 Register
3DAh Write -- Feature Control Register
The problem is that am not sure of how to code them, could you now help me?

>>The problem is that am not sure of how to code them, could you now help me?

No because you did not answer my previous questions. But here is some general information.

Your previous post was about writing a DOS tsr. If that is what you still have in mind I can understand why you don't want to use int 10h. However, if you are writing an MS-DOS text mode program, life might be a lot easier than that long list of i/o ports might suggest. The only thing you absolutely need to know is the address of the video buffer, and that will either be B000:0000H or B800:0000H. The first byte of that buffer holds the ascii character for the top left of the screen, the second byte the video attribute for that character (usually 7), the third byte the ascii character for the second character on the top row of the screen, followed by its attribute byte (again usually 7), and so on until you get to the end of the top row. Then it drops down a row, and carries on as before starting with the left hand edge of the screen. All the way down to bottom right. All you have to do is calculate the offset into the buffer (remembering that each character needs two bytes) which corresponds to a particular position on the screen. There plant the relevant ascii character, followed by a 7.

I would be careful of programming at least one of those ports by the way (3B5H), because if you get it wrong you can physically damage the display.

I already got those notes but theyr kinda complicated

I already got those notes but theyr kinda complicated

Why is it complicated? A favourite, relatively straightforward, exercise in writing a tsr is to put a clock on the top right of the screen. If your clock looked something like 09:34 the '0' would be the fifth character in from the right, or the 75th from the left. Taking account of the attribute bytes, that would make the code to put the '0' onto the screen look like:

mov bx, 0b800h
mov es,bx                    ;es = seg address of video buffer
 
...................
..................
..................
mov al, 0                     ;in practice, if this was a real clock program,
................                   ;the 0 would probably find its way into al
..................                ;via an arithmetical division operation
..................
..................
add al, '0'                    ;convert number 0 to ascii digit '0'
                                  ;similarly, if there was an 8 in al,
                                  ;add al, '0'
                                  ;would then get you the ascii character '8'
 
mov bx, 150                ;75th character * 2 
mov ah, 7                   ;character in al, attribute in ah
mov es:[bx], ax          ;copy character and attribute to video buffer
add bx, 2                    ;es:bx -> location for next character

You can forget all those port numbers; you don't need them.

I threw away my old MS-DOS books yonks ago, so there is a limit to how much I can remember.

I already got those notes but theyr kinda complicated

writing assembly language is always complicated. Being a tad crazy and nuts helps :lol: which is why there are not many assembly programmers left in this world, its a lot easier to just let higher-language compilers do all that grunt work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.