flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Matrix 09 Sep 2004, 12:55
Hy,
say, are you sure you want to do that? sp is a pointer to a word to the stack so if you do this Code: push word $1A $2B $3C then stack will look like this: Code: stack sp+4 $1A sp+2 $2B sp $3C MATRIX |
|||
![]() |
|
crc 09 Sep 2004, 13:17
Quote: say, are you sure you want to do that? Yes I want to do this. This is a routine that handles inline integers in my compiler. It's a handler for it. In a compiled function, I have: ... code ... call dolit dw value ... more code ... This routine needs to get the value after the call, put the value in ax, and tell the machine to skip over the value. The only register it can't touch is SI. The 32-bit code *works perfectly*, but I can't figure out how to do it in 16-bit code. |
|||
![]() |
|
Matrix 09 Sep 2004, 13:37
crc wrote:
oh its easy, if you call, then the caller 's address is pushed onto stack Code: mov bx,sp <= here 's your address now increase bx to get to data you can use it like mov dx,bx <= for example if you want to pass it to write it to screen MATRIX Last edited by Matrix on 09 Sep 2004, 13:41; edited 1 time in total |
|||
![]() |
|
crc 09 Sep 2004, 13:40
Thanks for the help MATRIX, I just got it to work
![]() Code: pop di ; SP> mov ax, [di] ; Value @ [SP] add di, 2 ; skip DW VALUE push di ; >SP * crc makes a note to mention your help in the documentation |
|||
![]() |
|
Matrix 09 Sep 2004, 13:43
crc wrote: Thanks for the help MATRIX, I just got it to work you're welcome ![]() MATRIX |
|||
![]() |
|
Matrix 09 Sep 2004, 14:34
Say,
i think with this message board we're like a team, and we're way better than microsoft type teams with this simple little message board, imagine if 900 people helps each other making a program ![]() that whould be really cool ![]() someone writes a function => 2 people see the problem immediately, others take a look 10 people optimizes it in 10 minutes here you are, a fully optimized function working smooth ![]() what a risc architecture MATRIX |
|||
![]() |
|
crc 09 Sep 2004, 14:48
Quote: here you are, a fully optimized function working smooth What if you don't want an optomized function? |
|||
![]() |
|
Matrix 09 Sep 2004, 14:53
crc wrote:
then you just don't optimize it ![]() but you shouldn't write things like windows i think, its very large and under optimized, of course sometimes you may want to size optimize somtimes for example in a boot loader, the team can work altogether on a project - that was my point of view functions can be seperately programmed by many people, thus you will only need to copy the functions and paste ![]() MATRIX |
|||
![]() |
|
crc 09 Sep 2004, 15:23
Quote: but you shouldn't write things like windows i think, its very large and under optimized, of course sometimes you may want to size optimize somtimes for example in a boot loader, the team can work altogether on a project - that was my point of view functions can be seperately programmed by many people, thus you will only need to copy the functions and paste I agree about Windows, and I understand your point. The problem with copying/pasting functions is that they don't always mesh cleanly in an application. For example, I code most of my apps around a subset of RetroForth. This subset is written in assembly, but it doesn't cleanly interface with standard libraries, procedures, and so on. So I can share a source routine, but it won't be easy for you to use it unless your app has a similar internal design to mine. And that, I think, it the main problem with having large, loose-knit teams work on functions. (Consider that if I had given the entire routine, rather than just the problem part, I'd have also had to give and explain the register uses, macros, etc.) |
|||
![]() |
|
ASHLEY4 09 Sep 2004, 15:33
May be MATRIX is thinking your entering a compo, maybe a 512b compo
![]() \\\\||//// (@@) ASHLEY4. |
|||
![]() |
|
crc 09 Sep 2004, 15:42
Quote: May be MATRIX is thinking your entering a compo, maybe a 512b compo? The way things are currently looking, my entry will barely fit in 512 bytes once it's done ![]() |
|||
![]() |
|
Matrix 09 Sep 2004, 16:08
Ok,
i understand all of your point of views, i can only say that we're creative, you probably won't just cut and paste a code of other's but there it might be no need to do this there are or maybe differences between out programming techniques, variable declaration modes, creating structures of program, it primarily depends on the purpose of the program you ' re writing, you might need to optimize for speed, code size, easy reading of code or nothing in som cases: ideas from a 3 line code snipplet could be very helpful too, you can never know when you'll need that idea that is somewhere out there - that you might never been thinking of. MATRIX |
|||
![]() |
|
ASHLEY4 09 Sep 2004, 16:24
My entry (a pmode cdplayer) was 200 bytes over, it tuck me about 2 hour's to get 100 bytes off, i thought this is going to be easy, but to get the other 100 bytes off tuck over a week. and still i had no space to turn the floppy motor off.
Any way just incase this is a good artical: http://www.assembly-journal.com/viewarticle.php?id=30&layout=html \\\\\||//// (@@) ASHLEY4. |
|||
![]() |
|
Matrix 09 Sep 2004, 16:39
ASHLEY4 wrote: My entry (a pmode cdplayer) was 200 bytes over, it tuck me about 2 hour's to get 100 bytes off, i thought this is going to be easy, but to get the other 100 bytes off tuck over a week. and still i had no space to turn the floppy motor off. Why whould you make such a thing? you can find cd rom drives with play buttons ![]() you won't even need a computer for it, just give the drive +12v +5v gnd and you're on for example i use mp3 and m4a MATRIX |
|||
![]() |
|
crc 09 Sep 2004, 17:40
Quote: you can find cd rom drives with play buttons What about sound? Do these CD-ROM drives have audio cards & jacks built in? Heh, my entry is ~30 bytes over (and I had to leave out a lot of good stuff), but I'll have it done soon. It's nothing fancy at this point (an RPN calculator), but it has a 16-bit, subroutine-threaded Forth interpreter under the hood. With ~2k I could do a full Forth, but that's outside the point of this compo ![]() |
|||
![]() |
|
Matrix 09 Sep 2004, 17:51
crc wrote:
yes, they use 1 bit oversampling, and they have stereo analog outputs, and they also have digital outputs, for example i have one of them, it can not only play, it can fast forward, and change to next, and stop additional to eject ![]() an simple 8x cdrom drive ! MATRIX |
|||
![]() |
|
ASHLEY4 09 Sep 2004, 20:45
Yes MATRIX you are right, mine has the button's on the front to play, next track etc too, but the point is not to have a cdplayer.
The point is to demo that You can setup vesa (including full vesa info), set A20, GDT, go to pmode, draw full 640x480 24bit image of a iPod, make a basic atapi driver, + menu that takes keyboard input, + prints to screen "Play","Stop",etc All in 510bytes. Remember we are in pmode, no fonts the letter "P" is 8 bytes *8 bytes * 4 (256),thats for one letter, 2 letters and thats it. We have tricks to make it smaller, but you can see what we are up against. crc, most cd/dvd drives have jack plugs (so head phone's are needed), but some very modern pc do not . The Forth interpreter sounds interesting. \\\\||//// (@@) ASHLEY4. |
|||
![]() |
|
Matrix 18 Sep 2004, 21:36
Hy crc, i have some stack procedure for you
![]() Code: org $100 push $b800 pop ss mov sp,80*25*2 mov cx,200 times 12 push $0f68 pop dword [ss:1000] pop dword [ss:1010] pop dword [ss:1020] int 20h so according to this analogy heres a putpixel: Code: org $100 mov ax,$13 int 10h push es push word 100 mov bx,320*100+160 call poppixel pop es xor ax,ax int 16h mov ax,3 int 10h int 20h poppixel: ; procedure poppixel crazy ha? ps.: now you can see what's in the stack ![]() MATRIX |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.